You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

javacc.html 7.3 KiB

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