Invokes
the ANTLR3
Translator generator on a grammar file.
Attribute |
Description |
Required |
target |
The
grammar file to process. |
Yes |
outputdirectory |
The
directory to write the generated files to. If not set, the files are written
to the directory containing the grammar file. |
No |
libdirectory |
The
directory where to find token files. |
No |
depend |
When set
to “true”, ANTLRs ‘depend’ option is used to
resolve dependencies and to decide whether to invoke ANTLR for compilation. When set
to “false”, try to figure out if an ANTLR generated file is out of date
without invoking ANTLR with its ‘depend’ option. Default
setting is “false” to keep backwards compatibility. |
No |
report |
When set
to "true", prints out a report about the grammar processed. Default
is “false”. |
No |
print |
When set
to "true", print out the grammar without actions. Default
is “false”. |
No |
debug |
When set
to "true", the generated parser emits debugging events. Default
is “false” |
No |
profile |
When set
to "true", generates a parser that computes profiling information. Default
is “false”. |
No |
nfa |
When set
to "true", generate an NFA for each rule. Default
is “false”. |
No |
dfa |
When set
to "true", generate an DFA for each rule. Default
is “false”. |
No |
messageFormat |
When set
to a message format the specified output style for messages is used. Default
is “false”. |
No |
multithreaded |
When set
to "true", run the analysis in 2 threads. Default
is “false”. |
No |
dir |
The
directory to invoke the VM in. |
No |
dbgST |
When set
to “true”, put tags at start/stop of all templates in output. Default
is “false”. |
No |
noprune |
Test lookahead against EBNF block exit branches. Default
is “false”. |
No |
nocollapse |
collapse
incident edges into DFA states Default
is “false”. |
No |
conversiontimeout |
Set the
NFA conversion timeout for each decisition to the
supplied number of milliseconds. Default
is 100 as per ANTLR3 |
No |
ANTLR3
supports a nested <classpath>
element, that represents a PATH like structure
Additional parameters may be passed
to the new VM via nested <jvmarg>
attributes,
for example:
<antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr" target="...">
<jvmarg value="-Xmx512M"/>
...
</antlr:antlr3>
would set the
maximum Java heap size to 512 Megabyte when running ANTLR3.
<jvmarg> allows all
attributes described in Command line arguments.
<project name="d2u"
default="dist" basedir=".">
More than a DOS to UNIX conversion of
line ends.
<property name="project.name"
value="d2u" />
<property name="version" value="1.00" />
<!-- set global properties for this build
-->
<property name="build" location="."/>
<property name="src"
location="src"/>
<property name="classes" location="classes"/>
<property name="dist" location="dist" />
<property name="doc" location="docs/api"/>
<property name="grammar" location="grammar"/>
<property name="package" value="org/myorg/${project.name}"/>
<!-- where to write/find token files -->
<property name="token.lib"
location="${src}/${package}" />
<property name="profile" value="false" />
<property name="report" value="true" />
<property name="multithreaded" value="true" />
<!-- where to find antlr
and associates -->
<!-- If the jar-archives listed below are
already in the classpath -->
<!-- the definition of antlr.path
could be dropped, because -->
<!-- antlr3.jar will resolve the libraries
by itself. -->
<!-- As antlr.libdir
and antlr.libs are just auxiliary -->
<!-- parameters helping to create antlr.path, -->
<!-- they could be eliminated in this case,
too. -->
<property name="antlr.libdir"
location="C:/Programme/antlr/lib"
/>
<include name="antlr-3.1.jar"
/>
<include
name="antlr-2.7.7.jar" />
<include
name="stringtemplate-3.2.jar" />
<include name="antlr-runtime-3.1.jar"
/>
<fileset
dir="${antlr.libdir}" casesensitive="yes">
<patternset
refid="antlr.libs"
/>
<!-- Create
the time stamp -->
<!-- Create
the build directory structure used by compile -->
<mkdir
dir="${src}/${package}"
/>
<mkdir
dir="${classes}/${package}"
/>
<mkdir
dir="${classes}/META-INF" />
<mkdir
dir="${doc}/${package}" />
<target name="antlr"
depends="init" description="run antlr
on grammar">
<echo message="antlr ${grammar}/${grammar.name}"
/>
<antlr:antlr3
xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${grammar}/${grammar.name}"
outputdirectory="${src}/${package}"
multithreaded="${multithreaded}"
<target name="compile" depends="antlr"
description="compile">
<!--
Compile the java code from ${src} into ${classes}
-->
<javac
debug="true" srcdir="${src}" destdir="${classes}"
listfiles="Yes"
deprecation="Yes">
<compilerarg
value="-Xlint:unchecked"/>
<manifest
file="${classes}/META-INF/MANIFEST.MF">
<attribute name="Main-Class"
value="${package}.Main" />
<target name="dist" depends="compile, manifest"
description="generate for
distribution">
<jar jarfile="${dist}/lib/${project.name}.jar" basedir="${classes}"
manifest="${classes}/META-INF/MANIFEST.MF"/>
<target name="doc" description="generate
documentation">
sourcefiles="${src}/${package}/*.java"
<target name="clean" description="clean up">
includes="**/*.class,**/*.tokens,**/*.g*"
/>
<fileset
dir="${dist}" includes="**/*.jar" />
<target name="all" depends="clean, dist, doc"
description="clean up"/>
<project name="d2u"
default="dist" basedir=".">
More than a DOS to UNIX conversion of
line ends.
<property name="project.name"
value="d2u" />
<property name="version" value="1.00" />
<!-- set global properties for this build
-->
<property name="build" location="."/>
<property name="src"
location="src"/>
<property name="classes" location="classes"/>
<property name="dist" location="dist" />
<property name="doc" location="docs/api"/>
<property name="grammar" location="grammar"/>
<property name="package" value="org/myorg/${project.name}"/>
<!-- where to write/find token files -->
<property name="token.lib"
location="${src}/${package}" />
<property name="profile" value="false" />
<property name="report" value="true" />
<property name="multithreaded" value="true" />
<property name="depend" value="true" />
<!-- Create
the time stamp -->
<!-- Create
the build directory structure used by compile -->
<mkdir
dir="${src}/${package}"
/>
<mkdir
dir="${classes}/${package}"
/>
<mkdir
dir="${classes}/META-INF" />
<mkdir
dir="${doc}/${package}" />
<target name="antlr"
depends="init" description="run antlr
on grammar">
<echo message="antlr ${grammar}/${project.name}.g"
/>
<antlr:antlr3
xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${grammar}/${project.name}.g"
outputdirectory="${src}/${package}"
multithreaded="${multithreaded}"
<target name="compile" depends="antlr"
description="compile">
<!--
Compile the java code from ${src} into ${classes}
-->
<javac
debug="true" srcdir="${src}" destdir="${classes}"
listfiles="Yes"
deprecation="Yes">
<compilerarg
value="-Xlint:unchecked"/>