From ffd60dc26b94e4e42e7f33ce5793b3d343847957 Mon Sep 17 00:00:00 2001 From: parrt Date: Thu, 4 Feb 2010 18:01:47 -0800 Subject: [PATCH] add def sym; fix errors so they ignore right of -> [git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6666] --- tool/src/org/antlr/v4/parse/ANTLRLexer.java | 4 +- tool/src/org/antlr/v4/parse/ANTLRParser.g | 7 +- tool/src/org/antlr/v4/parse/ANTLRParser.java | 1401 +++++++++-------- tool/src/org/antlr/v4/parse/ASTVerifier.g | 7 +- tool/src/org/antlr/v4/parse/ASTVerifier.java | 411 +++-- .../v4/semantics/BasicSemanticTriggers.g | 6 +- .../v4/semantics/BasicSemanticTriggers.java | 122 +- .../antlr/v4/semantics/DefineSymbolTriggers.g | 104 ++ .../v4/semantics/DefineSymbolTriggers.java | 422 +++++ .../v4/semantics/DefineSymbolTriggers.tokens | 97 ++ .../antlr/v4/semantics/SemanticsPipeline.java | 3 + 11 files changed, 1739 insertions(+), 845 deletions(-) create mode 100644 tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.g create mode 100644 tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.java create mode 100644 tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.tokens diff --git a/tool/src/org/antlr/v4/parse/ANTLRLexer.java b/tool/src/org/antlr/v4/parse/ANTLRLexer.java index 60bd32086..c5a03a225 100644 --- a/tool/src/org/antlr/v4/parse/ANTLRLexer.java +++ b/tool/src/org/antlr/v4/parse/ANTLRLexer.java @@ -1,4 +1,4 @@ -// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRLexer.g 2010-02-03 15:37:27 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRLexer.g 2010-02-04 17:29:59 /* [The "BSD licence"] @@ -263,7 +263,7 @@ public class ANTLRLexer extends Lexer { if ( (( input.LA(2) != '/')) ) { alt3=1; } - else if ( (((( true )&&( !(input.LA(1) == '*' && input.LA(2) == '/') ))||( true ))) ) { + else if ( ((( true )||(( true )&&( !(input.LA(1) == '*' && input.LA(2) == '/') )))) ) { alt3=2; } else { diff --git a/tool/src/org/antlr/v4/parse/ANTLRParser.g b/tool/src/org/antlr/v4/parse/ANTLRParser.g index bc5449cf0..fcf392a0b 100644 --- a/tool/src/org/antlr/v4/parse/ANTLRParser.g +++ b/tool/src/org/antlr/v4/parse/ANTLRParser.g @@ -834,8 +834,7 @@ rewriteTreeAlt rewriteTreeElement : rewriteTreeAtom - | rewriteTreeAtom ebnfSuffix - -> ^( ebnfSuffix ^(REWRITE_BLOCK ^(ALT rewriteTreeAtom)) ) + | rewriteTreeAtom ebnfSuffix -> ^( ebnfSuffix ^(REWRITE_BLOCK ^(ALT rewriteTreeAtom)) ) | rewriteTree ( ebnfSuffix -> ^(ebnfSuffix ^(REWRITE_BLOCK ^(ALT rewriteTree)) ) @@ -845,9 +844,9 @@ rewriteTreeElement ; rewriteTreeAtom - : TOKEN_REF ARG_ACTION? -> ^(TOKEN_REF ARG_ACTION?) // for imaginary nodes + : TOKEN_REF elementOptions? ARG_ACTION? -> ^(TOKEN_REF elementOptions? ARG_ACTION?) // for imaginary nodes | RULE_REF - | STRING_LITERAL + | STRING_LITERAL elementOptions? -> ^(STRING_LITERAL elementOptions?) | DOLLAR id -> LABEL[$DOLLAR,$id.text] // reference to a label in a rewrite rule | ACTION ; diff --git a/tool/src/org/antlr/v4/parse/ANTLRParser.java b/tool/src/org/antlr/v4/parse/ANTLRParser.java index 2bb52ae6b..b07fb045b 100644 --- a/tool/src/org/antlr/v4/parse/ANTLRParser.java +++ b/tool/src/org/antlr/v4/parse/ANTLRParser.java @@ -1,4 +1,4 @@ -// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRParser.g 2010-02-03 15:37:30 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRParser.g 2010-02-04 17:30:01 /* [The "BSD licence"] @@ -283,7 +283,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, DOC_COMMENT, rules, prequelConstruct, grammarType + // elements: rules, DOC_COMMENT, grammarType, prequelConstruct, id // token labels: // rule labels: retval // token list labels: @@ -787,7 +787,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: OPTIONS, option + // elements: option, OPTIONS // token labels: // rule labels: retval // token list labels: @@ -1208,12 +1208,12 @@ public class ANTLRParser extends Parser { { int LA8_1 = input.LA(2); - if ( (LA8_1==ASSIGN) ) { - alt8=1; - } - else if ( ((LA8_1>=COMMA && LA8_1<=SEMI)) ) { + if ( ((LA8_1>=COMMA && LA8_1<=SEMI)) ) { alt8=2; } + else if ( (LA8_1==ASSIGN) ) { + alt8=1; + } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = @@ -1227,12 +1227,12 @@ public class ANTLRParser extends Parser { { int LA8_2 = input.LA(2); - if ( (LA8_2==ASSIGN) ) { - alt8=1; - } - else if ( ((LA8_2>=COMMA && LA8_2<=SEMI)) ) { + if ( ((LA8_2>=COMMA && LA8_2<=SEMI)) ) { alt8=2; } + else if ( (LA8_2==ASSIGN) ) { + alt8=1; + } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = @@ -1558,7 +1558,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, STRING_LITERAL, ASSIGN + // elements: ASSIGN, STRING_LITERAL, id // token labels: // rule labels: retval // token list labels: @@ -1698,7 +1698,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, SCOPE, ACTION + // elements: ACTION, SCOPE, id // token labels: // rule labels: retval // token list labels: @@ -1852,7 +1852,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: actionScopeName, AT, ACTION, id + // elements: id, ACTION, AT, actionScopeName // token labels: // rule labels: retval // token list labels: @@ -2352,7 +2352,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: altListAsBlock, ruleReturns, ARG_ACTION, id, ruleModifiers, DOC_COMMENT, exceptionGroup, rulePrequel + // elements: DOC_COMMENT, ruleReturns, ruleModifiers, id, rulePrequel, exceptionGroup, altListAsBlock, ARG_ACTION // token labels: // rule labels: retval // token list labels: @@ -2578,7 +2578,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ARG_ACTION, ACTION, CATCH + // elements: ACTION, ARG_ACTION, CATCH // token labels: // rule labels: retval // token list labels: @@ -2975,7 +2975,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: qid, THROWS + // elements: THROWS, qid // token labels: // rule labels: retval // token list labels: @@ -3105,7 +3105,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: SCOPE, ACTION + // elements: ACTION, SCOPE // token labels: // rule labels: retval // token list labels: @@ -3184,7 +3184,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: SCOPE, id + // elements: id, SCOPE // token labels: // rule labels: retval // token list labels: @@ -3283,7 +3283,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, AT, ACTION + // elements: AT, id, ACTION // token labels: // rule labels: retval // token list labels: @@ -4828,7 +4828,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: element, TREE_BEGIN + // elements: TREE_BEGIN, element // token labels: // rule labels: retval // token list labels: @@ -5449,7 +5449,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: DOT, id, ruleref + // elements: ruleref, DOT, id // token labels: // rule labels: retval // token list labels: @@ -5507,7 +5507,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: DOT, id, terminal + // elements: terminal, DOT, id // token labels: // rule labels: retval // token list labels: @@ -5706,7 +5706,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: NOT, notTerminal + // elements: notTerminal, NOT // token labels: // rule labels: retval // token list labels: @@ -6013,7 +6013,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ra, ACTION, altList, optionsSpec + // elements: ra, altList, ACTION, optionsSpec // token labels: // rule labels: retval // token list labels: @@ -6540,7 +6540,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: TOKEN_REF, ARG_ACTION, elementOptions + // elements: ARG_ACTION, TOKEN_REF, elementOptions // token labels: // rule labels: retval // token list labels: @@ -6611,7 +6611,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: STRING_LITERAL, elementOptions + // elements: elementOptions, STRING_LITERAL // token labels: // rule labels: retval // token list labels: @@ -6769,7 +6769,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: BANG, terminal + // elements: terminal, BANG // token labels: // rule labels: retval // token list labels: @@ -6991,12 +6991,12 @@ public class ANTLRParser extends Parser { { int LA61_1 = input.LA(2); - if ( (LA61_1==ASSIGN) ) { - alt61=2; - } - else if ( (LA61_1==COMMA||LA61_1==GT||LA61_1==DOT) ) { + if ( (LA61_1==COMMA||LA61_1==GT||LA61_1==DOT) ) { alt61=1; } + else if ( (LA61_1==ASSIGN) ) { + alt61=2; + } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = @@ -7309,7 +7309,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: rewriteAlt, SEMPRED, rewriteAlt, SEMPRED + // elements: SEMPRED, rewriteAlt, rewriteAlt, SEMPRED // token labels: // rule labels: retval // token list labels: @@ -7779,19 +7779,19 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 838:3: -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) ) + // 837:31: -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) ) { - // ANTLRParser.g:838:6: ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) ) + // ANTLRParser.g:837:34: ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot(stream_ebnfSuffix.nextNode(), root_1); - // ANTLRParser.g:838:20: ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) + // ANTLRParser.g:837:48: ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) { GrammarAST root_2 = (GrammarAST)adaptor.nil(); root_2 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(REWRITE_BLOCK, "REWRITE_BLOCK"), root_2); - // ANTLRParser.g:838:36: ^( ALT rewriteTreeAtom ) + // ANTLRParser.g:837:64: ^( ALT rewriteTreeAtom ) { GrammarAST root_3 = (GrammarAST)adaptor.nil(); root_3 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(ALT, "ALT"), root_3); @@ -7813,15 +7813,15 @@ public class ANTLRParser extends Parser { } break; case 3 : - // ANTLRParser.g:839:6: rewriteTree ( ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) | -> rewriteTree ) + // ANTLRParser.g:838:6: rewriteTree ( ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) | -> rewriteTree ) { - pushFollow(FOLLOW_rewriteTree_in_rewriteTreeElement4454); + pushFollow(FOLLOW_rewriteTree_in_rewriteTreeElement4452); rewriteTree191=rewriteTree(); state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_rewriteTree.add(rewriteTree191.getTree()); - // ANTLRParser.g:840:3: ( ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) | -> rewriteTree ) + // ANTLRParser.g:839:3: ( ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) | -> rewriteTree ) int alt65=2; int LA65_0 = input.LA(1); @@ -7840,9 +7840,9 @@ public class ANTLRParser extends Parser { } switch (alt65) { case 1 : - // ANTLRParser.g:840:5: ebnfSuffix + // ANTLRParser.g:839:5: ebnfSuffix { - pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeElement4460); + pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeElement4458); ebnfSuffix192=ebnfSuffix(); state._fsp--; @@ -7851,7 +7851,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ebnfSuffix, rewriteTree + // elements: rewriteTree, ebnfSuffix // token labels: // rule labels: retval // token list labels: @@ -7862,19 +7862,19 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 841:4: -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) + // 840:4: -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) { - // ANTLRParser.g:841:7: ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) + // ANTLRParser.g:840:7: ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot(stream_ebnfSuffix.nextNode(), root_1); - // ANTLRParser.g:841:20: ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) + // ANTLRParser.g:840:20: ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) { GrammarAST root_2 = (GrammarAST)adaptor.nil(); root_2 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(REWRITE_BLOCK, "REWRITE_BLOCK"), root_2); - // ANTLRParser.g:841:36: ^( ALT rewriteTree ) + // ANTLRParser.g:840:36: ^( ALT rewriteTree ) { GrammarAST root_3 = (GrammarAST)adaptor.nil(); root_3 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(ALT, "ALT"), root_3); @@ -7896,7 +7896,7 @@ public class ANTLRParser extends Parser { } break; case 2 : - // ANTLRParser.g:842:5: + // ANTLRParser.g:841:5: { // AST REWRITE @@ -7911,7 +7911,7 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 842:5: -> rewriteTree + // 841:5: -> rewriteTree { adaptor.addChild(root_0, stream_rewriteTree.nextTree()); @@ -7927,11 +7927,11 @@ public class ANTLRParser extends Parser { } break; case 4 : - // ANTLRParser.g:844:6: rewriteTreeEbnf + // ANTLRParser.g:843:6: rewriteTreeEbnf { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement4499); + pushFollow(FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement4497); rewriteTreeEbnf193=rewriteTreeEbnf(); state._fsp--; @@ -7968,7 +7968,7 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTreeAtom" - // ANTLRParser.g:847:1: rewriteTreeAtom : ( TOKEN_REF ( ARG_ACTION )? -> ^( TOKEN_REF ( ARG_ACTION )? ) | RULE_REF | STRING_LITERAL | DOLLAR id -> LABEL[$DOLLAR,$id.text] | ACTION ); + // ANTLRParser.g:846:1: rewriteTreeAtom : ( TOKEN_REF ( elementOptions )? ( ARG_ACTION )? -> ^( TOKEN_REF ( elementOptions )? ( ARG_ACTION )? ) | RULE_REF | STRING_LITERAL ( elementOptions )? -> ^( STRING_LITERAL ( elementOptions )? ) | DOLLAR id -> LABEL[$DOLLAR,$id.text] | ACTION ); public final ANTLRParser.rewriteTreeAtom_return rewriteTreeAtom() throws RecognitionException { ANTLRParser.rewriteTreeAtom_return retval = new ANTLRParser.rewriteTreeAtom_return(); retval.start = input.LT(1); @@ -7976,81 +7976,110 @@ public class ANTLRParser extends Parser { GrammarAST root_0 = null; Token TOKEN_REF194=null; - Token ARG_ACTION195=null; - Token RULE_REF196=null; - Token STRING_LITERAL197=null; - Token DOLLAR198=null; - Token ACTION200=null; - ANTLRParser.id_return id199 = null; + Token ARG_ACTION196=null; + Token RULE_REF197=null; + Token STRING_LITERAL198=null; + Token DOLLAR200=null; + Token ACTION202=null; + ANTLRParser.elementOptions_return elementOptions195 = null; + + ANTLRParser.elementOptions_return elementOptions199 = null; + + ANTLRParser.id_return id201 = null; GrammarAST TOKEN_REF194_tree=null; - GrammarAST ARG_ACTION195_tree=null; - GrammarAST RULE_REF196_tree=null; - GrammarAST STRING_LITERAL197_tree=null; - GrammarAST DOLLAR198_tree=null; - GrammarAST ACTION200_tree=null; + GrammarAST ARG_ACTION196_tree=null; + GrammarAST RULE_REF197_tree=null; + GrammarAST STRING_LITERAL198_tree=null; + GrammarAST DOLLAR200_tree=null; + GrammarAST ACTION202_tree=null; RewriteRuleTokenStream stream_DOLLAR=new RewriteRuleTokenStream(adaptor,"token DOLLAR"); + RewriteRuleTokenStream stream_STRING_LITERAL=new RewriteRuleTokenStream(adaptor,"token STRING_LITERAL"); RewriteRuleTokenStream stream_TOKEN_REF=new RewriteRuleTokenStream(adaptor,"token TOKEN_REF"); RewriteRuleTokenStream stream_ARG_ACTION=new RewriteRuleTokenStream(adaptor,"token ARG_ACTION"); RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id"); + RewriteRuleSubtreeStream stream_elementOptions=new RewriteRuleSubtreeStream(adaptor,"rule elementOptions"); try { - // ANTLRParser.g:848:5: ( TOKEN_REF ( ARG_ACTION )? -> ^( TOKEN_REF ( ARG_ACTION )? ) | RULE_REF | STRING_LITERAL | DOLLAR id -> LABEL[$DOLLAR,$id.text] | ACTION ) - int alt68=5; + // ANTLRParser.g:847:5: ( TOKEN_REF ( elementOptions )? ( ARG_ACTION )? -> ^( TOKEN_REF ( elementOptions )? ( ARG_ACTION )? ) | RULE_REF | STRING_LITERAL ( elementOptions )? -> ^( STRING_LITERAL ( elementOptions )? ) | DOLLAR id -> LABEL[$DOLLAR,$id.text] | ACTION ) + int alt70=5; switch ( input.LA(1) ) { case TOKEN_REF: { - alt68=1; + alt70=1; } break; case RULE_REF: { - alt68=2; + alt70=2; } break; case STRING_LITERAL: { - alt68=3; + alt70=3; } break; case DOLLAR: { - alt68=4; + alt70=4; } break; case ACTION: { - alt68=5; + alt70=5; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = - new NoViableAltException("", 68, 0, input); + new NoViableAltException("", 70, 0, input); throw nvae; } - switch (alt68) { + switch (alt70) { case 1 : - // ANTLRParser.g:848:9: TOKEN_REF ( ARG_ACTION )? + // ANTLRParser.g:847:9: TOKEN_REF ( elementOptions )? ( ARG_ACTION )? { - TOKEN_REF194=(Token)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom4515); if (state.failed) return retval; + TOKEN_REF194=(Token)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom4513); if (state.failed) return retval; if ( state.backtracking==0 ) stream_TOKEN_REF.add(TOKEN_REF194); - // ANTLRParser.g:848:19: ( ARG_ACTION )? + // ANTLRParser.g:847:19: ( elementOptions )? int alt67=2; int LA67_0 = input.LA(1); - if ( (LA67_0==ARG_ACTION) ) { + if ( (LA67_0==LT) ) { alt67=1; } switch (alt67) { case 1 : - // ANTLRParser.g:848:19: ARG_ACTION + // ANTLRParser.g:847:19: elementOptions { - ARG_ACTION195=(Token)match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom4517); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ARG_ACTION.add(ARG_ACTION195); + pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom4515); + elementOptions195=elementOptions(); + + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_elementOptions.add(elementOptions195.getTree()); + + } + break; + + } + + // ANTLRParser.g:847:35: ( ARG_ACTION )? + int alt68=2; + int LA68_0 = input.LA(1); + + if ( (LA68_0==ARG_ACTION) ) { + alt68=1; + } + switch (alt68) { + case 1 : + // ANTLRParser.g:847:35: ARG_ACTION + { + ARG_ACTION196=(Token)match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom4518); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ARG_ACTION.add(ARG_ACTION196); } @@ -8061,7 +8090,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ARG_ACTION, TOKEN_REF + // elements: ARG_ACTION, elementOptions, TOKEN_REF // token labels: // rule labels: retval // token list labels: @@ -8072,14 +8101,20 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 848:31: -> ^( TOKEN_REF ( ARG_ACTION )? ) + // 847:47: -> ^( TOKEN_REF ( elementOptions )? ( ARG_ACTION )? ) { - // ANTLRParser.g:848:34: ^( TOKEN_REF ( ARG_ACTION )? ) + // ANTLRParser.g:847:50: ^( TOKEN_REF ( elementOptions )? ( ARG_ACTION )? ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot(new TerminalAST(stream_TOKEN_REF.nextToken()), root_1); - // ANTLRParser.g:848:59: ( ARG_ACTION )? + // ANTLRParser.g:847:75: ( elementOptions )? + if ( stream_elementOptions.hasNext() ) { + adaptor.addChild(root_1, stream_elementOptions.nextTree()); + + } + stream_elementOptions.reset(); + // ANTLRParser.g:847:91: ( ARG_ACTION )? if ( stream_ARG_ACTION.hasNext() ) { adaptor.addChild(root_1, stream_ARG_ACTION.nextNode()); @@ -8095,43 +8130,95 @@ public class ANTLRParser extends Parser { } break; case 2 : - // ANTLRParser.g:849:9: RULE_REF + // ANTLRParser.g:848:9: RULE_REF { root_0 = (GrammarAST)adaptor.nil(); - RULE_REF196=(Token)match(input,RULE_REF,FOLLOW_RULE_REF_in_rewriteTreeAtom4541); if (state.failed) return retval; + RULE_REF197=(Token)match(input,RULE_REF,FOLLOW_RULE_REF_in_rewriteTreeAtom4545); if (state.failed) return retval; if ( state.backtracking==0 ) { - RULE_REF196_tree = (GrammarAST)adaptor.create(RULE_REF196); - adaptor.addChild(root_0, RULE_REF196_tree); + RULE_REF197_tree = (GrammarAST)adaptor.create(RULE_REF197); + adaptor.addChild(root_0, RULE_REF197_tree); } } break; case 3 : - // ANTLRParser.g:850:6: STRING_LITERAL + // ANTLRParser.g:849:6: STRING_LITERAL ( elementOptions )? { - root_0 = (GrammarAST)adaptor.nil(); + STRING_LITERAL198=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom4552); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_STRING_LITERAL.add(STRING_LITERAL198); + + // ANTLRParser.g:849:21: ( elementOptions )? + int alt69=2; + int LA69_0 = input.LA(1); + + if ( (LA69_0==LT) ) { + alt69=1; + } + switch (alt69) { + case 1 : + // ANTLRParser.g:849:21: elementOptions + { + pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom4554); + elementOptions199=elementOptions(); + + state._fsp--; + if (state.failed) return retval; + if ( state.backtracking==0 ) stream_elementOptions.add(elementOptions199.getTree()); + + } + break; - STRING_LITERAL197=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom4548); if (state.failed) return retval; - if ( state.backtracking==0 ) { - STRING_LITERAL197_tree = new TerminalAST(STRING_LITERAL197) ; - adaptor.addChild(root_0, STRING_LITERAL197_tree); } + + + // AST REWRITE + // elements: elementOptions, STRING_LITERAL + // token labels: + // rule labels: retval + // token list labels: + // rule list labels: + // wildcard labels: + if ( state.backtracking==0 ) { + retval.tree = root_0; + RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); + + root_0 = (GrammarAST)adaptor.nil(); + // 849:40: -> ^( STRING_LITERAL ( elementOptions )? ) + { + // ANTLRParser.g:849:43: ^( STRING_LITERAL ( elementOptions )? ) + { + GrammarAST root_1 = (GrammarAST)adaptor.nil(); + root_1 = (GrammarAST)adaptor.becomeRoot(new TerminalAST(stream_STRING_LITERAL.nextToken()), root_1); + + // ANTLRParser.g:849:73: ( elementOptions )? + if ( stream_elementOptions.hasNext() ) { + adaptor.addChild(root_1, stream_elementOptions.nextTree()); + + } + stream_elementOptions.reset(); + + adaptor.addChild(root_0, root_1); + } + + } + + retval.tree = root_0;} } break; case 4 : - // ANTLRParser.g:851:6: DOLLAR id + // ANTLRParser.g:850:6: DOLLAR id { - DOLLAR198=(Token)match(input,DOLLAR,FOLLOW_DOLLAR_in_rewriteTreeAtom4558); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_DOLLAR.add(DOLLAR198); + DOLLAR200=(Token)match(input,DOLLAR,FOLLOW_DOLLAR_in_rewriteTreeAtom4577); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_DOLLAR.add(DOLLAR200); - pushFollow(FOLLOW_id_in_rewriteTreeAtom4560); - id199=id(); + pushFollow(FOLLOW_id_in_rewriteTreeAtom4579); + id201=id(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_id.add(id199.getTree()); + if ( state.backtracking==0 ) stream_id.add(id201.getTree()); // AST REWRITE @@ -8146,9 +8233,9 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 851:16: -> LABEL[$DOLLAR,$id.text] + // 850:16: -> LABEL[$DOLLAR,$id.text] { - adaptor.addChild(root_0, (GrammarAST)adaptor.create(LABEL, DOLLAR198, (id199!=null?input.toString(id199.start,id199.stop):null))); + adaptor.addChild(root_0, (GrammarAST)adaptor.create(LABEL, DOLLAR200, (id201!=null?input.toString(id201.start,id201.stop):null))); } @@ -8156,14 +8243,14 @@ public class ANTLRParser extends Parser { } break; case 5 : - // ANTLRParser.g:852:4: ACTION + // ANTLRParser.g:851:4: ACTION { root_0 = (GrammarAST)adaptor.nil(); - ACTION200=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteTreeAtom4571); if (state.failed) return retval; + ACTION202=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteTreeAtom4590); if (state.failed) return retval; if ( state.backtracking==0 ) { - ACTION200_tree = (GrammarAST)adaptor.create(ACTION200); - adaptor.addChild(root_0, ACTION200_tree); + ACTION202_tree = (GrammarAST)adaptor.create(ACTION202); + adaptor.addChild(root_0, ACTION202_tree); } } @@ -8196,7 +8283,7 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTreeEbnf" - // ANTLRParser.g:855:1: rewriteTreeEbnf : lp= LPAREN rewriteTreeAlt RPAREN ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) ; + // ANTLRParser.g:854:1: rewriteTreeEbnf : lp= LPAREN rewriteTreeAlt RPAREN ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) ; public final ANTLRParser.rewriteTreeEbnf_return rewriteTreeEbnf() throws RecognitionException { ANTLRParser.rewriteTreeEbnf_return retval = new ANTLRParser.rewriteTreeEbnf_return(); retval.start = input.LT(1); @@ -8204,14 +8291,14 @@ public class ANTLRParser extends Parser { GrammarAST root_0 = null; Token lp=null; - Token RPAREN202=null; - ANTLRParser.rewriteTreeAlt_return rewriteTreeAlt201 = null; + Token RPAREN204=null; + ANTLRParser.rewriteTreeAlt_return rewriteTreeAlt203 = null; - ANTLRParser.ebnfSuffix_return ebnfSuffix203 = null; + ANTLRParser.ebnfSuffix_return ebnfSuffix205 = null; GrammarAST lp_tree=null; - GrammarAST RPAREN202_tree=null; + GrammarAST RPAREN204_tree=null; RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN"); RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN"); RewriteRuleSubtreeStream stream_rewriteTreeAlt=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTreeAlt"); @@ -8220,27 +8307,27 @@ public class ANTLRParser extends Parser { Token firstToken = input.LT(1); try { - // ANTLRParser.g:863:2: (lp= LPAREN rewriteTreeAlt RPAREN ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) ) - // ANTLRParser.g:863:4: lp= LPAREN rewriteTreeAlt RPAREN ebnfSuffix + // ANTLRParser.g:862:2: (lp= LPAREN rewriteTreeAlt RPAREN ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) ) + // ANTLRParser.g:862:4: lp= LPAREN rewriteTreeAlt RPAREN ebnfSuffix { - lp=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteTreeEbnf4594); if (state.failed) return retval; + lp=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteTreeEbnf4613); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LPAREN.add(lp); - pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf4596); - rewriteTreeAlt201=rewriteTreeAlt(); + pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf4615); + rewriteTreeAlt203=rewriteTreeAlt(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTreeAlt.add(rewriteTreeAlt201.getTree()); - RPAREN202=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTreeEbnf4598); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN202); + if ( state.backtracking==0 ) stream_rewriteTreeAlt.add(rewriteTreeAlt203.getTree()); + RPAREN204=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTreeEbnf4617); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN204); - pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf4600); - ebnfSuffix203=ebnfSuffix(); + pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf4619); + ebnfSuffix205=ebnfSuffix(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ebnfSuffix.add(ebnfSuffix203.getTree()); + if ( state.backtracking==0 ) stream_ebnfSuffix.add(ebnfSuffix205.getTree()); // AST REWRITE @@ -8255,14 +8342,14 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 863:47: -> ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) + // 862:47: -> ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) { - // ANTLRParser.g:863:50: ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) + // ANTLRParser.g:862:50: ^( ebnfSuffix ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot(stream_ebnfSuffix.nextNode(), root_1); - // ANTLRParser.g:863:63: ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) + // ANTLRParser.g:862:63: ^( REWRITE_BLOCK[$lp] rewriteTreeAlt ) { GrammarAST root_2 = (GrammarAST)adaptor.nil(); root_2 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(REWRITE_BLOCK, lp), root_2); @@ -8312,76 +8399,76 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTree" - // ANTLRParser.g:866:1: rewriteTree : TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* RPAREN -> ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ; + // ANTLRParser.g:865:1: rewriteTree : TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* RPAREN -> ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ; public final ANTLRParser.rewriteTree_return rewriteTree() throws RecognitionException { ANTLRParser.rewriteTree_return retval = new ANTLRParser.rewriteTree_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token TREE_BEGIN204=null; - Token RPAREN207=null; - ANTLRParser.rewriteTreeAtom_return rewriteTreeAtom205 = null; + Token TREE_BEGIN206=null; + Token RPAREN209=null; + ANTLRParser.rewriteTreeAtom_return rewriteTreeAtom207 = null; - ANTLRParser.rewriteTreeElement_return rewriteTreeElement206 = null; + ANTLRParser.rewriteTreeElement_return rewriteTreeElement208 = null; - GrammarAST TREE_BEGIN204_tree=null; - GrammarAST RPAREN207_tree=null; + GrammarAST TREE_BEGIN206_tree=null; + GrammarAST RPAREN209_tree=null; RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN"); RewriteRuleTokenStream stream_TREE_BEGIN=new RewriteRuleTokenStream(adaptor,"token TREE_BEGIN"); RewriteRuleSubtreeStream stream_rewriteTreeAtom=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTreeAtom"); RewriteRuleSubtreeStream stream_rewriteTreeElement=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTreeElement"); try { - // ANTLRParser.g:867:2: ( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* RPAREN -> ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ) - // ANTLRParser.g:867:4: TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* RPAREN + // ANTLRParser.g:866:2: ( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* RPAREN -> ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ) + // ANTLRParser.g:866:4: TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* RPAREN { - TREE_BEGIN204=(Token)match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewriteTree4624); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_TREE_BEGIN.add(TREE_BEGIN204); + TREE_BEGIN206=(Token)match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewriteTree4643); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_TREE_BEGIN.add(TREE_BEGIN206); - pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTree4626); - rewriteTreeAtom205=rewriteTreeAtom(); + pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTree4645); + rewriteTreeAtom207=rewriteTreeAtom(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTreeAtom.add(rewriteTreeAtom205.getTree()); - // ANTLRParser.g:867:31: ( rewriteTreeElement )* - loop69: + if ( state.backtracking==0 ) stream_rewriteTreeAtom.add(rewriteTreeAtom207.getTree()); + // ANTLRParser.g:866:31: ( rewriteTreeElement )* + loop71: do { - int alt69=2; - int LA69_0 = input.LA(1); + int alt71=2; + int LA71_0 = input.LA(1); - if ( (LA69_0==ACTION||LA69_0==LPAREN||LA69_0==DOLLAR||LA69_0==TREE_BEGIN||(LA69_0>=TOKEN_REF && LA69_0<=RULE_REF)||LA69_0==STRING_LITERAL) ) { - alt69=1; + if ( (LA71_0==ACTION||LA71_0==LPAREN||LA71_0==DOLLAR||LA71_0==TREE_BEGIN||(LA71_0>=TOKEN_REF && LA71_0<=RULE_REF)||LA71_0==STRING_LITERAL) ) { + alt71=1; } - switch (alt69) { + switch (alt71) { case 1 : - // ANTLRParser.g:867:31: rewriteTreeElement + // ANTLRParser.g:866:31: rewriteTreeElement { - pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTree4628); - rewriteTreeElement206=rewriteTreeElement(); + pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTree4647); + rewriteTreeElement208=rewriteTreeElement(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTreeElement.add(rewriteTreeElement206.getTree()); + if ( state.backtracking==0 ) stream_rewriteTreeElement.add(rewriteTreeElement208.getTree()); } break; default : - break loop69; + break loop71; } } while (true); - RPAREN207=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTree4631); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN207); + RPAREN209=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTree4650); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN209); // AST REWRITE - // elements: TREE_BEGIN, rewriteTreeElement, rewriteTreeAtom + // elements: rewriteTreeAtom, TREE_BEGIN, rewriteTreeElement // token labels: // rule labels: retval // token list labels: @@ -8392,15 +8479,15 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 868:3: -> ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) + // 867:3: -> ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) { - // ANTLRParser.g:868:6: ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) + // ANTLRParser.g:867:6: ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot(stream_TREE_BEGIN.nextNode(), root_1); adaptor.addChild(root_1, stream_rewriteTreeAtom.nextTree()); - // ANTLRParser.g:868:35: ( rewriteTreeElement )* + // ANTLRParser.g:867:35: ( rewriteTreeElement )* while ( stream_rewriteTreeElement.hasNext() ) { adaptor.addChild(root_1, stream_rewriteTreeElement.nextTree()); @@ -8441,7 +8528,7 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTemplate" - // ANTLRParser.g:871:1: rewriteTemplate : ( TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ); + // ANTLRParser.g:870:1: rewriteTemplate : ( TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ); public final ANTLRParser.rewriteTemplate_return rewriteTemplate() throws RecognitionException { ANTLRParser.rewriteTemplate_return retval = new ANTLRParser.rewriteTemplate_return(); retval.start = input.LT(1); @@ -8449,22 +8536,22 @@ public class ANTLRParser extends Parser { GrammarAST root_0 = null; Token str=null; - Token TEMPLATE208=null; - Token LPAREN209=null; - Token RPAREN211=null; - Token ACTION214=null; - ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs210 = null; + Token TEMPLATE210=null; + Token LPAREN211=null; + Token RPAREN213=null; + Token ACTION216=null; + ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs212 = null; - ANTLRParser.rewriteTemplateRef_return rewriteTemplateRef212 = null; + ANTLRParser.rewriteTemplateRef_return rewriteTemplateRef214 = null; - ANTLRParser.rewriteIndirectTemplateHead_return rewriteIndirectTemplateHead213 = null; + ANTLRParser.rewriteIndirectTemplateHead_return rewriteIndirectTemplateHead215 = null; GrammarAST str_tree=null; - GrammarAST TEMPLATE208_tree=null; - GrammarAST LPAREN209_tree=null; - GrammarAST RPAREN211_tree=null; - GrammarAST ACTION214_tree=null; + GrammarAST TEMPLATE210_tree=null; + GrammarAST LPAREN211_tree=null; + GrammarAST RPAREN213_tree=null; + GrammarAST ACTION216_tree=null; RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN"); RewriteRuleTokenStream stream_DOUBLE_QUOTE_STRING_LITERAL=new RewriteRuleTokenStream(adaptor,"token DOUBLE_QUOTE_STRING_LITERAL"); RewriteRuleTokenStream stream_TEMPLATE=new RewriteRuleTokenStream(adaptor,"token TEMPLATE"); @@ -8472,59 +8559,59 @@ public class ANTLRParser extends Parser { RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN"); RewriteRuleSubtreeStream stream_rewriteTemplateArgs=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTemplateArgs"); try { - // ANTLRParser.g:882:2: ( TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ) - int alt71=4; - alt71 = dfa71.predict(input); - switch (alt71) { + // ANTLRParser.g:881:2: ( TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ) + int alt73=4; + alt73 = dfa73.predict(input); + switch (alt73) { case 1 : - // ANTLRParser.g:883:3: TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) + // ANTLRParser.g:882:3: TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) { - TEMPLATE208=(Token)match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate4663); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_TEMPLATE.add(TEMPLATE208); + TEMPLATE210=(Token)match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate4682); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_TEMPLATE.add(TEMPLATE210); - LPAREN209=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteTemplate4665); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN209); + LPAREN211=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteTemplate4684); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN211); - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate4667); - rewriteTemplateArgs210=rewriteTemplateArgs(); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate4686); + rewriteTemplateArgs212=rewriteTemplateArgs(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTemplateArgs.add(rewriteTemplateArgs210.getTree()); - RPAREN211=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTemplate4669); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN211); + if ( state.backtracking==0 ) stream_rewriteTemplateArgs.add(rewriteTemplateArgs212.getTree()); + RPAREN213=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTemplate4688); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN213); - // ANTLRParser.g:884:3: (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) - int alt70=2; - int LA70_0 = input.LA(1); + // ANTLRParser.g:883:3: (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) + int alt72=2; + int LA72_0 = input.LA(1); - if ( (LA70_0==DOUBLE_QUOTE_STRING_LITERAL) ) { - alt70=1; + if ( (LA72_0==DOUBLE_QUOTE_STRING_LITERAL) ) { + alt72=1; } - else if ( (LA70_0==DOUBLE_ANGLE_STRING_LITERAL) ) { - alt70=2; + else if ( (LA72_0==DOUBLE_ANGLE_STRING_LITERAL) ) { + alt72=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = - new NoViableAltException("", 70, 0, input); + new NoViableAltException("", 72, 0, input); throw nvae; } - switch (alt70) { + switch (alt72) { case 1 : - // ANTLRParser.g:884:5: str= DOUBLE_QUOTE_STRING_LITERAL + // ANTLRParser.g:883:5: str= DOUBLE_QUOTE_STRING_LITERAL { - str=(Token)match(input,DOUBLE_QUOTE_STRING_LITERAL,FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate4677); if (state.failed) return retval; + str=(Token)match(input,DOUBLE_QUOTE_STRING_LITERAL,FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate4696); if (state.failed) return retval; if ( state.backtracking==0 ) stream_DOUBLE_QUOTE_STRING_LITERAL.add(str); } break; case 2 : - // ANTLRParser.g:884:39: str= DOUBLE_ANGLE_STRING_LITERAL + // ANTLRParser.g:883:39: str= DOUBLE_ANGLE_STRING_LITERAL { - str=(Token)match(input,DOUBLE_ANGLE_STRING_LITERAL,FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate4683); if (state.failed) return retval; + str=(Token)match(input,DOUBLE_ANGLE_STRING_LITERAL,FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate4702); if (state.failed) return retval; if ( state.backtracking==0 ) stream_DOUBLE_ANGLE_STRING_LITERAL.add(str); @@ -8536,7 +8623,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: str, TEMPLATE, rewriteTemplateArgs + // elements: TEMPLATE, rewriteTemplateArgs, str // token labels: str // rule labels: retval // token list labels: @@ -8548,14 +8635,14 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 885:3: -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) + // 884:3: -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) { - // ANTLRParser.g:885:6: ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) + // ANTLRParser.g:884:6: ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); - root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(TEMPLATE, TEMPLATE208, "TEMPLATE"), root_1); + root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(TEMPLATE, TEMPLATE210, "TEMPLATE"), root_1); - // ANTLRParser.g:885:39: ( rewriteTemplateArgs )? + // ANTLRParser.g:884:39: ( rewriteTemplateArgs )? if ( stream_rewriteTemplateArgs.hasNext() ) { adaptor.addChild(root_1, stream_rewriteTemplateArgs.nextTree()); @@ -8572,42 +8659,42 @@ public class ANTLRParser extends Parser { } break; case 2 : - // ANTLRParser.g:888:3: rewriteTemplateRef + // ANTLRParser.g:887:3: rewriteTemplateRef { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_rewriteTemplateRef_in_rewriteTemplate4709); - rewriteTemplateRef212=rewriteTemplateRef(); + pushFollow(FOLLOW_rewriteTemplateRef_in_rewriteTemplate4728); + rewriteTemplateRef214=rewriteTemplateRef(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, rewriteTemplateRef212.getTree()); + if ( state.backtracking==0 ) adaptor.addChild(root_0, rewriteTemplateRef214.getTree()); } break; case 3 : - // ANTLRParser.g:891:3: rewriteIndirectTemplateHead + // ANTLRParser.g:890:3: rewriteIndirectTemplateHead { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate4718); - rewriteIndirectTemplateHead213=rewriteIndirectTemplateHead(); + pushFollow(FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate4737); + rewriteIndirectTemplateHead215=rewriteIndirectTemplateHead(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, rewriteIndirectTemplateHead213.getTree()); + if ( state.backtracking==0 ) adaptor.addChild(root_0, rewriteIndirectTemplateHead215.getTree()); } break; case 4 : - // ANTLRParser.g:894:3: ACTION + // ANTLRParser.g:893:3: ACTION { root_0 = (GrammarAST)adaptor.nil(); - ACTION214=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplate4727); if (state.failed) return retval; + ACTION216=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplate4746); if (state.failed) return retval; if ( state.backtracking==0 ) { - ACTION214_tree = (GrammarAST)adaptor.create(ACTION214); - adaptor.addChild(root_0, ACTION214_tree); + ACTION216_tree = (GrammarAST)adaptor.create(ACTION216); + adaptor.addChild(root_0, ACTION216_tree); } } @@ -8640,47 +8727,47 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTemplateRef" - // ANTLRParser.g:897:1: rewriteTemplateRef : id LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) ; + // ANTLRParser.g:896:1: rewriteTemplateRef : id LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) ; public final ANTLRParser.rewriteTemplateRef_return rewriteTemplateRef() throws RecognitionException { ANTLRParser.rewriteTemplateRef_return retval = new ANTLRParser.rewriteTemplateRef_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token LPAREN216=null; - Token RPAREN218=null; - ANTLRParser.id_return id215 = null; + Token LPAREN218=null; + Token RPAREN220=null; + ANTLRParser.id_return id217 = null; - ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs217 = null; + ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs219 = null; - GrammarAST LPAREN216_tree=null; - GrammarAST RPAREN218_tree=null; + GrammarAST LPAREN218_tree=null; + GrammarAST RPAREN220_tree=null; RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN"); RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN"); RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id"); RewriteRuleSubtreeStream stream_rewriteTemplateArgs=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTemplateArgs"); try { - // ANTLRParser.g:899:2: ( id LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) ) - // ANTLRParser.g:899:4: id LPAREN rewriteTemplateArgs RPAREN + // ANTLRParser.g:898:2: ( id LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) ) + // ANTLRParser.g:898:4: id LPAREN rewriteTemplateArgs RPAREN { - pushFollow(FOLLOW_id_in_rewriteTemplateRef4740); - id215=id(); + pushFollow(FOLLOW_id_in_rewriteTemplateRef4759); + id217=id(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_id.add(id215.getTree()); - LPAREN216=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteTemplateRef4742); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN216); + if ( state.backtracking==0 ) stream_id.add(id217.getTree()); + LPAREN218=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteTemplateRef4761); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN218); - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef4744); - rewriteTemplateArgs217=rewriteTemplateArgs(); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef4763); + rewriteTemplateArgs219=rewriteTemplateArgs(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTemplateArgs.add(rewriteTemplateArgs217.getTree()); - RPAREN218=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTemplateRef4746); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN218); + if ( state.backtracking==0 ) stream_rewriteTemplateArgs.add(rewriteTemplateArgs219.getTree()); + RPAREN220=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteTemplateRef4765); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN220); @@ -8696,15 +8783,15 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 900:3: -> ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) + // 899:3: -> ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) { - // ANTLRParser.g:900:6: ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) + // ANTLRParser.g:899:6: ^( TEMPLATE[$LPAREN,\"TEMPLATE\"] id ( rewriteTemplateArgs )? ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); - root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(TEMPLATE, LPAREN216, "TEMPLATE"), root_1); + root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(TEMPLATE, LPAREN218, "TEMPLATE"), root_1); adaptor.addChild(root_1, stream_id.nextTree()); - // ANTLRParser.g:900:40: ( rewriteTemplateArgs )? + // ANTLRParser.g:899:40: ( rewriteTemplateArgs )? if ( stream_rewriteTemplateArgs.hasNext() ) { adaptor.addChild(root_1, stream_rewriteTemplateArgs.nextTree()); @@ -8745,7 +8832,7 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteIndirectTemplateHead" - // ANTLRParser.g:903:1: rewriteIndirectTemplateHead : lp= LPAREN ACTION RPAREN LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) ; + // ANTLRParser.g:902:1: rewriteIndirectTemplateHead : lp= LPAREN ACTION RPAREN LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) ; public final ANTLRParser.rewriteIndirectTemplateHead_return rewriteIndirectTemplateHead() throws RecognitionException { ANTLRParser.rewriteIndirectTemplateHead_return retval = new ANTLRParser.rewriteIndirectTemplateHead_return(); retval.start = input.LT(1); @@ -8753,51 +8840,51 @@ public class ANTLRParser extends Parser { GrammarAST root_0 = null; Token lp=null; - Token ACTION219=null; - Token RPAREN220=null; - Token LPAREN221=null; - Token RPAREN223=null; - ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs222 = null; + Token ACTION221=null; + Token RPAREN222=null; + Token LPAREN223=null; + Token RPAREN225=null; + ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs224 = null; GrammarAST lp_tree=null; - GrammarAST ACTION219_tree=null; - GrammarAST RPAREN220_tree=null; - GrammarAST LPAREN221_tree=null; - GrammarAST RPAREN223_tree=null; + GrammarAST ACTION221_tree=null; + GrammarAST RPAREN222_tree=null; + GrammarAST LPAREN223_tree=null; + GrammarAST RPAREN225_tree=null; RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN"); RewriteRuleTokenStream stream_ACTION=new RewriteRuleTokenStream(adaptor,"token ACTION"); RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN"); RewriteRuleSubtreeStream stream_rewriteTemplateArgs=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTemplateArgs"); try { - // ANTLRParser.g:905:2: (lp= LPAREN ACTION RPAREN LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) ) - // ANTLRParser.g:905:4: lp= LPAREN ACTION RPAREN LPAREN rewriteTemplateArgs RPAREN + // ANTLRParser.g:904:2: (lp= LPAREN ACTION RPAREN LPAREN rewriteTemplateArgs RPAREN -> ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) ) + // ANTLRParser.g:904:4: lp= LPAREN ACTION RPAREN LPAREN rewriteTemplateArgs RPAREN { - lp=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4775); if (state.failed) return retval; + lp=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4794); if (state.failed) return retval; if ( state.backtracking==0 ) stream_LPAREN.add(lp); - ACTION219=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteIndirectTemplateHead4777); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ACTION.add(ACTION219); + ACTION221=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteIndirectTemplateHead4796); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ACTION.add(ACTION221); - RPAREN220=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4779); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN220); + RPAREN222=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4798); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN222); - LPAREN221=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4781); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN221); + LPAREN223=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4800); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN223); - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead4783); - rewriteTemplateArgs222=rewriteTemplateArgs(); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead4802); + rewriteTemplateArgs224=rewriteTemplateArgs(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTemplateArgs.add(rewriteTemplateArgs222.getTree()); - RPAREN223=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4785); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN223); + if ( state.backtracking==0 ) stream_rewriteTemplateArgs.add(rewriteTemplateArgs224.getTree()); + RPAREN225=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4804); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN225); // AST REWRITE - // elements: ACTION, rewriteTemplateArgs + // elements: rewriteTemplateArgs, ACTION // token labels: // rule labels: retval // token list labels: @@ -8808,15 +8895,15 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 906:3: -> ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) + // 905:3: -> ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) { - // ANTLRParser.g:906:6: ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) + // ANTLRParser.g:905:6: ^( TEMPLATE[$lp,\"TEMPLATE\"] ACTION ( rewriteTemplateArgs )? ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(TEMPLATE, lp, "TEMPLATE"), root_1); adaptor.addChild(root_1, stream_ACTION.nextNode()); - // ANTLRParser.g:906:40: ( rewriteTemplateArgs )? + // ANTLRParser.g:905:40: ( rewriteTemplateArgs )? if ( stream_rewriteTemplateArgs.hasNext() ) { adaptor.addChild(root_1, stream_rewriteTemplateArgs.nextTree()); @@ -8857,80 +8944,80 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTemplateArgs" - // ANTLRParser.g:909:1: rewriteTemplateArgs : ( rewriteTemplateArg ( COMMA rewriteTemplateArg )* -> ^( ARGLIST ( rewriteTemplateArg )+ ) | ); + // ANTLRParser.g:908:1: rewriteTemplateArgs : ( rewriteTemplateArg ( COMMA rewriteTemplateArg )* -> ^( ARGLIST ( rewriteTemplateArg )+ ) | ); public final ANTLRParser.rewriteTemplateArgs_return rewriteTemplateArgs() throws RecognitionException { ANTLRParser.rewriteTemplateArgs_return retval = new ANTLRParser.rewriteTemplateArgs_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token COMMA225=null; - ANTLRParser.rewriteTemplateArg_return rewriteTemplateArg224 = null; - + Token COMMA227=null; ANTLRParser.rewriteTemplateArg_return rewriteTemplateArg226 = null; + ANTLRParser.rewriteTemplateArg_return rewriteTemplateArg228 = null; - GrammarAST COMMA225_tree=null; + + GrammarAST COMMA227_tree=null; RewriteRuleTokenStream stream_COMMA=new RewriteRuleTokenStream(adaptor,"token COMMA"); RewriteRuleSubtreeStream stream_rewriteTemplateArg=new RewriteRuleSubtreeStream(adaptor,"rule rewriteTemplateArg"); try { - // ANTLRParser.g:910:2: ( rewriteTemplateArg ( COMMA rewriteTemplateArg )* -> ^( ARGLIST ( rewriteTemplateArg )+ ) | ) - int alt73=2; - int LA73_0 = input.LA(1); + // ANTLRParser.g:909:2: ( rewriteTemplateArg ( COMMA rewriteTemplateArg )* -> ^( ARGLIST ( rewriteTemplateArg )+ ) | ) + int alt75=2; + int LA75_0 = input.LA(1); - if ( (LA73_0==TEMPLATE||(LA73_0>=TOKEN_REF && LA73_0<=RULE_REF)) ) { - alt73=1; + if ( (LA75_0==TEMPLATE||(LA75_0>=TOKEN_REF && LA75_0<=RULE_REF)) ) { + alt75=1; } - else if ( (LA73_0==RPAREN) ) { - alt73=2; + else if ( (LA75_0==RPAREN) ) { + alt75=2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = - new NoViableAltException("", 73, 0, input); + new NoViableAltException("", 75, 0, input); throw nvae; } - switch (alt73) { + switch (alt75) { case 1 : - // ANTLRParser.g:910:4: rewriteTemplateArg ( COMMA rewriteTemplateArg )* + // ANTLRParser.g:909:4: rewriteTemplateArg ( COMMA rewriteTemplateArg )* { - pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4810); - rewriteTemplateArg224=rewriteTemplateArg(); + pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4829); + rewriteTemplateArg226=rewriteTemplateArg(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTemplateArg.add(rewriteTemplateArg224.getTree()); - // ANTLRParser.g:910:23: ( COMMA rewriteTemplateArg )* - loop72: + if ( state.backtracking==0 ) stream_rewriteTemplateArg.add(rewriteTemplateArg226.getTree()); + // ANTLRParser.g:909:23: ( COMMA rewriteTemplateArg )* + loop74: do { - int alt72=2; - int LA72_0 = input.LA(1); + int alt74=2; + int LA74_0 = input.LA(1); - if ( (LA72_0==COMMA) ) { - alt72=1; + if ( (LA74_0==COMMA) ) { + alt74=1; } - switch (alt72) { + switch (alt74) { case 1 : - // ANTLRParser.g:910:24: COMMA rewriteTemplateArg + // ANTLRParser.g:909:24: COMMA rewriteTemplateArg { - COMMA225=(Token)match(input,COMMA,FOLLOW_COMMA_in_rewriteTemplateArgs4813); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_COMMA.add(COMMA225); + COMMA227=(Token)match(input,COMMA,FOLLOW_COMMA_in_rewriteTemplateArgs4832); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_COMMA.add(COMMA227); - pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4815); - rewriteTemplateArg226=rewriteTemplateArg(); + pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4834); + rewriteTemplateArg228=rewriteTemplateArg(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_rewriteTemplateArg.add(rewriteTemplateArg226.getTree()); + if ( state.backtracking==0 ) stream_rewriteTemplateArg.add(rewriteTemplateArg228.getTree()); } break; default : - break loop72; + break loop74; } } while (true); @@ -8948,9 +9035,9 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 911:3: -> ^( ARGLIST ( rewriteTemplateArg )+ ) + // 910:3: -> ^( ARGLIST ( rewriteTemplateArg )+ ) { - // ANTLRParser.g:911:6: ^( ARGLIST ( rewriteTemplateArg )+ ) + // ANTLRParser.g:910:6: ^( ARGLIST ( rewriteTemplateArg )+ ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(ARGLIST, "ARGLIST"), root_1); @@ -8973,7 +9060,7 @@ public class ANTLRParser extends Parser { } break; case 2 : - // ANTLRParser.g:913:2: + // ANTLRParser.g:912:2: { root_0 = (GrammarAST)adaptor.nil(); @@ -9007,43 +9094,43 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "rewriteTemplateArg" - // ANTLRParser.g:915:1: rewriteTemplateArg : id ASSIGN ACTION -> ^( ARG[$ASSIGN] id ACTION ) ; + // ANTLRParser.g:914:1: rewriteTemplateArg : id ASSIGN ACTION -> ^( ARG[$ASSIGN] id ACTION ) ; public final ANTLRParser.rewriteTemplateArg_return rewriteTemplateArg() throws RecognitionException { ANTLRParser.rewriteTemplateArg_return retval = new ANTLRParser.rewriteTemplateArg_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token ASSIGN228=null; - Token ACTION229=null; - ANTLRParser.id_return id227 = null; + Token ASSIGN230=null; + Token ACTION231=null; + ANTLRParser.id_return id229 = null; - GrammarAST ASSIGN228_tree=null; - GrammarAST ACTION229_tree=null; + GrammarAST ASSIGN230_tree=null; + GrammarAST ACTION231_tree=null; RewriteRuleTokenStream stream_ACTION=new RewriteRuleTokenStream(adaptor,"token ACTION"); RewriteRuleTokenStream stream_ASSIGN=new RewriteRuleTokenStream(adaptor,"token ASSIGN"); RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id"); try { - // ANTLRParser.g:916:2: ( id ASSIGN ACTION -> ^( ARG[$ASSIGN] id ACTION ) ) - // ANTLRParser.g:916:6: id ASSIGN ACTION + // ANTLRParser.g:915:2: ( id ASSIGN ACTION -> ^( ARG[$ASSIGN] id ACTION ) ) + // ANTLRParser.g:915:6: id ASSIGN ACTION { - pushFollow(FOLLOW_id_in_rewriteTemplateArg4844); - id227=id(); + pushFollow(FOLLOW_id_in_rewriteTemplateArg4863); + id229=id(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_id.add(id227.getTree()); - ASSIGN228=(Token)match(input,ASSIGN,FOLLOW_ASSIGN_in_rewriteTemplateArg4846); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ASSIGN.add(ASSIGN228); + if ( state.backtracking==0 ) stream_id.add(id229.getTree()); + ASSIGN230=(Token)match(input,ASSIGN,FOLLOW_ASSIGN_in_rewriteTemplateArg4865); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ASSIGN.add(ASSIGN230); - ACTION229=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplateArg4848); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_ACTION.add(ACTION229); + ACTION231=(Token)match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplateArg4867); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_ACTION.add(ACTION231); // AST REWRITE - // elements: id, ACTION + // elements: ACTION, id // token labels: // rule labels: retval // token list labels: @@ -9054,12 +9141,12 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 916:23: -> ^( ARG[$ASSIGN] id ACTION ) + // 915:23: -> ^( ARG[$ASSIGN] id ACTION ) { - // ANTLRParser.g:916:26: ^( ARG[$ASSIGN] id ACTION ) + // ANTLRParser.g:915:26: ^( ARG[$ASSIGN] id ACTION ) { GrammarAST root_1 = (GrammarAST)adaptor.nil(); - root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(ARG, ASSIGN228), root_1); + root_1 = (GrammarAST)adaptor.becomeRoot((GrammarAST)adaptor.create(ARG, ASSIGN230), root_1); adaptor.addChild(root_1, stream_id.nextTree()); adaptor.addChild(root_1, stream_ACTION.nextNode()); @@ -9098,57 +9185,57 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "id" - // ANTLRParser.g:923:1: id : ( RULE_REF -> ID[$RULE_REF] | TOKEN_REF -> ID[$TOKEN_REF] | TEMPLATE -> ID[$TEMPLATE] ); + // ANTLRParser.g:922:1: id : ( RULE_REF -> ID[$RULE_REF] | TOKEN_REF -> ID[$TOKEN_REF] | TEMPLATE -> ID[$TEMPLATE] ); public final ANTLRParser.id_return id() throws RecognitionException { ANTLRParser.id_return retval = new ANTLRParser.id_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token RULE_REF230=null; - Token TOKEN_REF231=null; - Token TEMPLATE232=null; + Token RULE_REF232=null; + Token TOKEN_REF233=null; + Token TEMPLATE234=null; - GrammarAST RULE_REF230_tree=null; - GrammarAST TOKEN_REF231_tree=null; - GrammarAST TEMPLATE232_tree=null; + GrammarAST RULE_REF232_tree=null; + GrammarAST TOKEN_REF233_tree=null; + GrammarAST TEMPLATE234_tree=null; RewriteRuleTokenStream stream_TEMPLATE=new RewriteRuleTokenStream(adaptor,"token TEMPLATE"); RewriteRuleTokenStream stream_RULE_REF=new RewriteRuleTokenStream(adaptor,"token RULE_REF"); RewriteRuleTokenStream stream_TOKEN_REF=new RewriteRuleTokenStream(adaptor,"token TOKEN_REF"); try { - // ANTLRParser.g:924:5: ( RULE_REF -> ID[$RULE_REF] | TOKEN_REF -> ID[$TOKEN_REF] | TEMPLATE -> ID[$TEMPLATE] ) - int alt74=3; + // ANTLRParser.g:923:5: ( RULE_REF -> ID[$RULE_REF] | TOKEN_REF -> ID[$TOKEN_REF] | TEMPLATE -> ID[$TEMPLATE] ) + int alt76=3; switch ( input.LA(1) ) { case RULE_REF: { - alt74=1; + alt76=1; } break; case TOKEN_REF: { - alt74=2; + alt76=2; } break; case TEMPLATE: { - alt74=3; + alt76=3; } break; default: if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = - new NoViableAltException("", 74, 0, input); + new NoViableAltException("", 76, 0, input); throw nvae; } - switch (alt74) { + switch (alt76) { case 1 : - // ANTLRParser.g:924:7: RULE_REF + // ANTLRParser.g:923:7: RULE_REF { - RULE_REF230=(Token)match(input,RULE_REF,FOLLOW_RULE_REF_in_id4877); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_RULE_REF.add(RULE_REF230); + RULE_REF232=(Token)match(input,RULE_REF,FOLLOW_RULE_REF_in_id4896); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_RULE_REF.add(RULE_REF232); @@ -9164,9 +9251,9 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 924:17: -> ID[$RULE_REF] + // 923:17: -> ID[$RULE_REF] { - adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, RULE_REF230)); + adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, RULE_REF232)); } @@ -9174,10 +9261,10 @@ public class ANTLRParser extends Parser { } break; case 2 : - // ANTLRParser.g:925:7: TOKEN_REF + // ANTLRParser.g:924:7: TOKEN_REF { - TOKEN_REF231=(Token)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_id4890); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_TOKEN_REF.add(TOKEN_REF231); + TOKEN_REF233=(Token)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_id4909); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_TOKEN_REF.add(TOKEN_REF233); @@ -9193,9 +9280,9 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 925:17: -> ID[$TOKEN_REF] + // 924:17: -> ID[$TOKEN_REF] { - adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, TOKEN_REF231)); + adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, TOKEN_REF233)); } @@ -9203,10 +9290,10 @@ public class ANTLRParser extends Parser { } break; case 3 : - // ANTLRParser.g:926:7: TEMPLATE + // ANTLRParser.g:925:7: TEMPLATE { - TEMPLATE232=(Token)match(input,TEMPLATE,FOLLOW_TEMPLATE_in_id4902); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_TEMPLATE.add(TEMPLATE232); + TEMPLATE234=(Token)match(input,TEMPLATE,FOLLOW_TEMPLATE_in_id4921); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_TEMPLATE.add(TEMPLATE234); @@ -9222,9 +9309,9 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 926:17: -> ID[$TEMPLATE] + // 925:17: -> ID[$TEMPLATE] { - adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, TEMPLATE232)); + adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, TEMPLATE234)); } @@ -9259,62 +9346,62 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "qid" - // ANTLRParser.g:929:1: qid : id ( DOT id )* -> ID[$qid.start, $text] ; + // ANTLRParser.g:928:1: qid : id ( DOT id )* -> ID[$qid.start, $text] ; public final ANTLRParser.qid_return qid() throws RecognitionException { ANTLRParser.qid_return retval = new ANTLRParser.qid_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token DOT234=null; - ANTLRParser.id_return id233 = null; - + Token DOT236=null; ANTLRParser.id_return id235 = null; + ANTLRParser.id_return id237 = null; - GrammarAST DOT234_tree=null; + + GrammarAST DOT236_tree=null; RewriteRuleTokenStream stream_DOT=new RewriteRuleTokenStream(adaptor,"token DOT"); RewriteRuleSubtreeStream stream_id=new RewriteRuleSubtreeStream(adaptor,"rule id"); try { - // ANTLRParser.g:929:5: ( id ( DOT id )* -> ID[$qid.start, $text] ) - // ANTLRParser.g:929:7: id ( DOT id )* + // ANTLRParser.g:928:5: ( id ( DOT id )* -> ID[$qid.start, $text] ) + // ANTLRParser.g:928:7: id ( DOT id )* { - pushFollow(FOLLOW_id_in_qid4925); - id233=id(); + pushFollow(FOLLOW_id_in_qid4944); + id235=id(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_id.add(id233.getTree()); - // ANTLRParser.g:929:10: ( DOT id )* - loop75: + if ( state.backtracking==0 ) stream_id.add(id235.getTree()); + // ANTLRParser.g:928:10: ( DOT id )* + loop77: do { - int alt75=2; - int LA75_0 = input.LA(1); + int alt77=2; + int LA77_0 = input.LA(1); - if ( (LA75_0==DOT) ) { - alt75=1; + if ( (LA77_0==DOT) ) { + alt77=1; } - switch (alt75) { + switch (alt77) { case 1 : - // ANTLRParser.g:929:11: DOT id + // ANTLRParser.g:928:11: DOT id { - DOT234=(Token)match(input,DOT,FOLLOW_DOT_in_qid4928); if (state.failed) return retval; - if ( state.backtracking==0 ) stream_DOT.add(DOT234); + DOT236=(Token)match(input,DOT,FOLLOW_DOT_in_qid4947); if (state.failed) return retval; + if ( state.backtracking==0 ) stream_DOT.add(DOT236); - pushFollow(FOLLOW_id_in_qid4930); - id235=id(); + pushFollow(FOLLOW_id_in_qid4949); + id237=id(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) stream_id.add(id235.getTree()); + if ( state.backtracking==0 ) stream_id.add(id237.getTree()); } break; default : - break loop75; + break loop77; } } while (true); @@ -9332,7 +9419,7 @@ public class ANTLRParser extends Parser { RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null); root_0 = (GrammarAST)adaptor.nil(); - // 929:20: -> ID[$qid.start, $text] + // 928:20: -> ID[$qid.start, $text] { adaptor.addChild(root_0, (GrammarAST)adaptor.create(ID, ((Token)retval.start), input.toString(retval.start,input.LT(-1)))); @@ -9367,35 +9454,35 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "alternativeEntry" - // ANTLRParser.g:931:1: alternativeEntry : alternative EOF ; + // ANTLRParser.g:930:1: alternativeEntry : alternative EOF ; public final ANTLRParser.alternativeEntry_return alternativeEntry() throws RecognitionException { ANTLRParser.alternativeEntry_return retval = new ANTLRParser.alternativeEntry_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token EOF237=null; - ANTLRParser.alternative_return alternative236 = null; + Token EOF239=null; + ANTLRParser.alternative_return alternative238 = null; - GrammarAST EOF237_tree=null; + GrammarAST EOF239_tree=null; try { - // ANTLRParser.g:931:18: ( alternative EOF ) - // ANTLRParser.g:931:20: alternative EOF + // ANTLRParser.g:930:18: ( alternative EOF ) + // ANTLRParser.g:930:20: alternative EOF { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_alternative_in_alternativeEntry4946); - alternative236=alternative(); + pushFollow(FOLLOW_alternative_in_alternativeEntry4965); + alternative238=alternative(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, alternative236.getTree()); - EOF237=(Token)match(input,EOF,FOLLOW_EOF_in_alternativeEntry4948); if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, alternative238.getTree()); + EOF239=(Token)match(input,EOF,FOLLOW_EOF_in_alternativeEntry4967); if (state.failed) return retval; if ( state.backtracking==0 ) { - EOF237_tree = (GrammarAST)adaptor.create(EOF237); - adaptor.addChild(root_0, EOF237_tree); + EOF239_tree = (GrammarAST)adaptor.create(EOF239); + adaptor.addChild(root_0, EOF239_tree); } } @@ -9426,35 +9513,35 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "elementEntry" - // ANTLRParser.g:932:1: elementEntry : element EOF ; + // ANTLRParser.g:931:1: elementEntry : element EOF ; public final ANTLRParser.elementEntry_return elementEntry() throws RecognitionException { ANTLRParser.elementEntry_return retval = new ANTLRParser.elementEntry_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token EOF239=null; - ANTLRParser.element_return element238 = null; + Token EOF241=null; + ANTLRParser.element_return element240 = null; - GrammarAST EOF239_tree=null; + GrammarAST EOF241_tree=null; try { - // ANTLRParser.g:932:14: ( element EOF ) - // ANTLRParser.g:932:16: element EOF + // ANTLRParser.g:931:14: ( element EOF ) + // ANTLRParser.g:931:16: element EOF { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_element_in_elementEntry4957); - element238=element(); + pushFollow(FOLLOW_element_in_elementEntry4976); + element240=element(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, element238.getTree()); - EOF239=(Token)match(input,EOF,FOLLOW_EOF_in_elementEntry4959); if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, element240.getTree()); + EOF241=(Token)match(input,EOF,FOLLOW_EOF_in_elementEntry4978); if (state.failed) return retval; if ( state.backtracking==0 ) { - EOF239_tree = (GrammarAST)adaptor.create(EOF239); - adaptor.addChild(root_0, EOF239_tree); + EOF241_tree = (GrammarAST)adaptor.create(EOF241); + adaptor.addChild(root_0, EOF241_tree); } } @@ -9485,35 +9572,35 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "ruleEntry" - // ANTLRParser.g:933:1: ruleEntry : rule EOF ; + // ANTLRParser.g:932:1: ruleEntry : rule EOF ; public final ANTLRParser.ruleEntry_return ruleEntry() throws RecognitionException { ANTLRParser.ruleEntry_return retval = new ANTLRParser.ruleEntry_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token EOF241=null; - ANTLRParser.rule_return rule240 = null; + Token EOF243=null; + ANTLRParser.rule_return rule242 = null; - GrammarAST EOF241_tree=null; + GrammarAST EOF243_tree=null; try { - // ANTLRParser.g:933:11: ( rule EOF ) - // ANTLRParser.g:933:13: rule EOF + // ANTLRParser.g:932:11: ( rule EOF ) + // ANTLRParser.g:932:13: rule EOF { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_rule_in_ruleEntry4967); - rule240=rule(); + pushFollow(FOLLOW_rule_in_ruleEntry4986); + rule242=rule(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, rule240.getTree()); - EOF241=(Token)match(input,EOF,FOLLOW_EOF_in_ruleEntry4969); if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, rule242.getTree()); + EOF243=(Token)match(input,EOF,FOLLOW_EOF_in_ruleEntry4988); if (state.failed) return retval; if ( state.backtracking==0 ) { - EOF241_tree = (GrammarAST)adaptor.create(EOF241); - adaptor.addChild(root_0, EOF241_tree); + EOF243_tree = (GrammarAST)adaptor.create(EOF243); + adaptor.addChild(root_0, EOF243_tree); } } @@ -9544,35 +9631,35 @@ public class ANTLRParser extends Parser { }; // $ANTLR start "blockEntry" - // ANTLRParser.g:934:1: blockEntry : block EOF ; + // ANTLRParser.g:933:1: blockEntry : block EOF ; public final ANTLRParser.blockEntry_return blockEntry() throws RecognitionException { ANTLRParser.blockEntry_return retval = new ANTLRParser.blockEntry_return(); retval.start = input.LT(1); GrammarAST root_0 = null; - Token EOF243=null; - ANTLRParser.block_return block242 = null; + Token EOF245=null; + ANTLRParser.block_return block244 = null; - GrammarAST EOF243_tree=null; + GrammarAST EOF245_tree=null; try { - // ANTLRParser.g:934:12: ( block EOF ) - // ANTLRParser.g:934:14: block EOF + // ANTLRParser.g:933:12: ( block EOF ) + // ANTLRParser.g:933:14: block EOF { root_0 = (GrammarAST)adaptor.nil(); - pushFollow(FOLLOW_block_in_blockEntry4977); - block242=block(); + pushFollow(FOLLOW_block_in_blockEntry4996); + block244=block(); state._fsp--; if (state.failed) return retval; - if ( state.backtracking==0 ) adaptor.addChild(root_0, block242.getTree()); - EOF243=(Token)match(input,EOF,FOLLOW_EOF_in_blockEntry4979); if (state.failed) return retval; + if ( state.backtracking==0 ) adaptor.addChild(root_0, block244.getTree()); + EOF245=(Token)match(input,EOF,FOLLOW_EOF_in_blockEntry4998); if (state.failed) return retval; if ( state.backtracking==0 ) { - EOF243_tree = (GrammarAST)adaptor.create(EOF243); - adaptor.addChild(root_0, EOF243_tree); + EOF245_tree = (GrammarAST)adaptor.create(EOF245); + adaptor.addChild(root_0, EOF245_tree); } } @@ -9663,7 +9750,7 @@ public class ANTLRParser extends Parser { protected DFA44 dfa44 = new DFA44(this); protected DFA63 dfa63 = new DFA63(this); protected DFA66 dfa66 = new DFA66(this); - protected DFA71 dfa71 = new DFA71(this); + protected DFA73 dfa73 = new DFA73(this); static final String DFA35_eotS = "\12\uffff"; static final String DFA35_eofS = @@ -9730,20 +9817,20 @@ public class ANTLRParser extends Parser { static final String DFA44_eotS = "\26\uffff"; static final String DFA44_eofS = - "\1\uffff\1\7\2\5\4\uffff\1\7\1\uffff\1\5\13\uffff"; + "\1\uffff\1\10\2\5\3\uffff\1\10\2\uffff\1\5\13\uffff"; static final String DFA44_minS = - "\1\43\3\4\1\66\3\uffff\1\4\1\uffff\1\4\1\66\10\0\2\uffff"; + "\1\43\3\4\1\66\2\uffff\1\4\2\uffff\1\4\1\66\10\0\2\uffff"; static final String DFA44_maxS = - "\4\103\1\66\3\uffff\1\103\1\uffff\2\103\10\0\2\uffff"; + "\4\103\1\66\2\uffff\1\103\2\uffff\2\103\10\0\2\uffff"; static final String DFA44_acceptS = - "\5\uffff\1\4\1\6\1\5\1\uffff\1\1\12\uffff\1\3\1\2"; + "\5\uffff\1\4\1\6\1\uffff\1\5\1\1\12\uffff\1\3\1\2"; static final String DFA44_specialS = - "\14\uffff\1\6\1\5\1\7\1\3\1\2\1\4\1\0\1\1\2\uffff}>"; + "\14\uffff\1\7\1\6\1\5\1\3\1\4\1\1\1\2\1\0\2\uffff}>"; static final String[] DFA44_transitionS = { "\1\4\22\uffff\1\5\5\uffff\1\6\1\uffff\1\2\1\1\3\uffff\1\3", - "\1\7\11\uffff\1\7\1\uffff\1\7\22\uffff\1\7\3\uffff\3\7\4\uffff"+ - "\4\7\1\uffff\2\7\1\uffff\1\10\1\11\1\uffff\2\7\1\uffff\1\7\1"+ - "\uffff\2\7\3\uffff\1\7", + "\1\10\11\uffff\1\10\1\uffff\1\10\22\uffff\1\10\3\uffff\3\10"+ + "\4\uffff\4\10\1\uffff\2\10\1\uffff\1\7\1\11\1\uffff\2\10\1\uffff"+ + "\1\10\1\uffff\2\10\3\uffff\1\10", "\1\5\11\uffff\1\5\1\uffff\1\5\22\uffff\1\5\3\uffff\3\5\1\uffff"+ "\1\5\2\uffff\4\5\1\uffff\2\5\1\uffff\1\12\1\11\1\uffff\2\5\1"+ "\uffff\1\5\1\uffff\2\5\3\uffff\1\5", @@ -9753,10 +9840,10 @@ public class ANTLRParser extends Parser { "\1\13", "", "", + "\1\10\13\uffff\1\10\22\uffff\1\10\3\uffff\3\10\1\uffff\1\10"+ + "\2\uffff\4\10\1\uffff\2\10\1\uffff\1\17\2\uffff\2\10\1\uffff"+ + "\1\10\1\uffff\1\15\1\14\3\uffff\1\16", "", - "\1\7\13\uffff\1\7\22\uffff\1\7\3\uffff\3\7\1\uffff\1\7\2\uffff"+ - "\4\7\1\uffff\2\7\1\uffff\1\17\2\uffff\2\7\1\uffff\1\7\1\uffff"+ - "\1\15\1\14\3\uffff\1\16", "", "\1\5\13\uffff\1\5\22\uffff\1\5\3\uffff\3\5\1\uffff\1\5\2\uffff"+ "\4\5\1\uffff\2\5\1\uffff\1\23\2\uffff\2\5\1\uffff\1\5\1\uffff"+ @@ -9811,25 +9898,6 @@ public class ANTLRParser extends Parser { int _s = s; switch ( s ) { case 0 : - int LA44_18 = input.LA(1); - - - int index44_18 = input.index(); - input.rewind(); - s = -1; - if ( (( - input.LT(1).getCharPositionInLine()+input.LT(1).getText().length()== - input.LT(2).getCharPositionInLine() && - input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() - )) ) {s = 20;} - - else if ( (true) ) {s = 5;} - - - input.seek(index44_18); - if ( s>=0 ) return s; - break; - case 1 : int LA44_19 = input.LA(1); @@ -9848,45 +9916,7 @@ public class ANTLRParser extends Parser { input.seek(index44_19); if ( s>=0 ) return s; break; - case 2 : - int LA44_16 = input.LA(1); - - - int index44_16 = input.index(); - input.rewind(); - s = -1; - if ( (( - input.LT(1).getCharPositionInLine()+input.LT(1).getText().length()== - input.LT(2).getCharPositionInLine() && - input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() - )) ) {s = 21;} - - else if ( (true) ) {s = 5;} - - - input.seek(index44_16); - if ( s>=0 ) return s; - break; - case 3 : - int LA44_15 = input.LA(1); - - - int index44_15 = input.index(); - input.rewind(); - s = -1; - if ( (( - input.LT(1).getCharPositionInLine()+input.LT(1).getText().length()== - input.LT(2).getCharPositionInLine() && - input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() - )) ) {s = 20;} - - else if ( (true) ) {s = 7;} - - - input.seek(index44_15); - if ( s>=0 ) return s; - break; - case 4 : + case 1 : int LA44_17 = input.LA(1); @@ -9905,11 +9935,11 @@ public class ANTLRParser extends Parser { input.seek(index44_17); if ( s>=0 ) return s; break; - case 5 : - int LA44_13 = input.LA(1); + case 2 : + int LA44_18 = input.LA(1); - int index44_13 = input.index(); + int index44_18 = input.index(); input.rewind(); s = -1; if ( (( @@ -9918,17 +9948,36 @@ public class ANTLRParser extends Parser { input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() )) ) {s = 20;} - else if ( (true) ) {s = 7;} + else if ( (true) ) {s = 5;} - input.seek(index44_13); + input.seek(index44_18); if ( s>=0 ) return s; break; - case 6 : - int LA44_12 = input.LA(1); + case 3 : + int LA44_15 = input.LA(1); - int index44_12 = input.index(); + int index44_15 = input.index(); + input.rewind(); + s = -1; + if ( (( + input.LT(1).getCharPositionInLine()+input.LT(1).getText().length()== + input.LT(2).getCharPositionInLine() && + input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() + )) ) {s = 20;} + + else if ( (true) ) {s = 8;} + + + input.seek(index44_15); + if ( s>=0 ) return s; + break; + case 4 : + int LA44_16 = input.LA(1); + + + int index44_16 = input.index(); input.rewind(); s = -1; if ( (( @@ -9937,13 +9986,13 @@ public class ANTLRParser extends Parser { input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() )) ) {s = 21;} - else if ( (true) ) {s = 7;} + else if ( (true) ) {s = 5;} - input.seek(index44_12); + input.seek(index44_16); if ( s>=0 ) return s; break; - case 7 : + case 5 : int LA44_14 = input.LA(1); @@ -9956,12 +10005,50 @@ public class ANTLRParser extends Parser { input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() )) ) {s = 20;} - else if ( (true) ) {s = 7;} + else if ( (true) ) {s = 8;} input.seek(index44_14); if ( s>=0 ) return s; break; + case 6 : + int LA44_13 = input.LA(1); + + + int index44_13 = input.index(); + input.rewind(); + s = -1; + if ( (( + input.LT(1).getCharPositionInLine()+input.LT(1).getText().length()== + input.LT(2).getCharPositionInLine() && + input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() + )) ) {s = 20;} + + else if ( (true) ) {s = 8;} + + + input.seek(index44_13); + if ( s>=0 ) return s; + break; + case 7 : + int LA44_12 = input.LA(1); + + + int index44_12 = input.index(); + input.rewind(); + s = -1; + if ( (( + input.LT(1).getCharPositionInLine()+input.LT(1).getText().length()== + input.LT(2).getCharPositionInLine() && + input.LT(2).getCharPositionInLine()+1==input.LT(3).getCharPositionInLine() + )) ) {s = 21;} + + else if ( (true) ) {s = 8;} + + + input.seek(index44_12); + if ( s>=0 ) return s; + break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = @@ -9975,7 +10062,7 @@ public class ANTLRParser extends Parser { static final String DFA63_eofS = "\1\10\1\uffff\2\6\12\uffff"; static final String DFA63_minS = - "\1\20\1\uffff\1\20\1\16\1\20\1\0\3\uffff\2\20\1\16\1\20\1\50"; + "\1\20\1\uffff\1\20\1\16\1\20\1\0\3\uffff\3\20\1\16\1\50"; static final String DFA63_maxS = "\1\103\1\uffff\3\103\1\0\3\uffff\4\103\1\61"; static final String DFA63_acceptS = @@ -9988,9 +10075,9 @@ public class ANTLRParser extends Parser { "", "\1\6\26\uffff\1\6\1\11\1\6\4\uffff\1\6\1\uffff\2\6\1\uffff"+ "\1\6\1\uffff\1\6\3\uffff\2\6\3\uffff\2\6\3\uffff\1\6", - "\1\6\1\uffff\1\6\26\uffff\1\6\1\11\1\6\4\uffff\1\6\1\uffff"+ - "\2\6\1\uffff\1\6\1\uffff\1\6\3\uffff\2\6\3\uffff\2\6\3\uffff"+ - "\1\6", + "\1\6\1\uffff\1\6\26\uffff\1\6\1\11\1\6\1\uffff\1\6\2\uffff"+ + "\1\6\1\uffff\2\6\1\uffff\1\6\1\uffff\1\6\3\uffff\2\6\3\uffff"+ + "\2\6\3\uffff\1\6", "\1\12\27\uffff\1\6\14\uffff\1\6\4\uffff\1\6\3\uffff\2\6\3\uffff"+ "\1\6", "\1\uffff", @@ -9998,13 +10085,13 @@ public class ANTLRParser extends Parser { "", "", "\1\6\22\uffff\1\1\4\uffff\1\6\1\1\13\uffff\1\6\4\uffff\1\6"+ - "\3\uffff\1\13\1\14\3\uffff\1\6", + "\3\uffff\1\14\1\13\3\uffff\1\6", "\1\6\27\uffff\1\6\1\15\4\uffff\1\6\1\uffff\2\6\3\uffff\1\6"+ "\4\uffff\1\6\3\uffff\2\6\3\uffff\1\6", - "\1\6\1\uffff\1\6\27\uffff\2\6\3\uffff\1\1\1\6\1\uffff\2\6\3"+ - "\uffff\1\6\4\uffff\1\6\3\uffff\2\6\3\uffff\1\6", "\1\6\27\uffff\2\6\3\uffff\1\1\1\6\1\uffff\2\6\3\uffff\1\6\4"+ "\uffff\1\6\3\uffff\2\6\3\uffff\1\6", + "\1\6\1\uffff\1\6\27\uffff\2\6\1\uffff\1\6\1\uffff\1\1\1\6\1"+ + "\uffff\2\6\3\uffff\1\6\4\uffff\1\6\3\uffff\2\6\3\uffff\1\6", "\1\1\5\uffff\1\6\1\uffff\2\6" }; @@ -10068,42 +10155,120 @@ public class ANTLRParser extends Parser { } } static final String DFA66_eotS = - "\16\uffff"; + "\124\uffff"; static final String DFA66_eofS = - "\1\uffff\3\12\1\uffff\1\12\2\uffff\1\12\2\uffff\3\12"; + "\1\uffff\3\13\1\uffff\1\13\3\uffff\1\13\3\uffff\3\13\10\uffff\1"+ + "\13\4\uffff\1\13\66\uffff"; static final String DFA66_minS = - "\1\20\1\16\2\20\1\43\1\20\2\uffff\1\20\2\uffff\3\20"; + "\1\20\1\16\2\20\1\43\1\20\2\uffff\1\43\1\20\2\uffff\1\43\3\20\6"+ + "\46\2\43\1\16\4\43\1\20\24\46\6\43\24\46\2\43\6\46"; static final String DFA66_maxS = - "\4\103\1\77\1\103\2\uffff\1\103\2\uffff\3\103"; + "\4\103\1\77\1\103\2\uffff\1\77\1\103\2\uffff\1\77\3\103\6\66\2\77"+ + "\3\103\2\77\1\103\11\66\1\54\3\66\1\54\6\66\1\77\1\103\3\77\1\103"+ + "\6\66\1\54\14\66\1\54\2\77\6\66"; static final String DFA66_acceptS = - "\6\uffff\1\3\1\4\1\uffff\1\2\1\1\3\uffff"; + "\6\uffff\1\3\1\4\2\uffff\1\2\1\1\110\uffff"; static final String DFA66_specialS = - "\16\uffff}>"; + "\124\uffff}>"; static final String[] DFA66_transitionS = { "\1\5\27\uffff\1\7\14\uffff\1\4\4\uffff\1\6\3\uffff\1\1\1\2\3"+ "\uffff\1\3", - "\1\10\1\uffff\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11"+ - "\1\uffff\1\12\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff"+ - "\1\12", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12", - "\1\15\32\uffff\1\14\1\13", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12", + "\1\11\1\uffff\1\13\26\uffff\3\13\1\uffff\1\10\2\uffff\1\12"+ + "\1\uffff\2\12\1\uffff\1\13\1\uffff\1\13\3\uffff\2\13\3\uffff"+ + "\2\13\3\uffff\1\13", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", + "\1\13\26\uffff\3\13\1\uffff\1\14\2\uffff\1\12\1\uffff\2\12"+ + "\1\uffff\1\13\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff"+ + "\1\13", + "\1\17\32\uffff\1\16\1\15", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", "", "", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12", + "\1\22\32\uffff\1\21\1\20", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", "", "", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12", - "\1\12\26\uffff\3\12\4\uffff\1\11\1\uffff\2\11\1\uffff\1\12"+ - "\1\uffff\1\12\3\uffff\2\12\3\uffff\2\12\3\uffff\1\12" + "\1\25\32\uffff\1\24\1\23", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", + "\1\27\5\uffff\1\30\1\31\10\uffff\1\26", + "\1\27\5\uffff\1\30\1\31\10\uffff\1\26", + "\1\27\5\uffff\1\30\1\31\10\uffff\1\26", + "\1\34\5\uffff\1\35\1\32\10\uffff\1\33", + "\1\34\5\uffff\1\35\1\32\10\uffff\1\33", + "\1\34\5\uffff\1\35\1\32\10\uffff\1\33", + "\1\40\32\uffff\1\37\1\36", + "\1\43\32\uffff\1\42\1\41", + "\1\11\1\uffff\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12"+ + "\1\uffff\1\13\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff"+ + "\1\13", + "\1\46\32\uffff\1\45\1\44\3\uffff\1\47", + "\1\52\32\uffff\1\51\1\50\3\uffff\1\53", + "\1\56\32\uffff\1\55\1\54", + "\1\61\32\uffff\1\60\1\57", + "\1\13\26\uffff\3\13\4\uffff\1\12\1\uffff\2\12\1\uffff\1\13"+ + "\1\uffff\1\13\3\uffff\2\13\3\uffff\2\13\3\uffff\1\13", + "\1\27\5\uffff\1\30\11\uffff\1\26", + "\1\27\5\uffff\1\30\11\uffff\1\26", + "\1\27\5\uffff\1\30\11\uffff\1\26", + "\1\27\5\uffff\1\30\1\63\10\uffff\1\62", + "\1\27\5\uffff\1\30\1\63\10\uffff\1\62", + "\1\27\5\uffff\1\30\1\63\10\uffff\1\62", + "\1\27\5\uffff\1\30\11\uffff\1\64", + "\1\27\5\uffff\1\30\11\uffff\1\64", + "\1\27\5\uffff\1\30\11\uffff\1\64", + "\1\27\5\uffff\1\30", + "\1\34\5\uffff\1\35\11\uffff\1\65", + "\1\34\5\uffff\1\35\11\uffff\1\65", + "\1\34\5\uffff\1\35\11\uffff\1\65", + "\1\34\5\uffff\1\35", + "\1\34\5\uffff\1\35\11\uffff\1\33", + "\1\34\5\uffff\1\35\11\uffff\1\33", + "\1\34\5\uffff\1\35\11\uffff\1\33", + "\1\34\5\uffff\1\35\1\67\10\uffff\1\66", + "\1\34\5\uffff\1\35\1\67\10\uffff\1\66", + "\1\34\5\uffff\1\35\1\67\10\uffff\1\66", + "\1\72\32\uffff\1\71\1\70", + "\1\75\32\uffff\1\74\1\73\3\uffff\1\76", + "\1\101\32\uffff\1\100\1\77", + "\1\104\32\uffff\1\103\1\102", + "\1\107\32\uffff\1\106\1\105", + "\1\112\32\uffff\1\111\1\110\3\uffff\1\113", + "\1\27\5\uffff\1\30\11\uffff\1\62", + "\1\27\5\uffff\1\30\11\uffff\1\62", + "\1\27\5\uffff\1\30\11\uffff\1\62", + "\1\27\5\uffff\1\30\11\uffff\1\114", + "\1\27\5\uffff\1\30\11\uffff\1\114", + "\1\27\5\uffff\1\30\11\uffff\1\114", + "\1\27\5\uffff\1\30", + "\1\27\5\uffff\1\30\11\uffff\1\64", + "\1\27\5\uffff\1\30\11\uffff\1\64", + "\1\27\5\uffff\1\30\11\uffff\1\64", + "\1\34\5\uffff\1\35\11\uffff\1\65", + "\1\34\5\uffff\1\35\11\uffff\1\65", + "\1\34\5\uffff\1\35\11\uffff\1\65", + "\1\34\5\uffff\1\35\11\uffff\1\66", + "\1\34\5\uffff\1\35\11\uffff\1\66", + "\1\34\5\uffff\1\35\11\uffff\1\66", + "\1\34\5\uffff\1\35\11\uffff\1\115", + "\1\34\5\uffff\1\35\11\uffff\1\115", + "\1\34\5\uffff\1\35\11\uffff\1\115", + "\1\34\5\uffff\1\35", + "\1\120\32\uffff\1\117\1\116", + "\1\123\32\uffff\1\122\1\121", + "\1\27\5\uffff\1\30\11\uffff\1\114", + "\1\27\5\uffff\1\30\11\uffff\1\114", + "\1\27\5\uffff\1\30\11\uffff\1\114", + "\1\34\5\uffff\1\35\11\uffff\1\115", + "\1\34\5\uffff\1\35\11\uffff\1\115", + "\1\34\5\uffff\1\35\11\uffff\1\115" }; static final short[] DFA66_eot = DFA.unpackEncodedString(DFA66_eotS); @@ -10139,21 +10304,21 @@ public class ANTLRParser extends Parser { return "835:1: rewriteTreeElement : ( rewriteTreeAtom | rewriteTreeAtom ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTreeAtom ) ) ) | rewriteTree ( ebnfSuffix -> ^( ebnfSuffix ^( REWRITE_BLOCK ^( ALT rewriteTree ) ) ) | -> rewriteTree ) | rewriteTreeEbnf );"; } } - static final String DFA71_eotS = + static final String DFA73_eotS = "\23\uffff"; - static final String DFA71_eofS = + static final String DFA73_eofS = "\11\uffff\1\2\11\uffff"; - static final String DFA71_minS = + static final String DFA73_minS = "\1\20\1\50\3\uffff\1\43\3\55\1\12\1\20\1\uffff\1\46\1\43\3\55\1"+ "\20\1\46"; - static final String DFA71_maxS = + static final String DFA73_maxS = "\1\77\1\50\3\uffff\1\77\3\55\1\71\1\20\1\uffff\1\51\1\77\3\55\1"+ "\20\1\51"; - static final String DFA71_acceptS = + static final String DFA73_acceptS = "\2\uffff\1\2\1\3\1\4\6\uffff\1\1\7\uffff"; - static final String DFA71_specialS = + static final String DFA73_specialS = "\23\uffff}>"; - static final String[] DFA71_transitionS = { + static final String[] DFA73_transitionS = { "\1\4\22\uffff\1\1\4\uffff\1\3\25\uffff\2\2", "\1\5", "", @@ -10175,37 +10340,37 @@ public class ANTLRParser extends Parser { "\1\15\2\uffff\1\11" }; - static final short[] DFA71_eot = DFA.unpackEncodedString(DFA71_eotS); - static final short[] DFA71_eof = DFA.unpackEncodedString(DFA71_eofS); - static final char[] DFA71_min = DFA.unpackEncodedStringToUnsignedChars(DFA71_minS); - static final char[] DFA71_max = DFA.unpackEncodedStringToUnsignedChars(DFA71_maxS); - static final short[] DFA71_accept = DFA.unpackEncodedString(DFA71_acceptS); - static final short[] DFA71_special = DFA.unpackEncodedString(DFA71_specialS); - static final short[][] DFA71_transition; + static final short[] DFA73_eot = DFA.unpackEncodedString(DFA73_eotS); + static final short[] DFA73_eof = DFA.unpackEncodedString(DFA73_eofS); + static final char[] DFA73_min = DFA.unpackEncodedStringToUnsignedChars(DFA73_minS); + static final char[] DFA73_max = DFA.unpackEncodedStringToUnsignedChars(DFA73_maxS); + static final short[] DFA73_accept = DFA.unpackEncodedString(DFA73_acceptS); + static final short[] DFA73_special = DFA.unpackEncodedString(DFA73_specialS); + static final short[][] DFA73_transition; static { - int numStates = DFA71_transitionS.length; - DFA71_transition = new short[numStates][]; + int numStates = DFA73_transitionS.length; + DFA73_transition = new short[numStates][]; for (int i=0; i ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION );"; + return "870:1: rewriteTemplate : ( TEMPLATE LPAREN rewriteTemplateArgs RPAREN (str= DOUBLE_QUOTE_STRING_LITERAL | str= DOUBLE_ANGLE_STRING_LITERAL ) -> ^( TEMPLATE[$TEMPLATE,\"TEMPLATE\"] ( rewriteTemplateArgs )? $str) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION );"; } } @@ -10411,63 +10576,65 @@ public class ANTLRParser extends Parser { public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTreeElement4420 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTreeElement4425 = new BitSet(new long[]{0x0003400000000000L}); public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeElement4427 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rewriteTree_in_rewriteTreeElement4454 = new BitSet(new long[]{0x0003400000000002L}); - public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeElement4460 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement4499 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom4515 = new BitSet(new long[]{0x0000000000004002L}); - public static final BitSet FOLLOW_ARG_ACTION_in_rewriteTreeAtom4517 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_RULE_REF_in_rewriteTreeAtom4541 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_STRING_LITERAL_in_rewriteTreeAtom4548 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_DOLLAR_in_rewriteTreeAtom4558 = new BitSet(new long[]{0xC000000800000000L}); - public static final BitSet FOLLOW_id_in_rewriteTreeAtom4560 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ACTION_in_rewriteTreeAtom4571 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_LPAREN_in_rewriteTreeEbnf4594 = new BitSet(new long[]{0xC420010000010000L,0x0000000000000008L}); - public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf4596 = new BitSet(new long[]{0x0000020000000000L}); - public static final BitSet FOLLOW_RPAREN_in_rewriteTreeEbnf4598 = new BitSet(new long[]{0x0003400000000000L}); - public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeEbnf4600 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_TREE_BEGIN_in_rewriteTree4624 = new BitSet(new long[]{0xC020000000010000L,0x0000000000000008L}); - public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTree4626 = new BitSet(new long[]{0xC420030000010000L,0x0000000000000008L}); - public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTree4628 = new BitSet(new long[]{0xC420030000010000L,0x0000000000000008L}); - public static final BitSet FOLLOW_RPAREN_in_rewriteTree4631 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate4663 = new BitSet(new long[]{0x0000010000000000L}); - public static final BitSet FOLLOW_LPAREN_in_rewriteTemplate4665 = new BitSet(new long[]{0xC000020800000000L}); - public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate4667 = new BitSet(new long[]{0x0000020000000000L}); - public static final BitSet FOLLOW_RPAREN_in_rewriteTemplate4669 = new BitSet(new long[]{0x0000000000000C00L}); - public static final BitSet FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate4677 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate4683 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rewriteTemplateRef_in_rewriteTemplate4709 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate4718 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_ACTION_in_rewriteTemplate4727 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_id_in_rewriteTemplateRef4740 = new BitSet(new long[]{0x0000010000000000L}); - public static final BitSet FOLLOW_LPAREN_in_rewriteTemplateRef4742 = new BitSet(new long[]{0xC000020800000000L}); - public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef4744 = new BitSet(new long[]{0x0000020000000000L}); - public static final BitSet FOLLOW_RPAREN_in_rewriteTemplateRef4746 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4775 = new BitSet(new long[]{0x0000000000010000L}); - public static final BitSet FOLLOW_ACTION_in_rewriteIndirectTemplateHead4777 = new BitSet(new long[]{0x0000020000000000L}); - public static final BitSet FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4779 = new BitSet(new long[]{0x0000010000000000L}); - public static final BitSet FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4781 = new BitSet(new long[]{0xC000020800000000L}); - public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead4783 = new BitSet(new long[]{0x0000020000000000L}); - public static final BitSet FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4785 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4810 = new BitSet(new long[]{0x0000004000000002L}); - public static final BitSet FOLLOW_COMMA_in_rewriteTemplateArgs4813 = new BitSet(new long[]{0xC000000800000000L}); - public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4815 = new BitSet(new long[]{0x0000004000000002L}); - public static final BitSet FOLLOW_id_in_rewriteTemplateArg4844 = new BitSet(new long[]{0x0000200000000000L}); - public static final BitSet FOLLOW_ASSIGN_in_rewriteTemplateArg4846 = new BitSet(new long[]{0x0000000000010000L}); - public static final BitSet FOLLOW_ACTION_in_rewriteTemplateArg4848 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_RULE_REF_in_id4877 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_TOKEN_REF_in_id4890 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_TEMPLATE_in_id4902 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_id_in_qid4925 = new BitSet(new long[]{0x0040000000000002L}); - public static final BitSet FOLLOW_DOT_in_qid4928 = new BitSet(new long[]{0xC000000800000000L}); - public static final BitSet FOLLOW_id_in_qid4930 = new BitSet(new long[]{0x0040000000000002L}); - public static final BitSet FOLLOW_alternative_in_alternativeEntry4946 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_alternativeEntry4948 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_element_in_elementEntry4957 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_elementEntry4959 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_rule_in_ruleEntry4967 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_ruleEntry4969 = new BitSet(new long[]{0x0000000000000002L}); - public static final BitSet FOLLOW_block_in_blockEntry4977 = new BitSet(new long[]{0x0000000000000000L}); - public static final BitSet FOLLOW_EOF_in_blockEntry4979 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rewriteTree_in_rewriteTreeElement4452 = new BitSet(new long[]{0x0003400000000002L}); + public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeElement4458 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement4497 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom4513 = new BitSet(new long[]{0x0000080000004002L}); + public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom4515 = new BitSet(new long[]{0x0000000000004002L}); + public static final BitSet FOLLOW_ARG_ACTION_in_rewriteTreeAtom4518 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_RULE_REF_in_rewriteTreeAtom4545 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_STRING_LITERAL_in_rewriteTreeAtom4552 = new BitSet(new long[]{0x0000080000000002L}); + public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom4554 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_DOLLAR_in_rewriteTreeAtom4577 = new BitSet(new long[]{0xC000000800000000L}); + public static final BitSet FOLLOW_id_in_rewriteTreeAtom4579 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ACTION_in_rewriteTreeAtom4590 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_LPAREN_in_rewriteTreeEbnf4613 = new BitSet(new long[]{0xC420010000010000L,0x0000000000000008L}); + public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf4615 = new BitSet(new long[]{0x0000020000000000L}); + public static final BitSet FOLLOW_RPAREN_in_rewriteTreeEbnf4617 = new BitSet(new long[]{0x0003400000000000L}); + public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeEbnf4619 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_TREE_BEGIN_in_rewriteTree4643 = new BitSet(new long[]{0xC020000000010000L,0x0000000000000008L}); + public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTree4645 = new BitSet(new long[]{0xC420030000010000L,0x0000000000000008L}); + public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTree4647 = new BitSet(new long[]{0xC420030000010000L,0x0000000000000008L}); + public static final BitSet FOLLOW_RPAREN_in_rewriteTree4650 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate4682 = new BitSet(new long[]{0x0000010000000000L}); + public static final BitSet FOLLOW_LPAREN_in_rewriteTemplate4684 = new BitSet(new long[]{0xC000020800000000L}); + public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate4686 = new BitSet(new long[]{0x0000020000000000L}); + public static final BitSet FOLLOW_RPAREN_in_rewriteTemplate4688 = new BitSet(new long[]{0x0000000000000C00L}); + public static final BitSet FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate4696 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate4702 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rewriteTemplateRef_in_rewriteTemplate4728 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate4737 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ACTION_in_rewriteTemplate4746 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_id_in_rewriteTemplateRef4759 = new BitSet(new long[]{0x0000010000000000L}); + public static final BitSet FOLLOW_LPAREN_in_rewriteTemplateRef4761 = new BitSet(new long[]{0xC000020800000000L}); + public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef4763 = new BitSet(new long[]{0x0000020000000000L}); + public static final BitSet FOLLOW_RPAREN_in_rewriteTemplateRef4765 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4794 = new BitSet(new long[]{0x0000000000010000L}); + public static final BitSet FOLLOW_ACTION_in_rewriteIndirectTemplateHead4796 = new BitSet(new long[]{0x0000020000000000L}); + public static final BitSet FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4798 = new BitSet(new long[]{0x0000010000000000L}); + public static final BitSet FOLLOW_LPAREN_in_rewriteIndirectTemplateHead4800 = new BitSet(new long[]{0xC000020800000000L}); + public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead4802 = new BitSet(new long[]{0x0000020000000000L}); + public static final BitSet FOLLOW_RPAREN_in_rewriteIndirectTemplateHead4804 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4829 = new BitSet(new long[]{0x0000004000000002L}); + public static final BitSet FOLLOW_COMMA_in_rewriteTemplateArgs4832 = new BitSet(new long[]{0xC000000800000000L}); + public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs4834 = new BitSet(new long[]{0x0000004000000002L}); + public static final BitSet FOLLOW_id_in_rewriteTemplateArg4863 = new BitSet(new long[]{0x0000200000000000L}); + public static final BitSet FOLLOW_ASSIGN_in_rewriteTemplateArg4865 = new BitSet(new long[]{0x0000000000010000L}); + public static final BitSet FOLLOW_ACTION_in_rewriteTemplateArg4867 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_RULE_REF_in_id4896 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_TOKEN_REF_in_id4909 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_TEMPLATE_in_id4921 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_id_in_qid4944 = new BitSet(new long[]{0x0040000000000002L}); + public static final BitSet FOLLOW_DOT_in_qid4947 = new BitSet(new long[]{0xC000000800000000L}); + public static final BitSet FOLLOW_id_in_qid4949 = new BitSet(new long[]{0x0040000000000002L}); + public static final BitSet FOLLOW_alternative_in_alternativeEntry4965 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_alternativeEntry4967 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_element_in_elementEntry4976 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_elementEntry4978 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rule_in_ruleEntry4986 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_ruleEntry4988 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_block_in_blockEntry4996 = new BitSet(new long[]{0x0000000000000000L}); + public static final BitSet FOLLOW_EOF_in_blockEntry4998 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteTemplate_in_synpred1_ANTLRParser4311 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteTreeAlt_in_synpred2_ANTLRParser4350 = new BitSet(new long[]{0x0000000000000002L}); diff --git a/tool/src/org/antlr/v4/parse/ASTVerifier.g b/tool/src/org/antlr/v4/parse/ASTVerifier.g index a306a63de..4e359fa51 100644 --- a/tool/src/org/antlr/v4/parse/ASTVerifier.g +++ b/tool/src/org/antlr/v4/parse/ASTVerifier.g @@ -372,10 +372,13 @@ rewriteTreeElement ; rewriteTreeAtom - : ^(TOKEN_REF ARG_ACTION) + : ^(TOKEN_REF elementOptions ARG_ACTION) + | ^(TOKEN_REF elementOptions) + | ^(TOKEN_REF ARG_ACTION) | TOKEN_REF | RULE_REF - | STRING_LITERAL + | ^(STRING_LITERAL elementOptions) + | STRING_LITERAL | LABEL | ACTION ; diff --git a/tool/src/org/antlr/v4/parse/ASTVerifier.java b/tool/src/org/antlr/v4/parse/ASTVerifier.java index bca3a6e9d..b20a28e63 100644 --- a/tool/src/org/antlr/v4/parse/ASTVerifier.java +++ b/tool/src/org/antlr/v4/parse/ASTVerifier.java @@ -1,4 +1,4 @@ -// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-03 15:37:30 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-04 17:30:02 /* [The "BSD license"] @@ -3636,102 +3636,106 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTreeAtom" - // ASTVerifier.g:374:1: rewriteTreeAtom : ( ^( TOKEN_REF ARG_ACTION ) | TOKEN_REF | RULE_REF | STRING_LITERAL | LABEL | ACTION ); + // ASTVerifier.g:374:1: rewriteTreeAtom : ( ^( TOKEN_REF elementOptions ARG_ACTION ) | ^( TOKEN_REF elementOptions ) | ^( TOKEN_REF ARG_ACTION ) | TOKEN_REF | RULE_REF | ^( STRING_LITERAL elementOptions ) | STRING_LITERAL | LABEL | ACTION ); public final void rewriteTreeAtom() throws RecognitionException { try { - // ASTVerifier.g:375:5: ( ^( TOKEN_REF ARG_ACTION ) | TOKEN_REF | RULE_REF | STRING_LITERAL | LABEL | ACTION ) - int alt51=6; - switch ( input.LA(1) ) { - case TOKEN_REF: - { - int LA51_1 = input.LA(2); - - if ( (LA51_1==DOWN) ) { - alt51=1; - } - else if ( (LA51_1==UP||LA51_1==ACTION||LA51_1==TREE_BEGIN||(LA51_1>=TOKEN_REF && LA51_1<=RULE_REF)||LA51_1==STRING_LITERAL||(LA51_1>=OPTIONAL && LA51_1<=POSITIVE_CLOSURE)||LA51_1==LABEL) ) { - alt51=2; - } - else { - NoViableAltException nvae = - new NoViableAltException("", 51, 1, input); - - throw nvae; - } - } - break; - case RULE_REF: - { - alt51=3; - } - break; - case STRING_LITERAL: - { - alt51=4; - } - break; - case LABEL: - { - alt51=5; - } - break; - case ACTION: - { - alt51=6; - } - break; - default: - NoViableAltException nvae = - new NoViableAltException("", 51, 0, input); - - throw nvae; - } - + // ASTVerifier.g:375:5: ( ^( TOKEN_REF elementOptions ARG_ACTION ) | ^( TOKEN_REF elementOptions ) | ^( TOKEN_REF ARG_ACTION ) | TOKEN_REF | RULE_REF | ^( STRING_LITERAL elementOptions ) | STRING_LITERAL | LABEL | ACTION ) + int alt51=9; + alt51 = dfa51.predict(input); switch (alt51) { case 1 : - // ASTVerifier.g:375:9: ^( TOKEN_REF ARG_ACTION ) + // ASTVerifier.g:375:9: ^( TOKEN_REF elementOptions ARG_ACTION ) { match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1657); match(input, Token.DOWN, null); - match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1659); + pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1659); + elementOptions(); + + state._fsp--; + + match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1661); match(input, Token.UP, null); } break; case 2 : - // ASTVerifier.g:376:6: TOKEN_REF + // ASTVerifier.g:376:9: ^( TOKEN_REF elementOptions ) { - match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1667); + match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1673); + + match(input, Token.DOWN, null); + pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1675); + elementOptions(); + + state._fsp--; + + + match(input, Token.UP, null); } break; case 3 : - // ASTVerifier.g:377:9: RULE_REF + // ASTVerifier.g:377:9: ^( TOKEN_REF ARG_ACTION ) { - match(input,RULE_REF,FOLLOW_RULE_REF_in_rewriteTreeAtom1677); + match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1687); + + match(input, Token.DOWN, null); + match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1689); + + match(input, Token.UP, null); } break; case 4 : - // ASTVerifier.g:378:6: STRING_LITERAL + // ASTVerifier.g:378:6: TOKEN_REF { - match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1684); + match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1697); } break; case 5 : - // ASTVerifier.g:379:6: LABEL + // ASTVerifier.g:379:9: RULE_REF { - match(input,LABEL,FOLLOW_LABEL_in_rewriteTreeAtom1691); + match(input,RULE_REF,FOLLOW_RULE_REF_in_rewriteTreeAtom1707); } break; case 6 : - // ASTVerifier.g:380:4: ACTION + // ASTVerifier.g:380:6: ^( STRING_LITERAL elementOptions ) { - match(input,ACTION,FOLLOW_ACTION_in_rewriteTreeAtom1696); + match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1715); + + match(input, Token.DOWN, null); + pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1717); + elementOptions(); + + state._fsp--; + + + match(input, Token.UP, null); + + } + break; + case 7 : + // ASTVerifier.g:381:6: STRING_LITERAL + { + match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1725); + + } + break; + case 8 : + // ASTVerifier.g:382:6: LABEL + { + match(input,LABEL,FOLLOW_LABEL_in_rewriteTreeAtom1733); + + } + break; + case 9 : + // ASTVerifier.g:383:4: ACTION + { + match(input,ACTION,FOLLOW_ACTION_in_rewriteTreeAtom1738); } break; @@ -3750,23 +3754,23 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTreeEbnf" - // ASTVerifier.g:383:1: rewriteTreeEbnf : ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) ; + // ASTVerifier.g:386:1: rewriteTreeEbnf : ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) ; public final void rewriteTreeEbnf() throws RecognitionException { try { - // ASTVerifier.g:384:2: ( ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) ) - // ASTVerifier.g:384:4: ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) + // ASTVerifier.g:387:2: ( ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) ) + // ASTVerifier.g:387:4: ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) { - pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1708); + pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1750); ebnfSuffix(); state._fsp--; match(input, Token.DOWN, null); - match(input,REWRITE_BLOCK,FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1711); + match(input,REWRITE_BLOCK,FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1753); match(input, Token.DOWN, null); - pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1713); + pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1755); rewriteTreeAlt(); state._fsp--; @@ -3791,21 +3795,21 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTree" - // ASTVerifier.g:386:1: rewriteTree : ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ; + // ASTVerifier.g:389:1: rewriteTree : ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ; public final void rewriteTree() throws RecognitionException { try { - // ASTVerifier.g:387:2: ( ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ) - // ASTVerifier.g:387:4: ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) + // ASTVerifier.g:390:2: ( ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) ) + // ASTVerifier.g:390:4: ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) { - match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewriteTree1726); + match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewriteTree1768); match(input, Token.DOWN, null); - pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTree1728); + pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTree1770); rewriteTreeAtom(); state._fsp--; - // ASTVerifier.g:387:33: ( rewriteTreeElement )* + // ASTVerifier.g:390:33: ( rewriteTreeElement )* loop52: do { int alt52=2; @@ -3818,9 +3822,9 @@ public class ASTVerifier extends TreeParser { switch (alt52) { case 1 : - // ASTVerifier.g:387:33: rewriteTreeElement + // ASTVerifier.g:390:33: rewriteTreeElement { - pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTree1730); + pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTree1772); rewriteTreeElement(); state._fsp--; @@ -3852,20 +3856,20 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTemplate" - // ASTVerifier.g:390:1: rewriteTemplate : ( ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL ) | ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL ) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ); + // ASTVerifier.g:393:1: rewriteTemplate : ( ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL ) | ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL ) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ); public final void rewriteTemplate() throws RecognitionException { try { - // ASTVerifier.g:391:2: ( ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL ) | ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL ) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ) + // ASTVerifier.g:394:2: ( ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL ) | ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL ) | rewriteTemplateRef | rewriteIndirectTemplateHead | ACTION ) int alt55=5; alt55 = dfa55.predict(input); switch (alt55) { case 1 : - // ASTVerifier.g:391:4: ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL ) + // ASTVerifier.g:394:4: ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL ) { - match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1745); + match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1787); match(input, Token.DOWN, null); - // ASTVerifier.g:391:15: ( rewriteTemplateArgs )? + // ASTVerifier.g:394:15: ( rewriteTemplateArgs )? int alt53=2; int LA53_0 = input.LA(1); @@ -3874,9 +3878,9 @@ public class ASTVerifier extends TreeParser { } switch (alt53) { case 1 : - // ASTVerifier.g:391:15: rewriteTemplateArgs + // ASTVerifier.g:394:15: rewriteTemplateArgs { - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1747); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1789); rewriteTemplateArgs(); state._fsp--; @@ -3887,19 +3891,19 @@ public class ASTVerifier extends TreeParser { } - match(input,DOUBLE_QUOTE_STRING_LITERAL,FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1750); + match(input,DOUBLE_QUOTE_STRING_LITERAL,FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1792); match(input, Token.UP, null); } break; case 2 : - // ASTVerifier.g:392:4: ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL ) + // ASTVerifier.g:395:4: ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL ) { - match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1757); + match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1799); match(input, Token.DOWN, null); - // ASTVerifier.g:392:15: ( rewriteTemplateArgs )? + // ASTVerifier.g:395:15: ( rewriteTemplateArgs )? int alt54=2; int LA54_0 = input.LA(1); @@ -3908,9 +3912,9 @@ public class ASTVerifier extends TreeParser { } switch (alt54) { case 1 : - // ASTVerifier.g:392:15: rewriteTemplateArgs + // ASTVerifier.g:395:15: rewriteTemplateArgs { - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1759); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1801); rewriteTemplateArgs(); state._fsp--; @@ -3921,16 +3925,16 @@ public class ASTVerifier extends TreeParser { } - match(input,DOUBLE_ANGLE_STRING_LITERAL,FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate1762); + match(input,DOUBLE_ANGLE_STRING_LITERAL,FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate1804); match(input, Token.UP, null); } break; case 3 : - // ASTVerifier.g:393:4: rewriteTemplateRef + // ASTVerifier.g:396:4: rewriteTemplateRef { - pushFollow(FOLLOW_rewriteTemplateRef_in_rewriteTemplate1768); + pushFollow(FOLLOW_rewriteTemplateRef_in_rewriteTemplate1810); rewriteTemplateRef(); state._fsp--; @@ -3939,9 +3943,9 @@ public class ASTVerifier extends TreeParser { } break; case 4 : - // ASTVerifier.g:394:4: rewriteIndirectTemplateHead + // ASTVerifier.g:397:4: rewriteIndirectTemplateHead { - pushFollow(FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1773); + pushFollow(FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1815); rewriteIndirectTemplateHead(); state._fsp--; @@ -3950,9 +3954,9 @@ public class ASTVerifier extends TreeParser { } break; case 5 : - // ASTVerifier.g:395:4: ACTION + // ASTVerifier.g:398:4: ACTION { - match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplate1778); + match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplate1820); } break; @@ -3971,17 +3975,17 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTemplateRef" - // ASTVerifier.g:398:1: rewriteTemplateRef : ^( TEMPLATE ID ( rewriteTemplateArgs )? ) ; + // ASTVerifier.g:401:1: rewriteTemplateRef : ^( TEMPLATE ID ( rewriteTemplateArgs )? ) ; public final void rewriteTemplateRef() throws RecognitionException { try { - // ASTVerifier.g:399:2: ( ^( TEMPLATE ID ( rewriteTemplateArgs )? ) ) - // ASTVerifier.g:399:4: ^( TEMPLATE ID ( rewriteTemplateArgs )? ) + // ASTVerifier.g:402:2: ( ^( TEMPLATE ID ( rewriteTemplateArgs )? ) ) + // ASTVerifier.g:402:4: ^( TEMPLATE ID ( rewriteTemplateArgs )? ) { - match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplateRef1790); + match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplateRef1832); match(input, Token.DOWN, null); - match(input,ID,FOLLOW_ID_in_rewriteTemplateRef1792); - // ASTVerifier.g:399:18: ( rewriteTemplateArgs )? + match(input,ID,FOLLOW_ID_in_rewriteTemplateRef1834); + // ASTVerifier.g:402:18: ( rewriteTemplateArgs )? int alt56=2; int LA56_0 = input.LA(1); @@ -3990,9 +3994,9 @@ public class ASTVerifier extends TreeParser { } switch (alt56) { case 1 : - // ASTVerifier.g:399:18: rewriteTemplateArgs + // ASTVerifier.g:402:18: rewriteTemplateArgs { - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1794); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1836); rewriteTemplateArgs(); state._fsp--; @@ -4021,17 +4025,17 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteIndirectTemplateHead" - // ASTVerifier.g:402:1: rewriteIndirectTemplateHead : ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) ; + // ASTVerifier.g:405:1: rewriteIndirectTemplateHead : ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) ; public final void rewriteIndirectTemplateHead() throws RecognitionException { try { - // ASTVerifier.g:403:2: ( ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) ) - // ASTVerifier.g:403:4: ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) + // ASTVerifier.g:406:2: ( ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) ) + // ASTVerifier.g:406:4: ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) { - match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1808); + match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1850); match(input, Token.DOWN, null); - match(input,ACTION,FOLLOW_ACTION_in_rewriteIndirectTemplateHead1810); - // ASTVerifier.g:403:22: ( rewriteTemplateArgs )? + match(input,ACTION,FOLLOW_ACTION_in_rewriteIndirectTemplateHead1852); + // ASTVerifier.g:406:22: ( rewriteTemplateArgs )? int alt57=2; int LA57_0 = input.LA(1); @@ -4040,9 +4044,9 @@ public class ASTVerifier extends TreeParser { } switch (alt57) { case 1 : - // ASTVerifier.g:403:22: rewriteTemplateArgs + // ASTVerifier.g:406:22: rewriteTemplateArgs { - pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1812); + pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1854); rewriteTemplateArgs(); state._fsp--; @@ -4071,16 +4075,16 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTemplateArgs" - // ASTVerifier.g:406:1: rewriteTemplateArgs : ^( ARGLIST ( rewriteTemplateArg )+ ) ; + // ASTVerifier.g:409:1: rewriteTemplateArgs : ^( ARGLIST ( rewriteTemplateArg )+ ) ; public final void rewriteTemplateArgs() throws RecognitionException { try { - // ASTVerifier.g:407:2: ( ^( ARGLIST ( rewriteTemplateArg )+ ) ) - // ASTVerifier.g:407:4: ^( ARGLIST ( rewriteTemplateArg )+ ) + // ASTVerifier.g:410:2: ( ^( ARGLIST ( rewriteTemplateArg )+ ) ) + // ASTVerifier.g:410:4: ^( ARGLIST ( rewriteTemplateArg )+ ) { - match(input,ARGLIST,FOLLOW_ARGLIST_in_rewriteTemplateArgs1826); + match(input,ARGLIST,FOLLOW_ARGLIST_in_rewriteTemplateArgs1868); match(input, Token.DOWN, null); - // ASTVerifier.g:407:14: ( rewriteTemplateArg )+ + // ASTVerifier.g:410:14: ( rewriteTemplateArg )+ int cnt58=0; loop58: do { @@ -4094,9 +4098,9 @@ public class ASTVerifier extends TreeParser { switch (alt58) { case 1 : - // ASTVerifier.g:407:14: rewriteTemplateArg + // ASTVerifier.g:410:14: rewriteTemplateArg { - pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1828); + pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1870); rewriteTemplateArg(); state._fsp--; @@ -4132,17 +4136,17 @@ public class ASTVerifier extends TreeParser { // $ANTLR start "rewriteTemplateArg" - // ASTVerifier.g:410:1: rewriteTemplateArg : ^( ARG ID ACTION ) ; + // ASTVerifier.g:413:1: rewriteTemplateArg : ^( ARG ID ACTION ) ; public final void rewriteTemplateArg() throws RecognitionException { try { - // ASTVerifier.g:411:2: ( ^( ARG ID ACTION ) ) - // ASTVerifier.g:411:6: ^( ARG ID ACTION ) + // ASTVerifier.g:414:2: ( ^( ARG ID ACTION ) ) + // ASTVerifier.g:414:6: ^( ARG ID ACTION ) { - match(input,ARG,FOLLOW_ARG_in_rewriteTemplateArg1844); + match(input,ARG,FOLLOW_ARG_in_rewriteTemplateArg1886); match(input, Token.DOWN, null); - match(input,ID,FOLLOW_ID_in_rewriteTemplateArg1846); - match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplateArg1848); + match(input,ID,FOLLOW_ID_in_rewriteTemplateArg1888); + match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplateArg1890); match(input, Token.UP, null); @@ -4165,6 +4169,7 @@ public class ASTVerifier extends TreeParser { protected DFA26 dfa26 = new DFA26(this); protected DFA33 dfa33 = new DFA33(this); protected DFA42 dfa42 = new DFA42(this); + protected DFA51 dfa51 = new DFA51(this); protected DFA55 dfa55 = new DFA55(this); static final String DFA26_eotS = "\14\uffff"; @@ -4382,6 +4387,83 @@ public class ASTVerifier extends TreeParser { return "320:1: terminal : ( ^( STRING_LITERAL elementOptions ) | STRING_LITERAL | ^( TOKEN_REF ARG_ACTION elementOptions ) | ^( TOKEN_REF ARG_ACTION ) | ^( TOKEN_REF elementOptions ) | TOKEN_REF | ^( WILDCARD elementOptions ) | WILDCARD | ^( ROOT terminal ) | ^( BANG terminal ) );"; } } + static final String DFA51_eotS = + "\30\uffff"; + static final String DFA51_eofS = + "\30\uffff"; + static final String DFA51_minS = + "\1\20\1\2\1\uffff\1\2\2\uffff\1\16\4\uffff\1\2\1\55\1\3\1\2\1\3"+ + "\1\127\2\uffff\1\103\4\3"; + static final String DFA51_maxS = + "\2\134\1\uffff\1\134\2\uffff\1\142\4\uffff\1\2\2\127\1\2\1\16\1"+ + "\127\2\uffff\1\127\2\3\2\127"; + static final String DFA51_acceptS = + "\2\uffff\1\5\1\uffff\1\10\1\11\1\uffff\1\4\1\6\1\7\1\3\6\uffff\1"+ + "\1\1\2\5\uffff"; + static final String DFA51_specialS = + "\30\uffff}>"; + static final String[] DFA51_transitionS = { + "\1\5\55\uffff\1\1\1\2\3\uffff\1\3\30\uffff\1\4", + "\1\6\1\7\14\uffff\1\7\51\uffff\1\7\3\uffff\2\7\3\uffff\1\7"+ + "\12\uffff\3\7\13\uffff\1\7", + "", + "\1\10\1\11\14\uffff\1\11\51\uffff\1\11\3\uffff\2\11\3\uffff"+ + "\1\11\12\uffff\3\11\13\uffff\1\11", + "", + "", + "\1\12\123\uffff\1\13", + "", + "", + "", + "", + "\1\14", + "\1\16\51\uffff\1\15", + "\1\17\51\uffff\1\16\51\uffff\1\15", + "\1\20", + "\1\22\12\uffff\1\21", + "\1\23", + "", + "", + "\1\25\23\uffff\1\24", + "\1\26", + "\1\27", + "\1\17\51\uffff\1\16\51\uffff\1\15", + "\1\17\51\uffff\1\16\51\uffff\1\15" + }; + + static final short[] DFA51_eot = DFA.unpackEncodedString(DFA51_eotS); + static final short[] DFA51_eof = DFA.unpackEncodedString(DFA51_eofS); + static final char[] DFA51_min = DFA.unpackEncodedStringToUnsignedChars(DFA51_minS); + static final char[] DFA51_max = DFA.unpackEncodedStringToUnsignedChars(DFA51_maxS); + static final short[] DFA51_accept = DFA.unpackEncodedString(DFA51_acceptS); + static final short[] DFA51_special = DFA.unpackEncodedString(DFA51_specialS); + static final short[][] DFA51_transition; + + static { + int numStates = DFA51_transitionS.length; + DFA51_transition = new short[numStates][]; + for (int i=0; i + ^(TOKEN_REF ARG_ACTION) {BasicSemanticChecks.checkTokenArgs(g.getType(), $TOKEN_REF.token);} ; elementOption - : ^( ELEMENT_OPTIONS + : {!inContext("RESULT ...")}? // not on right side of -> + ^( ELEMENT_OPTIONS ( ^(ASSIGN o=ID value=ID) | ^(ASSIGN o=ID value=STRING_LITERAL) | o=ID diff --git a/tool/src/org/antlr/v4/semantics/BasicSemanticTriggers.java b/tool/src/org/antlr/v4/semantics/BasicSemanticTriggers.java index 7d4330f53..0bf8b5563 100644 --- a/tool/src/org/antlr/v4/semantics/BasicSemanticTriggers.java +++ b/tool/src/org/antlr/v4/semantics/BasicSemanticTriggers.java @@ -1,4 +1,4 @@ -// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-03 15:37:39 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-04 17:59:03 /* [The "BSD license"] @@ -1048,18 +1048,22 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter // $ANTLR start "tokenRefWithArgs" - // BasicSemanticTriggers.g:177:1: tokenRefWithArgs : ^( TOKEN_REF ARG_ACTION ) ; + // BasicSemanticTriggers.g:177:1: tokenRefWithArgs : {...}? ^( TOKEN_REF ARG_ACTION ) ; public final void tokenRefWithArgs() throws RecognitionException { GrammarAST TOKEN_REF7=null; try { - // BasicSemanticTriggers.g:178:2: ( ^( TOKEN_REF ARG_ACTION ) ) - // BasicSemanticTriggers.g:178:4: ^( TOKEN_REF ARG_ACTION ) + // BasicSemanticTriggers.g:178:2: ({...}? ^( TOKEN_REF ARG_ACTION ) ) + // BasicSemanticTriggers.g:178:4: {...}? ^( TOKEN_REF ARG_ACTION ) { - TOKEN_REF7=(GrammarAST)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenRefWithArgs530); if (state.failed) return ; + if ( !((!inContext("RESULT ..."))) ) { + if (state.backtracking>0) {state.failed=true; return ;} + throw new FailedPredicateException(input, "tokenRefWithArgs", "!inContext(\"RESULT ...\")"); + } + TOKEN_REF7=(GrammarAST)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenRefWithArgs538); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; - match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_tokenRefWithArgs532); if (state.failed) return ; + match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_tokenRefWithArgs540); if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ; if ( state.backtracking==1 ) { @@ -1083,7 +1087,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter }; // $ANTLR start "elementOption" - // BasicSemanticTriggers.g:182:1: elementOption : ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) ) ; + // BasicSemanticTriggers.g:183:1: elementOption : {...}? ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) ) ; public final BasicSemanticTriggers.elementOption_return elementOption() throws RecognitionException { BasicSemanticTriggers.elementOption_return retval = new BasicSemanticTriggers.elementOption_return(); retval.start = input.LT(1); @@ -1092,13 +1096,17 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter GrammarAST value=null; try { - // BasicSemanticTriggers.g:183:5: ( ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) ) ) - // BasicSemanticTriggers.g:183:7: ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) ) + // BasicSemanticTriggers.g:184:5: ({...}? ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) ) ) + // BasicSemanticTriggers.g:184:7: {...}? ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) ) { - match(input,ELEMENT_OPTIONS,FOLLOW_ELEMENT_OPTIONS_in_elementOption554); if (state.failed) return retval; + if ( !((!inContext("RESULT ..."))) ) { + if (state.backtracking>0) {state.failed=true; return retval;} + throw new FailedPredicateException(input, "elementOption", "!inContext(\"RESULT ...\")"); + } + match(input,ELEMENT_OPTIONS,FOLLOW_ELEMENT_OPTIONS_in_elementOption570); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; - // BasicSemanticTriggers.g:184:7: ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) + // BasicSemanticTriggers.g:186:7: ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) | o= ID ) int alt11=3; int LA11_0 = input.LA(1); @@ -1153,35 +1161,35 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter } switch (alt11) { case 1 : - // BasicSemanticTriggers.g:184:9: ^( ASSIGN o= ID value= ID ) + // BasicSemanticTriggers.g:186:9: ^( ASSIGN o= ID value= ID ) { - match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption565); if (state.failed) return retval; + match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption581); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; - o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption569); if (state.failed) return retval; - value=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption573); if (state.failed) return retval; + o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption585); if (state.failed) return retval; + value=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption589); if (state.failed) return retval; match(input, Token.UP, null); if (state.failed) return retval; } break; case 2 : - // BasicSemanticTriggers.g:185:11: ^( ASSIGN o= ID value= STRING_LITERAL ) + // BasicSemanticTriggers.g:187:11: ^( ASSIGN o= ID value= STRING_LITERAL ) { - match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption587); if (state.failed) return retval; + match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption603); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; - o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption591); if (state.failed) return retval; - value=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_elementOption595); if (state.failed) return retval; + o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption607); if (state.failed) return retval; + value=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_elementOption611); if (state.failed) return retval; match(input, Token.UP, null); if (state.failed) return retval; } break; case 3 : - // BasicSemanticTriggers.g:186:10: o= ID + // BasicSemanticTriggers.g:188:10: o= ID { - o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption609); if (state.failed) return retval; + o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption625); if (state.failed) return retval; } break; @@ -1224,21 +1232,21 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter }; // $ANTLR start "multiElementAltInTreeGrammar" - // BasicSemanticTriggers.g:206:1: multiElementAltInTreeGrammar : {...}? ^( ALT ~ ( SEMPRED | ACTION ) (~ ( SEMPRED | ACTION ) )+ ) ; + // BasicSemanticTriggers.g:208:1: multiElementAltInTreeGrammar : {...}? ^( ALT ~ ( SEMPRED | ACTION ) (~ ( SEMPRED | ACTION ) )+ ) ; public final BasicSemanticTriggers.multiElementAltInTreeGrammar_return multiElementAltInTreeGrammar() throws RecognitionException { BasicSemanticTriggers.multiElementAltInTreeGrammar_return retval = new BasicSemanticTriggers.multiElementAltInTreeGrammar_return(); retval.start = input.LT(1); try { - // BasicSemanticTriggers.g:207:2: ({...}? ^( ALT ~ ( SEMPRED | ACTION ) (~ ( SEMPRED | ACTION ) )+ ) ) - // BasicSemanticTriggers.g:207:4: {...}? ^( ALT ~ ( SEMPRED | ACTION ) (~ ( SEMPRED | ACTION ) )+ ) + // BasicSemanticTriggers.g:209:2: ({...}? ^( ALT ~ ( SEMPRED | ACTION ) (~ ( SEMPRED | ACTION ) )+ ) ) + // BasicSemanticTriggers.g:209:4: {...}? ^( ALT ~ ( SEMPRED | ACTION ) (~ ( SEMPRED | ACTION ) )+ ) { if ( !((inContext("ALT_REWRITE") && root.getOption("output")!=null && root.getOption("output").equals("template"))) ) { if (state.backtracking>0) {state.failed=true; return retval;} throw new FailedPredicateException(input, "multiElementAltInTreeGrammar", "inContext(\"ALT_REWRITE\") &&\n\t\t root.getOption(\"output\")!=null && root.getOption(\"output\").equals(\"template\")"); } - match(input,ALT,FOLLOW_ALT_in_multiElementAltInTreeGrammar649); if (state.failed) return retval; + match(input,ALT,FOLLOW_ALT_in_multiElementAltInTreeGrammar665); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; if ( (input.LA(1)>=FORCED_ACTION && input.LA(1)<=NESTED_ACTION)||(input.LA(1)>=ACTION_ESC && input.LA(1)<=ALT_REWRITE) ) { @@ -1251,7 +1259,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter throw mse; } - // BasicSemanticTriggers.g:209:28: (~ ( SEMPRED | ACTION ) )+ + // BasicSemanticTriggers.g:211:28: (~ ( SEMPRED | ACTION ) )+ int cnt12=0; loop12: do { @@ -1265,7 +1273,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter switch (alt12) { case 1 : - // BasicSemanticTriggers.g:209:28: ~ ( SEMPRED | ACTION ) + // BasicSemanticTriggers.g:211:28: ~ ( SEMPRED | ACTION ) { if ( (input.LA(1)>=FORCED_ACTION && input.LA(1)<=NESTED_ACTION)||(input.LA(1)>=ACTION_ESC && input.LA(1)<=ALT_REWRITE) ) { input.consume(); @@ -1320,7 +1328,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter }; // $ANTLR start "astOps" - // BasicSemanticTriggers.g:220:1: astOps : ( ^( ROOT el= . ) | ^( BANG el= . ) ); + // BasicSemanticTriggers.g:222:1: astOps : ( ^( ROOT el= . ) | ^( BANG el= . ) ); public final BasicSemanticTriggers.astOps_return astOps() throws RecognitionException { BasicSemanticTriggers.astOps_return retval = new BasicSemanticTriggers.astOps_return(); retval.start = input.LT(1); @@ -1328,7 +1336,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter GrammarAST el=null; try { - // BasicSemanticTriggers.g:221:2: ( ^( ROOT el= . ) | ^( BANG el= . ) ) + // BasicSemanticTriggers.g:223:2: ( ^( ROOT el= . ) | ^( BANG el= . ) ) int alt13=2; int LA13_0 = input.LA(1); @@ -1347,9 +1355,9 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter } switch (alt13) { case 1 : - // BasicSemanticTriggers.g:221:4: ^( ROOT el= . ) + // BasicSemanticTriggers.g:223:4: ^( ROOT el= . ) { - match(input,ROOT,FOLLOW_ROOT_in_astOps684); if (state.failed) return retval; + match(input,ROOT,FOLLOW_ROOT_in_astOps700); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; el=(GrammarAST)input.LT(1); @@ -1363,9 +1371,9 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter } break; case 2 : - // BasicSemanticTriggers.g:222:4: ^( BANG el= . ) + // BasicSemanticTriggers.g:224:4: ^( BANG el= . ) { - match(input,BANG,FOLLOW_BANG_in_astOps697); if (state.failed) return retval; + match(input,BANG,FOLLOW_BANG_in_astOps713); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval; el=(GrammarAST)input.LT(1); @@ -1393,19 +1401,19 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter // $ANTLR start "wildcardRoot" - // BasicSemanticTriggers.g:225:1: wildcardRoot : ^( TREE_BEGIN WILDCARD ( . )* ) ; + // BasicSemanticTriggers.g:227:1: wildcardRoot : ^( TREE_BEGIN WILDCARD ( . )* ) ; public final void wildcardRoot() throws RecognitionException { GrammarAST WILDCARD8=null; try { - // BasicSemanticTriggers.g:226:5: ( ^( TREE_BEGIN WILDCARD ( . )* ) ) - // BasicSemanticTriggers.g:226:7: ^( TREE_BEGIN WILDCARD ( . )* ) + // BasicSemanticTriggers.g:228:5: ( ^( TREE_BEGIN WILDCARD ( . )* ) ) + // BasicSemanticTriggers.g:228:7: ^( TREE_BEGIN WILDCARD ( . )* ) { - match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_wildcardRoot720); if (state.failed) return ; + match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_wildcardRoot736); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ; - WILDCARD8=(GrammarAST)match(input,WILDCARD,FOLLOW_WILDCARD_in_wildcardRoot722); if (state.failed) return ; - // BasicSemanticTriggers.g:226:29: ( . )* + WILDCARD8=(GrammarAST)match(input,WILDCARD,FOLLOW_WILDCARD_in_wildcardRoot738); if (state.failed) return ; + // BasicSemanticTriggers.g:228:29: ( . )* loop14: do { int alt14=2; @@ -1421,7 +1429,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter switch (alt14) { case 1 : - // BasicSemanticTriggers.g:226:29: . + // BasicSemanticTriggers.g:228:29: . { matchAny(input); if (state.failed) return ; @@ -1580,22 +1588,22 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter public static final BitSet FOLLOW_ASSIGN_in_tokenAlias509 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ID_in_tokenAlias511 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_STRING_LITERAL_in_tokenAlias513 = new BitSet(new long[]{0x0000000000000008L}); - public static final BitSet FOLLOW_TOKEN_REF_in_tokenRefWithArgs530 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_ARG_ACTION_in_tokenRefWithArgs532 = new BitSet(new long[]{0x0000000000000008L}); - public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOption554 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_ASSIGN_in_elementOption565 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_ID_in_elementOption569 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); - public static final BitSet FOLLOW_ID_in_elementOption573 = new BitSet(new long[]{0x0000000000000008L}); - public static final BitSet FOLLOW_ASSIGN_in_elementOption587 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_ID_in_elementOption591 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); - public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption595 = new BitSet(new long[]{0x0000000000000008L}); - public static final BitSet FOLLOW_ID_in_elementOption609 = new BitSet(new long[]{0x0000000000000008L}); - public static final BitSet FOLLOW_ALT_in_multiElementAltInTreeGrammar649 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_set_in_multiElementAltInTreeGrammar651 = new BitSet(new long[]{0xFFFFFFFFFFFEFFE0L,0x0000001FFFFFFFFFL}); - public static final BitSet FOLLOW_set_in_multiElementAltInTreeGrammar658 = new BitSet(new long[]{0xFFFFFFFFFFFEFFE8L,0x0000001FFFFFFFFFL}); - public static final BitSet FOLLOW_ROOT_in_astOps684 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_BANG_in_astOps697 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_TREE_BEGIN_in_wildcardRoot720 = new BitSet(new long[]{0x0000000000000004L}); - public static final BitSet FOLLOW_WILDCARD_in_wildcardRoot722 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x0000001FFFFFFFFFL}); + public static final BitSet FOLLOW_TOKEN_REF_in_tokenRefWithArgs538 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_ARG_ACTION_in_tokenRefWithArgs540 = new BitSet(new long[]{0x0000000000000008L}); + public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOption570 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_ASSIGN_in_elementOption581 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_ID_in_elementOption585 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L}); + public static final BitSet FOLLOW_ID_in_elementOption589 = new BitSet(new long[]{0x0000000000000008L}); + public static final BitSet FOLLOW_ASSIGN_in_elementOption603 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_ID_in_elementOption607 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); + public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption611 = new BitSet(new long[]{0x0000000000000008L}); + public static final BitSet FOLLOW_ID_in_elementOption625 = new BitSet(new long[]{0x0000000000000008L}); + public static final BitSet FOLLOW_ALT_in_multiElementAltInTreeGrammar665 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_set_in_multiElementAltInTreeGrammar667 = new BitSet(new long[]{0xFFFFFFFFFFFEFFE0L,0x0000001FFFFFFFFFL}); + public static final BitSet FOLLOW_set_in_multiElementAltInTreeGrammar674 = new BitSet(new long[]{0xFFFFFFFFFFFEFFE8L,0x0000001FFFFFFFFFL}); + public static final BitSet FOLLOW_ROOT_in_astOps700 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_BANG_in_astOps713 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_TREE_BEGIN_in_wildcardRoot736 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_WILDCARD_in_wildcardRoot738 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x0000001FFFFFFFFFL}); } \ No newline at end of file diff --git a/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.g b/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.g new file mode 100644 index 000000000..71eb83659 --- /dev/null +++ b/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.g @@ -0,0 +1,104 @@ +/* + [The "BSD license"] + Copyright (c) 2010 Terence Parr + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** Triggers for defining rules, tokens, scopes, and actions. + * Side-effects: ... + */ +tree grammar DefineSymbolTriggers; +options { + language = Java; + tokenVocab = ANTLRParser; + ASTLabelType = GrammarAST; + filter = true; + superClass = 'org.antlr.v4.runtime.tree.TreeFilter'; +} + +// Include the copyright in this source and also the generated source +@header { +/* + [The "BSD license"] + Copyright (c) 2010 Terence Parr + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package org.antlr.v4.semantics; +import org.antlr.v4.tool.*; +} + +@members { +Grammar g; // which grammar are we checking +public DefineSymbolTriggers(TreeNodeStream input, Grammar g) { + this(input); + this.g = g; +} +} + +topdown + : tokenAlias + | rule + | terminal + ; + +tokenAlias + : {inContext("TOKENS")}? ^(ASSIGN ID STRING_LITERAL) + {System.out.println("token alias "+$ID.text+"="+$STRING_LITERAL.token);} + ; + +rule: ^( RULE r=ID .*) {System.out.println("rule "+$r.token);} //{DefineSymbols.checkInvalidRuleDef(g.getType(), $r.token);} + ; + +terminal + : {!inContext("TOKENS ASSIGN")}? STRING_LITERAL + {System.out.println("terminal "+$STRING_LITERAL.token);} + | TOKEN_REF {System.out.println("terminal "+$TOKEN_REF.token);} + ; + +/* +ruleref + : ^(ROOT RULE_REF ARG_ACTION?) + | ^(BANG RULE_REF ARG_ACTION?) + | ^(RULE_REF ARG_ACTION?) + ; +*/ diff --git a/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.java b/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.java new file mode 100644 index 000000000..d37c8989c --- /dev/null +++ b/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.java @@ -0,0 +1,422 @@ +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 DefineSymbolTriggers.g 2010-02-04 17:59:03 + +/* + [The "BSD license"] + Copyright (c) 2010 Terence Parr + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +package org.antlr.v4.semantics; + +import org.antlr.runtime.*; +import org.antlr.runtime.tree.TreeNodeStream; +import org.antlr.v4.tool.Grammar; +import org.antlr.v4.tool.GrammarAST; +/** Triggers for defining rules, tokens, scopes, and actions. + * Side-effects: ... + */ +public class DefineSymbolTriggers extends org.antlr.v4.runtime.tree.TreeFilter { + public static final String[] tokenNames = new String[] { + "", "", "", "", "SEMPRED", "FORCED_ACTION", "DOC_COMMENT", "SRC", "NLCHARS", "COMMENT", "DOUBLE_QUOTE_STRING_LITERAL", "DOUBLE_ANGLE_STRING_LITERAL", "ACTION_STRING_LITERAL", "ACTION_CHAR_LITERAL", "ARG_ACTION", "NESTED_ACTION", "ACTION", "ACTION_ESC", "WSNLCHARS", "OPTIONS", "TOKENS", "SCOPE", "IMPORT", "FRAGMENT", "LEXER", "PARSER", "TREE", "GRAMMAR", "PROTECTED", "PUBLIC", "PRIVATE", "RETURNS", "THROWS", "CATCH", "FINALLY", "TEMPLATE", "COLON", "COLONCOLON", "COMMA", "SEMI", "LPAREN", "RPAREN", "IMPLIES", "LT", "GT", "ASSIGN", "QUESTION", "BANG", "STAR", "PLUS", "PLUS_ASSIGN", "OR", "ROOT", "DOLLAR", "DOT", "RANGE", "ETC", "RARROW", "TREE_BEGIN", "AT", "NOT", "RBRACE", "TOKEN_REF", "RULE_REF", "INT", "WSCHARS", "ESC_SEQ", "STRING_LITERAL", "HEX_DIGIT", "UNICODE_ESC", "WS", "ERRCHAR", "RULE", "RULES", "RULEMODIFIERS", "RULEACTIONS", "BLOCK", "REWRITE_BLOCK", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "CHAR_RANGE", "EPSILON", "ALT", "ALTLIST", "RESULT", "ID", "ARG", "ARGLIST", "RET", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "WILDCARD", "LIST", "ELEMENT_OPTIONS", "ST_RESULT", "ALT_REWRITE" + }; + public static final int LT=43; + public static final int STAR=48; + public static final int BACKTRACK_SEMPRED=95; + public static final int DOUBLE_ANGLE_STRING_LITERAL=11; + public static final int FORCED_ACTION=5; + public static final int ARGLIST=89; + public static final int ALTLIST=85; + public static final int NOT=60; + public static final int EOF=-1; + public static final int SEMPRED=4; + public static final int ACTION=16; + public static final int TOKEN_REF=62; + public static final int RULEMODIFIERS=74; + public static final int ST_RESULT=99; + public static final int RPAREN=41; + public static final int RET=90; + public static final int IMPORT=22; + public static final int STRING_LITERAL=67; + public static final int ARG=88; + public static final int ARG_ACTION=14; + public static final int DOUBLE_QUOTE_STRING_LITERAL=10; + public static final int COMMENT=9; + public static final int ACTION_CHAR_LITERAL=13; + public static final int GRAMMAR=27; + public static final int RULEACTIONS=75; + public static final int WSCHARS=65; + public static final int INITACTION=91; + public static final int ALT_REWRITE=100; + public static final int IMPLIES=42; + public static final int RULE=72; + public static final int RBRACE=61; + public static final int ACTION_ESC=17; + public static final int PRIVATE=30; + public static final int SRC=7; + public static final int THROWS=32; + public static final int CHAR_RANGE=82; + public static final int INT=64; + public static final int EPSILON=83; + public static final int LIST=97; + public static final int COLONCOLON=37; + public static final int WSNLCHARS=18; + public static final int WS=70; + public static final int LEXER=24; + public static final int OR=51; + public static final int GT=44; + public static final int CATCH=33; + public static final int CLOSURE=79; + public static final int PARSER=25; + public static final int DOLLAR=53; + public static final int PROTECTED=28; + public static final int ELEMENT_OPTIONS=98; + public static final int NESTED_ACTION=15; + public static final int FRAGMENT=23; + public static final int ID=87; + public static final int TREE_BEGIN=58; + public static final int LPAREN=40; + public static final int AT=59; + public static final int ESC_SEQ=66; + public static final int ALT=84; + public static final int TREE=26; + public static final int SCOPE=21; + public static final int ETC=56; + public static final int COMMA=38; + public static final int WILDCARD=96; + public static final int DOC_COMMENT=6; + public static final int PLUS=49; + public static final int REWRITE_BLOCK=77; + public static final int DOT=54; + public static final int RETURNS=31; + public static final int RULES=73; + public static final int RARROW=57; + public static final int UNICODE_ESC=69; + public static final int HEX_DIGIT=68; + public static final int RANGE=55; + public static final int TOKENS=20; + public static final int GATED_SEMPRED=93; + public static final int RESULT=86; + public static final int BANG=47; + public static final int ACTION_STRING_LITERAL=12; + public static final int ROOT=52; + public static final int SEMI=39; + public static final int RULE_REF=63; + public static final int NLCHARS=8; + public static final int OPTIONAL=78; + public static final int SYNPRED=81; + public static final int COLON=36; + public static final int QUESTION=46; + public static final int FINALLY=34; + public static final int TEMPLATE=35; + public static final int LABEL=92; + public static final int SYN_SEMPRED=94; + public static final int ERRCHAR=71; + public static final int BLOCK=76; + public static final int ASSIGN=45; + public static final int PLUS_ASSIGN=50; + public static final int PUBLIC=29; + public static final int POSITIVE_CLOSURE=80; + public static final int OPTIONS=19; + + // delegates + // delegators + + + public DefineSymbolTriggers(TreeNodeStream input) { + this(input, new RecognizerSharedState()); + } + public DefineSymbolTriggers(TreeNodeStream input, RecognizerSharedState state) { + super(input, state); + + } + + + public String[] getTokenNames() { return DefineSymbolTriggers.tokenNames; } + public String getGrammarFileName() { return "DefineSymbolTriggers.g"; } + + + Grammar g; // which grammar are we checking + public DefineSymbolTriggers(TreeNodeStream input, Grammar g) { + this(input); + this.g = g; + } + + + + // $ANTLR start "topdown" + // DefineSymbolTriggers.g:78:1: topdown : ( tokenAlias | rule | terminal ); + public final void topdown() throws RecognitionException { + try { + // DefineSymbolTriggers.g:79:5: ( tokenAlias | rule | terminal ) + int alt1=3; + switch ( input.LA(1) ) { + case ASSIGN: + { + alt1=1; + } + break; + case RULE: + { + alt1=2; + } + break; + case TOKEN_REF: + case STRING_LITERAL: + { + alt1=3; + } + break; + default: + if (state.backtracking>0) {state.failed=true; return ;} + NoViableAltException nvae = + new NoViableAltException("", 1, 0, input); + + throw nvae; + } + + switch (alt1) { + case 1 : + // DefineSymbolTriggers.g:79:7: tokenAlias + { + pushFollow(FOLLOW_tokenAlias_in_topdown96); + tokenAlias(); + + state._fsp--; + if (state.failed) return ; + + } + break; + case 2 : + // DefineSymbolTriggers.g:80:7: rule + { + pushFollow(FOLLOW_rule_in_topdown104); + rule(); + + state._fsp--; + if (state.failed) return ; + + } + break; + case 3 : + // DefineSymbolTriggers.g:81:7: terminal + { + pushFollow(FOLLOW_terminal_in_topdown112); + terminal(); + + state._fsp--; + if (state.failed) return ; + + } + break; + + } + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "topdown" + + + // $ANTLR start "tokenAlias" + // DefineSymbolTriggers.g:84:1: tokenAlias : {...}? ^( ASSIGN ID STRING_LITERAL ) ; + public final void tokenAlias() throws RecognitionException { + GrammarAST ID1=null; + GrammarAST STRING_LITERAL2=null; + + try { + // DefineSymbolTriggers.g:85:2: ({...}? ^( ASSIGN ID STRING_LITERAL ) ) + // DefineSymbolTriggers.g:85:4: {...}? ^( ASSIGN ID STRING_LITERAL ) + { + if ( !((inContext("TOKENS"))) ) { + if (state.backtracking>0) {state.failed=true; return ;} + throw new FailedPredicateException(input, "tokenAlias", "inContext(\"TOKENS\")"); + } + match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenAlias126); if (state.failed) return ; + + match(input, Token.DOWN, null); if (state.failed) return ; + ID1=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias128); if (state.failed) return ; + STRING_LITERAL2=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenAlias130); if (state.failed) return ; + + match(input, Token.UP, null); if (state.failed) return ; + if ( state.backtracking==1 ) { + System.out.println("token alias "+(ID1!=null?ID1.getText():null)+"="+STRING_LITERAL2.token); + } + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "tokenAlias" + + + // $ANTLR start "rule" + // DefineSymbolTriggers.g:89:1: rule : ^( RULE r= ID ( . )* ) ; + public final void rule() throws RecognitionException { + GrammarAST r=null; + + try { + // DefineSymbolTriggers.g:89:5: ( ^( RULE r= ID ( . )* ) ) + // DefineSymbolTriggers.g:89:9: ^( RULE r= ID ( . )* ) + { + match(input,RULE,FOLLOW_RULE_in_rule148); if (state.failed) return ; + + match(input, Token.DOWN, null); if (state.failed) return ; + r=(GrammarAST)match(input,ID,FOLLOW_ID_in_rule152); if (state.failed) return ; + // DefineSymbolTriggers.g:89:22: ( . )* + loop2: + do { + int alt2=2; + int LA2_0 = input.LA(1); + + if ( ((LA2_0>=SEMPRED && LA2_0<=ALT_REWRITE)) ) { + alt2=1; + } + else if ( (LA2_0==UP) ) { + alt2=2; + } + + + switch (alt2) { + case 1 : + // DefineSymbolTriggers.g:89:22: . + { + matchAny(input); if (state.failed) return ; + + } + break; + + default : + break loop2; + } + } while (true); + + + match(input, Token.UP, null); if (state.failed) return ; + if ( state.backtracking==1 ) { + System.out.println("rule "+r.token); + } + + } + + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "rule" + + + // $ANTLR start "terminal" + // DefineSymbolTriggers.g:92:1: terminal : ({...}? STRING_LITERAL | TOKEN_REF ); + public final void terminal() throws RecognitionException { + GrammarAST STRING_LITERAL3=null; + GrammarAST TOKEN_REF4=null; + + try { + // DefineSymbolTriggers.g:93:5: ({...}? STRING_LITERAL | TOKEN_REF ) + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0==STRING_LITERAL) ) { + alt3=1; + } + else if ( (LA3_0==TOKEN_REF) ) { + alt3=2; + } + else { + if (state.backtracking>0) {state.failed=true; return ;} + NoViableAltException nvae = + new NoViableAltException("", 3, 0, input); + + throw nvae; + } + switch (alt3) { + case 1 : + // DefineSymbolTriggers.g:93:7: {...}? STRING_LITERAL + { + if ( !((!inContext("TOKENS ASSIGN"))) ) { + if (state.backtracking>0) {state.failed=true; return ;} + throw new FailedPredicateException(input, "terminal", "!inContext(\"TOKENS ASSIGN\")"); + } + STRING_LITERAL3=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal178); if (state.failed) return ; + if ( state.backtracking==1 ) { + System.out.println("terminal "+STRING_LITERAL3.token); + } + + } + break; + case 2 : + // DefineSymbolTriggers.g:95:7: TOKEN_REF + { + TOKEN_REF4=(GrammarAST)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal193); if (state.failed) return ; + if ( state.backtracking==1 ) { + System.out.println("terminal "+TOKEN_REF4.token); + } + + } + break; + + } + } + catch (RecognitionException re) { + reportError(re); + recover(input,re); + } + finally { + } + return ; + } + // $ANTLR end "terminal" + + // Delegated rules + + + + + public static final BitSet FOLLOW_tokenAlias_in_topdown96 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_rule_in_topdown104 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_terminal_in_topdown112 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_ASSIGN_in_tokenAlias126 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_ID_in_tokenAlias128 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); + public static final BitSet FOLLOW_STRING_LITERAL_in_tokenAlias130 = new BitSet(new long[]{0x0000000000000008L}); + public static final BitSet FOLLOW_RULE_in_rule148 = new BitSet(new long[]{0x0000000000000004L}); + public static final BitSet FOLLOW_ID_in_rule152 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x0000001FFFFFFFFFL}); + public static final BitSet FOLLOW_STRING_LITERAL_in_terminal178 = new BitSet(new long[]{0x0000000000000002L}); + public static final BitSet FOLLOW_TOKEN_REF_in_terminal193 = new BitSet(new long[]{0x0000000000000002L}); + +} \ No newline at end of file diff --git a/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.tokens b/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.tokens new file mode 100644 index 000000000..3e967ae63 --- /dev/null +++ b/tool/src/org/antlr/v4/semantics/DefineSymbolTriggers.tokens @@ -0,0 +1,97 @@ +LT=43 +STAR=48 +BACKTRACK_SEMPRED=95 +DOUBLE_ANGLE_STRING_LITERAL=11 +FORCED_ACTION=5 +ARGLIST=89 +ALTLIST=85 +NOT=60 +SEMPRED=4 +ACTION=16 +TOKEN_REF=62 +RULEMODIFIERS=74 +ST_RESULT=99 +RPAREN=41 +RET=90 +IMPORT=22 +STRING_LITERAL=67 +ARG=88 +ARG_ACTION=14 +DOUBLE_QUOTE_STRING_LITERAL=10 +COMMENT=9 +ACTION_CHAR_LITERAL=13 +GRAMMAR=27 +RULEACTIONS=75 +WSCHARS=65 +INITACTION=91 +ALT_REWRITE=100 +IMPLIES=42 +RULE=72 +RBRACE=61 +ACTION_ESC=17 +PRIVATE=30 +SRC=7 +THROWS=32 +CHAR_RANGE=82 +INT=64 +EPSILON=83 +LIST=97 +COLONCOLON=37 +WSNLCHARS=18 +WS=70 +LEXER=24 +OR=51 +GT=44 +CATCH=33 +CLOSURE=79 +PARSER=25 +DOLLAR=53 +PROTECTED=28 +ELEMENT_OPTIONS=98 +NESTED_ACTION=15 +FRAGMENT=23 +ID=87 +TREE_BEGIN=58 +LPAREN=40 +AT=59 +ESC_SEQ=66 +ALT=84 +TREE=26 +SCOPE=21 +ETC=56 +COMMA=38 +WILDCARD=96 +DOC_COMMENT=6 +PLUS=49 +REWRITE_BLOCK=77 +DOT=54 +RETURNS=31 +RULES=73 +RARROW=57 +UNICODE_ESC=69 +HEX_DIGIT=68 +RANGE=55 +TOKENS=20 +GATED_SEMPRED=93 +RESULT=86 +BANG=47 +ACTION_STRING_LITERAL=12 +ROOT=52 +SEMI=39 +RULE_REF=63 +NLCHARS=8 +OPTIONAL=78 +SYNPRED=81 +COLON=36 +QUESTION=46 +FINALLY=34 +TEMPLATE=35 +LABEL=92 +SYN_SEMPRED=94 +ERRCHAR=71 +BLOCK=76 +ASSIGN=45 +PLUS_ASSIGN=50 +PUBLIC=29 +POSITIVE_CLOSURE=80 +OPTIONS=19 diff --git a/tool/src/org/antlr/v4/semantics/SemanticsPipeline.java b/tool/src/org/antlr/v4/semantics/SemanticsPipeline.java index 8a58667a0..b79267128 100644 --- a/tool/src/org/antlr/v4/semantics/SemanticsPipeline.java +++ b/tool/src/org/antlr/v4/semantics/SemanticsPipeline.java @@ -36,6 +36,9 @@ public class SemanticsPipeline { } // DEFINE SYMBOLS + nodes.reset(); + DefineSymbolTriggers sym = new DefineSymbolTriggers(nodes,g); + sym.downup(g.ast); // ASSIGN TOKEN TYPES