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