Invokes the ANTLR Translator generator on a grammar file.
To use the ANTLR task, set the target attribute to the name of the grammar file to process. Optionally, you can also set the outputdirectory to write the generated file to a specific directory. Otherwise ANTLR writes the generated files to the directory containing the grammar file.
This task only invokes ANTLR if the grammar file is newer than the generated files.
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 |
fork | Run ANTLR in a separate VM. | No, default is "off" |
dir | The directory to invoke the VM in. (ignored if fork is disabled) | No |
ANTLR
supports a nested <classpath>
element, that represents a PATH like
structure. 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.
If fork is enabled, additional parameters may be passed to the new
VM via nested <jvmarg>
attributes, for example:
<antlr fork="yes" target=...> <jvmarg value="-Djava.compiler=NONE"/> ... </antlr>
would run ANTLR in a VM without JIT.
<jvmarg>
allows all attributes described in Command line arguments.
<antlr target="etc/java.g" outputdirectory="build/src" />
This invokes ANTLR on grammar file etc/java.g, writing the generated files to build/src.
Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.