4
<meta http-equiv="Content-Language" content="en-us">
5
<title>JavaCC Task</title>
10
<h2><a name="javacc">JavaCC</a></h2>
13
Invokes the <a HREF="http://www.metamata.com/javacc/" target="_top">JavaCC</a> compiler
14
compiler on a grammar file.
17
To use the javacc task, set the <i>target</i> attribute to the name of the
18
grammar file to process. You also need to specify the directory containing
19
the JavaCC installation using the <i>javacchome</i> attribute, so that ant
20
can find the JavaCC classes. Optionally, you can also set the
21
<i>outputdirectory</i> to write the generated file to a specific directory.
22
Otherwise javacc writes the generated files to the directory containing
26
This task only invokes JavaCC if the grammar file is newer than the generated
27
Java files. javacc assumes that the Java class name of the generated parser
28
is the same as the name of the grammar file, ignoring the .jj.
29
If this is not the case, the javacc task will still work, but it will always
30
generate the output files.
34
<table border="1" cellpadding="2" cellspacing="0">
36
<td valign="top"><b>Attribute</b></td>
37
<td valign="top"><b>Description</b></td>
38
<td align="center" valign="top"><b>Required</b></td>
41
<td valign="top">target</td>
42
<td valign="top">The grammar file to process.</td>
43
<td valign="top" align="center">Yes</td>
46
<td valign="top">javacchome</td>
47
<td valign="top">The directory containing the JavaCC distribution.</td>
48
<td valign="top" align="center">Yes</td>
51
<td valign="top">outputdirectory</td>
53
The directory to write the generated files to. If not set, the files
54
are written to the directory containing the grammar file.
56
<td valign="top" align="center">No</td>
59
<td valign="top">buildparser</td>
60
<td valign="top">Sets the BUILD_PARSER grammar option. This is a boolean option.</td>
61
<td valign="top" align="center">No</td>
64
<td valign="top">buildtokenmanager</td>
65
<td valign="top">Sets the BUILD_TOKEN_MANAGER grammar option. This is a boolean option.</td>
66
<td valign="top" align="center">No</td>
69
<td valign="top">cachetokens</td>
70
<td valign="top">Sets the CACHE_TOKENS grammar option. This is a boolean option.</td>
71
<td valign="top" align="center">No</td>
74
<td valign="top">choiceambiguitycheck</td>
75
<td valign="top">Sets the CHOICE_AMBIGUITY_CHECK grammar option. This is an integer option.</td>
76
<td valign="top" align="center">No</td>
79
<td valign="top">commontokenaction</td>
80
<td valign="top">Sets the COMMON_TOKEN_ACTION grammar option. This is a boolean option.</td>
81
<td valign="top" align="center">No</td>
84
<td valign="top">debuglookahead</td>
85
<td valign="top">Sets the DEBUG_LOOKAHEAD grammar option. This is a boolean option.</td>
86
<td valign="top" align="center">No</td>
89
<td valign="top">debugparser</td>
90
<td valign="top">Sets the DEBUG_PARSER grammar option. This is a boolean option.</td>
91
<td valign="top" align="center">No</td>
94
<td valign="top">debugtokenmanager</td>
95
<td valign="top">Sets the DEBUG_TOKEN_MANAGER grammar option. This is a boolean option.</td>
96
<td valign="top" align="center">No</td>
99
<td valign="top">errorreporting</td>
100
<td valign="top">Sets the ERROR_REPORTING grammar option. This is a boolean option.</td>
101
<td valign="top" align="center">No</td>
104
<td valign="top">forcelacheck</td>
105
<td valign="top">Sets the FORCE_LA_CHECK grammar option. This is a boolean option.</td>
106
<td valign="top" align="center">No</td>
109
<td valign="top">ignorecase</td>
110
<td valign="top">Sets the IGNORE_CASE grammar option. This is a boolean option.</td>
111
<td valign="top" align="center">No</td>
114
<td valign="top">javaunicodeescape</td>
115
<td valign="top">Sets the JAVA_UNICODE_ESCAPE grammar option. This is a boolean option.</td>
116
<td valign="top" align="center">No</td>
119
<td valign="top">lookahead</td>
120
<td valign="top">Sets the LOOKAHEAD grammar option. This is an integer option.</td>
121
<td valign="top" align="center">No</td>
124
<td valign="top">optimizetokenmanager</td>
125
<td valign="top">Sets the OPTIMIZE_TOKEN_MANAGER grammar option. This is a boolean option.</td>
126
<td valign="top" align="center">No</td>
129
<td valign="top">otherambiguitycheck</td>
130
<td valign="top">Sets the OTHER_AMBIGUITY_CHECK grammar option. This is an integer option.</td>
131
<td valign="top" align="center">No</td>
134
<td valign="top">sanitycheck</td>
135
<td valign="top">Sets the SANITY_CHECK grammar option. This is a boolean option.</td>
136
<td valign="top" align="center">No</td>
139
<td valign="top">static</td>
140
<td valign="top">Sets the STATIC grammar option. This is a boolean option.</td>
141
<td valign="top" align="center">No</td>
144
<td valign="top">unicodeinput</td>
145
<td valign="top">Sets the UNICODE_INPUT grammar option. This is a boolean option.</td>
146
<td valign="top" align="center">No</td>
149
<td valign="top">usercharstream</td>
150
<td valign="top">Sets the USER_CHAR_STREAM grammar option. This is a boolean option.</td>
151
<td valign="top" align="center">No</td>
154
<td valign="top">usertokenmanager</td>
155
<td valign="top">Sets the USER_TOKEN_MANAGER grammar option. This is a boolean option.</td>
156
<td valign="top" align="center">No</td>
162
target="src/Parser.jj"
163
outputdirectory="build/src"
164
javacchome="c:/program files/JavaCC"
165
static="true"
169
This invokes JavaCC on grammar file src/Parser.jj, writing the generated
170
files to build/src. The grammar option STATIC is set to true when
175
<p align="center">Copyright © 2000,2001 Apache Software Foundation.