Ok, last runtime and template change before we go beta. I have one  
customer with an outstanding bug (I *think*), but they should be able  
to wait for 3.2.  I now need to go work on the documentation. This  
last change was motivated by discussions with an important customer  
this week. They were talking about the need for excellent error  
recovery so I spent the time to figure out how to handle error  
recovery within an alternative in the presence of actions a tree  
construction. previously x=ID {f($x);} would do crazy things if ID  
we're missing from input string. now, people have the opportunity to  
specify how to conjure up the missing ID. gets added to the tree and  
everything. Very cool... okay, here we go.

Single token insertion and deletion is back in with improvements so  
that it works properly with actions and AST construction :)

Trivial change to Java.stg code gen template so that token labels are  
set according to what match() does in terms of recovery:

/** match a token optionally with a label in front */
tokenRef(token,label,elementIndex,hetero) ::= <<
<if(label)>
<label>=(<labelType>)input.LT(1);<\n>
<endif>
match(input,<token>,FOLLOW_<token>_in_<ruleName><elementIndex>);  
<checkRuleBacktrackFailure()>
 >>

becomes

/** match a token optionally with a label in front */
tokenRef(token,label,elementIndex,hetero) ::= <<
< 
if 
(label 
)> 
< 
label 
 > 
= 
(< 
labelType 
 > 
)< 
endif>match(input,<token>,FOLLOW_<token>_in_<ruleName><elementIndex>);  
<checkRuleBacktrackFailure()>
 >>

The runtime has some easy but widespread changes across files:

Added BaseRecognizer methods: getCurrentInputSymbol(),  
getMissingSymbol()

Made match() return an object so that I can appropriately set token  
labels in the parser or tree parser.

Updated unit tests.

Had to to do some re-factoring of the error handling code, I'm afraid.  
Sorry!  EOF wasn't handled properly in some cases and I needed to make  
the error recovery work better with token labels.

Made debug tree adaptor deal with tokens conjured up during error  
recovery.

I was tempted to improves the debugging protocol to deal better with  
exception information for AW, but decided against it.

Ter
-------------
edit //depot/code/antlr/main/CHANGES.txt#62
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/ 
BaseRecognizer.java#13
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/ 
MismatchedRangeException.java#4
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/ 
MismatchedTokenException.java#5
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/ 
MissingTokenException.java#3
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/ 
Parser.java#6
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/ 
UnwantedTokenException.java#3
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/debug/ 
DebugParser.java#13
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/debug/ 
DebugTreeAdaptor.java#12
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/debug/ 
DebugTreeParser.java#11
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/tree/ 
CommonTreeNodeStream.java#12
edit //depot/code/antlr/main/runtime/Java/src/org/antlr/runtime/tree/ 
TreeParser.java#8
edit //depot/code/antlr/main/src/org/antlr/codegen/templates/Java/ 
Java.stg#129
edit //depot/code/antlr/main/src/org/antlr/test/TestAutoAST.java#27
edit //depot/code/antlr/main/src/org/antlr/test/TestRewriteAST.java#37
Change 4890 submitted.


_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev

Reply via email to