JJDoc

Since Apache Ant 1.6

Description

Invokes the JJDoc preprocessor for the JavaCC compiler compiler. It takes a JavaCC parser specification and produces documentation for the BNF grammar. It can operate in three modes, determined by command line options.

To use the jjdoc task, set the target attribute to the name of the JavaCC grammar file to process. You also need to specify the directory containing the JavaCC installation using the javacchome attribute, so that Ant can find the JavaCC classes. Optionally, you can also set the outputfile to write the generated BNF documentation file to a specific (directory and) file. Otherwise jjdoc writes the generated BNF documentation file as the JavaCC grammar file with a suffix .txt or .html.

This task only invokes JJDoc if the grammar file is newer than the generated BNF documentation file.

Parameters

Attribute Description Required
target The JavaCC grammar file to process. Yes
javacchome The directory containing the JavaCC distribution. Yes
outputfile The file to write the generated BNF documentation file to. If not set, the file is written with the same name as the JavaCC grammar file but with a the suffix .html or .txt No
text Sets the TEXT BNF documentation option. This is a boolean option. No
onetable Sets the ONE_TABLE BNF documentation option. This is a boolean option. No
maxmemory Max amount of memory to allocate to the forked JVM. since Ant 1.8.3 No

Example

Invoke JJDoc on grammar file src/Parser.jj, writing the generated BNF documentation file, ParserBNF.html, to doc.

<jjdoc target="src/Parser.jj"
       outputfile="doc/ParserBNF.html"
       javacchome="c:/program files/JavaCC"/>