2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
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.
|
|
|
|
-->
|
2000-11-14 09:30:38 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2005-04-29 18:58:16 +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>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="antlr">ANTLR</h2>
|
2000-11-14 09:30:38 +00:00
|
|
|
<h3>Description</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>Invokes the <a href="https://www.antlr.org/" target="_top">ANTLR</a> Translator generator on a
|
|
|
|
grammar file.</p>
|
|
|
|
<p>To use the ANTLR task, set the <var>target</var> attribute to the name of the grammar file to
|
|
|
|
process. Optionally, you can also set the <var>outputdirectory</var> to write the generated file to
|
|
|
|
a specific directory. Otherwise ANTLR writes the generated files to the directory containing the
|
|
|
|
grammar file.</p>
|
|
|
|
<p>This task only invokes ANTLR if the grammar file (or the supergrammar specified by
|
|
|
|
the <var>glib</var> attribute) is newer than the generated files.</p>
|
|
|
|
<p><strong>Note</strong>: This task depends on external libraries not included in the Apache Ant
|
|
|
|
distribution. See <a href="../install.html#librarydependencies">Library Dependencies</a> for more
|
|
|
|
information.</p>
|
|
|
|
<p>Antlr 2.7.2 Note: <em>You will need <samp>antlrall.jar</samp> that can be created by
|
2018-03-10 20:17:33 +01:00
|
|
|
the <q>antlr-all.jar</q> target of the Makefile provided with the download.</em></p>
|
2000-11-14 09:30:38 +00:00
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2000-11-14 09:30:38 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2000-11-14 09:30:38 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>target</td>
|
|
|
|
<td>The grammar file to process.</td>
|
|
|
|
<td>Yes</td>
|
2000-11-14 09:30:38 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>outputdirectory</td>
|
|
|
|
<td>The directory to write the generated files to.</td>
|
|
|
|
<td>No; defaults to the directory containing the grammar file</td>
|
2000-11-14 09:30:38 +00:00
|
|
|
</tr>
|
2002-06-20 15:03:46 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>glib</td>
|
|
|
|
<td>An optional super grammar file that the target grammar overrides. This feature is only
|
|
|
|
needed for advanced vocabularies.</td>
|
|
|
|
<td>No</td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>debug</td>
|
|
|
|
<td>When set to <q>yes</q>, this flag adds code to the generated parser that will launch the
|
|
|
|
ParseView debugger upon invocation.<br/> Note: ParseView is a separate component that needs
|
|
|
|
to be installed or your grammar will have compilation errors.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>html</td>
|
2018-03-02 08:23:45 +01:00
|
|
|
<td>Emit an HTML version of the grammar with hyperlinked actions if set to <q>yes</q>.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>diagnostic</td>
|
2018-03-02 08:23:45 +01:00
|
|
|
<td>Generate a text file with debugging information based on the target grammar if set
|
|
|
|
to <q>yes</q>.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>trace</td>
|
|
|
|
<td>Force <strong>all</strong> rules to call traceIn/traceOut if set to <q>yes</q>.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>traceParser</td>
|
|
|
|
<td>Only force parser rules to call traceIn/traceOut if set to <q>yes</q>.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>traceLexer</td>
|
|
|
|
<td>Only force lexer rules to call traceIn/traceOut if set to <q>yes</q>.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>traceTreeWalker</td>
|
|
|
|
<td>Only force tree walker rules to call traceIn/traceOut if set to <q>yes</q>.</td>
|
|
|
|
<td>No; default is <q>no</q></td>
|
2002-06-20 15:03:46 +00:00
|
|
|
</tr>
|
2001-12-15 13:41:39 +00:00
|
|
|
<!--tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>fork</td>
|
|
|
|
<td>Run ANTLR in a separate JVM.</td>
|
|
|
|
<td>No; default is <q>off</q></td>
|
2001-12-15 13:41:39 +00:00
|
|
|
</tr-->
|
2000-11-14 09:30:38 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>dir</td>
|
|
|
|
<td>The directory to invoke JVM in.<!--(ignored if fork is disabled)--></td>
|
|
|
|
<td>No</td>
|
2000-11-14 09:30:38 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
2018-03-05 17:35:30 +01:00
|
|
|
<h3 id="nested">Parameters specified as nested elements</h3>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
2018-03-05 17:35:30 +01:00
|
|
|
<p>The task supports a nested <code><classpath></code> element, that represents
|
2018-02-28 07:58:59 +01:00
|
|
|
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>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
|
|
|
<h4>jvmarg</h4>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><!--If fork is enabled, -->Additional parameters may be passed to the new JVM via
|
|
|
|
nested <code><jvmarg></code> attributes, for example:</p>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
|
|
|
<pre>
|
2002-09-04 11:05:19 +00:00
|
|
|
<antlr target="...">
|
2001-11-18 15:59:18 +00:00
|
|
|
<jvmarg value="-Djava.compiler=NONE"/>
|
|
|
|
...
|
2018-02-28 07:58:59 +01:00
|
|
|
</antlr></pre>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>would run ANTLR in a JVM without JIT.</p>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p><code><jvmarg></code> allows all attributes described
|
|
|
|
in <a href="../using.html#arg">Command line arguments</a>.</p>
|
2001-11-18 15:59:18 +00:00
|
|
|
|
2000-11-14 09:30:38 +00:00
|
|
|
<h3>Example</h3>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2000-11-14 09:30:38 +00:00
|
|
|
<antlr
|
|
|
|
target="etc/java.g"
|
2018-02-28 07:58:59 +01:00
|
|
|
outputdirectory="build/src"/></pre>
|
|
|
|
<p>This invokes ANTLR on grammar file <samp>etc/java.g</samp>, writing the generated files
|
|
|
|
to <samp>build/src</samp>.</p>
|
2000-11-14 09:30:38 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
</body>
|
|
|
|
</html>
|