JavaCC Plugin (quokka.plugin.javacc:0.1, namespace=javacc)
Generates java sources from JavaCC grammars for parsing
Template Targets
| javacc-main | Generates Java parser sources form a JavaCC grammar file. Implements quokka.plugin.lifecycle:generate-sources |
| javacc-test | Generates test Java parser sources form a JavaCC grammar file. Implements quokka.plugin.lifecycle:generate-test-sources |
To use the plugin, choose the correct template based on whether you are generating test or main sources. The generated sources will automatically be added to the relevant compilation source path. e.g.
<plugin group="quokka.plugin.javacc" version="?">
<target name="myjavacc" template="javacc-main">
<property name="in" value="src/TestGrammar.jj"/>
<property name="sourcesRoot" value="${q.project.targetDir}/generated-sources"/>
<property name="out" value="${myjavacc.sourcesRoot}/com/mypackage"/>
</target>
</plugin>
Properties: (Common to all targets)
- in Mandatory. The JavaCC grammar file (usually ending in .jj)
- out Mandatory. The directory the generated sources will be written to
- sourcesRoot Mandatory. The root directory of the generated sources that will be added for compilation. As JavaCC doesn't create the package structure, this is usually an ancestor of out.
- sourcesPath Mandatory. Either 'main' or 'test'. This controls whether the sources generated are added to the 'compile' or 'test-compile' source paths respectively.
- jdkVersion Optional. The JDK version for generated sources.
- options Optional. Any combination of options below.
Options
options is a sequence of settings separated by spaces.
Each option setting must be of one of the following forms:
-optionname=value (e.g., -STATIC=false)
-optionname:value (e.g., -STATIC:false)
-optionname (equivalent to -optionname=true. e.g., -STATIC)
-NOoptionname (equivalent to -optionname=false. e.g., -NOSTATIC)
Option settings are not case-sensitive, so one can say "-nOsTaTiC" instead
of "-NOSTATIC". Option values must be appropriate for the corresponding
option, and must be either an integer, a boolean, or a string value.
The integer valued options are:
LOOKAHEAD (default 1)
CHOICE_AMBIGUITY_CHECK (default 2)
OTHER_AMBIGUITY_CHECK (default 1)
The boolean valued options are:
STATIC (default true)
DEBUG_PARSER (default false)
DEBUG_LOOKAHEAD (default false)
DEBUG_TOKEN_MANAGER (default false)
OPTIMIZE_TOKEN_MANAGER (default true)
ERROR_REPORTING (default true)
JAVA_UNICODE_ESCAPE (default false)
UNICODE_INPUT (default false)
IGNORE_CASE (default false)
COMMON_TOKEN_ACTION (default false)
USER_TOKEN_MANAGER (default false)
USER_CHAR_STREAM (default false)
BUILD_PARSER (default true)
BUILD_TOKEN_MANAGER (default true)
TOKEN_MANAGER_USES_PARSER (default false)
SANITY_CHECK (default true)
FORCE_LA_CHECK (default false)
CACHE_TOKENS (default false)
KEEP_LINE_COLUMN (default true)
The string valued options are:
OUTPUT_DIRECTORY (default Current Directory)
JDK_VERSION (default 1.4)
EXAMPLE:
-STATIC=false -LOOKAHEAD:2
javacc-main
Generates Java parser sources form a JavaCC grammar file
- template: true
- Implements: quokka.plugin.lifecycle:generate-sources
Default Properties
| jdkVersion | ${@setifdef q.project.java.target} |
| sourcesPath | main |
javacc-test
Generates test Java parser sources form a JavaCC grammar file
- template: true
- Implements: quokka.plugin.lifecycle:generate-test-sources
Default Properties
| jdkVersion | ${@setifdef q.project.java.target} |
| sourcesPath | test |
Plugin Paths
runtime : Runtime class path
quokka.core.plugin-spi plugin-spi 0.3
quokka.plugin.lifecycle lifecycle 0.3
quokka.core.plugin-spi plugin-spi 0.3
apache.ant ant 1.7.1
quokka.core.bootstrap-util bootstrap-util 0.3
apache.ant ant 1.7.1
java-net.javacc javacc 4.0