JavaCC Release Notes

# JavaCC [tm]: Release Notes

    THIS FILE IS A COMPLETE LOG OF ALL CHANGES THAT HAVE TAKEN PLACE SINCE
    THE RELEASE OF VERSION 0.5 IN OCTOBER, 1996.

    AS NOTED HERE, DURING THE TRANSITION FROM 0.5 TO 4.0, THERE HAVE BEEN
    THE FOLLOWING INTERMEDIATE VERSIONS:

    	0.6.-10
    	0.6.-9
    	0.6.-8
    	0.6(Beta1)
    	0.6(Beta2)
    	0.6
    	0.6.1
    	0.7pre1
    	0.7pre2
    	0.7pre3
    	0.7pre4
    	0.7pre5
    	0.7pre6
    	0.7pre7
    	0.7
    	0.7.1
    	0.8pre1
    	0.8pre2
    	1.0
    	1.2
    	2.0
    	2.1
    	3.0
    	3.1
    	3.2
    	4.0
    	4.1
            4.2

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 4.2
    -------------------------------------------------------------------

    Release 4.2 is a maintenance release, incorporating a number of bug
    fixes and enhancements. For a complete list, please see the
    issue tracker:

    https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.2

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 4.1
    -------------------------------------------------------------------

    Release 4.1 is a maintenance release, incorporating a number of bug
    fixes and enhancements. For a complete list, please see the
    issue tracker:

    https://javacc.dev.java.net/issues/buglist.cgi?component=javacc&field0-0-0=target_milestone&type0-0-0=equals&value0-0-0=4.1

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 4.0
    -------------------------------------------------------------------

    See the bug list in issue tracker for all the bugs fixed in this release.
    JJTree and JavaCC both now support 1.5 syntax.
    We now support accessing token fields in the grammar like: s=<ID>.image
    Convenient constructors for passing encoding directly to the grammar
    Tabsetting is now customizable.
    SimpleNode can now extend a class using the NODE_EXTENDS option.
    JAVACODE and BNF productions take optional access modifiers.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 3.2
    -------------------------------------------------------------------
    New regular expression kind with range operator where the upperbound is
    optional, meaning just minimum, no max - (<RE>){n,}
    Fix for issue 41 where it takes exponential time to minimumSize

    MODIFICATIONS IN VERSION 3.2
    -------------------------------------------------------------------
    Added the LICENSE file to the installation root directory.
    Fixed issues #: 10, 11, 13, 2, 4, 5, 7
    In particular, the generated code should now compile with JDK 1.5 (Tiger)

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 3.1
    -------------------------------------------------------------------

    Open source with BSD license.
    Fixed the copyright text in the sourcefiles.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 3.0 (as compared to version 2.1)
    -------------------------------------------------------------------

    No GUI version anymore.

    Fixed a bug in handling string literals when they intersect some
    regular expression.

    Split up initializations of jj_la1_* vars into smaller methods so
    that there is no code size issue. This is a recently reported bug.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 2.1 (as compared to version 2.0)
    -------------------------------------------------------------------

    Added a new option - KEEP_LINE_COLUMN default true.

    If you set this option to false, the generated CharStream will not
    have any line/column tracking code. It will be your responsibility
    to do it some other way. This is needed for systems which don't care
    about giving error messages etc.

    -------------------------------------------------------------------

    API Changes: JavaCC no longer generates one of the 4 stream classes:

          ASCII_CharStream
          ASCII_UCodeESC_CharStream
          UCode_CharStream
          UCode_UCodeESC_CharStream

    In stead, it now supports two kinds of streams:

          SimpleCharStream
          JavaCharStream

    Both can be instantiated using a Reader object.

    SimpleCharStream just reads the characters from the Reader using the
    read(char[], int, int) method. So if you want to support a specific
    encoding - like SJIS etc., you will first create the Reader object
    with that encoding and instantiate the SimpleCharStream with that
    Reader so your encoding is automatically used. This should solve a
    whole bunch of issues with UCode* classes that were reported.

    JavaCharStream is pretty much like SimpleCharStream, but it also does
    \uxxxx processing as used by the Java programming language.

    Porting old grammars:

    Just replace Stream class names as follows -

        if you are using ASCII_CharStream or UCode_CharStream,
        change it to SimpleCharStream

        if you are using ASCII_UCodeESC_CharStream or UCode_UCodeESC_CharStream,
        change it to JavaCharStream

    The APIs remain the same.

    Also, the CharStream interface remains the same. So, if you have been using
    USER_CHAR_STREAM option, then you don't need to change anything.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 2.0 (as compared to version 1.2)
    -------------------------------------------------------------------

    Added CPP grammar to examples directory (contributed by Malome Khomo).

    -------------------------------------------------------------------

    GUI is now available to run JavaCC.  You can control all aspects of
    JJTree and JavaCC (except creating and editing the grammar file)
    through this GUI.

    -------------------------------------------------------------------

    Desktop icons now available on a variety of platforms so you can
    run JavaCC by double clicking the icon.

    -------------------------------------------------------------------

    Bash on NT support improved.

    -------------------------------------------------------------------

    Uninstaller included.

    -------------------------------------------------------------------

    Fixed some minor bugs.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 1.2 (as compared to version 1.0)
    -------------------------------------------------------------------

    Moved JavaCC to the Metamata installer and made it available for
    download from Metamata's web site.

    -------------------------------------------------------------------

    Added Java 1.2 grammars to the examples directory.

    -------------------------------------------------------------------

    Added repetition range specifications for regular expressions.
    You can specify exact number of times a particular re should
    occur or a {man, max} range, e.g,

        TOKEN:
        {
             < TLA: (["A"-"Z"]){3} > // Three letter acronyms!

          |

             < DOS_FILENAME: (~[".", ":", ";", "\\"]) {1,8}
                             ( "." (~[".", ":", ";", "\\"]){1,3})? >
                   // An incomplete spec for the DOS file name format
        }

    The translation is right now expanding out these many number of times
    so use it with caution.

    -------------------------------------------------------------------

    You can now specify actions/state changes for EOF. It is right now
    very strict in that it has to look exactly like:

       <*> TOKEN:
       {
          < EOF > { action } : NEW_STATE
       }

    which means that EOF is still EOF in every state except that now
    you can specify what state changes  if any or what java code
    if any to execute on seeing EOF.

    This should help in writing grammars for processing C/C++ #include
    files, without going through hoops as in the old versions.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 1.0 (as compared to version 0.8pre2)
    -------------------------------------------------------------------

    Fixed bugs related to usage of JavaCC with Java 2.

    -------------------------------------------------------------------

    Many other bug fixes.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.8pre2 (as compared to version 0.8pre1)
    -------------------------------------------------------------------

    Mainly bug fixes.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.8pre1 (as compared to version 0.7.1)
    -------------------------------------------------------------------

    Changed all references to Stream classes in the JavaCC code itself and
    changed them to Reader/Writer.

    -------------------------------------------------------------------

    Changed all the generated *CharStream classes to use Reader instead of
    InputStream. The names of the generated classes still say *CharStream.
    For compatibility reasons, the old constructors are still supported.
    All the constructors that take InputStream create InputStreamReader
    objects for reading the input data. All users parsing non-ASCII inputs
    should continue to use the InputStream constructors.

    -------------------------------------------------------------------

    Generate inner classes instead of top level classes where appropriate.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7.1 (as compared to version 0.7)
    -------------------------------------------------------------------

    Fixed a bug in the handling of empty PARSER_BEGIN...PARSER_END
    regions.

    -------------------------------------------------------------------

    Fixed a bug in Java1.1noLA.jj - the improved performance Java grammar.

    -------------------------------------------------------------------

    Fixed a spurious definition that was being generated into the parser
    when USER_TOKEN_MANAGER was set to true.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7 (as compared to version 0.7pre7)
    -------------------------------------------------------------------

    Fixed the error reporting routines to delete duplicate entries from
    the "expected" list.

    -------------------------------------------------------------------

    Generated braces around the "if (true) ..." construct inserted
    by JavaCC to prevent the dangling else problem.

    -------------------------------------------------------------------

    Added code to consume_token that performs garbage collections of
    tokens no longer necessary for error reporting purposes.

    -------------------------------------------------------------------

    Fixed a bug with OPTIMIZE_TOKEN_MANAGER when there is a common prefix
    for two or more (complex) regular expressions.

    -------------------------------------------------------------------

    Fixed a JJTree bug where a node annotation #P() caused a null pointer
    error.

    -------------------------------------------------------------------

    Only generate the jjtCreate() methods if the NODE_FACTORY option is
    set.

    -------------------------------------------------------------------

    Fixed a bug where the name of the JJTree state file was being used in
    the declaration of the field.

    -------------------------------------------------------------------

    Updated the performance page to demonstrate how JavaCC performance
    has improved since Version 0.5.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7pre7 (as compared to version 0.7pre6)
    -------------------------------------------------------------------

    Added an option CACHE_TOKENS with a default value of false.  You
    can generate slightly faster and (it so happens) more compact
    parsers if you set CACHE_TOKENS to true.

    -------------------------------------------------------------------

    Improved time and space requirements as compared to earlier
    versions - regardless of the setting of CACHE_TOKENS.

    Performance has improved roughly 10% (maybe even a little more).
    Space requirements have reduced approximately 30%.

    It is now possible to generate a Java parser whose class file is
    only 28K in size.  To do this, run JavaCC on Java1.1noLA.jj with
    options ERROR_REPORTING=false and CACHE_TOKENS=true.

    And over the next few months, there is still places where space
    and time can be trimmed!

    -------------------------------------------------------------------

    The token_mask arrays are completely gone and replaced by bit
    vectors.

    -------------------------------------------------------------------

    Nested switch statements have been flattened.

    -------------------------------------------------------------------

    Fixed a bug in the outputting of code to generate a method

        jjCheckNAddStates(int i)

    calls to which are generated, but not the method.

    -------------------------------------------------------------------

    Generating the `static' keyword for the backup method of the
    UCode*.java files when STATIC flag is set.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7pre6 (as compared to version 0.7pre5)
    -------------------------------------------------------------------

    Extended the generated CharStream classes with a method to adjust the
    line and column numbers for the beginning of a token.  Look at the C++
    grammar in the distribution to see an example usage.

    -------------------------------------------------------------------

    Fixed the JavaCC front-end so that error messages are given with line
    numbers relative to the original .jjt file if the .jj file is generated
    by pre-processing using jjtree.

    -------------------------------------------------------------------

    Removed support for old deprecated features:

    . IGNORE_IN_BNF can no longer be used.  Until this version, you
      would get a deprecated warning message if you did use it.

    . The extra {} in TOKEN specifications can no longer be used.  Until
      this version, you would get a deprecated warning message if your
      did use it.

    -------------------------------------------------------------------

    ParseError is no longer supported.  It is now ParseException.  Please
    delete the existing generated files for ParseError and ParseException.
    The right ParseException will automatically get regenerated.

    -------------------------------------------------------------------

    Completed step 1 in getting rid of the token mask arrays.  This
    occupies space and is also somewhat inefficient.  Essentially,
    replaced all "if" statements that test a token mask entry with
    faster "switch" statements.  The token mask array still exist for
    error reporting - but they will be removed in the next step (in
    the next release).  As a result, we have noticed improved parser
    speeds (up to 10% for the Java grammar).

    As a consequence of doing step 1, but not step 2, the size of the
    generated parser has increased a small amount.  When step 2 is
    completed, the size of the generated parser will go down to be even
    smaller than what it was before.

    -------------------------------------------------------------------

    Cache tokens one step ahead during parsing for performance reasons.

    -------------------------------------------------------------------

    Made the static token mask fields "final".  Note that the token
    mask arrays will go away in the next release.

    -------------------------------------------------------------------

    The Java 1.1 grammar was corrected to allow interfaces nested within
    blocks.  The JavaCC grammar was corrected to fix a bug in its
    handling of the ">>>=" operator.

    -------------------------------------------------------------------

    Fixed a bug in the optimizations of the lexical analyzer.

    -------------------------------------------------------------------

    Many changes have been made to JJTree.  See the JJTree release
    notes for more information.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7pre5 (as compared to version 0.7pre4)
    -------------------------------------------------------------------

    Fixed a bug with TOKEN_MGR_DECLS introduced in 0.7pre4.

    -------------------------------------------------------------------

    Enhanced JavaCC input grammar to allow JavaCC reserved words in
    Java code (such as actions).  This too was disallowed in 0.7pre4
    only and has been rectified.

    -------------------------------------------------------------------

    The JavaCC+JJTree grammar is now being offered to our users.  You
    can find it in the examples directory.

    -------------------------------------------------------------------

    Fixed an array index out of bounds bug in the parser - that sometimes
    can happen when a non-terminal can expand to more than 100 other
    non-terminals.

    -------------------------------------------------------------------

    Fixed a bug in generating parsers with USER_CHAR_STREAM set to true.

    -------------------------------------------------------------------

    Created an alternate Java 1.1 grammar in which lookaheads have been
    modified to minimize the space requirements of the generated
    parser.  See the JavaGrammars directory under the examples directory.

    -------------------------------------------------------------------

    Provided instructions on how you can make your own grammars space
    efficient (until JavaCC is improved to do this).  See the
    JavaGrammars directory under the examples directory.

    -------------------------------------------------------------------

    Updated all examples to make them current.  Some examples had become
    out of date due to newer versions of JavaCC.

    -------------------------------------------------------------------

    Updated the VHDL example - Chris Grimm made a fresh contribution.
    This seems to be a real product quality example now.

    -------------------------------------------------------------------

    Fixed bugs in the Obfuscator example that has started being used
    for real obfuscation by some users.

    -------------------------------------------------------------------

    The token manager class is non-final (this was a bug).

    -------------------------------------------------------------------

    Many changes have been made to JJTree.  See the JJTree release
    notes for more information.

    -------------------------------------------------------------------

    Fixed all token manager optimization bugs that we know about.

    -------------------------------------------------------------------

    Fixed all UNICODE lexing bugs that we know about.

    -------------------------------------------------------------------

    Fixed an array index out of bounds bug in the token manager.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7pre4 (as compared to version 0.7pre3)
    -------------------------------------------------------------------

    The only significant change for this version is that we incorporated
    the Java grammar into the JavaCC grammar.  The JavaCC front end is
    therefore able to parse the entire grammar file intelligently rather
    than simple ignore the actions.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7pre3 (as compared to version 0.7pre2)
    -------------------------------------------------------------------

    WE HAVE NOT ADDED ANY MAJOR FEATURES TO JAVACC FOR THIS PRERELEASE.
    WE'VE FOCUSED MAINLY ON BUG FIXES.  BUT HERE IS WHAT HAS CHANGED:

    -------------------------------------------------------------------

    Fixed the JavaCC license agreement to allow redistributions of example
    grammars.

    -------------------------------------------------------------------

    Fixed a couple of bugs in the JavaCC grammar.

    -------------------------------------------------------------------

    Fixed an obscure bug that caused spurious '\r's to be generated
    on Windows machines.

    -------------------------------------------------------------------

    Changed the generated *CharStream classes to take advantage of the
    STATIC flag setting.  With this (like the token manager and parser)
    the *CharStream class also will have all the methods and variables to
    be static with STATIC flag.

    -------------------------------------------------------------------

    A new option OPTIMIZE_TOKEN_MANAGER is introduced. It defaults to
    true.  When this option is set, optimizations for the TokenManager, in
    terms of size *and* time are performed.

    This option is automatically set to false if DEBUG_TOKEN_MANAGER is
    set to true.

    The new option OPTIMIZE_TOKEN_MANAGER might do some unsafe
    optimization that can cause your token manager not to compile or run
    properly. While we don't expect this to happen that much, in case it
    happens, just turn off the option so that those optimizations will not
    happen and you can continue working. Also, if this happens, please
    send us the grammar so we can analyze the problem and fix JavaCC.

    -------------------------------------------------------------------

    A String-valued option OUTPUT_DIRECTORY is implemented. This can be
    used to instruct JavaCC to generate all the code files in a particular
    directory.  By default, this is set to user.dir.

    -------------------------------------------------------------------

    Fixed a minor bug (in 0.7pre2) in that the specialToken field was not
    being set before a lexical action for a TOKEN type reg. exp.

    -------------------------------------------------------------------

    Added a toString method to the Token class to return the image.

    -------------------------------------------------------------------
    *******************************************************************
    -------------------------------------------------------------------

    MODIFICATIONS IN VERSION 0.7pre2 (as compared to version 0.7pre1)

    -------------------------------------------------------------------

    AS USUAL, KEEP IN MIND THAT THIS IS A PRERELEASE THAT WE HAVE NOT
    TESTED EXTENSIVELY.  THERE ARE A FEW KNOWN BUGS THAT ARE STILL PRESENT
    IN THIS VERSION.  QUALITY CONTROL FOR PRERELEASES ARE SIGNIFICANTLY
    LOWER THAN STABLE RELEASES - I.E., WE DON'T MIND THE PRESENCE OF BUGS
    THAT WE WOULD FEEL EMBARRASSED ABOUT IN STABLE RELEASES.

    -------------------------------------------------------------------

    Main feature release for 0.7pre2 is a completely redone JJTree.  It
    now bootstraps itself.  See the JJTree release notes for more
    information.

    -------------------------------------------------------------------

    Error recovery constructs have been modified a bit from 0.7pre1.  The
    parser methods now throw only ParseException by default.  You can now
    specify a "throws" clause with your non-terminals to add other
    exceptions to this list explicitly.  Please see the help web page at:

       http://www.suntest.com/JavaCCBeta/newerrorhandling.html

    for complete information on error recovery.

    -------------------------------------------------------------------

    A new Java grammar improved for performance in the presence of very
    complex expressions is now included.  This is NewJava1.1.jj.

    -------------------------------------------------------------------

    More optimizations for the size of the token manager's java and class
    files.  The generated .java files are about 10-15% smaller that
    0.7pre1 (and 40-45%) smaller compared to 0.6. The class files (with
    -O) are about 20% smaller compared to 0.6.

    -------------------------------------------------------------------

    The parser size has been decreased.  The current optimizations affect
    grammars that have small amounts of non-1 lookaheads.  For example the
    generated code for the Java grammar has now reduced by 10%.

    -------------------------------------------------------------------

    Extended the Token class to introduce a new factory function that
    takes the token kind and returns a new Token object. This is done to
    facilitate creating Objects of subclasses of Token based on the kind.
    Look at the generated file Token.java for more details.

    -------------------------------------------------------------------

    The restriction on the input size (to be < 2 gbytes) for the token
    manager is gone.  Now the lexer can tokenize any size input (no
    limit).

    -------------------------------------------------------------------

    Removed all the references to System.out.println in the *CharStream
    classes.  Now all these are thrown as Error objects.

    -------------------------------------------------------------------

    Fixed a very old problem with giving input from System.in. Previously
    for the EOF, you needed to give  or