2000-11-14 09:30:38 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-03-07 18:11:14 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css"/>
|
2000-11-14 09:30:38 +00:00
|
|
|
<title>ANTLR Task</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="antlr">ANTLR</a></h2>
|
|
|
|
<h3>Description</h3>
|
|
|
|
<p>
|
2001-02-13 12:32:01 +00:00
|
|
|
Invokes the <a HREF="http://www.antlr.org/" target="_top">ANTLR</a> Translator generator
|
2000-11-14 09:30:38 +00:00
|
|
|
on a grammar file.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
To use the ANTLR task, set the <i>target</i> attribute to the name of the
|
|
|
|
grammar file to process. Optionally, you can also set the
|
|
|
|
<i>outputdirectory</i> to write the generated file to a specific directory.
|
|
|
|
Otherwise ANTLR writes the generated files to the directory containing
|
|
|
|
the grammar file.
|
|
|
|
</p>
|
|
|
|
<p>
|
2003-04-01 14:44:00 +00:00
|
|
|
This task only invokes ANTLR if the grammar file (or the
|
|
|
|
supergrammar specified by the glib attribute) is newer than the
|
|
|
|
generated files.
|
2000-11-14 09:30:38 +00:00
|
|
|
</p>
|
2003-04-01 14:44:00 +00:00
|
|
|
<p>Antlr 2.7.1 Note:
|
2001-12-15 19:01:45 +00:00
|
|
|
<i>
|
|
|
|
To successfully run ANTLR, your best option is probably to build the whole
|
|
|
|
jar with the provided script <b>mkalljar</b> and drop the resulting jar (about 300KB)
|
|
|
|
into ${ant.home}/lib. Dropping the default jar (70KB) is probably not enough
|
|
|
|
for most needs and your only option will be to add ANTLR home directory
|
|
|
|
to your classpath as described in ANTLR <tt>install.html</tt> document.
|
|
|
|
</i>
|
|
|
|
</p>
|
2003-04-01 14:44:00 +00:00
|
|
|
<p>Antlr 2.7.2 Note:
|
|
|
|
<i>
|
|
|
|
Instead of the above, you will need antlrall.jar that can be created
|
|
|
|
by the <b>antlr-all.jar</b> target of the Makefile provided with the
|
|
|
|
download.
|
|
|
|
</i>
|
|
|
|
</p>
|
2000-11-14 09:30:38 +00:00
|
|
|
|
|
|
|
<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">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>
|
2002-06-20 15:03:46 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">glib</td>
|
|
|
|
<td valign="top">
|
|
|
|
An optional super grammar file that the target grammar overrides. This
|
|
|
|
feature is only needed for advanced vocabularies.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">debug</td>
|
|
|
|
<td valign="top">
|
|
|
|
When set to "yes", this flag adds code to the generated parser that will
|
|
|
|
launch the ParseView debugger upon invocation. The default is "no".
|
|
|
|
<br>
|
|
|
|
Note: ParseView is a separate component that needs to be installed or your
|
|
|
|
grammar will have compilation errors.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">html</td>
|
|
|
|
<td valign="top">
|
|
|
|
Emit an html version of the grammar with hyperlinked actions.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">diagnostic</td>
|
|
|
|
<td valign="top">
|
2004-11-12 10:36:29 +00:00
|
|
|
Generates a text file with debugging information based on the target grammar.
|
2002-06-20 15:03:46 +00:00
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">trace</td>
|
|
|
|
<td valign="top">
|
2002-06-22 23:38:38 +00:00
|
|
|
Forces <b>all</b> rules to call traceIn/traceOut if set to "yes".
|
2002-06-20 15:03:46 +00:00
|
|
|
The default is "no".
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">traceParser</td>
|
|
|
|
<td valign="top">
|
2002-06-22 23:38:38 +00:00
|
|
|
Only forces parser rules to call traceIn/traceOut if set to "yes".
|
2002-06-20 15:03:46 +00:00
|
|
|
The default is "no".
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">traceLexer</td>
|
|
|
|
<td valign="top">
|
2002-06-22 23:38:38 +00:00
|
|
|
Only forces lexer rules to call traceIn/traceOut if set to "yes".
|
2002-06-20 15:03:46 +00:00
|
|
|
The default is "no".
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">traceTreeWalker</td>
|
|
|
|
<td valign="top">
|
|
|
|
Only forces tree walker rules to call traceIn/traceOut if set to
|
|
|
|
"yes". The default is "no".
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2001-12-15 13:41:39 +00:00
|
|
|
<!--tr>
|
2000-11-14 09:30:38 +00:00
|
|
|
<td valign="top">fork</td>
|
|
|
|
<td valign="top">Run ANTLR in a separate VM.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
<td align="center" valign="top">No, default is "off"</td>
|
2001-12-15 13:41:39 +00:00
|
|
|
</tr-->
|
2000-11-14 09:30:38 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">dir</td>
|
2001-12-15 13:41:39 +00:00
|
|
|
<td valign="top">The directory to invoke the VM in. <!--(ignored if
|
|
|
|
fork is disabled)--></td>
|
2000-11-14 09:30:38 +00:00
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
|
|
|
<h3><a name="nested">Nested Elements</a></h3>
|
|
|
|
|
|
|
|
<p><code>ANTLR</code> supports a nested <code><classpath></code>
|
|
|
|
element, that represents a <a href="../using.html#path">PATH like
|
|
|
|
structure</a>. It is given as a convenience if you have to specify
|
|
|
|
the original ANTLR directory. In most cases, dropping the appropriate
|
|
|
|
ANTLR jar in the normal Ant lib repository will be enough.</p>
|
|
|
|
|
|
|
|
<h4>jvmarg</h4>
|
|
|
|
|
2001-12-15 13:41:39 +00:00
|
|
|
<p><!--If fork is enabled, -->Additional parameters may be passed to the new
|
2001-11-18 15:59:18 +00:00
|
|
|
VM via nested <code><jvmarg></code> attributes, for example:</p>
|
|
|
|
|
|
|
|
<pre>
|
2002-09-04 11:05:19 +00:00
|
|
|
<antlr target="...">
|
2001-11-18 15:59:18 +00:00
|
|
|
<jvmarg value="-Djava.compiler=NONE"/>
|
|
|
|
...
|
|
|
|
</antlr>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>would run ANTLR in a VM without JIT.</p>
|
|
|
|
|
|
|
|
<p><code><jvmarg></code> allows all attributes described in <a
|
|
|
|
href="../using.html#arg">Command line arguments</a>.</p>
|
|
|
|
|
2000-11-14 09:30:38 +00:00
|
|
|
<h3>Example</h3>
|
|
|
|
<blockquote><pre>
|
|
|
|
<antlr
|
|
|
|
target="etc/java.g"
|
|
|
|
outputdirectory="build/src"
|
|
|
|
/>
|
|
|
|
</pre></blockquote>
|
|
|
|
<p>
|
|
|
|
This invokes ANTLR on grammar file etc/java.g, writing the generated
|
|
|
|
files to build/src.
|
|
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
|
2005-03-07 18:11:14 +00:00
|
|
|
<p align="center">Copyright © 2000-2005 The Apache Software Foundation. All rights
|
2001-02-13 12:32:01 +00:00
|
|
|
Reserved.</p>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|