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 6.2 KiB

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