Home | History | Annotate | Download | only in tool
      1 ANTLR 3.4 Release
      2 July 18, 2011
      3 
      4 Terence Parr, parrt at cs usfca edu
      5 ANTLR project lead and supreme dictator for life
      6 University of San Francisco
      7 
      8 CHANGES
      9 
     10 July 18, 2011 -- release 3.4
     11 
     12 * Added tree method insertChild(int i, Object t).
     13 
     14 July 14, 2011
     15 
     16 * Added BaesTree.freshenParentAndChildIndexesDeeply() to recursively
     17   walk tree and set ptrs.
     18 
     19 July 6, 2011
     20 
     21 * reset() for token stream didn't skip initial off-channel tokens.
     22 
     23 July 5, 2011
     24 
     25 * Sam fixes rare infinite loop upon error in nextToken().
     26 * rewrites weren't pulled from syntactic predicates.
     27 
     28 June 29, 2011
     29 
     30 * Sam noticed CommonToken.getText() cached substring pulled from input, which
     31   defeated purpose of pointing into input char array.  Altered to not cache.
     32   Should reduce memory footprint.
     33 
     34 June 24, 2011
     35 
     36 * empty alts with actions didn't have EPSILON dummy alt node.
     37 
     38 June 19, 2011
     39 
     40 * Udo noticed that Parser.getMissingSymbol() didn't set invented token's input
     41 
     42 June 8, 2011
     43 
     44 * Added inContext(String context) back into TreeParser.
     45 
     46 April 21, 2011
     47 
     48 * Updated for ST v4.0.2 (setting iterateAcrossValues = true as instance var)
     49 * Needed throws condition for delegatedRules.
     50 
     51 April 20, 2011 (Sam Harwell)
     52 
     53 * Implement the 'throwsSpec' feature of parser rules for the Java target
     54 * Improve algorithm for SemanticContext Boolean predicate reduction
     55 
     56 April 13, 2011
     57 
     58 * Unmangled region names in STViz hiearchy tree display.
     59 * Removed conversion timeout thing again
     60 
     61 April 11, 2011
     62 
     63 * Added option -Xconversiontimeout back in.  Turns out we hit NFA conversion
     64   time landmine occasionally with huge grammars; fails over to backtracking
     65   (if turned on) if it can't make DFA.
     66 
     67 March 29 - April 10, 2011
     68 
     69 * Uses ST v4 now!!!  Massive change.  Only updated Java target so far.
     70   Ripped out ST v3 usage to remove indirect dependency on ANTLR v2.
     71 
     72 March 28, 2011
     73 
     74 * Sam Harwell ported all v2 grammars to v3!
     75 
     76 March 3, 2011
     77 
     78 * left-recursion pattern off until all targets catch up
     79 
     80 * ANTLRCore.sti no longer used; removed from all targets.
     81 
     82 * Adding type, text terminal options
     83 
     84 * Replaced hetero arg with terminalOptions arg in all templates that reference hetero
     85   (this is the class name / node type used for TOKEN<NODETYPE> references
     86   in grammar).  Widespread but trivial changes to all targets.  hetero is
     87   now terminalOptions.node.  Can also get terminalOptions.type and
     88   terminalOptions.text from dictionary of options.
     89 
     90 * Fixed mispelling of license in BSD license headers
     91 
     92 March 3, 2011
     93 
     94 * Add tree, getTree() to ParserRuleReturnScope to do away with specific ones like:
     95     public static class rewrite_template_args_return extends ParserRuleReturnScope {
     96         CommonTree tree;
     97         public Object getTree() { return tree; }
     98     };
     99   Removed these special classes if it's just AST; keep if they have defined "returns"
    100   values
    101 
    102 February 26, 2011
    103 
    104 * All finally {} have comment now to suppress warning.
    105 
    106 * removed ; from {;} blank method
    107 
    108 * Added @SuppressWarnings({"all"}) to front of each
    109   generated class.
    110 
    111 * -print wasn't always showing ^ and ! in grammar
    112 
    113 * Added java-left-recur/Java.g example.
    114 
    115 * left-recursion pattern detection handles backtracking mode now
    116 
    117 February 25, 2011
    118 
    119 * -Xmaxinlinedfastates went to 60 from 10 for forcing prediction in left-
    120   recursive expression rules to stay in rule; preds use a parameter.
    121 
    122 * trees know where they came from now start..stop tokens; todo: use for better err handling.
    123 
    124 * Got immediate left-recursion working for rules. Added TestLeftRecursion.java
    125 
    126 February 21, 2011
    127 
    128 * Fixed http://www.antlr.org/jira/browse/ANTLR-437 thanks to Vladislav Kuzkokov.
    129   added unit test.
    130 
    131 February 17, 2011
    132 
    133 * Add -language L option to override language=L option in grammar.  Same
    134   grammar can yield multiple parsers in different languages now.
    135 
    136 February 10, 2011
    137 
    138 * Added method to generated Java code to return the array of delegates; e.g.,
    139     import Sub1, Sub2;
    140   yields:
    141 
    142     public Parser[] getDelegates() {
    143         return new Parser[] {gSub1, gSub2};
    144     }
    145 
    146 January 25, 2011
    147 
    148 * Improve error messages for no viable alt parse exceptions
    149 
    150 January 20, 2011
    151 
    152 * TokenRewriteStream had dead code; also updated insertBefore followed by
    153   replace or delete.  If input is abc and I did insertBefore(2,"y"), where
    154   'c' is index 2, then did delete of 2 previously defined functionality
    155   was to ignore the insert. that's weird; fixed to keep insert.  Also
    156   Delete special case of replace (text==null):
    157   	  D.i-j.u D.x-y.v	| boundaries overlap => combine to max(min)..max(right)
    158 
    159 December 12, 2010
    160 
    161 * Send couldBacktrack now to enterDecision in debug protocol
    162 
    163 December 4, 2010
    164 
    165 * TreeWizard ctor needed a default tree adapator.
    166 
    167 November 29, 2010 -- ANTLR v3.3
    168 
    169 November 23, 2010
    170 
    171 * CodeGenerator.loadLanguageTarget is now static and available to load
    172   targets so we can ask them questions during analysis.
    173 
    174 * Fixed and added unit test
    175     http://www.antlr.org/jira/browse/ANTLR-370
    176     http://www.antlr.org/jira/browse/ANTLR-375
    177 
    178 November 23, 2010
    179 
    180 * Added source name to syntax error msgs
    181 
    182 October 20, 2010
    183 
    184 Added boolean couldBacktrack to enterDecision in dbg interface. Breaks AW
    185 interface and other tools! [BREAKS BACKWARD COMPATIBILITY]
    186 
    187 October 17, 2010
    188 
    189 * Missing -trace in help msg
    190 
    191 November 22, 2010
    192 
    193 * Added GrammarAST: public int getCharPositionInLine() { return getColumn()-1; }
    194   and Grammar.getHasDelegates() for C# guys
    195 
    196 October 16, 2010
    197 
    198 * Doesn't write profile data to file anymore; emits decision data to stderr
    199 
    200 October 14, 2010
    201 
    202 * Make OrderedHashSet have deterministic iteration
    203 
    204 July 20, 2010
    205 
    206 * greedy=true option shuts off nondeterminism warning.
    207 
    208 * code gen for AST and -profile didn't compile. had useless line:
    209 
    210              proxy.setTreeAdaptor(adap);
    211 
    212 
    213 July 17, 2010
    214 
    215 * Removed conversion timeout failsafe; no longer needed.
    216 
    217 * Stats updated to be correct for -report.
    218 
    219 June 10, 2010
    220 
    221 * added toArray in OrderedHashSet to make addAll calls get same order for DFA edges and possibly code gen in some areas.
    222 
    223 June 5, 2010
    224 
    225 * Added -Xsavelexer
    226 
    227 May 24, 2010
    228 
    229 * lexerStringRef was missing elementIndex attribute. i='import' didn't work
    230   in lexer.  Altered all target stg files.  Set in codegen.g
    231 
    232 * output=AST, rewrite=true for tree rewriters broken. nextNode for subtree
    233   streams didn't dup node, it gave whole tree back.
    234 
    235 March 17, 2010
    236 
    237 * Added MachineProbe class to make it easier to highlight ambig paths in
    238   grammar.  More accurate than DecisionProbe; retrofitted from v4.
    239 
    240 February 20, 2010
    241 
    242 * added range to TokenStream and implementors:
    243     /** How far ahead has the stream been asked to look?  The return
    244      *  value is a valid index from 0..n-1.
    245      */
    246     int range();
    247 
    248 * added new method to get subset of tokens to buffered token streams:
    249 	public List get(int start, int stop);
    250 
    251 February 15, 2010
    252 
    253 * Refs to other tokens in a lexer rule didn't get its line/charpos right.
    254   altered Java.stg.
    255 
    256 January 31, 2010
    257 
    258 * Creating token from another token didn't copy input stream in CommonToken.
    259   makes sense to copy too; i don't think anybody relies on it being null after
    260   a copy. We might want to know where token came from.
    261 
    262 January 26, 2009
    263 
    264 * TreeParser.getMissingSymbol() use CommonTree instead of using
    265   adaptor.create()
    266 
    267 December 8, 2009
    268 
    269 * Instead of sharing Token.EOF_TOKEN, I'm now creating EOF tokens so I can set the char position for better error messages.
    270 
    271 December 5, 2009
    272 
    273 * Fixed bug in TreeVisitor when rewrites altered number of children. Thanks to Chris DiGiano.
    274 
    275 * added new buffered on-demand streams: BufferedTokenStream. Renamed CommonTokenStream to LegacyCommonTokenStream and made new one as subclass of BufferedTokenStream.
    276 
    277 November 3, 2009
    278 
    279 * Added org.antlr.runtime.UnbufferedTokenStream. Was trivial and works!
    280 
    281 November 1, 2009
    282 
    283 * Couldn't properly reuse parser state; ctor reset the state; fixed.
    284 	Parser(TokenStream input, RecognizerSharedState state)
    285 
    286 * LookaheadStream<T> used some hardcoded Object return types for LT, etc...
    287   uses T now.
    288 
    289 September 23, 2009 -- ANTLR v3.2
    290 
    291 September 21, 2009 [Jim Idle]
    292 
    293 * Added new options for tool invocation to control the points at which the code
    294   generator tells the target code to use its equivalent of switch() instead of
    295   inline ifs.
    296       -Xmaxswitchcaselabels m don't generate switch() statements for dfas
    297                               bigger  than m [300]
    298       -Xminswitchalts m       don't generate switch() statements for dfas smaller
    299                               than m [3]
    300 * Upgraded -X help output to include new optins and provide the default
    301   settings, as well as provide units for those settings that need them.
    302 
    303 * Change the C Target to overide the deafults for the new settings to
    304   generate the most optimizable C code from the modern C compiler point of
    305   view. This is essentially to always use swtich statements unless there
    306   is absolutely no other option. C defaults are to use 1 for minimum and
    307   3000 for maximum number of alts that trigger switch(). This results in
    308   object code that is 30% smaller and up to 20% faster.
    309 
    310 April 23, 2009
    311 
    312 * Added reset to TreeNodeStream interface.
    313 
    314 April 22, 2009
    315 
    316 * Fixed ANTLR-374.  Was caused by moved of grammars. %foo() stuff didn't work
    317 
    318 April 9, 2009
    319 
    320 * .g and .g3 file extensions work again.
    321 * introduced bug in 3.1.3: gives exception not error msg upon
    322   missing .g file
    323 
    324 March 26, 2009
    325 
    326 * Made ctor in TreeRewriter and TreeFilter call this not super.
    327 
    328 March 21, 2009
    329 
    330 * Added ctor to RecognizerSharedState to allow cloning it.
    331 
    332 March 17, 2009 -- ANTLR v3.1.3
    333 
    334 * improved ANTLRv3.g to handle <...> element options
    335 
    336 March 15, 2009
    337 
    338 * Fixed ANTLR-389. Strip didn't ignore options in subrules; also seemed
    339   to demand stdin.
    340 
    341 March 15, 2009
    342 
    343 * ANTLR always sorts incoming grammar list by dependency.  For example,
    344   If W.g depends on tokens from P.g then P.g is done first even if
    345   W.g mentioned first on command line.  It does not ignore any files you
    346   specify the commandline.  If you do *.g and that includes some
    347   imported grammars, it will run antlr on them.
    348 
    349 * -make option prevents ANTLR from running on P.g if P older than
    350   generated files.
    351 
    352 * Added org.antlr.tool.GrammarSpelunker to build a faster dependency
    353   checker (what grammars depend on etc...).  Totally independent of any
    354   ANTLR code; easy to pull into other tools.
    355 
    356 * Added org.antlr.misc.Graph, a general graph with nodes
    357   containing an Object payload. It knows how to do a topological sort
    358   on the nodes.
    359 
    360 March 10, 2009
    361 
    362 * Added associativity token option to support upcoming special expression
    363   parsing. Added rule option strategy=precedence also
    364 
    365 March 1, 2009
    366 
    367 * Changed ANTLRWorks debug port from 49153 to 49100.  Apparently we change the port in
    368   ANTLRWorks to 49100 in 1.2 but forgot to do so in the ANTLR targets.
    369 
    370 START CHANGES FOR TREE FILTER MODE (pulled from dev branch)
    371 
    372 This feature will be announced in 3.2, but I am integrating from my development branch now into the mainline so target developers have a chance to implement. We might release 3.1.3 bug fix release before 3.2.
    373 
    374 * CommonTreeNodeStream -> BufferedTreeNodeStream.  Now,
    375   CommonTreeNodeStream is completely unbuffered unless you are
    376   backtracking.  No longer making a list of all nodes before tree parsing.
    377 
    378 * Added tree grammar filter=true mode.
    379 
    380   Altered templates:
    381 	Java.stg: added filterMode to genericParser and treeParser.
    382 	This required a change to ANTLRCore.sti
    383 	Defined a default parameter in treeParser to set the superclass
    384 	to TreeFilter for tree grammar with filter=true. It sets
    385 	superclass to TreeRewriter if filter=true and output=AST.
    386   Other them that, I only had to change ANTLR itself a little bit.
    387   Made filter mode valid for tree grammars and have it automatically set
    388   the necessary elements: @synpredgate, backtrack=true, rewrite=true
    389   (if output=AST).  Added error message for detecting conflicting
    390   options.
    391 
    392 * Added misc.FastQueue and TestFastQueue:
    393   A queue that can dequeue and get(i) in O(1) and grow arbitrarily large.
    394   A linked list is fast at dequeue but slow at get(i).  An array is
    395   the reverse.  This is O(1) for both operations.
    396 
    397 * Added tree.TreeIterator, a generator that walks a doubly linked tree.
    398   The nodes must know what index they are. It's an Iterator but
    399   remove() is not supported. Returns navigation nodes always:
    400   UP, DOWN, EOF.
    401 
    402 * Added misc.LookaheadStream: A lookahead queue that knows how
    403   to mark/release locations in the buffer for backtracking purposes.
    404   I hope to use for both tree nodes and tokens.  Just implement
    405   nextElement() to say how to get next node or token.
    406 
    407 END CHANGES FOR TREE FILTER MODE
    408 
    409 February 23, 2009 -- ANTLR v3.1.2
    410 
    411 February 18, 2009
    412 
    413 * Added org.antlr.tool.Strip (reads from file arg or stdin, emits to stdout)
    414   to strip actions from a grammar.
    415 
    416 February 4, 2009
    417 
    418 * Added CommonTree.setUnknownTokenBoundaries().  Sometimes we build trees
    419   in a grammar and some of the token boundaries are not set properly.
    420   This only matters if you want to print out the original text associated
    421   with a subtree.  Check this out rule:
    422 
    423 	postfixExpression
    424 	    :   primary ('.'^ ID)*
    425 	    ;
    426 
    427   For a.b.c, we get a '.' that does not have the token boundaries set.
    428   ANTLR only sets token boundaries for subtrees returned from a rule.
    429   SO, the overall '.' operator has the token boundaries set from 'a'
    430   to 'c' tokens, but the lower '.' subtree does not get the boundaries
    431   set (they are -1,-1).  Calling setUnknownTokenBoundaries() on
    432   the returned tree sets the boundaries appropriately according to the
    433   children's token boundaries.
    434 
    435 January 22, 2009
    436 
    437 * fixed to be listeners.add(listener); in addListener() of DebugEventHub.java
    438 
    439 January 20, 2009
    440 
    441 * Removed runtime method: mismatch in BaseRecognizer and TreeParser.  Seems
    442   to be unused.  Had to override method recoverFromMismatchedToken() in
    443   TreeParser to get rid of single token insertion and deletion for
    444   tree parsing because it makes no sense with all of the up-and-down nodes.
    445 
    446 * Changed JIRA port number from 8888 to no port spec (aka port 80) and all
    447   refs to it in this file.
    448 
    449 * Changed BaseTree to Tree typecase in getChild and toStringTree() and
    450   deleteChild() to make more generic.
    451 
    452 December 16, 2008
    453 
    454 * Added -verbose cmd-line option and turned off standard header
    455   and list of read files.  Silent now without -verbose.
    456 
    457 November 24, 2008
    458 
    459 * null-ptr protected getParent and a few others.
    460 
    461 * Added new ctor to CommonTreeNodeStream for walking subtrees.  Avoids
    462   having to make new serialized stream as it can reuse overall node stream
    463   buffer.
    464 
    465 November 20, 2008
    466 
    467 * Updated BaseTest to isolate tests better.
    468 
    469 November 17, 2008
    470 
    471 * BaseTreeAdaptor.getType() was hosed; always gave 0.  Thanks to Sam Harwell.
    472 
    473 November 8, 2008
    474 
    475 * Added methods to BaseRecognizer:
    476   public void setBacktrackingLevel(int n) { state.backtracking = n; }
    477   /** Return whether or not a backtracking attempt failed. */
    478   public boolean failed() { return state.failed; }
    479 
    480 November 5, 2008
    481 
    482 * Tweaked traceIn/Out to say "fail/succeeded"
    483 
    484 * Bug in code gen for tree grammar wildcard list label x+=.
    485 
    486 * Use of backtrack=true anywhere in grammar causes backtracking sensitive
    487   code to be generated.  Actions are gated etc...  Previously, that only
    488   happened when a syntactic predicate appeared in a DFA.  But, we need
    489   to gate actions when backtracking option is set even if no decision
    490   is generated to support filtering of trees.
    491 
    492 October 25, 2008
    493 
    494 * Fixed debug event socket protocol to allow spaces in filenames.
    495 
    496 * Added TreeVisitor and TreeVisitorAction to org.antlr.runtime.tree.
    497 
    498 October 22, 2008
    499 
    500 * Added inContext() to TreeParser.  Very useful for predicating
    501   tree grammar productions according to context (their parent list).
    502   Added new TestTreeContext unit tests (15).
    503 
    504     /** Check if current node in input has a context.  Context means sequence
    505      *  of nodes towards root of tree.  For example, you might say context
    506      *  is "MULT" which means my parent must be MULT.  "CLASS VARDEF" says
    507      *  current node must be child of a VARDEF and whose parent is a CLASS node.
    508      *  You can use "..." to mean zero-or-more nodes.  "METHOD ... VARDEF"
    509      *  means my parent is VARDEF and somewhere above that is a METHOD node.
    510      *  The first node in the context is not necessarily the root.  The context
    511      *  matcher stops matching and returns true when it runs out of context.
    512      *  There is no way to force the first node to be the root.
    513      */
    514     public boolean inContext(String context) {...}
    515 
    516 * Added 3 methods to Tree interface [BREAKS BACKWARD COMPATIBILITY]
    517 
    518     /** Is there is a node above with token type ttype? */
    519     public boolean hasAncestor(int ttype);
    520 
    521     /** Walk upwards and get first ancestor with this token type. */
    522     public Tree getAncestor(int ttype);
    523 
    524     /** Return a list of all ancestors of this node.  The first node of
    525      *  list is the root and the last is the parent of this node.
    526      */
    527     public List getAncestors();
    528 
    529 October 21, 2008
    530 
    531 * Updated unit tests to be correct for \uFFFE->\uFFFF change
    532 
    533 * Made . in tree grammar look like ^(. .*) to analysis, though ^(. foo)
    534   is illegal (can't have . at root). Wildcard is subtree or node.
    535   Fixed bugs:
    536     http://www.antlr.org/browse/ANTLR-248
    537     http://www.antlr.org/browse/ANTLR-344
    538 
    539 October 1, 2008 -- ANTLR v3.1.1
    540 
    541 September 8, 2008
    542 
    543 * Labels on tokens, rules carry into synpreds now so semantic predicates work.
    544   This didn't work since labels were stripped in the synpred and they weren't
    545   defined in the generated method.
    546 
    547   a : x=A z=a {$x.text.equals($z.text)}? A
    548     | y=A a A A
    549     ;
    550 
    551 September 3, 2008
    552 
    553 * Made a REV static variable in Tool so that we can change the rev for
    554   daily builds.
    555 
    556 * Made \uFFFF a valid character. Token types are 32-bit clean using -1
    557   not 0x0000FFFF as -1 so it should be okay.  Label.java:
    558     public static final int MIN_CHAR_VALUE = '\u0000';
    559     public static final int MAX_CHAR_VALUE = '\uFFFF';
    560 
    561 August 30, 2008
    562 
    563 * Changed messages in en.stg so that TOKEN_NONDETERMINISM correctly
    564   indicates when actions hid semantic predicates.
    565 
    566 August 15, 2008
    567 
    568 * Tweaked build properties and build.xml
    569 
    570 August 13, 2008
    571 
    572 * Fixed ANTLR-314; 3.1 introduced a problem with list labels +=
    573 
    574 August 12, 2008 -- ANTLR v3.1
    575 
    576 * Added JavaScript target
    577 
    578 August 7, 2008
    579 
    580 * an NFA target of EOF predicate transition in DFA cause an exception in
    581   getPredicatesPerNonDeterministicAlt().
    582 
    583 * Kay Roepke found a nasty bug when debugging AST-constructing
    584   composite recognizers.  If the input state was null to the constructor,
    585   super class constructor created a new parser state object.
    586   Later, though we passed the argument state not this.state
    587   to the delegate constructors, forcing them to share a different
    588   state objects!  Changed state to this.state in Dbg.stg constructors.
    589 
    590 * Ack. messed up debug/AST.  Have to set proxy's tree adaptor; it's
    591   a circular ref.  Just an ASTDbg.stg change.
    592 
    593 August 4, 2008
    594 
    595 * superClass works now for lexers
    596 
    597 * Made Grammar.defineNamedAction propogate header actions down to all
    598   delegates if root grammar; regardless of lexer/parser scope.
    599 
    600 * Rejiggered AST templates to propogate changes to tree adaptor
    601   for delegate grammars. Fixes ANTLR-302
    602 
    603 August 4, 2008
    604 
    605 * FOLLOW set computations altered constant FOLLOW bit sets.
    606 
    607 * Added (...) are all predicate evaluations.
    608 
    609 * Extra init code for tree parser nonrewrite mode removed.
    610 
    611 * Added empty child list check in becomeRoot
    612 
    613 August 3, 2008
    614 
    615 * Was using RuleReturnScope not Rulename_return for list labels in tree
    616   parser.
    617 
    618 * Didn't set _last in tree parser for rule ref track stuff (rewrite=true)
    619 
    620 August 2, 2008
    621 
    622 * Benjamin found another rewrite engine bug.
    623 
    624 July 30, 2008
    625 
    626 * CommonTreeNodeStream / CommonTokenStream did not reset properly.
    627 
    628 July 29, 2008
    629 
    630 * Fixed another bug in TokenRewriteStream; didn't like inserts after end.
    631 
    632 July 28, 2008
    633 
    634 * Fixed bug in TokenRewriteStream.toString(start,stop); it ignored
    635   parameters. ;)
    636 
    637 July 17, 2008
    638 
    639 * allow qualified type names in hetero <...> options like T<a.b.c.Node>
    640 
    641 July 5, 2008
    642 
    643 * treeLevel not set for setBlock alts; added unit test
    644 
    645 July 3, 2008
    646 
    647 * Fixed ANTLR-267. parse tree added nodes during backtracking and
    648   cyclic DFAs.  tracks hidden tokens too now. Added toInputString() to
    649   get text back including hidden tokens.  Shows <epsilon> for rules
    650   that match nothing.
    651 
    652 June 26, 2008
    653 
    654 * Added gParent ptr that points to immediate parent grammar. E.g.,
    655     // delegators
    656     public MParser gM;
    657     public M_S gS;
    658     public M_S gParent = gS; // NEW
    659 
    660 * Grammar imports didn't set all the delegate pointers...lots of imported
    661   grammars would cause a null ptr exception.  Fixes ANTLR-292.
    662 
    663 June 25, 2008
    664 
    665 * List labels in tree construction didn't always track the tree; sometimes
    666   had a rule result structure.
    667 
    668 June 4, 2008
    669 
    670 * Improved unit testing so that each test suite executes and builds grammars
    671   in a separate temporary directory. This means they can execute concurrently.
    672   Also seem to be a problem with my class path during execution. Moved
    673   tmpdir for ahead of standard CLASSPATH.
    674 
    675 * By virtue of an improvement to StringTemplate, output newlines
    676   in generated files should be normalized to whatever your host uses.
    677 
    678 June 3, 2008
    679 
    680 * Restrict legality of grammar options; for example you cannot use output option
    681   in lexer anymore.
    682 
    683 June 2, 2008
    684 
    685 * Throw illegal arg exception upon invalid TokenRewriteStream ops. Rewrote
    686   core of engine.  Slightly different operation.  Added many more unit tests.
    687 
    688 3.1b1 - May 20, 2008
    689 
    690 May 11, 2008
    691 
    692 * rewrite=true, output=AST for tree grammar was not working.  Altered trees were not
    693   propagated back up the rule reference chain.  Required a number of mods to
    694   ASTTreeParser.stg.  Added unit tests.
    695 
    696 May 10, 2008
    697 
    698 * [BACKWARD INCOMPATIBLE if you override match()]
    699   I had turned off single token insertion and deletion because I could not figure
    700   out how to work with trees and actions. Figure that out and so I turned it back on.
    701   match() returns Object matched now (parser, tree parser) so we can set labels
    702   on token refs properly after single token ins/del error recovery.  Allows actions
    703   and tree construction to proceed normally even though we recover in the middle of
    704   an alternative.  Added methods for conjuring up missing symbols: getMissingSymbol().
    705 
    706 * refactored BaseRecognizer error handling routines
    707 
    708 * Single token error recovery was not properly taking into consideration EOF.
    709 
    710 * ANTLR no longer tries to recover in tree parsers inline using single node deletion or insertion; throw exception.  Trees should be well formed as they are not created by users.
    711 
    712 * Added empty constructors to the exception classes that did not have them so that ANTLRWorks can create the exceptions.
    713 
    714 * Made debug tree adaptor deal with tokens conjured up during error recovery.
    715 
    716 * Removed extra location() debug element that was emitted.
    717 
    718 May 8, 2008
    719 
    720 * ANTLR didn't update line/col to DFA map for AW.
    721 
    722 May 6-7, 2008
    723 
    724 * Insufficiently covered (with semantic predicates) alt warnings are now emitted before
    725   nondeterminisms so it's clear the nondeterminism is a result of insufficient preds.
    726 
    727 * Improved insufficiently covered alt warnings from:
    728     warning(203): T.g:2:3: The following alternatives are insufficiently covered with predicates: 1
    729   to:
    730     warning(203): T.g:2:3: Input B is insufficiently covered with predicates at loca
    731 tions: alt 1: line 3:15, alt 2: line 2:9
    732 
    733 * Improved nondeterminism warning to have:
    734   Semantic predicates were present but were hidden by actions.
    735 parser grammar U;
    736 a : (A B)? ;
    737 b : X a {p1}? A B | Y a {a1} {p2}? A B | Z a ;
    738 
    739 To create the prediction DFA for the optional sub rule in 'a', ANTLR must find all references to 'a' to determine what can follow. A B can follow 'a' in the first two alts rule 'b'.   To resolve the conflict between matching A B immediately in the sub rule and exiting rule 'a' to match it in 'b', ANTLR looks for predicates. In this case, there are two predicates that indicate the semantic context in which the surrounding alternatives are valid. The problem is that one of the predicates is hidden by an action. It took me 1.5 days, but I've finally have gotten ANTLR to properly track the insufficiently covered alternatives. Further, I have gotten it to tell you precisely where the uncovered predicates are even if they are simply hidden by actions. I have also updated all of the nondeterminism warnings so that it tells you if there was a predicate but one hidden by an action (this could be a separate condition from insufficiently covered predicates). here are your messages from ANTLR:
    740 
    741 ANTLR Parser Generator  Version 3.1b1 (??)  1989-2007
    742 warning(203): U.g:2:5: Input such as "A B" is insufficiently covered with predicates at locations: alt 2: line 3:38 at B
    743 Semantic predicates were present but were hidden by actions.
    744 warning(200): U.g:2:5: Decision can match input such as "A B" using multiple alternatives: 1, 2
    745 As a result, alternative(s) 2 were disabled for that input
    746 Semantic predicates were present but were hidden by actions.
    747 
    748 * Fixed issue where
    749 r41
    750    : (INT -> INT) ( ('+' i=INT) -> ^($i $r41) )* ';'
    751    ;
    752 still warned about $r41 being ambig.
    753 
    754 * actions are now added to the NFA.
    755 
    756 * Fixed ANTLR-222.  ANTLR now ignores preds after actions.
    757 
    758 May 5, 2008
    759 
    760 * Fixed ANTLR-235 by backing out a change from 12-31-07.
    761 
    762 * Fixed ANTLR-249; I include semantic context again in closure busy signal.
    763 
    764 May 3, 2008
    765 
    766 * Fixed ANTLR-208.  Looks in library or in -o output path.  antlr -o foo T.g U.g where U needs T.tokens won't work unless we look in foo too.  fixed.
    767 
    768 * Refactored assign.types.g to move methods to a class called AssignTokenTypesBehavior.
    769 
    770 * Fixed ANTLR-207.  Lexers importing vocabs didn't see ';'=4 type aliases in .tokens.
    771 
    772 * Fixed ANTLR-228.  Couldn't use wildcard in alts with AST rewrites.
    773 
    774 May 2, 2008
    775 
    776 * Fixed ANTLR-230; can use \' now in action.
    777 
    778 * Scope attributes no longer have a stack depth check on front.  If you ref $r::a when r has not invoked you, then you get an exception not a default value.  Back to the way 3.0.1 worked.
    779 
    780 * $channel was a global variable in 3.0.1 unlike $type which did not affect an invoking lexer rule.  Now it's local too.  Only $type and $channel are ever set with regularity.  Setting those should not affect an invoking lexer rule as in the following should work:
    781 
    782   X : ID WS? '=' ID ;  // result is X on normal channel
    783   WS : ' '+ {$channel = HIDDEN; } ;
    784 
    785   STRING : '"' (ESC|.)* '"' ;  // result is STRING not ESC
    786 
    787   FLOAT : INT '.' INT? ; // should be FLOAT
    788   INT : Digit+ ;
    789   fragment
    790   Digit : '0'..'9' ;
    791 
    792 * Fixed bug in interpreter regarding (...)* loops
    793 
    794 May 1, 2008
    795 
    796 * Fixed ANTLR-202.  These now give warnings about ambig ref to $a.
    797     a : ID a -> $a | INT ;
    798   and
    799     a : A a {$a.text} | B ;
    800 
    801 April 30, 2008
    802 
    803 * Fixed ANTLR-237. updated -depend to know about imported grammars.
    804 $ java org.antlr.Tool -depend -lib foo T.g
    805   ANTLR Parser Generator  Version 3.1b1 (??)  1989-2007
    806   T.g: foo/Java.g
    807   TParser.java : T.g
    808   T.tokens : T.g
    809   TLexer.java : T.g
    810   T_Java : T.g
    811 
    812 April 29, 2008
    813 
    814 * Fixed ANTLR-217; scope A,B,C; didn't work
    815 
    816 * Fixed ANTLR-224; ! or ^ on item in alt with rewrite gave exception
    817 
    818 * Added token options to terminals: ID<node=V; foo="Big bob"> etc...
    819   node is default so you can do ID<V> for hetero tree types. most common.
    820 
    821 April 17, 2008
    822 
    823 * Use default msg if unknown recog type in getErrorMessage():
    824 	String msg = e.getMessage();
    825 
    826 April 14, 2008
    827 
    828 * %x.y = foo; was not working in @members section
    829 
    830 March 29, 2008
    831 
    832 * Import couldn't handle A imports B imports C.
    833 
    834 March 27, 2008
    835 
    836 * Added get/setInputStream to Token interface and affected classes.
    837 
    838 February 26, 2008
    839 
    840 * made fillBuffer public in CommonTreeNodeStream so we can add trees
    841   to stream for interactive interpreters.
    842 
    843 February 14, 2008
    844 
    845 * Fixed a bug in the code generation where tree level 0 was used
    846   no matter what to rewrite trees in tree grammars. added unit test
    847 
    848 * Fixed ANTLR-221. exceptions were generated when using
    849   AST construction operators and no output=AST option.
    850 
    851 February 13, 2008
    852 
    853 * Improved error msgs for unreachable alts and tokens.
    854 
    855 February 11-12, 2008
    856 
    857 * Fixed ANTLR-219.
    858   It looks like the AST construction code for sets was totally messed up.
    859   This was for not only the new tree parser AST construction, but also
    860   the regular tree construction for parsers. I had to introduce templates
    861   in the ASTTreeParser.stg file to deal with this. added unit tests:
    862   TestTreeGrammarRewriteAST.testSetMatchNoRewrite(),
    863   testSetMatchNoRewriteLevel2(), testSetMatchNoRewriteLevel2Root().
    864   Had to add template matchRuleBlockSet()
    865   to differentiate between a regular set in one that is an entire rule.
    866   If it is an entire rule, it has to set the return value, retval.tree.
    867 
    868 * Fixed ANTLR-220.
    869   Made TreeAdaptor dupNode and dupTree events emit debugging events
    870   so AW could see tree node duplications.
    871 
    872 February 4, 2008
    873 
    874 * BACKWARD INCOMPATIBILITY
    875   Added getSourceName to IntStream and TokenSource interfaces and also the
    876   BaseRecognizer.  Have to know where char come from for error messages.
    877   Widespread change, but a trivial one.
    878 
    879 January 17, 2008
    880 
    881 * Interpreter throws FailedPredicateException now when it sees a predicate;
    882   before it was silently failing.  I'll make it work one of these days. ;)
    883 
    884 January 12, 2008
    885 
    886 * Copy ctor not copying start and stop for common token. Fixes ANTLR-212
    887 
    888 * Removed single token insertion and deletion for tokens, sets.
    889   Required a change to the code generation for matchSet() template
    890   and a tweak inside the BaseRecognizer.  To engage this again is easy,
    891   just override mismatch() to call mismatchRecover(). I changed it to simply
    892   throw an exception.
    893 
    894 * Added syntaxError recognizer state var so you can easily tell if
    895   a recognizer failed.  Added getNumberOfSyntaxErrors() to recognizers.
    896 
    897 * Added doc for the error node stuff:
    898   http://www.antlr.org/wiki/display/ANTLR3/Tree+construction
    899 
    900 * Fixed ANTLR-193
    901 
    902 * Added recognizer methods to answer questions about current mismatched
    903   token error.  Useful now since i don't automatically recover inline
    904   to such errors (I throw exception):
    905 	mismatchIsUnwantedToken(IntStream input, int ttype)
    906 	mismatchIsMissingToken(IntStream input, BitSet follow)
    907 
    908 * Added UnwantedTokenException and MissingTokenException to make
    909   match() problems more precise in case you want to catch differently.
    910   Updated getErrorMessage() to be more precise.  Says:
    911 
    912 	line 2:9 missing EQ at '0'
    913 
    914   now instead of
    915 
    916 	line 2:9 mismatched input '0' expecting EQ
    917 
    918   Input "x=9 9;" gives
    919 
    920 	line 3:8 extraneous input '9' expecting ';'
    921 
    922   When very confused, "x=9 for;", you still get old mismatched message:
    923 
    924 	line 3:8 extraneous input 'for' expecting ';'
    925 	line 3:11 mismatched input ';' expecting '('
    926 
    927 * Added unit tests to TestAutoAST and copied to TestRewriteAST with
    928   suitable rewrites to ensure basic error node insertion works.
    929 
    930 January 11, 2008
    931 
    932 * Adding errorNode to TreeAdaptor and various debug
    933   events/listeners.  Had to add new class runtime.tree.CommonErrorNode
    934   to hold all the goodies: input stream, start/stop objects.
    935 
    936 * Tweaked CommonTree.getType() to return INVALID_TOKEN_TYPE
    937   instead of literal 0 (same thing at moment though).
    938 
    939 * Updated ANTLRWorks to show error nodes in tree as much as I could; Jean
    940   will get to rest of it.
    941 
    942 January 9-10, 2008
    943 
    944 * Continued work on debugging/profiling composite grammars.
    945 
    946 * Updated debug protocol for debugging composite grammars.  enter/exit
    947   rule needs grammar to know when to flip display in AW.
    948 
    949 * Fixed ANTLR-209.  ANTLR consumed 2 not 1 char to recover in lexer.
    950 
    951 * Added two faqs instead of making changes to antlr runtime about
    952   lexer error handling:
    953   http://www.antlr.org/wiki/pages/viewpage.action?pageId=5341230
    954   http://www.antlr.org/wiki/pages/viewpage.action?pageId=5341217
    955 
    956 January 1-8, 2008
    957 
    958 * Making debugging/profiling work with composite grammars.
    959 
    960 * Updated ANTLRWorks so it works still for noncomposite grammars.
    961 
    962 * two new examples: import and composite-java (the java example grammar
    963   broken up into multiple pieces using import).
    964 
    965 * Worked on composite grammars.  Had to refactor a lot of code to make
    966   ANTLR deal with one meta grammar made up of multiple grammars.  I
    967   thought I had it sort of working back in August.  Yes, but barely. Lots
    968   of work to do it seemed.  Lots of clean up work.  Many new unit tests
    969   in TestCompositeGrammars.  Had to add new error messages warning about
    970   conflicting tokens inherited from multiple grammars etc...
    971 
    972     TOKEN_ALIAS_CONFLICT(arg,arg2) ::=
    973       "cannot alias <arg>; string already assigned to <arg2>"
    974     TOKEN_ALIAS_REASSIGNMENT(arg,arg2) ::=
    975       "cannot alias <arg>; token name already assigned to <arg2>"
    976     TOKEN_VOCAB_IN_DELEGATE(arg,arg2) ::=
    977       "tokenVocab option ignored in imported grammar <arg>"
    978     INVALID_IMPORT(arg,arg2) ::=
    979       "<arg.grammarTypeString> grammar <arg.name> cannot import <arg2.grammarTypeString> grammar <arg2.name>"
    980     IMPORTED_TOKENS_RULE_EMPTY(arg,arg2) ::=
    981       "no lexer rules contributed to <arg> from imported grammar <arg2>"
    982     IMPORT_NAME_CLASH(arg,arg2) ::=
    983       "combined grammar <arg.name> and imported <arg2.grammarTypeString> grammar <arg2.name> both generate <arg2.recognizerName>; import ignored"
    984 
    985   This stuff got really really complicated.  Syntactic predicate names even
    986   had to be scoped per grammar so they don't conflict.
    987 
    988 * When using subrules like (atom->atom) to set result tree, it was not
    989   properly setting result (early enough).  Future code got null for
    990   $rule.tree.
    991 
    992 December 31, 2007
    993 
    994 * Added the start of a semantic predicate computation for LL(1) to
    995   solve a problem with slow grammar analysis even with k=1 due to
    996   predicates.  Then I realized the problem with that grammar was
    997   elsewhere.  Semantic context really shouldn't be used when
    998   preventing closure recomputation (May 2008 I discovered I was
    999   wrong--you do need it).  The predicates became huge even though the
   1000   reduced value would be no different.  The analyzer seems faster now
   1001   that I am not testing predicate values all the time.  Further it may
   1002   terminate sooner just due to reduced closure recursion.
   1003 
   1004 * Moved FIRST/FOLLOW computations to a separate class LL1Analyzer to
   1005   tidy up.
   1006 
   1007 * ANTLR lexer allowed octal escapes, but they didn't work. ;)  Rather than
   1008   fix, I'm removing.  Use '\uxxxx' to get even 8 bit char values: \u00xx.
   1009 
   1010 December 29, 2007
   1011 
   1012 * Fixed ANTLR-206. I wasn't avoiding analyzing decisions in
   1013   left-recursive rules.
   1014 
   1015 * Had to add hetero arg to all tokenRef*() templates.  Added _last
   1016   local var to track last child so we can do replaceChildren() during
   1017   AST rewrite mode for tree grammars.  Should be useful later for .text
   1018   property.  Ack, hetero arg is on lots of templates. :(  Moved
   1019   ruleCleanUp() template into ASTTreeParser and ASTParser groups.
   1020 
   1021 * added noRewrite() template (to Java.stg) so we can insert code during
   1022   rewrite mode to return original tree if no rewrite.  Might be useful
   1023   for token rewrites later.  For templates too?
   1024 
   1025 * Had to add if !rewriteMode around tree construction in tree parser
   1026   templates.
   1027 
   1028 * Harald Muller pointed out that we need to use <initValue(attr.type)>
   1029   in our tests for null token/rule property references. For int types
   1030   we need 0 not null. (p!=null?p.line:0).  Changed scopeAttributeRef,
   1031   ruleLabelRef.  Also changed the known typed attributes like
   1032   lexerRuleLabelPropertyRef_line to yield 0 upon null rule ref to
   1033   be consistent with case when we don't know the type.  Fixes ANTLR-195.
   1034   Added testTypeOfGuardedAttributeRefIsCorrect test and reset expected
   1035   output for 13 tests that now "fail".
   1036 
   1037 December 28, 2007
   1038 
   1039 * added polydiff example (Java target)
   1040 
   1041 * added "int" property for token and lexer rule refs.  super convenient. E.g.,
   1042   a : b=INT {int x = $b.int;} ;
   1043 
   1044 December 27, 2007
   1045 
   1046 * Changed -Xnoinlinedfa to -Xmaxinlinedfastates m where m is
   1047   maximum number of states a DFA can have before ANTLR avoids
   1048   inlining it.  Instead, you get a table-based DFA.  This
   1049   affectively avoids some acyclic DFA that still have many states
   1050   with multiple incident edges.  The combinatorial explosion smacks
   1051   of infinite loop.  Fixes ANTLR-130.
   1052 
   1053 * [...] are allowed in args now but ] must be escaped as \]. E.g.,
   1054   a[String[\] ick, int i] : ... ;
   1055   And calling a rule: foo[x[i\], 34]
   1056   Fixes ANTLR-140.
   1057 
   1058 * Fixed ANTLR-105.  Target.getTargetStringLiteralFromANTLRStringLiteral()
   1059   escaped " that were already escaped.
   1060 
   1061 * target's can now specify how to encode int as char escape.  Moved
   1062   DFA.encodeIntAsCharEscape to Target.
   1063 
   1064 * Bug in runtime.DFA.  If a special state (one with predicate) failed, it
   1065   tried to continue (causing out of range exception due to state = -1)
   1066   instead of reporting error.
   1067 
   1068 * If -dfa with combined grammar T.g, builds T.dec-*.dot and TLexer.dec-*.dot
   1069 
   1070 * Fix ANTLR-165.
   1071   Generate TParser.java and TLexer.java from T.g if combined, else
   1072   use T.java as output regardless of type.
   1073   BACKWARD INCOMPATIBILITY since file names change.
   1074   I changed the examples-v3/java to be consistent.  Required XML.g ->
   1075   XMLLexer.java and fuzzy/Main.java change.
   1076 
   1077 * Fix ANTLR-169.  Deletes tmp lexer grammar file.
   1078 
   1079 December 25, 2007
   1080 
   1081 * Fixed ANTLR-111.  More unit tests in TestAttributes.
   1082 
   1083 December 25, 2007
   1084 
   1085 * Dangling states ("decision cannot distinguish between alternatives
   1086   for at least one input sequence") is now an error not a warning.
   1087 
   1088 * Added sample input sequence that leads to dangling DFA state, one
   1089   that cannot reach an accept state.  ANTLR ran into a case where
   1090   the same input sequence reaches multiple locations in the NFA
   1091   (and so not nondeterministic), but analysis ran out of further
   1092   NFA states to look for more input.  Commonly at EOF target states.
   1093   Now says:
   1094 
   1095   error(202): CS.g:248:95: the decision cannot distinguish between alternative(s) 1,2 for input such as "DOT IDENTIFIER EOF"
   1096 
   1097   Also fixed bug where dangling states did not resolve to stop states.
   1098 
   1099 * Fixed ANTLR-123
   1100 
   1101 December 17-21, 2007
   1102 
   1103 * k=1 doesn't prevent backtracking anymore as in
   1104   (options {k=1;}:'else' statement)?
   1105   if backtrack=true for overall grammar.  Set to false in subrule.
   1106 
   1107 * Optimized the analysis engine for LL(1).  Doesn't attempt LL(*) unless
   1108   LL(1) fails.  If not LL(1) but autobacktracking but no other kind of
   1109   predicate, it also avoids LL(*).  This is only important for really
   1110   big 4000 line grammars etc...
   1111 
   1112 * Lots of code clean up
   1113 
   1114 December 16, 2007
   1115 
   1116 * Yet more Kay pair programming.  Saved yet more RAM; 15% by
   1117   wacking NFA configurations etc in each DFA state after DFA construction.
   1118 
   1119 * Overall we drop from 2m49s to 1m11s for a huge 4000 line TSQL grammar
   1120   with k=*.  Only needs -Xconversiontimeout 2000 now not
   1121   -Xconversiontimeout 5000 too.  With k=1, it's 1m30s down to 40s.
   1122 
   1123 December 15, 2007
   1124 
   1125 * Working with Kay Roepke, we got about 15% speed improvement in
   1126   overall ANTLR exec time.  Memory footprint seems to be about 50%
   1127   smaller.
   1128 
   1129 December 13-14, 2007
   1130 
   1131 * I abort entire DFA construction now when I see recursion in > 1 alt.
   1132   Decision is non-LL(*) even if some pieces are LL(*).  Safer to bail
   1133   out and try with fixed k.  If user set fixed k then it continues because
   1134   analysis will eventually terminate for sure.  If a pred is encountered
   1135   and k=* and it's non-LL(*), it aborts and retries at k=1 but does NOT
   1136   emit an error.
   1137 
   1138 * Decided that recursion overflow while computing a lookahead DFA is
   1139   serious enough that I should bail out of entire DFA computation.
   1140   Previously analysis tried to keep going and made the rules about
   1141   how analysis worked more complicated.  Better to simply abort when
   1142   decision can't be computed with current max stack (-Xm option).
   1143   User can adjust or add predicate etc...  This is now an error
   1144   not a warning.
   1145 
   1146 * Recursion overflow and unreachable alt is now a fatal error; no code gen.
   1147   The decision will literally not work.
   1148 
   1149 * Cleaned up how DFA construction/analysis aborts due to non-LL(*) and
   1150   overflow etc...  Throws exceptions now, which cleans up a bunch of IF
   1151   checks etc...  Very nice now. Exceptions:
   1152 	analysis/AnalysisRecursionOverflowException.java
   1153 	analysis/AnalysisTimeoutException.java
   1154 	analysis/NonLLStarDecisionException.java
   1155 
   1156 * ErrorManager.grammarWarning() counted them as errors not warnings.
   1157 
   1158 * Unreachable alt warnings are now errors.
   1159 
   1160 * The upshot of these changes is that I fixed ANTLR-178 and did
   1161   lots of refactoring of code handling analysis failure.
   1162 
   1163 December 11, 2007
   1164 
   1165 * Could not deal with spaces, oddly enough in arg lists:
   1166 	grammar Bad;
   1167 	a : A b["foo", $A.text] ;
   1168 	b[String x, String y] : C ;
   1169 
   1170 October 28, 2007
   1171 
   1172 * Made ANTLR emit a better error message when it cannot write the
   1173   implicit lexer file from a combined grammar. Used to say "cannot open
   1174   file", now says "cannot write file" and gives backtrace.
   1175 
   1176 September 15, 2007
   1177 
   1178 add getCharStream to Lexer.
   1179 
   1180 September 10, 2007
   1181 
   1182 * Added {{...}} forced action executed even during backtracking.
   1183 
   1184 September 9, 2007
   1185 
   1186 * r='string' in lexer got a duplicate label definition.
   1187 
   1188 August 21, 2007
   1189 
   1190 * $scope::variable refs now check for empty stack so that expr == null if
   1191   $scope has an empty stack. Works for $scope[...]::variable too.  Nice!
   1192 
   1193 August 20, 2007
   1194 
   1195 * Added reset() to CommonTreeNodeStream, token stream too
   1196 
   1197 * Made refs to rule/token properties use ?: to avoid null ptr exception.
   1198   $label.st now is label!=null?label.st:null.  Updated TestAttributes.
   1199   This is useful not only for optional rule/token refs, but also during
   1200   error recovery.  If ID is not matched, $ID.text won't cause a null ptr.
   1201 
   1202 August 20, 2007
   1203 *	Fixed ANTLR-177: hashCode/equals not consistent for label
   1204 	Fixed bug where Rule was compared to string; introduced from dev branch
   1205 
   1206 August 15, 2007 -- Got rough draft of the grammar import working.
   1207                    Submit to dev and then integrate into mainline.
   1208 
   1209 	All file changes/additions:
   1210 
   1211 	README.txt	# edit
   1212 	CHANGES.txt	# add
   1213 	  Factored out the changes from the readme.
   1214 
   1215 	runtime/Java/src/org/antlr/runtime/BaseRecognizer.java	# edit
   1216 	runtime/Java/src/org/antlr/runtime/DFA.java	# edit
   1217 	runtime/Java/src/org/antlr/runtime/Lexer.java	# edit
   1218 	runtime/Java/src/org/antlr/runtime/Parser.java	# edit
   1219 	runtime/Java/src/org/antlr/runtime/debug/DebugParser.java	# edit
   1220 	runtime/Java/src/org/antlr/runtime/tree/TreeParser.java	# edit
   1221 	  Factored state fields into RecognizerSharedState
   1222 	  object. You will see a lot of things like
   1223             state.errorRecovery = false;
   1224 	runtime/Java/src/org/antlr/runtime/RecognizerSharedState.java	# add
   1225           Shares all recognizer state variables including lexer even though
   1226 	  these are superfluous to parsers and tree parsers.  There
   1227 	  was a casting issue that I could not resolve.
   1228 
   1229 	src/org/antlr/Tool.java	# edit
   1230 	  Broke a part Grammar.setGrammarContent() into
   1231 	  parseAndBuildAST() and analyzeGrammar() to make the grammar
   1232 	  import work. I needed to be able to look at the trees for
   1233 	  imported grammars before analyzing them and building DFA. Added
   1234 	  use of the CompositeGrammar object and handling of multiple
   1235 	  delegate grammars. Changed decision DFA DOT file names to
   1236 	  include the grammar name.
   1237 
   1238 	src/org/antlr/analysis/DFA.java	# edit
   1239 	  Just tweaked to use generics, updated a comment.
   1240 
   1241 	src/org/antlr/analysis/DecisionProbe.java	# edit
   1242 	  Just tweaked to use generics.
   1243 
   1244 	src/org/antlr/analysis/NFA.java	# edit
   1245 	  NFA now span multiple grammars and so I moved the NFAs state
   1246 	  tracking to the composite grammar object.
   1247 
   1248 	src/org/antlr/analysis/NFAState.java	# edit
   1249 	  Added some null checking and made a field public.
   1250 
   1251 	src/org/antlr/analysis/NFAToDFAConverter.java	# edit
   1252 	  Changed a method call to directly access a field.
   1253 
   1254 	src/org/antlr/analysis/RuleClosureTransition.java	# edit
   1255 	  Instead of using a rule index, which does not span multiple
   1256 	  grammars, the transition object now attracts a pointer to
   1257 	  the actual Rule definition object.
   1258 
   1259 	src/org/antlr/analysis/SemanticContext.java	# edit
   1260 	  Tweaked to use a field instead of a method
   1261 
   1262 	src/org/antlr/codegen/ActionTranslator.g	# edit
   1263 	src/org/antlr/codegen/ActionTranslatorLexer.java	# edit
   1264 	  Tweaked to use new runtime and they changed method name.
   1265 
   1266 	src/org/antlr/codegen/CodeGenerator.java	# edit
   1267 	  Tweaked comments.
   1268 
   1269 	src/org/antlr/codegen/codegen.g	# edit
   1270 	  Added import grammar syntax and altered rule atom to pass a
   1271 	  scope around so that grammar.rule works.  Caution this
   1272 	  feature is used internally by ANTLR and is not meant to be
   1273 	  used by users at this point.
   1274 
   1275 	src/org/antlr/codegen/templates/ANTLRCore.sti	# edit
   1276 	  Added scope to all ruleref template interfaces.
   1277 
   1278 	src/org/antlr/codegen/templates/Java/Java.stg	# edit
   1279 	  Grammars can now import other grammars, which I implemented
   1280 	  using a delegation pointer to the other grammar(s). So if
   1281 	  grammar A imports grammars B and C, then the generated
   1282 	  recognizer for A must have delegation pointers to BParser
   1283 	  and CParser objects. These are now fields:
   1284 
   1285 	    // delegates
   1286 	    <grammar.delegates:
   1287 	     {g|public <g.name>Lexer <g:delegateName()>;}; separator="\n">
   1288 
   1289           Also, B and C must have back pointers to the delegator so
   1290           that they can refer to rules that have been overridden.
   1291           This is a mechanism akin to static inheritance:
   1292 
   1293 	    // delegators
   1294 	    <grammar.delegators:
   1295 	     {g|public <g.name>Lexer <g:delegateName()>;}; separator="\n">
   1296 
   1297 	  This file also has a lot of changes so that state variables
   1298 	  now are state.backtracking instead of the implied
   1299 	  this.backtracking.
   1300 
   1301 	  The file also refers to grammar.delegatedRules attribute
   1302 	  which is the list of Rule objects for which you must
   1303 	  generate manual delegation.  This amounts to a stub whereby
   1304 	  rule foo's method foo() simply calls X.foo() if foo is not
   1305 	  defined inside the delegator.
   1306 
   1307 	  You will notice that the ruleref templates now take a scope
   1308 	  so that I can have implicit rule Tokens referred to
   1309 	  delegate.Tokens rule in a delegate grammar.  This is the way
   1310 	  I do lexer grammar imports.
   1311 
   1312 	  I added a template called delegateName which uses the
   1313 	  grammar name to compute a delegate name if the user does not
   1314 	  specify a label in the import statement such as:
   1315 
   1316 	  import x=X;
   1317 
   1318 	  Oh, note that rule reference templates all receive a Rule
   1319 	  object now instead of the simple rule name as the 'rule'
   1320 	  attribute.  You will see me doing <rule.name> instead of
   1321 	  <name> now.
   1322 
   1323 	src/org/antlr/codegen/templates/Java/Dbg.stg	# edit
   1324 	  Changes mirroring the constructor and field stuff from
   1325 	  Java.stg. Part of this is a cut and paste because of a bug
   1326 	  in ST.
   1327 
   1328 	src/org/antlr/codegen/templates/Java/AST.stg	# edit
   1329 	src/org/antlr/codegen/templates/Java/ASTParser.stg	# edit
   1330 	src/org/antlr/codegen/templates/Java/ASTTreeParser.stg	# edit
   1331 	  Just added the scope attribute.
   1332 
   1333 	src/org/antlr/test/BaseTest.java	# edit
   1334 	  Added functionality to support testing composite grammars.
   1335 	    execLexer()
   1336 
   1337 	src/org/antlr/test/TestAttributes.java	# edit
   1338 	  Tweak to deal with shared recognizer state.
   1339 
   1340 	src/org/antlr/test/TestCompositeGrammars.java	# add
   1341 	  Start of my unit tests.
   1342 
   1343 	src/org/antlr/tool/CompositeGrammar.java	# add
   1344 	src/org/antlr/tool/CompositeGrammarTree.java	# add
   1345 	  Tracks main grammar and all delegate grammars. Tracks unique
   1346 	  NFA state numbers and unique token types. This keeps a tree
   1347 	  of grammars computed from the import/delegation chain. When
   1348 	  you want to look up a rule, it starts at the root of the
   1349 	  tree and does a pre-order search to find the rule.
   1350 
   1351 	src/org/antlr/tool/ActionAnalysis.g	# edit
   1352 	src/org/antlr/tool/ActionAnalysisLexer.java	# edit
   1353 
   1354 	src/org/antlr/tool/AttributeScope.java	# edit
   1355 	  Updated to use generics in one place.
   1356 
   1357 	src/org/antlr/tool/DOTGenerator.java	# edit
   1358 	  Updated to indicate when nonlocal rules are referenced.
   1359 
   1360 	src/org/antlr/tool/ErrorManager.java	# edit
   1361 	  Added some error messages for import grammars; I need more.
   1362 
   1363 	src/org/antlr/tool/FASerializer.java	# edit
   1364 	  Tweaked to use a field not method.
   1365 
   1366 	src/org/antlr/tool/Grammar.java	# edit
   1367 	  This is where most of the meat is for the grammar import
   1368 	  stuff as you can imagine.  I factored out the token type
   1369 	  tracking into the CompositeGrammar object. I added code to
   1370 	  the addArtificialMatchTokensRule method so that it includes
   1371 	  references to all delegate lexer Tokens rules. Altered the
   1372 	  rule lookup stuff so that it knows about delegate grammars.
   1373 
   1374 	src/org/antlr/tool/GrammarAST.java	# edit
   1375 	src/org/antlr/tool/GrammarAnalysisAbortedMessage.java	# edit
   1376 	src/org/antlr/tool/GrammarReport.java	# edit
   1377 	src/org/antlr/tool/NonRegularDecisionMessage.java	# edit
   1378 	  Made enclosing rule visible as field.
   1379 
   1380 	src/org/antlr/tool/GrammarSanity.java	# edit
   1381 	  General cleanup and addition of generics.
   1382 
   1383 	src/org/antlr/tool/Interpreter.java	# edit
   1384 	  Reference fields instead of methods.
   1385 
   1386 	src/org/antlr/tool/NFAFactory.java	# edit
   1387 	  General cleanup and use of Rule object instead of rule
   1388 	  index.
   1389 
   1390 	src/org/antlr/tool/NameSpaceChecker.java	# edit
   1391 	  A little bit of cleanup and changes to use either the local
   1392 	  or globally visible rule. Added code to check that scopes
   1393 	  are valid on scoped rule references. again this is an
   1394 	  internal feature, not to be used by users.
   1395 
   1396 	src/org/antlr/tool/RandomPhrase.java	# edit
   1397 	  Tweaked.
   1398 
   1399 	src/org/antlr/tool/Rule.java	# edit
   1400 	  Added field imported. Removed some unused methods by
   1401 	  commenting them out. Made toString() more expressive.
   1402 
   1403 	src/org/antlr/tool/antlr.g	# edit
   1404 	src/org/antlr/tool/antlr.print.g	# edit
   1405 	src/org/antlr/tool/assign.types.g	# edit
   1406 	src/org/antlr/tool/buildnfa.g	# edit
   1407 	src/org/antlr/tool/define.g	# edit
   1408 	  Added syntax for import statement.  assign.types.g is the
   1409 	  grammar that invokes Grammar.importGrammar().
   1410 
   1411 	src/org/antlr/tool/templates/messages/languages/en.stg	# edit
   1412 	  Added error messages.
   1413 
   1414 	Added
   1415 
   1416 	CHANGES.txt
   1417 	runtime/Java/src/org/antlr/runtime/RecognizerSharedState.java
   1418 	src/org/antlr/test/TestCompositeGrammars.java
   1419 	src/org/antlr/tool/CompositeGrammar.java
   1420 	src/org/antlr/tool/CompositeGrammarTree.java
   1421 
   1422 3.0.1 - August 13, 2007
   1423 
   1424 [See target pages on the wiki for more information on the non-Java targets]
   1425 
   1426 August 7, 2007
   1427 
   1428 * added escaping of double quotes in DOTTreeGenerator
   1429 
   1430 July 22, 2007
   1431 
   1432 * fixed dynamic scope implementation in lexers. They were not creating new scope
   1433   entries on the stack.  Unsupported feature!
   1434 
   1435 July 30, 2007
   1436 
   1437 * float return values were initalized to 0.0 not 0.0f in java.
   1438 
   1439 July 28, 2007
   1440 
   1441 * Sam Ellis points out an init var bug in ANTLRReaderStream.
   1442 
   1443 July 27, 2007 (done in dev branch)
   1444 
   1445 * Moved token type index stuff from CommonTreeNodeStream to TreeWizard
   1446 
   1447 * Added getChildren to BaseTree.
   1448 
   1449 * Added heterogeneous tree functionality; rewrite for parser/tree parser
   1450   and auto AST constr. for parser.
   1451 
   1452 	org/antlr/runtime/tree/RewriteRuleElementStream.java
   1453 	org/antlr/runtime/tree/RewriteRuleNodeStream.java
   1454 	org/antlr/runtime/tree/RewriteRuleTokenStream.java
   1455 		Renamed method next() and re-factor things to have more
   1456 		specific methods: nextToken, nextNode, nextTree.
   1457 
   1458 	codegen/codegen.g
   1459 		Updated to include new <NodeType> AST structure for
   1460 		token references.  Pushed hereto attribute into
   1461 		all tokenRef* templates.
   1462 	codegen/templates/Java/AST.stg
   1463 		Factored out a few templates:
   1464 			createImaginaryNode(tokenType,hetero,args)
   1465 			createRewriteNodeFromElement(token,hetero,args)
   1466 		Converted a lot of stream next() calls to more specific
   1467 			nextToken, nextNode, nextTree per above.
   1468 	codegen/templates/Java/ASTParser.stg
   1469 		Added createNodeFromToken template and re-factored creation
   1470 		sites to use that template.  Added hetero attribute.
   1471 	codegen/templates/Java/ASTTreeParser.stg
   1472 		Added createRewriteNodeFromElement template and re-factored.
   1473 
   1474 	test/TestHeteroAST.java
   1475 		New file. Unit tests to test new hetero tree construction.
   1476 	test/TestRewriteAST.java
   1477 		Fixed test.  Nil single-node trees no longer return nil;
   1478 		They return null.
   1479 
   1480 	tool/ErrorManager.java
   1481 	tool/templates/messages/languages/en.stg
   1482 		Added error message:
   1483 		HETERO_ILLEGAL_IN_REWRITE_ALT(arg) ::=
   1484 		  "alts with rewrites can't use heterogeneous types left of ->"
   1485 
   1486 	tool/antlr.g
   1487 	tool/antlr.print.g
   1488 	tool/assign.types.g
   1489 	tool/buildnfa.g
   1490 	tool/define.g
   1491 		Added syntax for <NodeType> to token references.
   1492 		Altered AST structure rippled through different phases.
   1493 
   1494 July 24, 2007
   1495 
   1496 * Deleted DoubleLinkTree.java; CommonTree does that now.
   1497 
   1498 July 23, 2007
   1499 
   1500 * template group outputFile; changed rewrite arg to rewriteMode.
   1501 
   1502 * added rewrite mode for tree parser build AST.
   1503 
   1504 July 22, 2007
   1505 
   1506 * Kay fixed dynamic scope implementation in lexers. They were not
   1507   creating new scope entries on the stack.  This is an UNSUPPORTED feature.
   1508 
   1509 * added getParent and getChildIndex to TreeAdaptor.  Added
   1510   implementation to CommonTree.  It's just too useful having those
   1511   parent and child indexes available for rewriting etc...  I tried 2x
   1512   to make an implementation of tree rewriting w/o this and the
   1513   constraints just made it too expensive and complicated.  Have to
   1514   update adaptors to set parent, child index values.  Updated Tree
   1515   interface and BaseTree also.  Should only affect target developers
   1516   not users.  Well, unless they impl Tree.
   1517 
   1518 * dupNode (via ctor) of CommonTree didn't copy start/stop token indexes.
   1519 
   1520 TARGET DEVELOPERS WARNING -- AST.stg split with some functionality
   1521                              going into ASTParser.stg then I added
   1522                              ASTTreeParser.stg.  CodeGenerator
   1523                              assumes new subgroups exist.
   1524 
   1525 July 20, 2007
   1526 
   1527 * Added AST construction for tree parsers including -> rewrite rules.
   1528   Rewrite mode (rewrite=true) alters the tree in place rather than
   1529   constructing a whole new tree.  Implementation notes:
   1530 
   1531   org/antlr/runtime/tree/Tree.java
   1532 	Add methods for parent and child index functionality.
   1533 	Also added freshenParentAndChildIndexes() which you can use
   1534 	to ensure that all double linking is set up right after you
   1535 	manipulate the tree manually.  The setChild preteens etc. do
   1536 	the proper thing so you shouldn't need this.
   1537 	Added replaceChildren() to support tree rewrite mode in tree parsers
   1538   org/antlr/runtime/tree/BaseTree.java
   1539 	Updated to set parent and child index stuff.  Added replaceChildren
   1540 	method etc...  It still only has a list of children as sole field
   1541      	but calls methods that subclasses can choose to implement such as
   1542 	CommonTree.
   1543   org/antlr/runtime/tree/CommonTree.java
   1544 	Added parent and childIndex fields to doubly link.
   1545   org/antlr/runtime/tree/TreeAdaptor.java
   1546 	Added methods for new parent and child index functionality.
   1547 	Also added method for rewrite mode in tree parsers:
   1548 	replaceChildren(Object parent, int startChildIndex,
   1549                         int stopChildIndex, Object t);
   1550 	Added setChild and deleteChild methods
   1551   org/antlr/runtime/tree/BaseTreeAdaptor.java
   1552 	Moved dupTree here from BaseTree.
   1553 	Updated rulePostProcessing to deal with parent and child index.
   1554 	Added setChild and deleteChild implementations
   1555   org/antlr/runtime/tree/CommonTreeAdaptor.java
   1556 	Added methods to deal with the parent and child index for a node.
   1557 
   1558   org/antlr/runtime/tree/CommonTreeNodeStream.java
   1559 	Removed token type index and method fillReverseIndex etc...
   1560 	Probably will move into the tree wizard in the future.
   1561 	Changed call/seek stack implementation to use IntArray
   1562 	Added replaceChildren interface.
   1563   org/antlr/runtime/tree/TreeNodeStream.java
   1564 	Added replaceChildren.
   1565   org/antlr/runtime/tree/UnBufferedTreeNodeStream.java
   1566 	Added replaceChildren method but no implementation
   1567 
   1568   codegen/templates/ANTLRCore.sti
   1569 	Changed rewrite to a better name: rewriteMode
   1570 	Added tree level argument to alt, tree so that auto AST
   1571         construction can occur while recognizing in tree parsers.
   1572 
   1573   codegen/templates/Java/AST.stg
   1574 	Split template group: added two subclasses to handle different
   1575 	functionality for normal parsing and tree parsing + AST
   1576 	construction.  Tree parsers default behavior is to dup tree
   1577 	not construct another.  Added ASTParser.stg and
   1578 	ASTTreeParser.stg to handle auto AST construction during
   1579 	recognition for the two different parser types.  I just copied
   1580 	the token, rule, set, wildcard templates to the subclasses.
   1581 	The rewrite templates are still in AST.stg. I factored out the
   1582 	node creation so that the same rewrite templates can be used
   1583 	for both parsing and tree parsing.
   1584 
   1585   codegen/templates/Java/ASTParser.stg
   1586 	The templates needed to build trees with auto construction
   1587 	during parsing.
   1588   codegen/templates/Java/ASTTreeParser.stg
   1589 	The templates needed to build trees with auto construction
   1590 	during tree parsing.
   1591   codegen/templates/Java/Java.stg
   1592 	genericParser now has rewriteElementType (Note or Token) so
   1593 	that the rewrite streams know what kind of elements are inside
   1594 	during rewrite rule tree construction.
   1595   codegen/templates/Java/ST.stg
   1596 	rewrite attribute name change to rewriteMode
   1597 
   1598   org/antlr/runtime/debug/DebugTreeAdaptor.java
   1599   org/antlr/runtime/debug/DebugTreeNodeStream.java
   1600 	Updated to handle new interfaces
   1601 
   1602   test/BaseTest.java
   1603 	Added test rig update to handle AST construction by tree parsers.
   1604 	All tree construction runs automatically test sanity of parent
   1605 	and child indexes.
   1606   test/TestTreeGrammarRewriteAST.java
   1607   test/TestTreeNodeStream.java
   1608   test/TestTrees.java
   1609 	new file; tests the new parent and child index stuff in trees.
   1610 
   1611 July 19, 2007
   1612 
   1613 * implemented new unique ID; GC was causing non unique hash codes.  Debugging
   1614   tree grammars was messing up.
   1615 
   1616 * got tree rewrites working in tree grammars.  It builds a completely new
   1617   tree from old tree; i.e., you get two trees in memory.  W/o a rewrite
   1618   rule, the input for that rule is duplicated and returned. -> w/o elements
   1619   to the right means don't return anything; i.e., delete.  Ooops...way
   1620   harder than I thought.  Real implementation notes above.
   1621 
   1622 INCOMPATIBILITY WARNING -- templates have changed; must regen output from
   1623                            grammars.  Runtime libraries have also changed.
   1624                            Debug event listener interface has changed also.
   1625 
   1626 July 17, 2007
   1627 
   1628 * Added line/charposition to node socket events and event dump so
   1629   we have more info during tree parsing.  Only works if your
   1630   tree adaptor returns a value Token object from getToken(treenode)
   1631   with line/col set.  Refactored consumeNode/LN to use deserializeNode().
   1632 
   1633 * Fixed mismatched tree node exceptions; for imaginary nodes, it said
   1634   "missing null".  Now prints the token type we found.
   1635 
   1636 * Cleaned up exception stuff. MismatchedTreeNodeException was setting
   1637   line/col, but only RecognitionException should do that.
   1638 
   1639 * If imaginary token gets a mismatch, there is no line info.  Search
   1640   backwards in stream if input node stream supports to find last
   1641   node with good line/col info. E.g.,
   1642 
   1643 ANTLRv3Tree.g: node from after line 156:72 mismatched tree node: EOA expecting <UP>
   1644 
   1645   which used to be:
   1646 
   1647 ANTLRv3Tree.g: node from line 0:0 mismatched tree node: null expecting <UP>
   1648 
   1649 * mismatched tree node exceptions were not sent to the debug event stream.
   1650   Due to a type being slightly different on recoverFromMismatchedToken()
   1651   in DebugTreeParser.  Was calling BaseRecognizer version not subclass.
   1652   Now we get:
   1653 
   1654   9459:   Recognition exception MismatchedTreeNodeException(0!=0)
   1655 
   1656 * List labels were not allowed as root nodes in tree rewrites like
   1657   ^($listlabel ...).  Had to add a template to AST.stg:
   1658 
   1659   /** Gen ^($label ...) where label+=... */
   1660   rewriteTokenListLabelRefRoot ::= rewriteTokenLabelRefRoot
   1661 
   1662 
   1663 July 16, 2007
   1664 
   1665 * fixed nextNode in RewriteRuleSubtreeStream was dup'ing too much,
   1666   screwing up debug event stream.  Also there was a bug in how
   1667   the rewrite tree stream stuff decided to dup nodes.
   1668 
   1669 * fixed bug in LT for tree parsing; text was not transmitted properly;
   1670   only single words worked.
   1671 
   1672 * made decision for rule put line/col on colon not first token of first alt.
   1673 
   1674 * remote ProxyToken now emits token index for easier debugging when looking
   1675   at AW's event stream.  For example, the @5 here is the token index:
   1676 
   1677   31	Consume hidden [ /<64>,channel=99,30:7, @5]
   1678 
   1679 * same is true for consume nodes now:
   1680 
   1681   25586	Consume node [')'/, <44>, 4712040,@1749]	25
   1682 
   1683   When debugging tree parsers, it helps to track errors when you know
   1684   what corresponding input symbol created this tree node.
   1685 
   1686 * Changed debug events associated with trees quite a bit.  Passes nodes around
   1687   now rather than text, type, unique IDs etc...  Mostly affects internal stuff.
   1688   Target developers will have some work in their runtime to do to match
   1689   this change. :(  BUT, there is only a slight tweak in the Dbg.stg
   1690   and ASTDbg.stg templates.
   1691   Interface just didn't make sense as is.  If you turn on debugging, and
   1692   want to track a node creation, you want the node pointer not its ID,
   1693   text, etc...
   1694   Added ProxyTree for passing across socket.  Has line/charpos and tokenIndex
   1695 
   1696 July 15, 2007
   1697 
   1698 * added null ptr protection in CommonTreeAdaptor.
   1699 
   1700 July 14, 2007
   1701 
   1702 * null child in TreeAdaptor does nothing now.  Changed interface and
   1703   implementation.  Changed DebugTreeAdaptor to not fire events on null add
   1704   as well.
   1705 
   1706 July 12, 2007
   1707 
   1708 * added get method for the line/col to DFA map in Grammar.java
   1709 
   1710 July 7, 2007
   1711 
   1712 * fixed wrong order of test for exceptions in Lexer.getErrorMessage()
   1713 
   1714 June 28, 2007
   1715 
   1716 * Added ability to set the port number in the constructor for the debug parser.
   1717 
   1718 June 5, 2007
   1719 
   1720 * Changed (hidden) option -verbose to -Xnfastates; this just prints out the NFA states along each nondeterministic path for nondeterminism warnings.
   1721 
   1722 May 18, 2007
   1723 
   1724 * there were some dependencies with org.antlr.* that I removed from
   1725   org.antlr.runtime.*
   1726 
   1727 3.0 final - May 17, 2007
   1728 
   1729 May 14, 2007
   1730 
   1731 * Auto backtracking didn't work with ! and ^ suffixes on first element
   1732   of an alt.
   1733 
   1734 * Auto backtracking didn't work with an action as first element.
   1735 
   1736 May 10, 2007
   1737 
   1738 * turn off the warning about no local messages:
   1739  no such locale file org/antlr/tool/templates/messages/languages/ru.stg retrying with English locale
   1740 
   1741 May 5, 2007
   1742 
   1743 * moving org.antlr.runtime to runtime/Java/src/org/... Other target
   1744   source / libs are under runtime/targetname.
   1745 
   1746 May 4, 2007
   1747 
   1748 * You could not use arguments on a token reference that was a route in a
   1749   tree rewrite rule like -> ^(ID[args] ...).
   1750 
   1751 May 3, 2007
   1752 
   1753 * Fixed ANTLR-82.  Actions after the root were considered part of
   1754   an optional child.  They were not always executed.  Required a change
   1755   to the ANTLRCore.sti interface for tree() template.
   1756 
   1757 May 2, 2007
   1758 
   1759 * Fixed ANTLR-117. Wasn't building decisions properly for subrules in
   1760   syntactic predicates.
   1761 
   1762 April 22, 2007
   1763 
   1764 * Made build.xml ref all jars in antlr lib.  Thanks to Miguel Ping.
   1765 
   1766 * Fixed ANTLR-11
   1767 
   1768 * Now labels on ranges and such in lexer work properly.
   1769 
   1770 * ActionAnalysisLexer was in wrong package.
   1771 
   1772 April 21, 2007
   1773 
   1774 * Pushing a huge update that fixes:
   1775 	http://www.antlr.org/browse/ANTLR-112
   1776 	http://www.antlr.org/browse/ANTLR-110
   1777 	http://www.antlr.org/browse/ANTLR-109
   1778 	http://www.antlr.org/browse/ANTLR-103
   1779 	http://www.antlr.org/browse/ANTLR-97
   1780 	http://www.antlr.org/browse/ANTLR-113
   1781 	http://www.antlr.org/browse/ANTLR-66
   1782 	http://www.antlr.org/browse/ANTLR-98
   1783 	http://www.antlr.org/browse/ANTLR-24
   1784 	http://www.antlr.org/browse/ANTLR-114
   1785 	http://www.antlr.org/browse/ANTLR-5
   1786 	http://www.antlr.org/browse/ANTLR-6
   1787 
   1788   Basically, I gutted the way AST rewrites work.  MUCH better.
   1789 
   1790 * Fixed lots of little label issues in the lexer.  Couldn't do x+=ID
   1791   in lexer, for example.  Fixed ANTLR-114, ANTLR-112
   1792 
   1793 * Isolated EOT transition in lexer generated dangling else clause.
   1794   Fixed ANTLR-113.
   1795 
   1796 April 17, 2007
   1797 
   1798 * Fixed a major problem with gated semantic predicates.  Added more
   1799   unit tests.
   1800 
   1801 * Fixed bug in cyclic DFA with syntactic predicates.  Wasn't rewinding
   1802   properly.  Further, mark() in token stream did not fill buffer so
   1803   when you rewound back to last marker index was -1 not 0.  At same time
   1804   I fixed ANTLR-103.  Syn preds evaluated only once now.
   1805 
   1806 * Altered code gen file writing so it writes directly to a file
   1807   instead of building a big string and then writing that out.  Should
   1808   be faster and much less memory intensive.
   1809 
   1810 * Fixed so antlr writes files to correct location again.  See:
   1811 
   1812 http://www.antlr.org/wiki/pages/viewpage.action?pageId=1862
   1813 
   1814 3.0b7 - April 12, 2007
   1815 
   1816 April 10, 2007
   1817 
   1818 * Allows -> {...} actions now when building ASTs.  Fixed ANTLR-14.
   1819 
   1820 * Allows ! on sets and wildcard now during output=AST option. Fixed ANTLR-17.
   1821 
   1822 * Fixed ANTLR-92 bug.  Couldn't use sets with -> tree construction.
   1823 
   1824 * No lexer rule for a token type is now a warning.
   1825 
   1826 * Fixed set labels in lexer; ANTLR-60 bug
   1827 
   1828 * Fixed problem with duplicate state variable definitions in switch-case
   1829 
   1830 April 9, 2007
   1831 
   1832 * Gated predicates didn't work properly in cyclic DFA.
   1833 
   1834 April 7, 2007
   1835 
   1836 * Couldn't have more than one set per rule it seems.  Fixed.
   1837 
   1838 April 3, 2007
   1839 
   1840 * Fix a problem in my unused label optimization.  Added new
   1841   pass over actions to examine them.
   1842 
   1843 * RuleReturnScope has method back:
   1844   /** Has a value potentially if output=template; Don't use StringTemplate
   1845    *  type as it then causes a dependency with ST lib.
   1846    */
   1847   public Object getTemplate() { return null; }
   1848 
   1849 March 30, 2007
   1850 
   1851 * Fixed ANTLR-8.  Labels to rules w/o return values caused compile errors.
   1852 
   1853 * Fixed ANTLR-89; semantic predicates in lexer sometimes
   1854   caused exception in code gen.
   1855 
   1856 * Fixed ANTLR-36; remove runtime dependency with ST
   1857 
   1858 March 29, 2007
   1859 
   1860 * Over last few days, I've gutted how ANTLR handles sets of chars or
   1861   tokens.  I cleaned up a lot of stuff in the grammars and added lots
   1862   of unit tests.
   1863 
   1864 March 26, 2007
   1865 
   1866 * CommonTreeNodeStream didn't push correctly; couldn't handle very
   1867   deeply nested trees.
   1868 
   1869 * Fixed bug that E : 'a' 'b' ; made E be seen as an alias of 'a'.
   1870 
   1871 March 22, 2007
   1872 
   1873 * Working with Egor Ushakov from Sun Optimization / NetBeans team I
   1874   made all the Java lexer transition tables static w/o screwing up
   1875   ability to reference semantic predicates etc...  Only changed Java.stg
   1876 
   1877 * cached text string in CommonToken.getText(); saves on repeated calls;
   1878   Java mode.
   1879 
   1880 * made all generated methods final; saves a few percent speed according to
   1881   Egor Ushakov (Java only).
   1882 
   1883 * removed most assignments from each lexer rule and even the Lexer.emit()
   1884   call!  All done in nextToken now.  Saves on code gen size and a wee bit of
   1885   execution speed probably.  Variables became fields: type, channel, line,
   1886   etc... Now emit() needs no args even.  Again, Egor helped on this.
   1887 
   1888 March 17, 2007
   1889 
   1890 * Jonathan DeKlotz updated C# templates to be 3.0b6 current
   1891 
   1892 March 14, 2007
   1893 
   1894 * Manually-specified (...)=> force backtracking eval of that predicate.
   1895   backtracking=true mode does not however.  Added unit test.
   1896 
   1897 March 14, 2007
   1898 
   1899 * Fixed bug in lexer where ~T didn't compute the set from rule T.
   1900 
   1901 * Added -Xnoinlinedfa make all DFA with tables; no inline prediction with IFs
   1902 
   1903 * Fixed http://www.antlr.org/browse/ANTLR-80.
   1904   Sem pred states didn't define lookahead vars.
   1905 
   1906 * Fixed http://www.antlr.org/browse/ANTLR-91.
   1907   When forcing some acyclic DFA to be state tables, they broke.
   1908   Forcing all DFA to be state tables should give same results.
   1909 
   1910 March 12, 2007
   1911 
   1912 * setTokenSource in CommonTokenStream didn't clear tokens list.
   1913   setCharStream calls reset in Lexer.
   1914 
   1915 * Altered -depend.  No longer printing grammar files for multiple input
   1916   files with -depend.  Doesn't show T__.g temp file anymore. Added
   1917   TLexer.tokens.  Added .h files if defined.
   1918 
   1919 February 11, 2007
   1920 
   1921 * Added -depend command-line option that, instead of processing files,
   1922   it shows you what files the input grammar(s) depend on and what files
   1923   they generate. For combined grammar T.g:
   1924 
   1925   $ java org.antlr.Tool -depend T.g
   1926 
   1927   You get:
   1928 
   1929   TParser.java : T.g
   1930   T.tokens : T.g
   1931   T__.g : T.g
   1932 
   1933   Now, assuming U.g is a tree grammar ref'd T's tokens:
   1934 
   1935   $ java org.antlr.Tool -depend T.g U.g
   1936 
   1937   TParser.java : T.g
   1938   T.tokens : T.g
   1939   T__.g : T.g
   1940   U.g: T.tokens
   1941   U.java : U.g
   1942   U.tokens : U.g
   1943 
   1944   Handles spaces by escaping them.  Pays attention to -o, -fo and -lib.
   1945   Dir 'x y' is a valid dir in current dir.
   1946 
   1947   $ java org.antlr.Tool -depend -lib /usr/local/lib -o 'x y' T.g U.g
   1948   x\ y/TParser.java : T.g
   1949   x\ y/T.tokens : T.g
   1950   x\ y/T__.g : T.g
   1951   U.g: /usr/local/lib/T.tokens
   1952   x\ y/U.java : U.g
   1953   x\ y/U.tokens : U.g
   1954 
   1955   You have API access via org.antlr.tool.BuildDependencyGenerator class:
   1956   getGeneratedFileList(), getDependenciesFileList().  You can also access
   1957   the output template: getDependencies().  The file
   1958   org/antlr/tool/templates/depend.stg contains the template.  You can
   1959   modify as you want.  File objects go in so you can play with path etc...
   1960 
   1961 February 10, 2007
   1962 
   1963 * no more .gl files generated.  All .g all the time.
   1964 
   1965 * changed @finally to be @after and added a finally clause to the
   1966   exception stuff.  I also removed the superfluous "exception"
   1967   keyword.  Here's what the new syntax looks like:
   1968 
   1969   a
   1970   @after { System.out.println("ick"); }
   1971     : 'a'
   1972     ;
   1973     catch[RecognitionException e] { System.out.println("foo"); }
   1974     catch[IOException e] { System.out.println("io"); }
   1975     finally { System.out.println("foobar"); }
   1976 
   1977   @after executes after bookkeeping to set $rule.stop, $rule.tree but
   1978   before scopes pop and any memoization happens.  Dynamic scopes and
   1979   memoization are still in generated finally block because they must
   1980   exec even if error in rule.  The @after action and tree setting
   1981   stuff can technically be skipped upon syntax error in rule.  [Later
   1982   we might add something to finally to stick an ERROR token in the
   1983   tree and set the return value.]  Sequence goes: set $stop, $tree (if
   1984   any), @after (if any), pop scopes (if any), memoize (if needed),
   1985   grammar finally clause.  Last 3 are in generated code's finally
   1986   clause.
   1987 
   1988 3.0b6 - January 31, 2007
   1989 
   1990 January 30, 2007
   1991 
   1992 * Fixed bug in IntervalSet.and: it returned the same empty set all the time
   1993   rather than new empty set.  Code altered the same empty set.
   1994 
   1995 * Made analysis terminate faster upon a decision that takes too long;
   1996   it seemed to keep doing work for a while.  Refactored some names
   1997   and updated comments.  Also made it terminate when it realizes it's
   1998   non-LL(*) due to recursion.  just added terminate conditions to loop
   1999   in convert().
   2000 
   2001 * Sometimes fatal non-LL(*) messages didn't appear; instead you got
   2002   "antlr couldn't analyze", which is actually untrue.  I had the
   2003   order of some prints wrong in the DecisionProbe.
   2004 
   2005 * The code generator incorrectly detected when it could use a fixed,
   2006   acyclic inline DFA (i.e., using an IF).  Upon non-LL(*) decisions
   2007   with predicates, analysis made cyclic DFA.  But this stops
   2008   the computation detecting whether they are cyclic.  I just added
   2009   a protection in front of the acyclic DFA generator to avoid if
   2010   non-LL(*).  Updated comments.
   2011 
   2012 January 23, 2007
   2013 
   2014 * Made tree node streams use adaptor to create navigation nodes.
   2015   Thanks to Emond Papegaaij.
   2016 
   2017 January 22, 2007
   2018 
   2019 * Added lexer rule properties: start, stop
   2020 
   2021 January 1, 2007
   2022 
   2023 * analysis failsafe is back on; if a decision takes too long, it bails out
   2024   and uses k=1
   2025 
   2026 January 1, 2007
   2027 
   2028 * += labels for rules only work for output option; previously elements
   2029   of list were the return value structs, but are now either the tree or
   2030   StringTemplate return value.  You can label different rules now
   2031   x+=a x+=b.
   2032 
   2033 December 30, 2006
   2034 
   2035 * Allow \" to work correctly in "..." template.
   2036 
   2037 December 28, 2006
   2038 
   2039 * errors that are now warnings: missing AST label type in trees.
   2040   Also "no start rule detected" is warning.
   2041 
   2042 * tree grammars also can do rewrite=true for output=template.
   2043   Only works for alts with single node or tree as alt elements.
   2044   If you are going to use $text in a tree grammar or do rewrite=true
   2045   for templates, you must use in your main:
   2046 
   2047   nodes.setTokenStream(tokens);
   2048 
   2049 * You get a warning for tree grammars that do rewrite=true and
   2050   output=template and have -> for alts that are not simple nodes
   2051   or simple trees.  new unit tests in TestRewriteTemplates at end.
   2052 
   2053 December 27, 2006
   2054 
   2055 * Error message appears when you use -> in tree grammar with
   2056   output=template and rewrite=true for alt that is not simple
   2057   node or tree ref.
   2058 
   2059 * no more $stop attribute for tree parsers; meaningless/useless.
   2060   Removed from TreeRuleReturnScope also.
   2061 
   2062 * rule text attribute in tree parser must pull from token buffer.
   2063   Makes no sense otherwise.  added getTokenStream to TreeNodeStream
   2064   so rule $text attr works.  CommonTreeNodeStream etc... now let
   2065   you set the token stream so you can access later from tree parser.
   2066   $text is not well-defined for rules like
   2067 
   2068      slist : stat+ ;
   2069 
   2070   because stat is not a single node nor rooted with a single node.
   2071   $slist.text will get only first stat.  I need to add a warning about
   2072   this...
   2073 
   2074 * Fixed http://www.antlr.org/browse/ANTLR-76 for Java.
   2075   Enhanced TokenRewriteStream so it accepts any object; converts
   2076   to string at last second.  Allows you to rewrite with StringTemplate
   2077   templates now :)
   2078 
   2079 * added rewrite option that makes -> template rewrites do replace ops for
   2080   TokenRewriteStream input stream.  In output=template and rewrite=true mode
   2081   same as before 'cept that the parser does
   2082 
   2083     ((TokenRewriteStream)input).replace(
   2084 	      ((Token)retval.start).getTokenIndex(),
   2085 	      input.LT(-1).getTokenIndex(),
   2086 	      retval.st);
   2087 
   2088   after each rewrite so that the input stream is altered.  Later refs to
   2089   $text will have rewrites.  Here's a sample test program for grammar Rew.
   2090 
   2091         FileReader groupFileR = new FileReader("Rew.stg");
   2092         StringTemplateGroup templates = new StringTemplateGroup(groupFileR);
   2093         ANTLRInputStream input = new ANTLRInputStream(System.in);
   2094         RewLexer lexer = new RewLexer(input);
   2095         TokenRewriteStream tokens = new TokenRewriteStream(lexer);
   2096         RewParser parser = new RewParser(tokens);
   2097         parser.setTemplateLib(templates);
   2098         parser.program();
   2099         System.out.println(tokens.toString());
   2100         groupFileR.close();
   2101 
   2102 December 26, 2006
   2103 
   2104 * BaseTree.dupTree didn't dup recursively.
   2105 
   2106 December 24, 2006
   2107 
   2108 * Cleaned up some comments and removed field treeNode
   2109   from MismatchedTreeNodeException class.  It is "node" in
   2110   RecognitionException.
   2111 
   2112 * Changed type from Object to BitSet for expecting fields in
   2113   MismatchedSetException and MismatchedNotSetException
   2114 
   2115 * Cleaned up error printing in lexers and the messages that it creates.
   2116 
   2117 * Added this to TreeAdaptor:
   2118 	/** Return the token object from which this node was created.
   2119 	 *  Currently used only for printing an error message.
   2120 	 *  The error display routine in BaseRecognizer needs to
   2121 	 *  display where the input the error occurred. If your
   2122 	 *  tree of limitation does not store information that can
   2123 	 *  lead you to the token, you can create a token filled with
   2124 	 *  the appropriate information and pass that back.  See
   2125 	 *  BaseRecognizer.getErrorMessage().
   2126 	 */
   2127 	public Token getToken(Object t);
   2128 
   2129 December 23, 2006
   2130 
   2131 * made BaseRecognizer.displayRecognitionError nonstatic so people can
   2132   override it. Not sure why it was static before.
   2133 
   2134 * Removed state/decision message that comes out of no
   2135   viable alternative exceptions, as that was too much.
   2136   removed the decision number from the early exit exception
   2137   also.  During development, you can simply override
   2138   displayRecognitionError from BaseRecognizer to add the stuff
   2139   back in if you want.
   2140 
   2141 * made output go to an output method you can override: emitErrorMessage()
   2142 
   2143 * general cleanup of the error emitting code in BaseRecognizer.  Lots
   2144   more stuff you can override: getErrorHeader, getTokenErrorDisplay,
   2145   emitErrorMessage, getErrorMessage.
   2146 
   2147 December 22, 2006
   2148 
   2149 * Altered Tree.Parser.matchAny() so that it skips entire trees if
   2150   node has children otherwise skips one node.  Now this works to
   2151   skip entire body of function if single-rooted subtree:
   2152   ^(FUNC name=ID arg=ID .)
   2153 
   2154 * Added "reverse index" from node to stream index.  Override
   2155   fillReverseIndex() in CommonTreeNodeStream if you want to change.
   2156   Use getNodeIndex(node) to find stream index for a specific tree node.
   2157   See getNodeIndex(), reverseIndex(Set tokenTypes),
   2158   reverseIndex(int tokenType), fillReverseIndex().  The indexing
   2159   costs time and memory to fill, but pulling stuff out will be lots
   2160   faster as it can jump from a node ptr straight to a stream index.
   2161 
   2162 * Added TreeNodeStream.get(index) to make it easier for interpreters to
   2163   jump around in tree node stream.
   2164 
   2165 * New CommonTreeNodeStream buffers all nodes in stream for fast jumping
   2166   around.  It now has push/pop methods to invoke other locations in
   2167   the stream for building interpreters.
   2168 
   2169 * Moved CommonTreeNodeStream to UnBufferedTreeNodeStream and removed
   2170   Iterator implementation.  moved toNodesOnlyString() to TestTreeNodeStream
   2171 
   2172 * [BREAKS ANY TREE IMPLEMENTATION]
   2173   made CommonTreeNodeStream work with any tree node type.  TreeAdaptor
   2174   now implements isNil so must add; trivial, but does break back
   2175   compatibility.
   2176 
   2177 December 17, 2006
   2178 
   2179 * Added traceIn/Out methods to recognizers so that you can override them;
   2180   previously they were in-line print statements. The message has also
   2181   been slightly improved.
   2182 
   2183 * Factored BuildParseTree into debug package; cleaned stuff up. Fixed
   2184   unit tests.
   2185 
   2186 December 15, 2006
   2187 
   2188 * [BREAKS ANY TREE IMPLEMENTATION]
   2189   org.antlr.runtime.tree.Tree; needed to add get/set for token start/stop
   2190   index so CommonTreeAdaptor can assume Tree interface not CommonTree
   2191   implementation.  Otherwise, no way to create your own nodes that satisfy
   2192   Tree because CommonTreeAdaptor was doing
   2193 
   2194 	public int getTokenStartIndex(Object t) {
   2195 		return ((CommonTree)t).startIndex;
   2196 	}
   2197 
   2198   Added to Tree:
   2199 
   2200 	/**  What is the smallest token index (indexing from 0) for this node
   2201 	 *   and its children?
   2202 	 */
   2203 	int getTokenStartIndex();
   2204 
   2205 	void setTokenStartIndex(int index);
   2206 
   2207 	/**  What is the largest token index (indexing from 0) for this node
   2208 	 *   and its children?
   2209 	 */
   2210 	int getTokenStopIndex();
   2211 
   2212 	void setTokenStopIndex(int index);
   2213 
   2214 December 13, 2006
   2215 
   2216 * Added org.antlr.runtime.tree.DOTTreeGenerator so you can generate DOT
   2217   diagrams easily from trees.
   2218 
   2219 	CharStream input = new ANTLRInputStream(System.in);
   2220 	TLexer lex = new TLexer(input);
   2221 	CommonTokenStream tokens = new CommonTokenStream(lex);
   2222 	TParser parser = new TParser(tokens);
   2223 	TParser.e_return r = parser.e();
   2224 	Tree t = (Tree)r.tree;
   2225 	System.out.println(t.toStringTree());
   2226 	DOTTreeGenerator gen = new DOTTreeGenerator();
   2227 	StringTemplate st = gen.toDOT(t);
   2228 	System.out.println(st);
   2229 
   2230 * Changed the way mark()/rewind() work in CommonTreeNode stream to mirror
   2231   more flexible solution in ANTLRStringStream.  Forgot to set lastMarker
   2232   anyway.  Now you can rewind to non-most-recent marker.
   2233 
   2234 December 12, 2006
   2235 
   2236 * Temp lexer now end in .gl (T__.gl, for example)
   2237 
   2238 * TreeParser suffix no longer generated for tree grammars
   2239 
   2240 * Defined reset for lexer, parser, tree parser; rewinds the input stream also
   2241 
   2242 December 10, 2006
   2243 
   2244 * Made Grammar.abortNFAToDFAConversion() abort in middle of a DFA.
   2245 
   2246 December 9, 2006
   2247 
   2248 * fixed bug in OrderedHashSet.add().  It didn't track elements correctly.
   2249 
   2250 December 6, 2006
   2251 
   2252 * updated build.xml for future Ant compatibility, thanks to Matt Benson.
   2253 
   2254 * various tests in TestRewriteTemplate and TestSyntacticPredicateEvaluation
   2255   were using the old 'channel' vs. new '$channel' notation.
   2256   TestInterpretedParsing didn't pick up an earlier change to CommonToken.
   2257   Reported by Matt Benson.
   2258 
   2259 * fixed platform dependent test failures in TestTemplates, supplied by Matt
   2260   Benson.
   2261 
   2262 November 29, 2006
   2263 
   2264 *  optimized semantic predicate evaluation so that p||!p yields true.
   2265 
   2266 November 22, 2006
   2267 
   2268 * fixed bug that prevented var = $rule.some_retval from working in anything
   2269   but the first alternative of a rule or subrule.
   2270 
   2271 * attribute names containing digits were not allowed, this is now fixed,
   2272   allowing attributes like 'name1' but not '1name1'.
   2273 
   2274 November 19, 2006
   2275 
   2276 * Removed LeftRecursionMessage and apparatus because it seems that I check
   2277   for left recursion upfront before analysis and everything gets specified as
   2278   recursion cycles at this point.
   2279 
   2280 November 16, 2006
   2281 
   2282 * TokenRewriteStream.replace was not passing programName to next method.
   2283 
   2284 November 15, 2006
   2285 
   2286 * updated DOT files for DFA generation to make smaller circles.
   2287 
   2288 * made epsilon edges italics in the NFA diagrams.
   2289 
   2290 3.0b5 - November 15, 2006
   2291 
   2292 The biggest thing is that your grammar file names must match the grammar name
   2293 inside (your generated class names will also be different) and we use
   2294 $channel=HIDDEN now instead of channel=99 inside lexer actions.
   2295 Should be compatible other than that.   Please look at complete list of
   2296 changes.
   2297 
   2298 November 14, 2006
   2299 
   2300 * Force token index to be -1 for CommonIndex in case not set.
   2301 
   2302 November 11, 2006
   2303 
   2304 * getUniqueID for TreeAdaptor now uses identityHashCode instead of hashCode.
   2305 
   2306 November 10, 2006
   2307 
   2308 * No grammar nondeterminism warning now when wildcard '.' is final alt.
   2309   Examples:
   2310 
   2311 	a : A | B | . ;
   2312 
   2313 	A : 'a'
   2314 	  | .
   2315 	  ;
   2316 
   2317 	SL_COMMENT
   2318 	    : '//' (options {greedy=false;} : .)* '\r'? '\n'
   2319 	    ;
   2320 
   2321 	SL_COMMENT2
   2322 	    : '//' (options {greedy=false;} : 'x'|.)* '\r'? '\n'
   2323 	    ;
   2324 
   2325 
   2326 November 8, 2006
   2327 
   2328 * Syntactic predicates did not get hoisting properly upon non-LL(*) decision.  Other hoisting issues fixed.  Cleaned up code.
   2329 
   2330 * Removed failsafe that check to see if I'm spending too much time on a single DFA; I don't think we need it anymore.
   2331 
   2332 November 3, 2006
   2333 
   2334 * $text, $line, etc... were not working in assignments. Fixed and added
   2335   test case.
   2336 
   2337 * $label.text translated to label.getText in lexer even if label was on a char
   2338 
   2339 November 2, 2006
   2340 
   2341 * Added error if you don't specify what the AST type is; actions in tree
   2342   grammar won't work without it.
   2343 
   2344   $ cat x.g
   2345   tree grammar x;
   2346   a : ID {String s = $ID.text;} ;
   2347 
   2348   ANTLR Parser Generator   Early Access Version 3.0b5 (??, 2006)  1989-2006
   2349   error: x.g:0:0: (152) tree grammar x has no ASTLabelType option
   2350 
   2351 November 1, 2006
   2352 
   2353 * $text, $line, etc... were not working properly within lexer rule.
   2354 
   2355 October 32, 2006
   2356 
   2357 * Finally actions now execute before dynamic scopes are popped it in the
   2358   rule. Previously was not possible to access the rules scoped variables
   2359   in a finally action.
   2360 
   2361 October 29, 2006
   2362 
   2363 * Altered ActionTranslator to emit errors on setting read-only attributes
   2364   such as $start, $stop, $text in a rule. Also forbid setting any attributes
   2365   in rules/tokens referenced by a label or name.
   2366   Setting dynamic scopes's attributes and your own parameter attributes
   2367   is legal.
   2368 
   2369 October 27, 2006
   2370 
   2371 * Altered how ANTLR figures out what decision is associated with which
   2372   block of grammar.  Makes ANTLRWorks correctly find DFA for a block.
   2373 
   2374 October 26, 2006
   2375 
   2376 * Fixed bug where EOT transitions led to no NFA configs in a DFA state,
   2377   yielding an error in DFA table generation.
   2378 
   2379 * renamed action.g to ActionTranslator.g
   2380   the ActionTranslator class is now called ActionTranslatorLexer, as ANTLR
   2381   generates this classname now. Fixed rest of codebase accordingly.
   2382 
   2383 * added rules recognizing setting of scopes' attributes to ActionTranslator.g
   2384   the Objective C target needed access to the right-hand side of the assignment
   2385   in order to generate correct code
   2386 
   2387 * changed ANTLRCore.sti to reflect the new mandatory templates to support the above
   2388   namely: scopeSetAttributeRef, returnSetAttributeRef and the ruleSetPropertyRef_*
   2389   templates, with the exception of ruleSetPropertyRef_text. we cannot set this attribute
   2390 
   2391 October 19, 2006
   2392 
   2393 * Fixed 2 bugs in DFA conversion that caused exceptions.
   2394   altered functionality of getMinElement so it ignores elements<0.
   2395 
   2396 October 18, 2006
   2397 
   2398 * moved resetStateNumbersToBeContiguous() to after issuing of warnings;
   2399   an internal error in that routine should make more sense as issues
   2400   with decision will appear first.
   2401 
   2402 * fixed cut/paste bug I introduced when fixed EOF in min/max
   2403   bug. Prevented C grammar from working briefly.
   2404 
   2405 October 17, 2006
   2406 
   2407 * Removed a failsafe that seems to be unnecessary that ensure DFA didn't
   2408   get too big.  It was resulting in some failures in code generation that
   2409   led me on quite a strange debugging trip.
   2410 
   2411 October 16, 2006
   2412 
   2413 * Use channel=HIDDEN not channel=99 to put tokens on hidden channel.
   2414 
   2415 October 12, 2006
   2416 
   2417 * ANTLR now has a customizable message format for errors and warnings,
   2418   to make it easier to fulfill requirements by IDEs and such.
   2419   The format to be used can be specified via the '-message-format name'
   2420   command line switch. The default for name is 'antlr', also available
   2421   at the moment is 'gnu'. This is done via StringTemplate, for details
   2422   on the requirements look in org/antlr/tool/templates/messages/formats/
   2423 
   2424 * line numbers for lexers in combined grammars are now reported correctly.
   2425 
   2426 September 29, 2006
   2427 
   2428 * ANTLRReaderStream improperly checked for end of input.
   2429 
   2430 September 28, 2006
   2431 
   2432 * For ANTLRStringStream, LA(-1) was off by one...gave you LA(-2).
   2433 
   2434 3.0b4 - August 24, 2006
   2435 
   2436 * error when no rules in grammar.  doesn't crash now.
   2437 
   2438 * Token is now an interface.
   2439 
   2440 * remove dependence on non runtime classes in runtime package.
   2441 
   2442 * filename and grammar name must be same Foo in Foo.g.  Generates FooParser,
   2443   FooLexer, ...  Combined grammar Foo generates Foo$Lexer.g which generates
   2444   FooLexer.java.  tree grammars generate FooTreeParser.java
   2445 
   2446 August 24, 2006
   2447 
   2448 * added C# target to lib, codegen, templates
   2449 
   2450 August 11, 2006
   2451 
   2452 * added tree arg to navigation methods in treeadaptor
   2453 
   2454 August 07, 2006
   2455 
   2456 * fixed bug related to (a|)+ on end of lexer rules.  crashed instead
   2457   of warning.
   2458 
   2459 * added warning that interpreter doesn't do synpreds yet
   2460 
   2461 * allow different source of classloader:
   2462 ClassLoader cl = Thread.currentThread().getContextClassLoader();
   2463 if ( cl==null ) {
   2464     cl = this.getClass().getClassLoader();
   2465 }
   2466 
   2467 
   2468 July 26, 2006
   2469 
   2470 * compressed DFA edge tables significantly.  All edge tables are
   2471   unique. The transition table can reuse arrays.  Look like this now:
   2472 
   2473      public static readonly DFA30_transition0 =
   2474      	new short[] { 46, 46, -1, 46, 46, -1, -1, -1, -1, -1, -1, -1,...};
   2475          public static readonly DFA30_transition1 =
   2476      	new short[] { 21 };
   2477       public static readonly short[][] DFA30_transition = {
   2478      	  DFA30_transition0,
   2479      	  DFA30_transition0,
   2480      	  DFA30_transition1,
   2481      	  ...
   2482       };
   2483 
   2484 * If you defined both a label like EQ and '=', sometimes the '=' was
   2485   used instead of the EQ label.
   2486 
   2487 * made headerFile template have same arg list as outputFile for consistency
   2488 
   2489 * outputFile, lexer, genericParser, parser, treeParser templates
   2490   reference cyclicDFAs attribute which was no longer used after I
   2491   started the new table-based DFA.  I made cyclicDFADescriptors
   2492   argument to outputFile and headerFile (only).  I think this is
   2493   correct as only OO languages will want the DFA in the recognizer.
   2494   At the top level, C and friends can use it.  Changed name to use
   2495   cyclicDFAs again as it's a better name probably.  Removed parameter
   2496   from the lexer, ...  For example, my parser template says this now:
   2497 
   2498     <cyclicDFAs:cyclicDFA()> <! dump tables for all DFA !>
   2499 
   2500 * made all token ref token types go thru code gen's
   2501   getTokenTypeAsTargetLabel()
   2502 
   2503 * no more computing DFA transition tables for acyclic DFA.
   2504 
   2505 July 25, 2006
   2506 
   2507 * fixed a place where I was adding syn predicates into rewrite stuff.
   2508 
   2509 * turned off invalid token index warning in AW support; had a problem.
   2510 
   2511 * bad location event generated with -debug for synpreds in autobacktrack mode.
   2512 
   2513 July 24, 2006
   2514 
   2515 * changed runtime.DFA so that it treats all chars and token types as
   2516   char (unsigned 16 bit int).  -1 becomes '\uFFFF' then or 65535.
   2517 
   2518 * changed MAX_STATE_TRANSITIONS_FOR_TABLE to be 65534 by default
   2519   now. This means that all states can use a table to do transitions.
   2520 
   2521 * was not making synpreds on (C)* type loops with backtrack=true
   2522 
   2523 * was copying tree stuff and actions into synpreds with backtrack=true
   2524 
   2525 * was making synpreds on even single alt rules / blocks with backtrack=true
   2526 
   2527 3.0b3 - July 21, 2006
   2528 
   2529 * ANTLR fails to analyze complex decisions much less frequently.  It
   2530   turns out that the set of decisions for which ANTLR fails (times
   2531   out) is the same set (so far) of non-LL(*) decisions.  Morever, I'm
   2532   able to detect this situation quickly and report rather than timing
   2533   out. Errors look like:
   2534 
   2535   java.g:468:23: [fatal] rule concreteDimensions has non-LL(*)
   2536     decision due to recursive rule invocations in alts 1,2.  Resolve
   2537     by left-factoring or using syntactic predicates with fixed k
   2538     lookahead or use backtrack=true option.
   2539 
   2540   This message only appears when k=*.
   2541 
   2542 * Shortened no viable alt messages to not include decision
   2543   description:
   2544 
   2545 [compilationUnit, declaration]: line 8:8 decision=<<67:1: declaration
   2546 : ( ( fieldDeclaration )=> fieldDeclaration | ( methodDeclaration )=>
   2547 methodDeclaration | ( constructorDeclaration )=>
   2548 constructorDeclaration | ( classDeclaration )=> classDeclaration | (
   2549 interfaceDeclaration )=> interfaceDeclaration | ( blockDeclaration )=>
   2550 blockDeclaration | emptyDeclaration );>> state 3 (decision=14) no
   2551 viable alt; token=[@1,184:187='java',<122>,8:8]
   2552 
   2553   too long and hard to read.
   2554 
   2555 July 19, 2006
   2556 
   2557 * Code gen bug: states with no emanating edges were ignored by ST.
   2558   Now an empty list is used.
   2559 
   2560 * Added grammar parameter to recognizer templates so they can access
   2561   properties like getName(), ...
   2562 
   2563 July 10, 2006
   2564 
   2565 * Fixed the gated pred merged state bug.  Added unit test.
   2566 
   2567 * added new method to Target: getTokenTypeAsTargetLabel()
   2568 
   2569 July 7, 2006
   2570 
   2571 * I was doing an AND instead of OR in the gated predicate stuff.
   2572   Thanks to Stephen Kou!
   2573 
   2574 * Reduce op for combining predicates was insanely slow sometimes and
   2575   didn't actually work well.  Now it's fast and works.
   2576 
   2577 * There is a bug in merging of DFA stop states related to gated
   2578   preds...turned it off for now.
   2579 
   2580 3.0b2 - July 5, 2006
   2581 
   2582 July 5, 2006
   2583 
   2584 * token emission not properly protected in lexer filter mode.
   2585 
   2586 * EOT, EOT DFA state transition tables should be init'd to -1 (only
   2587   was doing this for compressed tables).  Fixed.
   2588 
   2589 * in trace mode, exit method not shown for memoized rules
   2590 
   2591 * added -Xmaxdfaedges to allow you to increase number of edges allowed
   2592   for a single DFA state before it becomes "special" and can't fit in
   2593   a simple table.
   2594 
   2595 * Bug in tables.  Short are signed so min/max tables for DFA are now
   2596   char[].  Bizarre.
   2597 
   2598 July 3, 2006
   2599 
   2600 * Added a method to reset the tool error state for current thread.
   2601   See ErrorManager.java
   2602 
   2603 * [Got this working properly today] backtrack mode that let's you type
   2604   in any old crap and ANTLR will backtrack if it can't figure out what
   2605   you meant.  No errors are reported by antlr during analysis.  It
   2606   implicitly adds a syn pred in front of every production, using them
   2607   only if static grammar LL(*) analysis fails.  Syn pred code is not
   2608   generated if the pred is not used in a decision.
   2609 
   2610   This is essentially a rapid prototyping mode.
   2611 
   2612 * Added backtracking report to the -report option
   2613 
   2614 * Added NFA->DFA conversion early termination report to the -report option
   2615 
   2616 * Added grammar level k and backtrack options to -report
   2617 
   2618 * Added a dozen unit tests to test autobacktrack NFA construction.
   2619 
   2620 * If you are using filter mode, you must manually use option
   2621   memoize=true now.
   2622 
   2623 July 2, 2006
   2624 
   2625 * Added k=* option so you can set k=2, for example, on whole grammar,
   2626   but an individual decision can be LL(*).
   2627 
   2628 * memoize option for grammars, rules, blocks.  Remove -nomemo cmd-line option
   2629 
   2630 * but in DOT generator for DFA; fixed.
   2631 
   2632 * runtime.DFA reported errors even when backtracking
   2633 
   2634 July 1, 2006
   2635 
   2636 * Added -X option list to help
   2637 
   2638 * Syn preds were being hoisted into other rules, causing lots of extra
   2639   backtracking.
   2640 
   2641 June 29, 2006
   2642 
   2643 * unnecessary files removed during build.
   2644 
   2645 * Matt Benson updated build.xml
   2646 
   2647 * Detecting use of synpreds in analysis now instead of codegen.  In
   2648   this way, I can avoid analyzing decisions in synpreds for synpreds
   2649   not used in a DFA for a real rule.  This is used to optimize things
   2650   for backtrack option.
   2651 
   2652 * Code gen must add _fragment or whatever to end of pred name in
   2653   template synpredRule to avoid having ANTLR know anything about
   2654   method names.
   2655 
   2656 * Added -IdbgST option to emit ST delimiters at start/stop of all
   2657   templates spit out.
   2658 
   2659 June 28, 2006
   2660 
   2661 * Tweaked message when ANTLR cannot handle analysis.
   2662 
   2663 3.0b1 - June 27, 2006
   2664 
   2665 June 24, 2006
   2666 
   2667 * syn preds no longer generate little static classes; they also don't
   2668   generate a whole bunch of extra crap in the rules built to test syn
   2669   preds.  Removed GrammarFragmentPointer class from runtime.
   2670 
   2671 June 23-24, 2006
   2672 
   2673 * added output option to -report output.
   2674 
   2675 * added profiling info:
   2676   Number of rule invocations in "guessing" mode
   2677   number of rule memoization cache hits
   2678   number of rule memoization cache misses
   2679 
   2680 * made DFA DOT diagrams go left to right not top to bottom
   2681 
   2682 * I try to recursive overflow states now by resolving these states
   2683   with semantic/syntactic predicates if they exist.  The DFA is then
   2684   deterministic rather than simply resolving by choosing first
   2685   nondeterministic alt.  I used to generated errors:
   2686 
   2687 ~/tmp $ java org.antlr.Tool -dfa t.g
   2688 ANTLR Parser Generator   Early Access Version 3.0b2 (July 5, 2006)  1989-2006
   2689 t.g:2:5: Alternative 1: after matching input such as A A A A A decision cannot predict what comes next due to recursion overflow to b from b
   2690 t.g:2:5: Alternative 2: after matching input such as A A A A A decision cannot predict what comes next due to recursion overflow to b from b
   2691 
   2692   Now, I uses predicates if available and emits no warnings.
   2693 
   2694 * made sem preds share accept states.  Previously, multiple preds in a
   2695 decision forked new accepts each time for each nondet state.
   2696 
   2697 June 19, 2006
   2698 
   2699 * Need parens around the prediction expressions in templates.
   2700 
   2701 * Referencing $ID.text in an action forced bad code gen in lexer rule ID.
   2702 
   2703 * Fixed a bug in how predicates are collected.  The definition of
   2704   "last predicated alternative" was incorrect in the analysis.  Further,
   2705   gated predicates incorrectly missed a case where an edge should become
   2706   true (a tautology).
   2707 
   2708 * Removed an unnecessary input.consume() reference in the runtime/DFA class.
   2709 
   2710 June 14, 2006
   2711 
   2712 * -> ($rulelabel)? didn't generate proper code for ASTs.
   2713 
   2714 * bug in code gen (did not compile)
   2715 a : ID -> ID
   2716   | ID -> ID
   2717   ;
   2718 Problem is repeated ref to ID from left side.  Juergen pointed this out.
   2719 
   2720 * use of tokenVocab with missing file yielded exception
   2721 
   2722 * (A|B)=> foo yielded an exception as (A|B) is a set not a block. Fixed.
   2723 
   2724 * Didn't set ID1= and INT1= for this alt:
   2725   | ^(ID INT+ {System.out.print(\"^(\"+$ID+\" \"+$INT+\")\");})
   2726 
   2727 * Fixed so repeated dangling state errors only occur once like:
   2728 t.g:4:17: the decision cannot distinguish between alternative(s) 2,1 for at least one input sequence
   2729 
   2730 * tracking of rule elements was on (making list defs at start of
   2731   method) with templates instead of just with ASTs.  Turned off.
   2732 
   2733 * Doesn't crash when you give it a missing file now.
   2734 
   2735 * -report: add output info: how many LL(1) decisions.
   2736 
   2737 June 13, 2006
   2738 
   2739 * ^(ROOT ID?) Didn't work; nor did any other nullable child list such as
   2740   ^(ROOT ID* INT?).  Now, I check to see if child list is nullable using
   2741   Grammar.LOOK() and, if so, I generate an "IF lookahead is DOWN" gate
   2742   around the child list so the whole thing is optional.
   2743 
   2744 * Fixed a bug in LOOK that made it not look through nullable rules.
   2745 
   2746 * Using AST suffixes or -> rewrite syntax now gives an error w/o a grammar
   2747   output option.  Used to crash ;)
   2748 
   2749 * References to EOF ended up with improper -1 refs instead of EOF in output.
   2750 
   2751 * didn't warn of ambig ref to $expr in rewrite; fixed.
   2752 list
   2753      :	'[' expr 'for' type ID 'in' expr ']'
   2754 	-> comprehension(expr={$expr.st},type={},list={},i={})
   2755 	;
   2756 
   2757 June 12, 2006
   2758 
   2759 * EOF works in the parser as a token name.
   2760 
   2761 * Rule b:(A B?)*; didn't display properly in AW due to the way ANTLR
   2762   generated NFA.
   2763 
   2764 * "scope x;" in a rule for unknown x gives no error.  Fixed.  Added unit test.
   2765 
   2766 * Label type for refs to start/stop in tree parser and other parsers were
   2767   not used.  Lots of casting.  Ick. Fixed.
   2768 
   2769 * couldn't refer to $tokenlabel in isolation; but need so we can test if
   2770   something was matched.  Fixed.
   2771 
   2772 * Lots of little bugs fixed in $x.y, %... translation due to new
   2773   action translator.
   2774 
   2775 * Improperly tracking block nesting level; result was that you couldn't
   2776   see $ID in action of rule "a : A+ | ID {Token t = $ID;} | C ;"
   2777 
   2778 * a : ID ID {$ID.text;} ; did not get a warning about ambiguous $ID ref.
   2779 
   2780 * No error was found on $COMMENT.text:
   2781 
   2782 COMMENT
   2783     :   '/*' (options {greedy=false;} : . )* '*/'
   2784         {System.out.println("found method "+$COMMENT.text);}
   2785     ;
   2786 
   2787   $enclosinglexerrule scope does not exist.  Use text or setText() here.
   2788 
   2789 June 11, 2006
   2790 
   2791 * Single return values are initialized now to default or to your spec.
   2792 
   2793 * cleaned up input stream stuff.  Added ANTLRReaderStream, ANTLRInputStream
   2794   and refactored.  You can specify encodings now on ANTLRFileStream (and
   2795   ANTLRInputStream) now.
   2796 
   2797 * You can set text local var now in a lexer rule and token gets that text.
   2798   start/stop indexes are still set for the token.
   2799 
   2800 * Changed lexer slightly.  Calling a nonfragment rule from a
   2801   nonfragment rule does not set the overall token.
   2802 
   2803 June 10, 2006
   2804 
   2805 * Fixed bug where unnecessary escapes yield char==0 like '\{'.
   2806 
   2807 * Fixed analysis bug.  This grammar didn't report a recursion warning:
   2808 x   : y X
   2809     | y Y
   2810     ;
   2811 y   : L y R
   2812     | B
   2813     ;
   2814   The DFAState.equals() method was messed up.
   2815 
   2816 * Added @synpredgate {...} action so you can tell ANTLR how to gate actions
   2817   in/out during syntactic predicate evaluation.
   2818 
   2819 * Fuzzy parsing should be more efficient.  It should backtrack over a rule
   2820   and then rewind and do it again "with feeling" to exec actions.  It was
   2821   actually doing it 3x not 2x.
   2822 
   2823 June 9, 2006
   2824 
   2825 * Gutted and rebuilt the action translator for $x.y, $x::y, ...
   2826   Uses ANTLR v3 now for the first time inside v3 source. :)
   2827   ActionTranslator.java
   2828 
   2829 * Fixed a bug where referencing a return value on a rule didn't work
   2830   because later a ref to that rule's predefined properties didn't
   2831   properly force a return value struct to be built.  Added unit test.
   2832 
   2833 June 6, 2006
   2834 
   2835 * New DFA mechanisms.  Cyclic DFA are implemented as state tables,
   2836   encoded via strings as java cannot handle large static arrays :(
   2837   States with edges emanating that have predicates are specially
   2838   treated.  A method is generated to do these states.  The DFA
   2839   simulation routine uses the "special" array to figure out if the
   2840   state is special.  See March 25, 2006 entry for description:
   2841   http://www.antlr.org/blog/antlr3/codegen.tml.  analysis.DFA now has
   2842   all the state tables generated for code gen.  CyclicCodeGenerator.java
   2843   disappeared as it's unneeded code. :)
   2844 
   2845 * Internal general clean up of the DFA.states vs uniqueStates thing.
   2846   Fixed lookahead decisions no longer fill uniqueStates.  Waste of
   2847   time.  Also noted that when adding sem pred edges, I didn't check
   2848   for state reuse.  Fixed.
   2849 
   2850 June 4, 2006
   2851 
   2852 * When resolving ambig DFA states predicates, I did not add the new states
   2853   to the list of unique DFA states.  No observable effect on output except
   2854   that DFA state numbers were not always contiguous for predicated decisions.
   2855   I needed this fix for new DFA tables.
   2856 
   2857 3.0ea10 - June 2, 2006
   2858 
   2859 June 2, 2006
   2860 
   2861 * Improved grammar stats and added syntactic pred tracking.
   2862 
   2863 June 1, 2006
   2864 
   2865 * Due to a type mismatch, the DebugParser.recoverFromMismatchedToken()
   2866   method was not called.  Debug events for mismatched token error
   2867   notification were not sent to ANTLRWorks probably
   2868 
   2869 * Added getBacktrackingLevel() for any recognizer; needed for profiler.
   2870 
   2871 * Only writes profiling data for antlr grammar analysis with -profile set
   2872 
   2873 * Major update and bug fix to (runtime) Profiler.
   2874 
   2875 May 27, 2006
   2876 
   2877 * Added Lexer.skip() to force lexer to ignore current token and look for
   2878   another; no token is created for current rule and is not passed on to
   2879   parser (or other consumer of the lexer).
   2880 
   2881 * Parsers are much faster now.  I removed use of java.util.Stack for pushing
   2882   follow sets and use a hardcoded array stack instead.  Dropped from
   2883   5900ms to 3900ms for parse+lex time parsing entire java 1.4.2 source.  Lex
   2884   time alone was about 1500ms.  Just looking at parse time, we get about 2x
   2885   speed improvement. :)
   2886 
   2887 May 26, 2006
   2888 
   2889 * Fixed NFA construction so it generates NFA for (A*)* such that ANTLRWorks
   2890   can display it properly.
   2891 
   2892 May 25, 2006
   2893 
   2894 * added abort method to Grammar so AW can terminate the conversion if it's
   2895   taking too long.
   2896 
   2897 May 24, 2006
   2898 
   2899 * added method to get left recursive rules from grammar without doing full
   2900   grammar analysis.
   2901 
   2902 * analysis, code gen not attempted if serious error (like
   2903   left-recursion or missing rule definition) occurred while reading
   2904   the grammar in and defining symbols.
   2905 
   2906 * added amazing optimization; reduces analysis time by 90% for java
   2907   grammar; simple IF statement addition!
   2908 
   2909 3.0ea9 - May 20, 2006
   2910 
   2911 * added global k value for grammar to limit lookahead for all decisions unless
   2912 overridden in a particular decision.
   2913 
   2914 * added failsafe so that any decision taking longer than 2 seconds to create
   2915 the DFA will fall back on k=1.  Use -ImaxtimeforDFA n (in ms) to set the time.
   2916 
   2917 * added an option (turned off for now) to use multiple threads to
   2918 perform grammar analysis.  Not much help on a 2-CPU computer as
   2919 garbage collection seems to peg the 2nd CPU already. :( Gotta wait for
   2920 a 4 CPU box ;)
   2921 
   2922 * switched from #src to // $ANTLR src directive.
   2923 
   2924 * CommonTokenStream.getTokens() looked past end of buffer sometimes. fixed.
   2925 
   2926 * unicode literals didn't really work in DOT output and generated code. fixed.
   2927 
   2928 * fixed the unit test rig so it compiles nicely with Java 1.5
   2929 
   2930 * Added ant build.xml file (reads build.properties file)
   2931 
   2932 * predicates sometimes failed to compile/eval properly due to missing (...)
   2933   in IF expressions.  Forced (..)
   2934 
   2935 * (...)? with only one alt were not optimized.  Was:
   2936 
   2937         // t.g:4:7: ( B )?
   2938         int alt1=2;
   2939         int LA1_0 = input.LA(1);
   2940         if ( LA1_0==B ) {
   2941             alt1=1;
   2942         }
   2943         else if ( LA1_0==-1 ) {
   2944             alt1=2;
   2945         }
   2946         else {
   2947             NoViableAltException nvae =
   2948                 new NoViableAltException("4:7: ( B )?", 1, 0, input);
   2949             throw nvae;
   2950         }
   2951 
   2952 is now:
   2953 
   2954         // t.g:4:7: ( B )?
   2955         int alt1=2;
   2956         int LA1_0 = input.LA(1);
   2957         if ( LA1_0==B ) {
   2958             alt1=1;
   2959         }
   2960 
   2961   Smaller, faster and more readable.
   2962 
   2963 * Allow manual init of return values now:
   2964   functionHeader returns [int x=3*4, char (*f)()=null] : ... ;
   2965 
   2966 * Added optimization for DFAs that fixed a codegen bug with rules in lexer:
   2967    EQ			 : '=' ;
   2968    ASSIGNOP		 : '=' | '+=' ;
   2969   EQ is a subset of other rule.  It did not given an error which is
   2970   correct, but generated bad code.
   2971 
   2972 * ANTLR was sending column not char position to ANTLRWorks.
   2973 
   2974 * Bug fix: location 0, 0 emitted for synpreds and empty alts.
   2975 
   2976 * debugging event handshake how sends grammar file name.  Added getGrammarFileName() to recognizers.  Java.stg generates it:
   2977 
   2978     public String getGrammarFileName() { return "<fileName>"; }
   2979 
   2980 * tree parsers can do arbitrary lookahead now including backtracking.  I
   2981   updated CommonTreeNodeStream.
   2982 
   2983 * added events for debugging tree parsers:
   2984 
   2985 	/** Input for a tree parser is an AST, but we know nothing for sure
   2986 	 *  about a node except its type and text (obtained from the adaptor).
   2987 	 *  This is the analog of the consumeToken method.  Again, the ID is
   2988 	 *  the hashCode usually of the node so it only works if hashCode is
   2989 	 *  not implemented.
   2990 	 */
   2991 	public void consumeNode(int ID, String text, int type);
   2992 
   2993 	/** The tree parser looked ahead */
   2994 	public void LT(int i, int ID, String text, int type);
   2995 
   2996 	/** The tree parser has popped back up from the child list to the
   2997 	 *  root node.
   2998 	 */
   2999 	public void goUp();
   3000 
   3001 	/** The tree parser has descended to the first child of a the current
   3002 	 *  root node.
   3003 	 */
   3004 	public void goDown();
   3005 
   3006 * Added DebugTreeNodeStream and DebugTreeParser classes
   3007 
   3008 * Added ctor because the debug tree node stream will need to ask quesitons about nodes and since  nodes are just Object, it needs an adaptor to decode the nodes and get text/type info for the debugger.
   3009 
   3010 public CommonTreeNodeStream(TreeAdaptor adaptor, Tree tree);
   3011 
   3012 * added getter to TreeNodeStream:
   3013 	public TreeAdaptor getTreeAdaptor();
   3014 
   3015 * Implemented getText/getType in CommonTreeAdaptor.
   3016 
   3017 * Added TraceDebugEventListener that can dump all events to stdout.
   3018 
   3019 * I broke down and make Tree implement getText
   3020 
   3021 * tree rewrites now gen location debug events.
   3022 
   3023 * added AST debug events to listener; added blank listener for convenience
   3024 
   3025 * updated debug events to send begin/end backtrack events for debugging
   3026 
   3027 * with a : (b->b) ('+' b -> ^(PLUS $a b))* ; you get b[0] each time as
   3028   there is no loop in rewrite rule itself.  Need to know context that
   3029   the -> is inside the rule and hence b means last value of b not all
   3030   values.
   3031 
   3032 * Bug in TokenRewriteStream; ops at indexes < start index blocked proper op.
   3033 
   3034 * Actions in ST rewrites "-> ({$op})()" were not translated
   3035 
   3036 * Added new action name:
   3037 
   3038 @rulecatch {
   3039 catch (RecognitionException re) {
   3040     reportError(re);
   3041     recover(input,re);
   3042 }
   3043 catch (Throwable t) {
   3044     System.err.println(t);
   3045 }
   3046 }
   3047 Overrides rule catch stuff.
   3048 
   3049 * Isolated $ refs caused exception
   3050 
   3051 3.0ea8 - March 11, 2006
   3052 
   3053 * added @finally {...} action like @init for rules.  Executes in
   3054   finally block (java target) after all other stuff like rule memoization.
   3055   No code changes needs; ST just refs a new action:
   3056       <ruleDescriptor.actions.finally>
   3057 
   3058 * hideous bug fixed: PLUS='+' didn't result in '+' rule in lexer
   3059 
   3060 * TokenRewriteStream didn't do toString() right when no rewrites had been done.
   3061 
   3062 * lexer errors in interpreter were not printed properly
   3063 
   3064 * bitsets are dumped in hex not decimal now for FOLLOW sets
   3065 
   3066 * /* epsilon */ is not printed now when printing out grammars with empty alts
   3067 
   3068 * Fixed another bug in tree rewrite stuff where it was checking that elements
   3069   had at least one element.  Strange...commented out for now to see if I can remember what's up.
   3070 
   3071 * Tree rewrites had problems when you didn't have x+=FOO variables.  Rules
   3072   like this work now:
   3073 
   3074   a : (x=ID)? y=ID -> ($x $y)?;
   3075 
   3076 * filter=true for lexers turns on k=1 and backtracking for every token
   3077   alternative.  Put the rules in priority order.
   3078 
   3079 * added getLine() etc... to Tree to support better error reporting for
   3080   trees.  Added MismatchedTreeNodeException.
   3081 
   3082 * $templates::foo() is gone.  added % as special template symbol.
   3083   %foo(a={},b={},...) ctor (even shorter than $templates::foo(...))
   3084   %({name-expr})(a={},...) indirect template ctor reference
   3085 
   3086   The above are parsed by antlr.g and translated by codegen.g
   3087   The following are parsed manually here:
   3088 
   3089   %{string-expr} anonymous template from string expr
   3090   %{expr}.y = z; template attribute y of StringTemplate-typed expr to z
   3091   %x.y = z; set template attribute y of x (always set never get attr)
   3092             to z [languages like python without ';' must still use the
   3093             ';' which the code generator is free to remove during code gen]
   3094 
   3095 * -> ({expr})(a={},...) notation for indirect template rewrite.
   3096   expr is the name of the template.
   3097 
   3098 * $x[i]::y and $x[-i]::y notation for accesssing absolute scope stack
   3099   indexes and relative negative scopes.  $x[-1]::y is the y attribute
   3100   of the previous scope (stack top - 1).
   3101 
   3102 * filter=true mode for lexers; can do this now...upon mismatch, just
   3103   consumes a char and tries again:
   3104 lexer grammar FuzzyJava;
   3105 options {filter=true;}
   3106 
   3107 FIELD
   3108     :   TYPE WS? name=ID WS? (';'|'=')
   3109         {System.out.println("found var "+$name.text);}
   3110     ;
   3111 
   3112 * refactored char streams so ANTLRFileStream is now a subclass of
   3113   ANTLRStringStream.
   3114 
   3115 * char streams for lexer now allowed nested backtracking in lexer.
   3116 
   3117 * added TokenLabelType for lexer/parser for all token labels
   3118 
   3119 * line numbers for error messages were not updated properly in antlr.g
   3120   for strings, char literals and <<...>>
   3121 
   3122 * init action in lexer rules was before the type,start,line,... decls.
   3123 
   3124 * Tree grammars can now specify output; I've only tested output=templat
   3125   though.
   3126 
   3127 * You can reference EOF now in the parser and lexer.  It's just token type
   3128   or char value -1.
   3129 
   3130 * Bug fix: $ID refs in the *lexer* were all messed up.  Cleaned up the
   3131   set of properties available...
   3132 
   3133 * Bug fix: .st not found in rule ref when rule has scope:
   3134 field
   3135 scope {
   3136 	StringTemplate funcDef;
   3137 }
   3138     :   ...
   3139 	{$field::funcDef = $field.st;}
   3140     ;
   3141 it gets field_stack.st instead
   3142 
   3143 * return in backtracking must return retval or null if return value.
   3144 
   3145 * $property within a rule now works like $text, $st, ...
   3146 
   3147 * AST/Template Rewrites were not gated by backtracking==0 so they
   3148   executed even when guessing.  Auto AST construction is now gated also.
   3149 
   3150 * CommonTokenStream was somehow returning tokens not text in toString()
   3151 
   3152 * added useful methods to runtime.BitSet and also to CommonToken so you can
   3153   update the text.  Added nice Token stream method:
   3154 
   3155   /** Given a start and stop index, return a List of all tokens in
   3156    *  the token type BitSet.  Return null if no tokens were found.  This
   3157    *  method looks at both on and off channel tokens.
   3158    */
   3159   public List getTokens(int start, int stop, BitSet types);
   3160 
   3161 * literals are now passed in the .tokens files so you can ref them in
   3162   tree parses, for example.
   3163 
   3164 * added basic exception handling; no labels, just general catches:
   3165 
   3166 a : {;}A | B ;
   3167         exception
   3168                 catch[RecognitionException re] {
   3169                         System.out.println("recog error");
   3170                 }
   3171                 catch[Exception e] {
   3172                         System.out.println("error");
   3173                 }
   3174 
   3175 * Added method to TokenStream:
   3176   public String toString(Token start, Token stop);
   3177 
   3178 * antlr generates #src lines in lexer grammars generated from combined grammars
   3179   so error messages refer to original file.
   3180 
   3181 * lexers generated from combined grammars now use originally formatting.
   3182 
   3183 * predicates have $x.y stuff translated now.  Warning: predicates might be
   3184   hoisted out of context.
   3185 
   3186 * return values in return val structs are now public.
   3187 
   3188 * output=template with return values on rules was broken.  I assume return values with ASTs was broken too.  Fixed.
   3189 
   3190 3.0ea7 - December 14, 2005
   3191 
   3192 * Added -print option to print out grammar w/o actions
   3193 
   3194 * Renamed BaseParser to be BaseRecognizer and even made Lexer derive from
   3195   this; nice as it now shares backtracking support code.
   3196 
   3197 * Added syntactic predicates (...)=>.  See December 4, 2005 entry:
   3198 
   3199   http://www.antlr.org/blog/antlr3/lookahead.tml
   3200 
   3201   Note that we have a new option for turning off rule memoization during
   3202   backtracking:
   3203 
   3204   -nomemo        when backtracking don't generate memoization code
   3205 
   3206 * Predicates are now tested in order that you specify the alts.  If you
   3207   leave the last alt "naked" (w/o pred), it will assume a true pred rather
   3208   than union of other preds.
   3209 
   3210 * Added gated predicates "{p}?=>" that literally turn off a production whereas
   3211 disambiguating predicates are only hoisted into the predictor when syntax alone
   3212 is not sufficient to uniquely predict alternatives.
   3213 
   3214 A : {p}?  => "a" ;
   3215 B : {!p}? => ("a"|"b")+ ;
   3216 
   3217 * bug fixed related to predicates in predictor
   3218 lexer grammar w;
   3219 A : {p}? "a" ;
   3220 B : {!p}? ("a"|"b")+ ;
   3221 DFA is correct.  A state splits for input "a" on the pred.
   3222 Generated code though was hosed.  No pred tests in prediction code!
   3223 I added testLexerPreds() and others in TestSemanticPredicateEvaluation.java
   3224 
   3225 * added execAction template in case we want to do something in front of
   3226   each action execution or something.
   3227 
   3228 * left-recursive cycles from rules w/o decisions were not detected.
   3229 
   3230 * undefined lexer rules were not announced! fixed.
   3231 
   3232 * unreachable messages for Tokens rule now indicate rule name not alt. E.g.,
   3233 
   3234   Ruby.lexer.g:24:1: The following token definitions are unreachable: IVAR
   3235 
   3236 * nondeterminism warnings improved for Tokens rule:
   3237 
   3238 Ruby.lexer.g:10:1: Multiple token rules can match input such as ""0".."9"": INT, FLOAT
   3239 As a result, tokens(s) FLOAT were disabled for that input
   3240 
   3241 
   3242 * DOT diagrams didn't show escaped char properly.
   3243 
   3244 * Char/string literals are now all 'abc' not "abc".
   3245 
   3246 * action syntax changed "@scope::actionname {action}" where scope defaults
   3247   to "parser" if parser grammar or combined grammar, "lexer" if lexer grammar,
   3248   and "treeparser" if tree grammar.  The code generation targets decide
   3249   what scopes are available.  Each "scope" yields a hashtable for use in
   3250   the output templates.  The scopes full of actions are sent to all output
   3251   file templates (currently headerFile and outputFile) as attribute actions.
   3252   Then you can reference <actions.scope> to get the map of actions associated
   3253   with scope and <actions.parser.header> to get the parser's header action
   3254   for example.  This should be very flexible.  The target should only have
   3255   to define which scopes are valid, but the action names should be variable
   3256   so we don't have to recompile ANTLR to add actions to code gen templates.
   3257 
   3258   grammar T;
   3259   options {language=Java;}
   3260   @header { package foo; }
   3261   @parser::stuff { int i; } // names within scope not checked; target dependent
   3262   @members { int i; }
   3263   @lexer::header {head}
   3264   @lexer::members { int j; }
   3265   @headerfile::blort {...} // error: this target doesn't have headerfile
   3266   @treeparser::members {...} // error: this is not a tree parser
   3267   a
   3268   @init {int i;}
   3269     : ID
   3270     ;
   3271   ID : 'a'..'z';
   3272 
   3273   For now, the Java target uses members and header as a valid name.  Within a
   3274   rule, the init action name is valid.
   3275 
   3276 * changed $dynamicscope.value to $dynamicscope::value even if value is defined
   3277   in same rule such as $function::name where rule function defines name.
   3278 
   3279 * $dynamicscope gets you the stack
   3280 
   3281 * rule scopes go like this now:
   3282 
   3283   rule
   3284   scope {...}
   3285   scope slist,Symbols;
   3286   	: ...
   3287 	;
   3288 
   3289 * Created RuleReturnScope as a generic rule return value.  Makes it easier
   3290   to do this:
   3291     RuleReturnScope r = parser.program();
   3292     System.out.println(r.getTemplate().toString());
   3293 
   3294 * $template, $tree, $start, etc...
   3295 
   3296 * $r.x in current rule.  $r is ignored as fully-qualified name. $r.start works too
   3297 
   3298 * added warning about $r referring to both return value of rule and dynamic scope of rule
   3299 
   3300 * integrated StringTemplate in a very simple manner
   3301 
   3302 Syntax:
   3303 -> template(arglist) "..."
   3304 -> template(arglist) <<...>>
   3305 -> namedTemplate(arglist)
   3306 -> {free expression}
   3307 -> // empty
   3308 
   3309 Predicate syntax:
   3310 a : A B -> {p1}? foo(a={$A.text})
   3311         -> {p2}? foo(a={$B.text})
   3312         -> // return nothing
   3313 
   3314 An arg list is just a list of template attribute assignments to actions in curlies.
   3315 
   3316 There is a setTemplateLib() method for you to use with named template rewrites.
   3317 
   3318 Use a new option:
   3319 
   3320 grammar t;
   3321 options {output=template;}
   3322 ...
   3323 
   3324 This all should work for tree grammars too, but I'm still testing.
   3325 
   3326 * fixed bugs where strings were improperly escaped in exceptions, comments, etc..  For example, newlines came out as newlines not the escaped version
   3327 
   3328 3.0ea6 - November 13, 2005
   3329 
   3330 * turned off -debug/-profile, which was on by default
   3331 
   3332 * completely refactored the output templates; added some missing templates.
   3333 
   3334 * dramatically improved infinite recursion error messages (actually
   3335   left-recursion never even was printed out before).
   3336 
   3337 * wasn't printing dangling state messages when it reanalyzes with k=1.
   3338 
   3339 * fixed a nasty bug in the analysis engine dealing with infinite recursion.
   3340   Spent all day thinking about it and cleaned up the code dramatically.
   3341   Bug fixed and software is more powerful and I understand it better! :)
   3342 
   3343 * improved verbose DFA nodes; organized by alt
   3344 
   3345 * got much better random phrase generation.  For example:
   3346 
   3347  $ java org.antlr.tool.RandomPhrase simple.g program
   3348  int Ktcdn ';' method wh '(' ')' '{' return 5 ';' '}'
   3349 
   3350 * empty rules like "a : ;" generated code that didn't compile due to
   3351   try/catch for RecognitionException.  Generated code couldn't possibly
   3352   throw that exception.
   3353 
   3354 * when printing out a grammar, such as in comments in generated code,
   3355   ANTLR didn't print ast suffix stuff back out for literals.
   3356 
   3357 * This never exited loop:
   3358   DATA : (options {greedy=false;}: .* '\n' )* '\n' '.' ;
   3359   and now it works due to new default nongreedy .*  Also this works:
   3360   DATA : (options {greedy=false;}: .* '\n' )* '.' ;
   3361 
   3362 * Dot star ".*" syntax didn't work; in lexer it is nongreedy by
   3363   default.  In parser it is on greedy but also k=1 by default.  Added
   3364   unit tests.  Added blog entry to describe.
   3365 
   3366 * ~T where T is the only token yielded an empty set but no error
   3367 
   3368 * Used to generate unreachable message here:
   3369 
   3370   parser grammar t;
   3371   a : ID a
   3372     | ID
   3373     ;
   3374 
   3375   z.g:3:11: The following alternatives are unreachable: 2
   3376 
   3377   In fact it should really be an error; now it generates:
   3378 
   3379   no start rule in grammar t (no rule can obviously be followed by EOF)
   3380 
   3381   Per next change item, ANTLR cannot know that EOF follows rule 'a'.
   3382 
   3383 * added error message indicating that ANTLR can't figure out what your
   3384   start rule is.  Required to properly generate code in some cases.
   3385 
   3386 * validating semantic predicates now work (if they are false, they
   3387   throw a new FailedPredicateException
   3388 
   3389 * two hideous bug fixes in the IntervalSet, which made analysis go wrong
   3390   in a few cases.  Thanks to Oliver Zeigermann for finding lots of bugs
   3391   and making suggested fixes (including the next two items)!
   3392 
   3393 * cyclic DFAs are now nonstatic and hence can access instance variables
   3394 
   3395 * labels are now allowed on lexical elements (in the lexer)
   3396 
   3397 * added some internal debugging options
   3398 
   3399 * ~'a'* and ~('a')* were not working properly; refactored antlr.g grammar
   3400 
   3401 3.0ea5 - July 5, 2005
   3402 
   3403 * Using '\n' in a parser grammar resulted in a nonescaped version of '\n' in the token names table making compilation fail.  I fixed this by reorganizing/cleaning up portion of ANTLR that deals with literals.  See comment org.antlr.codegen.Target.
   3404 
   3405 * Target.getMaxCharValue() did not use the appropriate max value constant.
   3406 
   3407 * ALLCHAR was a constant when it should use the Target max value def.  set complement for wildcard also didn't use the Target def.  Generally cleaned up the max char value stuff.
   3408 
   3409 * Code gen didn't deal with ASTLabelType properly...I think even the 3.0ea7 example tree parser was broken! :(
   3410 
   3411 * Added a few more unit tests dealing with escaped literals
   3412 
   3413 3.0ea4 - June 29, 2005
   3414 
   3415 * tree parsers work; added CommonTreeNodeStream.  See simplecTreeParser
   3416   example in examples-v3 tarball.
   3417 
   3418 * added superClass and ASTLabelType options
   3419 
   3420 * refactored Parser to have a BaseParser and added TreeParser
   3421 
   3422 * bug fix: actions being dumped in description strings; compile errors
   3423   resulted
   3424 
   3425 3.0ea3 - June 23, 2005
   3426 
   3427 Enhancements
   3428 
   3429 * Automatic tree construction operators are in: ! ^ ^^
   3430 
   3431 * Tree construction rewrite rules are in
   3432 	-> {pred1}? rewrite1
   3433 	-> {pred2}? rewrite2
   3434 	...
   3435 	-> rewriteN
   3436 
   3437   The rewrite rules may be elements like ID, expr, $label, {node expr}
   3438   and trees ^( <root> <children> ).  You have have (...)?, (...)*, (...)+
   3439   subrules as well.
   3440 
   3441   You may have rewrites in subrules not just at outer level of rule, but
   3442   any -> rewrite forces auto AST construction off for that alternative
   3443   of that rule.
   3444 
   3445   To avoid cycles, copy semantics are used:
   3446 
   3447   r : INT -> INT INT ;
   3448 
   3449   means make two new nodes from the same INT token.
   3450 
   3451   Repeated references to a rule element implies a copy for at least one
   3452   tree:
   3453 
   3454   a : atom -> ^(atom atom) ; // NOT CYCLE! (dup atom tree)
   3455 
   3456 * $ruleLabel.tree refers to tree created by matching the labeled element.
   3457 
   3458 * A description of the blocks/alts is generated as a comment in output code
   3459 
   3460 * A timestamp / signature is put at top of each generated code file
   3461 
   3462 3.0ea2 - June 12, 2005
   3463 
   3464 Bug fixes
   3465 
   3466 * Some error messages were missing the stackTrace parameter
   3467 
   3468 * Removed the file locking mechanism as it's not cross platform
   3469 
   3470 * Some absolute vs relative path name problems with writing output
   3471   files.  Rules are now more concrete.  -o option takes precedence
   3472   // -o /tmp /var/lib/t.g => /tmp/T.java
   3473   // -o subdir/output /usr/lib/t.g => subdir/output/T.java
   3474   // -o . /usr/lib/t.g => ./T.java
   3475   // -o /tmp subdir/t.g => /tmp/subdir/t.g
   3476   // If they didn't specify a -o dir so just write to location
   3477   // where grammar is, absolute or relative
   3478 
   3479 * does error checking on unknown option names now
   3480 
   3481 * Using just language code not locale name for error message file.  I.e.,
   3482   the default (and for any English speaking locale) is en.stg not en_US.stg
   3483   anymore.
   3484 
   3485 * The error manager now asks the Tool to panic rather than simply doing
   3486   a System.exit().
   3487 
   3488 * Lots of refactoring concerning grammar, rule, subrule options.  Now
   3489   detects invalid options.
   3490 
   3491 3.0ea1 - June 1, 2005
   3492 
   3493 Initial early access release
   3494