java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Ant arrow How to use JavaCC task
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4084
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use JavaCC task E-mail
User Rating: / 4
PoorBest 

JavaCC

Description

Invokes the JavaCC compiler compiler on a grammar file.

To use the javacc task, set the target attribute to the name of the 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 outputdirectory to write the generated file to a specific directory. Otherwise javacc writes the generated files to the directory containing the grammar file.

This task only invokes JavaCC if the grammar file is newer than the generated Java files. javacc assumes that the Java class name of the generated parser is the same as the name of the grammar file, ignoring the .jj. If this is not the case, the javacc task will still work, but it will always generate the output files.

Parameters

Attribute Description Required
target The grammar file to process. Yes
javacchome The directory containing the JavaCC distribution. 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
buildparser Sets the BUILD_PARSER grammar option. This is a boolean option. No
buildtokenmanager Sets the BUILD_TOKEN_MANAGER grammar option. This is a boolean option. No
cachetokens Sets the CACHE_TOKENS grammar option. This is a boolean option. No
choiceambiguitycheck Sets the CHOICE_AMBIGUITY_CHECK grammar option. This is an integer option. No
commontokenaction Sets the COMMON_TOKEN_ACTION grammar option. This is a boolean option. No
debuglookahead Sets the DEBUG_LOOKAHEAD grammar option. This is a boolean option. No
debugparser Sets the DEBUG_PARSER grammar option. This is a boolean option. No
debugtokenmanager Sets the DEBUG_TOKEN_MANAGER grammar option. This is a boolean option. No
errorreporting Sets the ERROR_REPORTING grammar option. This is a boolean option. No
forcelacheck Sets the FORCE_LA_CHECK grammar option. This is a boolean option. No
ignorecase Sets the IGNORE_CASE grammar option. This is a boolean option. No
javaunicodeescape Sets the JAVA_UNICODE_ESCAPE grammar option. This is a boolean option. No
keeplinecolumn Sets the KEEP_LINE_COLUMN grammar option. This is a boolean option. No
lookahead Sets the LOOKAHEAD grammar option. This is an integer option. No
optimizetokenmanager Sets the OPTIMIZE_TOKEN_MANAGER grammar option. This is a boolean option. No
otherambiguitycheck Sets the OTHER_AMBIGUITY_CHECK grammar option. This is an integer option. No
sanitycheck Sets the SANITY_CHECK grammar option. This is a boolean option. No
static Sets the STATIC grammar option. This is a boolean option. No
unicodeinput Sets the UNICODE_INPUT grammar option. This is a boolean option. No
usercharstream Sets the USER_CHAR_STREAM grammar option. This is a boolean option. No
usertokenmanager Sets the USER_TOKEN_MANAGER grammar option. This is a boolean option. No

Example

<javacc
    target="src/Parser.jj"
    outputdirectory="build/src"
    javacchome="c:/program files/JavaCC"

    static="true"
/>

This invokes JavaCC on grammar file src/Parser.jj, writing the generated files to build/src. The grammar option STATIC is set to true when invoking JavaCC.

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.