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.

antlr.html 2.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>ANTLR Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="antlr">ANTLR</a></h2>
  8. <h3>Description</h3>
  9. <p>
  10. Invokes the <a HREF="http://www.antlr.org/" target="_top">ANTLR</a> Translator generator
  11. on a grammar file.
  12. </p>
  13. <p>
  14. To use the ANTLR task, set the <i>target</i> attribute to the name of the
  15. grammar file to process. Optionally, you can also set the
  16. <i>outputdirectory</i> to write the generated file to a specific directory.
  17. Otherwise ANTLR writes the generated files to the directory containing
  18. the grammar file.
  19. </p>
  20. <p>
  21. This task only invokes ANTLR if the grammar file is newer than the generated
  22. files.
  23. </p>
  24. <h3>Parameters</h3>
  25. <table border="1" cellpadding="2" cellspacing="0">
  26. <tr>
  27. <td valign="top"><b>Attribute</b></td>
  28. <td valign="top"><b>Description</b></td>
  29. <td align="center" valign="top"><b>Required</b></td>
  30. </tr>
  31. <tr>
  32. <td valign="top">target</td>
  33. <td valign="top">The grammar file to process.</td>
  34. <td valign="top" align="center">Yes</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">outputdirectory</td>
  38. <td valign="top">
  39. The directory to write the generated files to. If not set, the files
  40. are written to the directory containing the grammar file.
  41. </td>
  42. <td valign="top" align="center">No</td>
  43. </tr>
  44. <tr>
  45. <td valign="top">fork</td>
  46. <td valign="top">Run ANTLR in a separate VM.</td>
  47. <td align="center" valign="top">No, default is &quot;off&quot;</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">dir</td>
  51. <td valign="top">The directory to invoke the VM in. (ignored if
  52. fork is disabled)</td>
  53. <td align="center" valign="top">No</td>
  54. </tr>
  55. </table>
  56. <h3><a name="nested">Nested Elements</a></h3>
  57. <p><code>ANTLR</code> supports a nested <code>&lt;classpath&gt;</code>
  58. element, that represents a <a href="../using.html#path">PATH like
  59. structure</a>. It is given as a convenience if you have to specify
  60. the original ANTLR directory. In most cases, dropping the appropriate
  61. ANTLR jar in the normal Ant lib repository will be enough.</p>
  62. <h4>jvmarg</h4>
  63. <p>If fork is enabled, additional parameters may be passed to the new
  64. VM via nested <code>&lt;jvmarg&gt;</code> attributes, for example:</p>
  65. <pre>
  66. &lt;antlr fork=&quot;yes&quot; target=...&gt;
  67. &lt;jvmarg value=&quot;-Djava.compiler=NONE&quot;/&gt;
  68. ...
  69. &lt;/antlr&gt;
  70. </pre>
  71. <p>would run ANTLR in a VM without JIT.</p>
  72. <p><code>&lt;jvmarg&gt;</code> allows all attributes described in <a
  73. href="../using.html#arg">Command line arguments</a>.</p>
  74. <h3>Example</h3>
  75. <blockquote><pre>
  76. &lt;antlr
  77. target=&quot;etc/java.g&quot;
  78. outputdirectory=&quot;build/src&quot;
  79. /&gt;
  80. </pre></blockquote>
  81. <p>
  82. This invokes ANTLR on grammar file etc/java.g, writing the generated
  83. files to build/src.
  84. </p>
  85. <hr>
  86. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  87. Reserved.</p>
  88. </body>
  89. </html>