1 | <!--
|
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | contributor license agreements. See the NOTICE file distributed with
|
---|
4 | this work for additional information regarding copyright ownership.
|
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | (the "License"); you may not use this file except in compliance with
|
---|
7 | the License. You may obtain a copy of the License at
|
---|
8 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 |
|
---|
19 | <head>
|
---|
20 | <meta http-equiv="Content-Language" content="en-us">
|
---|
21 | <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
22 | <title>JavaCC Task</title>
|
---|
23 | </head>
|
---|
24 |
|
---|
25 | <body>
|
---|
26 |
|
---|
27 | <h2><a name="javacc">JavaCC</a></h2>
|
---|
28 | <h3>Description</h3>
|
---|
29 | <p>
|
---|
30 | Invokes the <a HREF="http://javacc.dev.java.net/" target="_top">JavaCC</a> compiler
|
---|
31 | compiler on a grammar file.
|
---|
32 | </p>
|
---|
33 | <p>
|
---|
34 | To use the javacc task, set the <i>target</i> attribute to the name of the
|
---|
35 | grammar file to process. You also need to specify the directory containing
|
---|
36 | the JavaCC installation using the <i>javacchome</i> attribute, so that ant
|
---|
37 | can find the JavaCC classes. Optionally, you can also set the
|
---|
38 | <i>outputdirectory</i> to write the generated file to a specific directory.
|
---|
39 | Otherwise javacc writes the generated files to the directory containing
|
---|
40 | the grammar file.
|
---|
41 | </p>
|
---|
42 | <p>
|
---|
43 | This task only invokes JavaCC if the grammar file is newer than the generated
|
---|
44 | Java files. javacc assumes that the Java class name of the generated parser
|
---|
45 | is the same as the name of the grammar file, ignoring the .jj.
|
---|
46 | If this is not the case, the javacc task will still work, but it will always
|
---|
47 | generate the output files.
|
---|
48 | </p>
|
---|
49 |
|
---|
50 | <h3>Parameters</h3>
|
---|
51 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
52 | <tr>
|
---|
53 | <td valign="top"><b>Attribute</b></td>
|
---|
54 | <td valign="top"><b>Description</b></td>
|
---|
55 | <td align="center" valign="top"><b>Required</b></td>
|
---|
56 | </tr>
|
---|
57 | <tr>
|
---|
58 | <td valign="top">target</td>
|
---|
59 | <td valign="top">The grammar file to process.</td>
|
---|
60 | <td valign="top" align="center">Yes</td>
|
---|
61 | </tr>
|
---|
62 | <tr>
|
---|
63 | <td valign="top">javacchome</td>
|
---|
64 | <td valign="top">The directory containing the JavaCC distribution.</td>
|
---|
65 | <td valign="top" align="center">Yes</td>
|
---|
66 | </tr>
|
---|
67 | <tr>
|
---|
68 | <td valign="top">outputdirectory</td>
|
---|
69 | <td valign="top">
|
---|
70 | The directory to write the generated files to. If not set, the files
|
---|
71 | are written to the directory containing the grammar file.
|
---|
72 | </td>
|
---|
73 | <td valign="top" align="center">No</td>
|
---|
74 | </tr>
|
---|
75 | <tr>
|
---|
76 | <td valign="top">buildparser</td>
|
---|
77 | <td valign="top">Sets the BUILD_PARSER grammar option. This is a boolean option.</td>
|
---|
78 | <td valign="top" align="center">No</td>
|
---|
79 | </tr>
|
---|
80 | <tr>
|
---|
81 | <td valign="top">buildtokenmanager</td>
|
---|
82 | <td valign="top">Sets the BUILD_TOKEN_MANAGER grammar option. This is a boolean option.</td>
|
---|
83 | <td valign="top" align="center">No</td>
|
---|
84 | </tr>
|
---|
85 | <tr>
|
---|
86 | <td valign="top">cachetokens</td>
|
---|
87 | <td valign="top">Sets the CACHE_TOKENS grammar option. This is a boolean option.</td>
|
---|
88 | <td valign="top" align="center">No</td>
|
---|
89 | </tr>
|
---|
90 | <tr>
|
---|
91 | <td valign="top">choiceambiguitycheck</td>
|
---|
92 | <td valign="top">Sets the CHOICE_AMBIGUITY_CHECK grammar option. This is an integer option.</td>
|
---|
93 | <td valign="top" align="center">No</td>
|
---|
94 | </tr>
|
---|
95 | <tr>
|
---|
96 | <td valign="top">commontokenaction</td>
|
---|
97 | <td valign="top">Sets the COMMON_TOKEN_ACTION grammar option. This is a boolean option.</td>
|
---|
98 | <td valign="top" align="center">No</td>
|
---|
99 | </tr>
|
---|
100 | <tr>
|
---|
101 | <td valign="top">debuglookahead</td>
|
---|
102 | <td valign="top">Sets the DEBUG_LOOKAHEAD grammar option. This is a boolean option.</td>
|
---|
103 | <td valign="top" align="center">No</td>
|
---|
104 | </tr>
|
---|
105 | <tr>
|
---|
106 | <td valign="top">debugparser</td>
|
---|
107 | <td valign="top">Sets the DEBUG_PARSER grammar option. This is a boolean option.</td>
|
---|
108 | <td valign="top" align="center">No</td>
|
---|
109 | </tr>
|
---|
110 | <tr>
|
---|
111 | <td valign="top">debugtokenmanager</td>
|
---|
112 | <td valign="top">Sets the DEBUG_TOKEN_MANAGER grammar option. This is a boolean option.</td>
|
---|
113 | <td valign="top" align="center">No</td>
|
---|
114 | </tr>
|
---|
115 | <tr>
|
---|
116 | <td valign="top">errorreporting</td>
|
---|
117 | <td valign="top">Sets the ERROR_REPORTING grammar option. This is a boolean option.</td>
|
---|
118 | <td valign="top" align="center">No</td>
|
---|
119 | </tr>
|
---|
120 | <tr>
|
---|
121 | <td valign="top">forcelacheck</td>
|
---|
122 | <td valign="top">Sets the FORCE_LA_CHECK grammar option. This is a boolean option.</td>
|
---|
123 | <td valign="top" align="center">No</td>
|
---|
124 | </tr>
|
---|
125 | <tr>
|
---|
126 | <td valign="top">ignorecase</td>
|
---|
127 | <td valign="top">Sets the IGNORE_CASE grammar option. This is a boolean option.</td>
|
---|
128 | <td valign="top" align="center">No</td>
|
---|
129 | </tr>
|
---|
130 | <tr>
|
---|
131 | <td valign="top">javaunicodeescape</td>
|
---|
132 | <td valign="top">Sets the JAVA_UNICODE_ESCAPE grammar option. This is a boolean option.</td>
|
---|
133 | <td valign="top" align="center">No</td>
|
---|
134 | </tr>
|
---|
135 | <tr>
|
---|
136 | <td valign="top">jdkversion</td>
|
---|
137 | <td valign="top">Sets the JDK_VERSION option. This is a string option.</td>
|
---|
138 | <td valign="top" align="center">No</td>
|
---|
139 | </tr> <tr>
|
---|
140 | <td valign="top">keeplinecolumn</td>
|
---|
141 | <td valign="top">Sets the KEEP_LINE_COLUMN grammar option. This is a boolean option.</td>
|
---|
142 | <td valign="top" align="center">No</td>
|
---|
143 | </tr>
|
---|
144 | <tr>
|
---|
145 | <td valign="top">lookahead</td>
|
---|
146 | <td valign="top">Sets the LOOKAHEAD grammar option. This is an integer option.</td>
|
---|
147 | <td valign="top" align="center">No</td>
|
---|
148 | </tr>
|
---|
149 | <tr>
|
---|
150 | <td valign="top">optimizetokenmanager</td>
|
---|
151 | <td valign="top">Sets the OPTIMIZE_TOKEN_MANAGER grammar option. This is a boolean option.</td>
|
---|
152 | <td valign="top" align="center">No</td>
|
---|
153 | </tr>
|
---|
154 | <tr>
|
---|
155 | <td valign="top">otherambiguitycheck</td>
|
---|
156 | <td valign="top">Sets the OTHER_AMBIGUITY_CHECK grammar option. This is an integer option.</td>
|
---|
157 | <td valign="top" align="center">No</td>
|
---|
158 | </tr>
|
---|
159 | <tr>
|
---|
160 | <td valign="top">sanitycheck</td>
|
---|
161 | <td valign="top">Sets the SANITY_CHECK grammar option. This is a boolean option.</td>
|
---|
162 | <td valign="top" align="center">No</td>
|
---|
163 | </tr>
|
---|
164 | <tr>
|
---|
165 | <td valign="top">static</td>
|
---|
166 | <td valign="top">Sets the STATIC grammar option. This is a boolean option.</td>
|
---|
167 | <td valign="top" align="center">No</td>
|
---|
168 | </tr>
|
---|
169 | <tr>
|
---|
170 | <td valign="top">unicodeinput</td>
|
---|
171 | <td valign="top">Sets the UNICODE_INPUT grammar option. This is a boolean option.</td>
|
---|
172 | <td valign="top" align="center">No</td>
|
---|
173 | </tr>
|
---|
174 | <tr>
|
---|
175 | <td valign="top">usercharstream</td>
|
---|
176 | <td valign="top">Sets the USER_CHAR_STREAM grammar option. This is a boolean option.</td>
|
---|
177 | <td valign="top" align="center">No</td>
|
---|
178 | </tr>
|
---|
179 | <tr>
|
---|
180 | <td valign="top">usertokenmanager</td>
|
---|
181 | <td valign="top">Sets the USER_TOKEN_MANAGER grammar option. This is a boolean option.</td>
|
---|
182 | <td valign="top" align="center">No</td>
|
---|
183 | </tr>
|
---|
184 | </table>
|
---|
185 | <h3>Example</h3>
|
---|
186 | <blockquote><pre>
|
---|
187 | <javacc
|
---|
188 | target="src/Parser.jj"
|
---|
189 | outputdirectory="build/src"
|
---|
190 | javacchome="c:/program files/JavaCC"
|
---|
191 | static="true"
|
---|
192 | />
|
---|
193 | </pre></blockquote>
|
---|
194 | <p>
|
---|
195 | This invokes JavaCC on grammar file src/Parser.jj, writing the generated
|
---|
196 | files to build/src. The grammar option STATIC is set to true when
|
---|
197 | invoking JavaCC.
|
---|
198 | </p>
|
---|
199 |
|
---|
200 |
|
---|
201 | </body>
|
---|
202 | </html>
|
---|
203 |
|
---|
204 |
|
---|