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