aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/ant/apache-ant-1.9.6/manual/Tasks/javacc.html
blob: 3c0dcfa8572fc7fe2b891e2e5d191f888cf1ed4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
<title>JavaCC Task</title>
</head>

<body>

<h2><a name="javacc">JavaCC</a></h2>
<h3>Description</h3>
<p>
  Invokes the <a HREF="http://javacc.dev.java.net/" target="_top">JavaCC</a> compiler
  compiler on a grammar file.
</p>
<p>
  To use the javacc task, set the <i>target</i> attribute to the name of the
  grammar file to process.  You also need to specify the directory containing
  the JavaCC installation using the <i>javacchome</i> attribute, so that Apache Ant
  can find the JavaCC classes.  Optionally, you can also set the
  <i>outputdirectory</i> to write the generated file to a specific directory.
  Otherwise javacc writes the generated files to the directory containing
  the grammar file.
</p>
<p>
  This task only invokes JavaCC if the grammar file is newer than the generated
  Java files.  javacc assumes that the Java class name of the generated parser
  is the same as the name of the grammar file, ignoring the .jj.
  If this is not the case, the javacc task will still work, but it will always
  generate the output files.
</p>

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">target</td>
    <td valign="top">The grammar file to process.</td>
    <td valign="top" align="center">Yes</td>
  </tr>
  <tr>
    <td valign="top">javacchome</td>
    <td valign="top">The directory containing the JavaCC distribution.</td>
    <td valign="top" align="center">Yes</td>
  </tr>
  <tr>
    <td valign="top">outputdirectory</td>
    <td valign="top">
      The directory to write the generated files to.  If not set, the files
      are written to the directory containing the grammar file.
    </td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">buildparser</td>
    <td valign="top">Sets the BUILD_PARSER grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">buildtokenmanager</td>
    <td valign="top">Sets the BUILD_TOKEN_MANAGER grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">cachetokens</td>
    <td valign="top">Sets the CACHE_TOKENS grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">choiceambiguitycheck</td>
    <td valign="top">Sets the CHOICE_AMBIGUITY_CHECK grammar option.  This is an integer option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">commontokenaction</td>
    <td valign="top">Sets the COMMON_TOKEN_ACTION grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">debuglookahead</td>
    <td valign="top">Sets the DEBUG_LOOKAHEAD grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">debugparser</td>
    <td valign="top">Sets the DEBUG_PARSER grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">debugtokenmanager</td>
    <td valign="top">Sets the DEBUG_TOKEN_MANAGER grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">errorreporting</td>
    <td valign="top">Sets the ERROR_REPORTING grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">forcelacheck</td>
    <td valign="top">Sets the FORCE_LA_CHECK grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">ignorecase</td>
    <td valign="top">Sets the IGNORE_CASE grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">javaunicodeescape</td>
    <td valign="top">Sets the JAVA_UNICODE_ESCAPE grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">jdkversion</td>
    <td valign="top">Sets the JDK_VERSION option. This is a string option.</td>
    <td valign="top" align="center">No</td>
  </tr>  <tr>
    <td valign="top">keeplinecolumn</td>
    <td valign="top">Sets the KEEP_LINE_COLUMN grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">lookahead</td>
    <td valign="top">Sets the LOOKAHEAD grammar option.  This is an integer option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">optimizetokenmanager</td>
    <td valign="top">Sets the OPTIMIZE_TOKEN_MANAGER grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">otherambiguitycheck</td>
    <td valign="top">Sets the OTHER_AMBIGUITY_CHECK grammar option.  This is an integer option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">sanitycheck</td>
    <td valign="top">Sets the SANITY_CHECK grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">static</td>
    <td valign="top">Sets the STATIC grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">unicodeinput</td>
    <td valign="top">Sets the UNICODE_INPUT grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">usercharstream</td>
    <td valign="top">Sets the USER_CHAR_STREAM grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">usertokenmanager</td>
    <td valign="top">Sets the USER_TOKEN_MANAGER grammar option.  This is a boolean option.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">maxmemory</td>
    <td valign="top">Max amount of memory to allocate to the forked
      VM.  <em>since Ant 1.8.3</em></td>
    <td align="center" valign="top">No</td>
  </tr>
</table>
<h3>Example</h3>
<blockquote><pre>
&lt;javacc
    target=&quot;src/Parser.jj&quot;
    outputdirectory=&quot;build/src&quot;
    javacchome=&quot;c:/program files/JavaCC&quot;
    static=&quot;true&quot;
/&gt;
</pre></blockquote>
<p>
  This invokes JavaCC on grammar file src/Parser.jj, writing the generated
  files to build/src.  The grammar option STATIC is set to true when
  invoking JavaCC.
</p>


</body>
</html>