NOTES:

Fixes
        http://www.antlr.org:8888/browse/ANTLR-248
        http://www.antlr.org:8888/browse/ANTLR-344

rebuild from v2.7.7 .g files. I changed a few these.

Templates:

AST.stg:

* I separate out now labels for wildcards; previously they were  
considered token labels. Added attribute referencedWildcardLabels to  
rewriteCode.

* Added

wildcardTrack(label,elementIndex) ::= <<
<super.wildcard(...)>
 >>

* Updated rewriteCodeLabels so that it takes care of wildcards; note  
that it has to use a subtree stream rather than a nodes stream.

* added

rewriteWildcardLabelRef(label) ::= <<
adaptor.addChild(root_<treeLevel>, stream_<label>.nextTree());<\n>
 >>

So you can reference $labelforwildcard in the rewrite section

Java.stg:

* tweaked the following template so that it references wildcards:

ruleLabelDefs() ::= <<
< 
[ruleDescriptor 
.tokenLabels 
,ruleDescriptor.tokenListLabels,ruleDescriptor.wildcardTreeLabels]
     :{<labelType> <it.label.text>=null;}; separator="\n"
 >
...
 >>

ASTTreeParser.stg:

* Added:

/** Match . wildcard and auto dup the node/subtree */
wildcard(token,label,elementIndex,hetero) ::= <<
_last = (<ASTLabelType>)input.LT(1);
<super.wildcard(...)>
<if(!rewriteMode)>
<if(backtracking)>if ( state.backtracking==0 ) {<endif>
<label>_tree = (<ASTLabelType>)adaptor.dupTree(<label>);
adaptor.addChild(root_<treeLevel>, <label>_tree);
<if(backtracking)>}<endif>
<else> <! rewrite mode !>
<if(backtracking)>if ( state.backtracking==0 )<endif>
if ( _first_<treeLevel>==null ) _first_<treeLevel> = <label>;
<endif>
 >>

All other changes should work invisibly in your targets.

Ter
---------------------------
Submitting change 5315.
Locking 24 files ...
edit //depot/code/antlr/main/CHANGES.txt#98
edit //depot/code/antlr/main/src/org/antlr/Tool.java#140
edit //depot/code/antlr/main/src/org/antlr/codegen/ActionTranslator.g#20
edit //depot/code/antlr/main/src/org/antlr/codegen/ 
ActionTranslator.java#48
edit //depot/code/antlr/main/src/org/antlr/codegen/codegen.g#130
edit //depot/code/antlr/main/src/org/antlr/codegen/templates/Java/ 
AST.stg#52
edit //depot/code/antlr/main/src/org/antlr/codegen/templates/Java/ 
ASTTreeParser.stg#11
edit //depot/code/antlr/main/src/org/antlr/codegen/templates/Java/ 
Java.stg#139
edit //depot/code/antlr/main/src/org/antlr/test/BaseTest.java#14
edit //depot/code/antlr/main/src/org/antlr/test/TestAutoAST.java#28
edit //depot/code/antlr/main/src/org/antlr/test/ 
TestCharDFAConversion.java#37
edit //depot/code/antlr/main/src/org/antlr/test/ 
TestDFAConversion.java#70
edit //depot/code/antlr/main/src/org/antlr/test/TestIntervalSet.java#14
edit //depot/code/antlr/main/src/org/antlr/test/ 
TestNFAConstruction.java#34
edit //depot/code/antlr/main/src/org/antlr/test/TestRewriteAST.java#38
edit //depot/code/antlr/main/src/org/antlr/test/ 
TestTreeGrammarRewriteAST.java#11
edit //depot/code/antlr/main/src/org/antlr/tool/ErrorManager.java#90
edit //depot/code/antlr/main/src/org/antlr/tool/Grammar.java#252
edit //depot/code/antlr/main/src/org/antlr/tool/NFAFactory.java#52
edit //depot/code/antlr/main/src/org/antlr/tool/Rule.java#38
edit //depot/code/antlr/main/src/org/antlr/tool/antlr.g#105
edit //depot/code/antlr/main/src/org/antlr/tool/buildnfa.g#72
edit //depot/code/antlr/main/src/org/antlr/tool/define.g#68
edit //depot/code/antlr/main/src/org/antlr/tool/templates/messages/ 
languages/en.stg#23
Change 5315 submitted.

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

Reply via email to