From e825a774665817e3f669ba72d3c5f6a60e24d2cc Mon Sep 17 00:00:00 2001 From: parrt Date: Thu, 11 Feb 2010 11:17:29 -0800 Subject: [PATCH] made listener for action splitter [git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6686] --- .../org/antlr/v4/runtime/tree/CommonTree.java | 1 + tool/src/org/antlr/v4/parse/ANTLRLexer.java | 2 +- tool/src/org/antlr/v4/parse/ANTLRParser.java | 56 +- tool/src/org/antlr/v4/parse/ASTVerifier.java | 2 +- tool/src/org/antlr/v4/parse/ActionSplitter.g | 87 +- .../org/antlr/v4/parse/ActionSplitter.java | 1831 +++++++++-------- .../org/antlr/v4/parse/ActionSplitter.tokens | 48 +- .../v4/parse/ActionSplitterListener.java | 40 + .../antlr/v4/semantics/AttributeChecks.java | 57 +- .../v4/semantics/BasicSemanticTriggers.java | 2 +- .../antlr/v4/semantics/CollectSymbols.java | 2 +- .../antlr/v4/semantics/SemanticPipeline.java | 8 +- 12 files changed, 1204 insertions(+), 932 deletions(-) create mode 100644 tool/src/org/antlr/v4/parse/ActionSplitterListener.java diff --git a/runtime/Java/src/org/antlr/v4/runtime/tree/CommonTree.java b/runtime/Java/src/org/antlr/v4/runtime/tree/CommonTree.java index f50fd18cd..41c0ebd7d 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/tree/CommonTree.java +++ b/runtime/Java/src/org/antlr/v4/runtime/tree/CommonTree.java @@ -182,6 +182,7 @@ public class CommonTree extends BaseTree { } // TODO: move to basetree when i settle on how runtime works + // TODO: don't include this node!! /** include this node */ public CommonTree getFirstDescendantWithType(int type) { if ( getType()==type ) return this; diff --git a/tool/src/org/antlr/v4/parse/ANTLRLexer.java b/tool/src/org/antlr/v4/parse/ANTLRLexer.java index b28684ad7..7967ebfff 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-10 17:19:36 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRLexer.g 2010-02-11 11:14:45 /* [The "BSD licence"] diff --git a/tool/src/org/antlr/v4/parse/ANTLRParser.java b/tool/src/org/antlr/v4/parse/ANTLRParser.java index 1e3672ed0..50311bed8 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-10 17:19:39 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRParser.g 2010-02-11 11:14:47 /* [The "BSD licence"] @@ -284,7 +284,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: DOC_COMMENT, grammarType, id, rules, prequelConstruct + // elements: DOC_COMMENT, id, grammarType, rules, prequelConstruct // token labels: // rule labels: retval // token list labels: @@ -788,7 +788,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: option, OPTIONS + // elements: OPTIONS, option // token labels: // rule labels: retval // token list labels: @@ -1559,7 +1559,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ASSIGN, STRING_LITERAL, id + // elements: STRING_LITERAL, id, ASSIGN // token labels: // rule labels: retval // token list labels: @@ -1853,7 +1853,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ACTION, actionScopeName, id, AT + // elements: ACTION, AT, id, actionScopeName // token labels: // rule labels: retval // token list labels: @@ -2353,7 +2353,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, altListAsBlock, ARG_ACTION, exceptionGroup, ruleReturns, rulePrequel, DOC_COMMENT, ruleModifiers + // elements: exceptionGroup, ruleReturns, rulePrequel, ARG_ACTION, DOC_COMMENT, ruleModifiers, altListAsBlock, id // token labels: // rule labels: retval // token list labels: @@ -2579,7 +2579,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ACTION, CATCH, ARG_ACTION + // elements: CATCH, ACTION, ARG_ACTION // token labels: // rule labels: retval // token list labels: @@ -2976,7 +2976,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: qid, THROWS + // elements: THROWS, qid // token labels: // rule labels: retval // token list labels: @@ -3185,7 +3185,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: SCOPE, id + // elements: id, SCOPE // token labels: // rule labels: retval // token list labels: @@ -3284,7 +3284,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: AT, ACTION, id + // elements: ACTION, AT, id // token labels: // rule labels: retval // token list labels: @@ -3800,7 +3800,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: elements, rewrite + // elements: rewrite, elements // token labels: // rule labels: retval // token list labels: @@ -4165,7 +4165,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ebnfSuffix, labeledElement + // elements: labeledElement, ebnfSuffix // token labels: // rule labels: retval // token list labels: @@ -4279,7 +4279,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: atom, ebnfSuffix + // elements: ebnfSuffix, atom // token labels: // rule labels: retval // token list labels: @@ -4504,7 +4504,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: treeSpec, ebnfSuffix + // elements: ebnfSuffix, treeSpec // token labels: // rule labels: retval // token list labels: @@ -4944,7 +4944,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: blockSuffixe, block + // elements: block, blockSuffixe // token labels: // rule labels: retval // token list labels: @@ -5450,7 +5450,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: DOT, id, ruleref + // elements: id, DOT, ruleref // token labels: // rule labels: retval // token list labels: @@ -5508,7 +5508,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, DOT, terminal + // elements: id, terminal, DOT // token labels: // rule labels: retval // token list labels: @@ -5750,7 +5750,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: NOT, block + // elements: block, NOT // token labels: // rule labels: retval // token list labels: @@ -6014,7 +6014,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: altList, ra, ACTION, optionsSpec + // elements: ACTION, altList, ra, optionsSpec // token labels: // rule labels: retval // token list labels: @@ -6242,7 +6242,7 @@ public class ANTLRParser extends Parser { { // AST REWRITE - // elements: ARG_ACTION, RULE_REF + // elements: RULE_REF, ARG_ACTION // token labels: // rule labels: retval // token list labels: @@ -7229,7 +7229,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: predicatedRewrite, nakedRewrite + // elements: nakedRewrite, predicatedRewrite // token labels: // rule labels: retval // token list labels: @@ -7317,7 +7317,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: SEMPRED, rewriteAlt, rewriteAlt, SEMPRED + // elements: rewriteAlt, SEMPRED, SEMPRED, rewriteAlt // token labels: // rule labels: retval // token list labels: @@ -7776,7 +7776,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: ebnfSuffix, rewriteTreeAtom + // elements: rewriteTreeAtom, ebnfSuffix // token labels: // rule labels: retval // token list labels: @@ -8098,7 +8098,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: elementOptions, ARG_ACTION, TOKEN_REF + // elements: elementOptions, TOKEN_REF, ARG_ACTION // token labels: // rule labels: retval // token list labels: @@ -8339,7 +8339,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: rewriteTreeAlt, ebnfSuffix + // elements: ebnfSuffix, rewriteTreeAlt // token labels: // rule labels: retval // token list labels: @@ -8476,7 +8476,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: rewriteTreeAtom, TREE_BEGIN, rewriteTreeElement + // elements: rewriteTreeElement, rewriteTreeAtom, TREE_BEGIN // token labels: // rule labels: retval // token list labels: @@ -8631,7 +8631,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: TEMPLATE, str, rewriteTemplateArgs + // elements: TEMPLATE, rewriteTemplateArgs, str // token labels: str // rule labels: retval // token list labels: @@ -9138,7 +9138,7 @@ public class ANTLRParser extends Parser { // AST REWRITE - // elements: id, ACTION + // elements: ACTION, id // token labels: // rule labels: retval // token list labels: diff --git a/tool/src/org/antlr/v4/parse/ASTVerifier.java b/tool/src/org/antlr/v4/parse/ASTVerifier.java index 8e7192902..a780462c7 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-10 17:19:39 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-11 11:14:48 /* [The "BSD license"] diff --git a/tool/src/org/antlr/v4/parse/ActionSplitter.g b/tool/src/org/antlr/v4/parse/ActionSplitter.g index 174f90cb3..de96e12c2 100644 --- a/tool/src/org/antlr/v4/parse/ActionSplitter.g +++ b/tool/src/org/antlr/v4/parse/ActionSplitter.g @@ -8,25 +8,34 @@ import org.antlr.v4.tool.*; } @members { +/* public void setQualifiedAttr(Token x, Token y, Token expr) { } public void qualifiedAttr(Token x, Token y) { } -public void setDynamicScopeAttr() { } -public void dynamicScopeAttr() { } -public void setDynamicNegativeIndexedScopeAttr() { } -public void dynamicNegativeIndexedScopeAttr() { } -public void setDynamicAbsoluteIndexedScopeAttr() { } -public void dynamicAbsoluteIndexedScopeAttr() { } -public void setAttr() { } -public void attr() { } +public void setDynamicScopeAttr(Token x, Token y, Token expr) { } +public void dynamicScopeAttr(Token x, Token y) { } +public void setDynamicNegativeIndexedScopeAttr(Token x, Token y, Token index, Token expr) { } +public void dynamicNegativeIndexedScopeAttr(Token x, Token y, Token index) { } +public void setDynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index, Token expr) { } +public void dynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index) { } +public void setAttr(Token x, Token expr) { } +public void attr(Token x) { } public void templateInstance() { } public void indirectTemplateInstance() { } public void setExprAttribute() { } public void setAttribute() { } public void templateExpr() { } -public void unknownSyntax() { } -public void text() { } +public void unknownSyntax(String text) { } +public void text(String text) { } +*/ +ActionSplitterListener delegate; -public List getActionChunks() { +public ActionSplitter(CharStream input, ActionSplitterListener delegate) { + this(input, new RecognizerSharedState()); + this.delegate = delegate; +} + +/** force filtering (and return tokens). triggers all above actions. */ +public List getActionChunks() { List chunks = new ArrayList(); Token t = nextToken(); while ( t.getType()!=Token.EOF ) { @@ -37,21 +46,32 @@ public List getActionChunks() { } } +// ignore comments right away + +COMMENT + : '/*' ( options {greedy=false;} : . )* '*/' {delegate.text($text);} + ; + +LINE_COMMENT + : '//' ~('\n'|'\r')* '\r'? '\n' {delegate.text($text);} + ; + SET_QUALIFIED_ATTR : '$' x=ID '.' y=ID WS? '=' expr=ATTR_VALUE_EXPR ';' - {setQualifiedAttr($x, $y, $expr);} + {delegate.setQualifiedAttr($x, $y, $expr);} ; QUALIFIED_ATTR - : '$' x=ID '.' y=ID {input.LA(1)!='('}? {qualifiedAttr($x, $y);} + : '$' x=ID '.' y=ID {input.LA(1)!='('}? {delegate.qualifiedAttr($x, $y);} ; SET_DYNAMIC_SCOPE_ATTR : '$' x=ID '::' y=ID WS? '=' expr=ATTR_VALUE_EXPR ';' + {delegate.setDynamicScopeAttr($x, $y, $expr);} ; DYNAMIC_SCOPE_ATTR - : '$' x=ID '::' y=ID + : '$' x=ID '::' y=ID {delegate.dynamicScopeAttr($x, $y);} ; /** To access deeper (than top of stack) scopes, use the notation: @@ -63,29 +83,33 @@ DYNAMIC_SCOPE_ATTR * $x[0]::y is the absolute 0 indexed element (bottom of the stack) */ SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR - : '$' x=ID '[' '-' expr=SCOPE_INDEX_EXPR ']' '::' y=ID + : '$' x=ID '[' '-' index=SCOPE_INDEX_EXPR ']' '::' y=ID WS? ('=' expr=ATTR_VALUE_EXPR ';')? + {delegate.setDynamicNegativeIndexedScopeAttr($x, $y, $index, $expr);} ; DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR - : '$' x=ID '[' '-' expr=SCOPE_INDEX_EXPR ']' '::' y=ID + : '$' x=ID '[' '-' index=SCOPE_INDEX_EXPR ']' '::' y=ID + {delegate.dynamicNegativeIndexedScopeAttr($x, $y, $index);} ; SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR - : '$' x=ID '[' expr=SCOPE_INDEX_EXPR ']' '::' y=ID + : '$' x=ID '[' index=SCOPE_INDEX_EXPR ']' '::' y=ID WS? ('=' expr=ATTR_VALUE_EXPR ';')? + {delegate.setDynamicAbsoluteIndexedScopeAttr($x, $y, $index, $expr);} ; DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR - : '$' x=ID '[' expr=SCOPE_INDEX_EXPR ']' '::' y=ID + : '$' x=ID '[' index=SCOPE_INDEX_EXPR ']' '::' y=ID + {delegate.dynamicAbsoluteIndexedScopeAttr($x, $y, $index);} ; SET_ATTR - : ATTR WS? '=' expr=ATTR_VALUE_EXPR ';' + : '$' x=ID WS? '=' expr=ATTR_VALUE_EXPR ';' {delegate.setAttr($x, $expr);} ; ATTR - : '$' ID + : '$' x=ID {delegate.attr($x);} ; /** %foo(a={},b={},...) ctor */ @@ -117,26 +141,15 @@ TEMPLATE_EXPR ; UNKNOWN_SYNTAX - : '$' - { -// chunks.add(getText()); - // shouldn't need an error here. Just accept \$ if it doesn't look like anything - } - | '%' (ID|'.'|'('|')'|','|'{'|'}'|'"')* - { -/* - chunks.add(getText()); - ErrorManager.grammarError(ErrorManager.MSG_INVALID_TEMPLATE_ACTION, - grammar, - actionToken, - getText()); -*/ - } +@after {delegate.unknownSyntax($text);} + : '%' (ID|'.'|'('|')'|','|'{'|'}'|'"')* ; -TEXT: ( '\\$' +// Anything else is just random text +TEXT +@after {delegate.text($text);} + : ( '\\$' | '\\%' - | ~('$'|'%') )+ ; diff --git a/tool/src/org/antlr/v4/parse/ActionSplitter.java b/tool/src/org/antlr/v4/parse/ActionSplitter.java index a901772b2..cfa5d0bd9 100644 --- a/tool/src/org/antlr/v4/parse/ActionSplitter.java +++ b/tool/src/org/antlr/v4/parse/ActionSplitter.java @@ -1,4 +1,4 @@ -// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ActionSplitter.g 2010-02-10 17:19:39 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ActionSplitter.g 2010-02-11 11:14:48 package org.antlr.v4.parse; @@ -7,50 +7,61 @@ import org.antlr.runtime.*; import java.util.ArrayList; import java.util.List; public class ActionSplitter extends Lexer { - public static final int INDIRECT_TEMPLATE_INSTANCE=21; - public static final int DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=13; - public static final int SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=12; - public static final int SET_ATTRIBUTE=23; - public static final int TEMPLATE_EXPR=24; - public static final int TEXT=26; - public static final int ID=4; - public static final int QUALIFIED_ATTR=8; + public static final int INDIRECT_TEMPLATE_INSTANCE=23; + public static final int LINE_COMMENT=5; + public static final int DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=15; + public static final int SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=14; + public static final int SET_ATTRIBUTE=25; + public static final int TEMPLATE_EXPR=26; + public static final int TEXT=28; + public static final int ID=6; + public static final int QUALIFIED_ATTR=10; public static final int EOF=-1; - public static final int ACTION=20; - public static final int UNKNOWN_SYNTAX=25; - public static final int SET_QUALIFIED_ATTR=7; - public static final int SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=14; - public static final int WS=5; - public static final int ARG=18; - public static final int TEMPLATE_INSTANCE=19; - public static final int SET_EXPR_ATTRIBUTE=22; - public static final int ATTR_VALUE_EXPR=6; - public static final int SET_DYNAMIC_SCOPE_ATTR=9; - public static final int SCOPE_INDEX_EXPR=11; - public static final int DYNAMIC_SCOPE_ATTR=10; - public static final int SET_ATTR=17; - public static final int ATTR=16; - public static final int DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=15; + public static final int ACTION=22; + public static final int UNKNOWN_SYNTAX=27; + public static final int SET_QUALIFIED_ATTR=9; + public static final int SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=16; + public static final int WS=7; + public static final int ARG=20; + public static final int TEMPLATE_INSTANCE=21; + public static final int SET_EXPR_ATTRIBUTE=24; + public static final int ATTR_VALUE_EXPR=8; + public static final int SET_DYNAMIC_SCOPE_ATTR=11; + public static final int SCOPE_INDEX_EXPR=13; + public static final int DYNAMIC_SCOPE_ATTR=12; + public static final int SET_ATTR=18; + public static final int COMMENT=4; + public static final int ATTR=19; + public static final int DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=17; + /* public void setQualifiedAttr(Token x, Token y, Token expr) { } public void qualifiedAttr(Token x, Token y) { } - public void setDynamicScopeAttr() { } - public void dynamicScopeAttr() { } - public void setDynamicNegativeIndexedScopeAttr() { } - public void dynamicNegativeIndexedScopeAttr() { } - public void setDynamicAbsoluteIndexedScopeAttr() { } - public void dynamicAbsoluteIndexedScopeAttr() { } - public void setAttr() { } - public void attr() { } + public void setDynamicScopeAttr(Token x, Token y, Token expr) { } + public void dynamicScopeAttr(Token x, Token y) { } + public void setDynamicNegativeIndexedScopeAttr(Token x, Token y, Token index, Token expr) { } + public void dynamicNegativeIndexedScopeAttr(Token x, Token y, Token index) { } + public void setDynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index, Token expr) { } + public void dynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index) { } + public void setAttr(Token x, Token expr) { } + public void attr(Token x) { } public void templateInstance() { } public void indirectTemplateInstance() { } public void setExprAttribute() { } public void setAttribute() { } public void templateExpr() { } - public void unknownSyntax() { } - public void text() { } + public void unknownSyntax(String text) { } + public void text(String text) { } + */ + ActionSplitterListener delegate; - public List getActionChunks() { + public ActionSplitter(CharStream input, ActionSplitterListener delegate) { + this(input, new RecognizerSharedState()); + this.delegate = delegate; + } + + /** force filtering (and return tokens). triggers all above actions. */ + public List getActionChunks() { List chunks = new ArrayList(); Token t = nextToken(); while ( t.getType()!=Token.EOF ) { @@ -124,7 +135,147 @@ public class ActionSplitter extends Lexer { public boolean alreadyParsedRule(IntStream input, int ruleIndex) { if ( state.backtracking>1 ) return super.alreadyParsedRule(input, ruleIndex); return false; - }// $ANTLR start "SET_QUALIFIED_ATTR" + }// $ANTLR start "COMMENT" + public final void mCOMMENT() throws RecognitionException { + try { + int _type = COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // ActionSplitter.g:52:5: ( '/*' ( options {greedy=false; } : . )* '*/' ) + // ActionSplitter.g:52:9: '/*' ( options {greedy=false; } : . )* '*/' + { + match("/*"); if (state.failed) return ; + + // ActionSplitter.g:52:14: ( options {greedy=false; } : . )* + loop1: + do { + int alt1=2; + int LA1_0 = input.LA(1); + + if ( (LA1_0=='*') ) { + int LA1_1 = input.LA(2); + + if ( (LA1_1=='/') ) { + alt1=2; + } + else if ( ((LA1_1>='\u0000' && LA1_1<='.')||(LA1_1>='0' && LA1_1<='\uFFFF')) ) { + alt1=1; + } + + + } + else if ( ((LA1_0>='\u0000' && LA1_0<=')')||(LA1_0>='+' && LA1_0<='\uFFFF')) ) { + alt1=1; + } + + + switch (alt1) { + case 1 : + // ActionSplitter.g:52:42: . + { + matchAny(); if (state.failed) return ; + + } + break; + + default : + break loop1; + } + } while (true); + + match("*/"); if (state.failed) return ; + + if ( state.backtracking==1 ) { + delegate.text(getText()); + } + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "COMMENT" + + // $ANTLR start "LINE_COMMENT" + public final void mLINE_COMMENT() throws RecognitionException { + try { + int _type = LINE_COMMENT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // ActionSplitter.g:56:5: ( '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' ) + // ActionSplitter.g:56:7: '//' (~ ( '\\n' | '\\r' ) )* ( '\\r' )? '\\n' + { + match("//"); if (state.failed) return ; + + // ActionSplitter.g:56:12: (~ ( '\\n' | '\\r' ) )* + loop2: + do { + int alt2=2; + int LA2_0 = input.LA(1); + + if ( ((LA2_0>='\u0000' && LA2_0<='\t')||(LA2_0>='\u000B' && LA2_0<='\f')||(LA2_0>='\u000E' && LA2_0<='\uFFFF')) ) { + alt2=1; + } + + + switch (alt2) { + case 1 : + // ActionSplitter.g:56:12: ~ ( '\\n' | '\\r' ) + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='\t')||(input.LA(1)>='\u000B' && input.LA(1)<='\f')||(input.LA(1)>='\u000E' && input.LA(1)<='\uFFFF') ) { + input.consume(); + state.failed=false; + } + else { + if (state.backtracking>0) {state.failed=true; return ;} + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop2; + } + } while (true); + + // ActionSplitter.g:56:26: ( '\\r' )? + int alt3=2; + int LA3_0 = input.LA(1); + + if ( (LA3_0=='\r') ) { + alt3=1; + } + switch (alt3) { + case 1 : + // ActionSplitter.g:56:26: '\\r' + { + match('\r'); if (state.failed) return ; + + } + break; + + } + + match('\n'); if (state.failed) return ; + if ( state.backtracking==1 ) { + delegate.text(getText()); + } + + } + + state.type = _type; + state.channel = _channel; + } + finally { + } + } + // $ANTLR end "LINE_COMMENT" + + // $ANTLR start "SET_QUALIFIED_ATTR" public final void mSET_QUALIFIED_ATTR() throws RecognitionException { try { int _type = SET_QUALIFIED_ATTR; @@ -133,27 +284,27 @@ public class ActionSplitter extends Lexer { CommonToken y=null; CommonToken expr=null; - // ActionSplitter.g:41:2: ( '$' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) - // ActionSplitter.g:41:4: '$' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:60:2: ( '$' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) + // ActionSplitter.g:60:4: '$' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' { match('$'); if (state.failed) return ; - int xStart39 = getCharIndex(); + int xStart112 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart39, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart112, getCharIndex()-1); match('.'); if (state.failed) return ; - int yStart45 = getCharIndex(); + int yStart118 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart45, getCharIndex()-1); - // ActionSplitter.g:41:22: ( WS )? - int alt1=2; - int LA1_0 = input.LA(1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart118, getCharIndex()-1); + // ActionSplitter.g:60:22: ( WS )? + int alt4=2; + int LA4_0 = input.LA(1); - if ( ((LA1_0>='\t' && LA1_0<='\n')||LA1_0=='\r'||LA1_0==' ') ) { - alt1=1; + if ( ((LA4_0>='\t' && LA4_0<='\n')||LA4_0=='\r'||LA4_0==' ') ) { + alt4=1; } - switch (alt1) { + switch (alt4) { case 1 : - // ActionSplitter.g:41:22: WS + // ActionSplitter.g:60:22: WS { mWS(); if (state.failed) return ; @@ -163,12 +314,12 @@ public class ActionSplitter extends Lexer { } match('='); if (state.failed) return ; - int exprStart54 = getCharIndex(); + int exprStart127 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart54, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart127, getCharIndex()-1); match(';'); if (state.failed) return ; if ( state.backtracking==1 ) { - setQualifiedAttr(x, y, expr); + delegate.setQualifiedAttr(x, y, expr); } } @@ -189,23 +340,23 @@ public class ActionSplitter extends Lexer { CommonToken x=null; CommonToken y=null; - // ActionSplitter.g:46:2: ( '$' x= ID '.' y= ID {...}?) - // ActionSplitter.g:46:4: '$' x= ID '.' y= ID {...}? + // ActionSplitter.g:65:2: ( '$' x= ID '.' y= ID {...}?) + // ActionSplitter.g:65:4: '$' x= ID '.' y= ID {...}? { match('$'); if (state.failed) return ; - int xStart75 = getCharIndex(); + int xStart148 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart75, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart148, getCharIndex()-1); match('.'); if (state.failed) return ; - int yStart81 = getCharIndex(); + int yStart154 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart81, getCharIndex()-1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart154, getCharIndex()-1); if ( !((input.LA(1)!='(')) ) { if (state.backtracking>0) {state.failed=true; return ;} throw new FailedPredicateException(input, "QUALIFIED_ATTR", "input.LA(1)!='('"); } if ( state.backtracking==1 ) { - qualifiedAttr(x, y); + delegate.qualifiedAttr(x, y); } } @@ -227,28 +378,28 @@ public class ActionSplitter extends Lexer { CommonToken y=null; CommonToken expr=null; - // ActionSplitter.g:50:2: ( '$' x= ID '::' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) - // ActionSplitter.g:50:4: '$' x= ID '::' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:69:2: ( '$' x= ID '::' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) + // ActionSplitter.g:69:4: '$' x= ID '::' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' { match('$'); if (state.failed) return ; - int xStart100 = getCharIndex(); + int xStart173 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart100, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart173, getCharIndex()-1); match("::"); if (state.failed) return ; - int yStart106 = getCharIndex(); + int yStart179 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart106, getCharIndex()-1); - // ActionSplitter.g:50:23: ( WS )? - int alt2=2; - int LA2_0 = input.LA(1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart179, getCharIndex()-1); + // ActionSplitter.g:69:23: ( WS )? + int alt5=2; + int LA5_0 = input.LA(1); - if ( ((LA2_0>='\t' && LA2_0<='\n')||LA2_0=='\r'||LA2_0==' ') ) { - alt2=1; + if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0=='\r'||LA5_0==' ') ) { + alt5=1; } - switch (alt2) { + switch (alt5) { case 1 : - // ActionSplitter.g:50:23: WS + // ActionSplitter.g:69:23: WS { mWS(); if (state.failed) return ; @@ -258,10 +409,13 @@ public class ActionSplitter extends Lexer { } match('='); if (state.failed) return ; - int exprStart115 = getCharIndex(); + int exprStart188 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart115, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart188, getCharIndex()-1); match(';'); if (state.failed) return ; + if ( state.backtracking==1 ) { + delegate.setDynamicScopeAttr(x, y, expr); + } } @@ -281,18 +435,21 @@ public class ActionSplitter extends Lexer { CommonToken x=null; CommonToken y=null; - // ActionSplitter.g:54:2: ( '$' x= ID '::' y= ID ) - // ActionSplitter.g:54:4: '$' x= ID '::' y= ID + // ActionSplitter.g:74:2: ( '$' x= ID '::' y= ID ) + // ActionSplitter.g:74:4: '$' x= ID '::' y= ID { match('$'); if (state.failed) return ; - int xStart132 = getCharIndex(); + int xStart209 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart132, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart209, getCharIndex()-1); match("::"); if (state.failed) return ; - int yStart138 = getCharIndex(); + int yStart215 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart138, getCharIndex()-1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart215, getCharIndex()-1); + if ( state.backtracking==1 ) { + delegate.dynamicScopeAttr(x, y); + } } @@ -310,37 +467,38 @@ public class ActionSplitter extends Lexer { int _type = SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR; int _channel = DEFAULT_TOKEN_CHANNEL; CommonToken x=null; - CommonToken expr=null; + CommonToken index=null; CommonToken y=null; + CommonToken expr=null; - // ActionSplitter.g:66:2: ( '$' x= ID '[' '-' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? ) - // ActionSplitter.g:66:4: '$' x= ID '[' '-' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? + // ActionSplitter.g:86:2: ( '$' x= ID '[' '-' index= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? ) + // ActionSplitter.g:86:4: '$' x= ID '[' '-' index= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? { match('$'); if (state.failed) return ; - int xStart155 = getCharIndex(); + int xStart234 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart155, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart234, getCharIndex()-1); match('['); if (state.failed) return ; match('-'); if (state.failed) return ; - int exprStart163 = getCharIndex(); + int indexStart242 = getCharIndex(); mSCOPE_INDEX_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart163, getCharIndex()-1); + index = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, indexStart242, getCharIndex()-1); match(']'); if (state.failed) return ; match("::"); if (state.failed) return ; - int yStart171 = getCharIndex(); + int yStart250 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart171, getCharIndex()-1); - // ActionSplitter.g:67:3: ( WS )? - int alt3=2; - int LA3_0 = input.LA(1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart250, getCharIndex()-1); + // ActionSplitter.g:87:3: ( WS )? + int alt6=2; + int LA6_0 = input.LA(1); - if ( ((LA3_0>='\t' && LA3_0<='\n')||LA3_0=='\r'||LA3_0==' ') ) { - alt3=1; + if ( ((LA6_0>='\t' && LA6_0<='\n')||LA6_0=='\r'||LA6_0==' ') ) { + alt6=1; } - switch (alt3) { + switch (alt6) { case 1 : - // ActionSplitter.g:67:3: WS + // ActionSplitter.g:87:3: WS { mWS(); if (state.failed) return ; @@ -349,21 +507,21 @@ public class ActionSplitter extends Lexer { } - // ActionSplitter.g:67:7: ( '=' expr= ATTR_VALUE_EXPR ';' )? - int alt4=2; - int LA4_0 = input.LA(1); + // ActionSplitter.g:87:7: ( '=' expr= ATTR_VALUE_EXPR ';' )? + int alt7=2; + int LA7_0 = input.LA(1); - if ( (LA4_0=='=') ) { - alt4=1; + if ( (LA7_0=='=') ) { + alt7=1; } - switch (alt4) { + switch (alt7) { case 1 : - // ActionSplitter.g:67:8: '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:87:8: '=' expr= ATTR_VALUE_EXPR ';' { match('='); if (state.failed) return ; - int exprStart183 = getCharIndex(); + int exprStart262 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart183, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart262, getCharIndex()-1); match(';'); if (state.failed) return ; } @@ -371,6 +529,9 @@ public class ActionSplitter extends Lexer { } + if ( state.backtracking==1 ) { + delegate.setDynamicNegativeIndexedScopeAttr(x, y, index, expr); + } } @@ -388,27 +549,30 @@ public class ActionSplitter extends Lexer { int _type = DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR; int _channel = DEFAULT_TOKEN_CHANNEL; CommonToken x=null; - CommonToken expr=null; + CommonToken index=null; CommonToken y=null; - // ActionSplitter.g:71:2: ( '$' x= ID '[' '-' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ) - // ActionSplitter.g:71:4: '$' x= ID '[' '-' expr= SCOPE_INDEX_EXPR ']' '::' y= ID + // ActionSplitter.g:92:2: ( '$' x= ID '[' '-' index= SCOPE_INDEX_EXPR ']' '::' y= ID ) + // ActionSplitter.g:92:4: '$' x= ID '[' '-' index= SCOPE_INDEX_EXPR ']' '::' y= ID { match('$'); if (state.failed) return ; - int xStart202 = getCharIndex(); + int xStart285 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart202, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart285, getCharIndex()-1); match('['); if (state.failed) return ; match('-'); if (state.failed) return ; - int exprStart210 = getCharIndex(); + int indexStart293 = getCharIndex(); mSCOPE_INDEX_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart210, getCharIndex()-1); + index = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, indexStart293, getCharIndex()-1); match(']'); if (state.failed) return ; match("::"); if (state.failed) return ; - int yStart218 = getCharIndex(); + int yStart301 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart218, getCharIndex()-1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart301, getCharIndex()-1); + if ( state.backtracking==1 ) { + delegate.dynamicNegativeIndexedScopeAttr(x, y, index); + } } @@ -426,36 +590,37 @@ public class ActionSplitter extends Lexer { int _type = SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR; int _channel = DEFAULT_TOKEN_CHANNEL; CommonToken x=null; - CommonToken expr=null; + CommonToken index=null; CommonToken y=null; + CommonToken expr=null; - // ActionSplitter.g:75:2: ( '$' x= ID '[' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? ) - // ActionSplitter.g:75:4: '$' x= ID '[' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? + // ActionSplitter.g:97:2: ( '$' x= ID '[' index= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? ) + // ActionSplitter.g:97:4: '$' x= ID '[' index= SCOPE_INDEX_EXPR ']' '::' y= ID ( WS )? ( '=' expr= ATTR_VALUE_EXPR ';' )? { match('$'); if (state.failed) return ; - int xStart233 = getCharIndex(); + int xStart320 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart233, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart320, getCharIndex()-1); match('['); if (state.failed) return ; - int exprStart239 = getCharIndex(); + int indexStart326 = getCharIndex(); mSCOPE_INDEX_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart239, getCharIndex()-1); + index = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, indexStart326, getCharIndex()-1); match(']'); if (state.failed) return ; match("::"); if (state.failed) return ; - int yStart247 = getCharIndex(); + int yStart334 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart247, getCharIndex()-1); - // ActionSplitter.g:76:3: ( WS )? - int alt5=2; - int LA5_0 = input.LA(1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart334, getCharIndex()-1); + // ActionSplitter.g:98:3: ( WS )? + int alt8=2; + int LA8_0 = input.LA(1); - if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0=='\r'||LA5_0==' ') ) { - alt5=1; + if ( ((LA8_0>='\t' && LA8_0<='\n')||LA8_0=='\r'||LA8_0==' ') ) { + alt8=1; } - switch (alt5) { + switch (alt8) { case 1 : - // ActionSplitter.g:76:3: WS + // ActionSplitter.g:98:3: WS { mWS(); if (state.failed) return ; @@ -464,21 +629,21 @@ public class ActionSplitter extends Lexer { } - // ActionSplitter.g:76:7: ( '=' expr= ATTR_VALUE_EXPR ';' )? - int alt6=2; - int LA6_0 = input.LA(1); + // ActionSplitter.g:98:7: ( '=' expr= ATTR_VALUE_EXPR ';' )? + int alt9=2; + int LA9_0 = input.LA(1); - if ( (LA6_0=='=') ) { - alt6=1; + if ( (LA9_0=='=') ) { + alt9=1; } - switch (alt6) { + switch (alt9) { case 1 : - // ActionSplitter.g:76:8: '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:98:8: '=' expr= ATTR_VALUE_EXPR ';' { match('='); if (state.failed) return ; - int exprStart259 = getCharIndex(); + int exprStart346 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart259, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart346, getCharIndex()-1); match(';'); if (state.failed) return ; } @@ -486,6 +651,9 @@ public class ActionSplitter extends Lexer { } + if ( state.backtracking==1 ) { + delegate.setDynamicAbsoluteIndexedScopeAttr(x, y, index, expr); + } } @@ -503,26 +671,29 @@ public class ActionSplitter extends Lexer { int _type = DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR; int _channel = DEFAULT_TOKEN_CHANNEL; CommonToken x=null; - CommonToken expr=null; + CommonToken index=null; CommonToken y=null; - // ActionSplitter.g:80:2: ( '$' x= ID '[' expr= SCOPE_INDEX_EXPR ']' '::' y= ID ) - // ActionSplitter.g:80:4: '$' x= ID '[' expr= SCOPE_INDEX_EXPR ']' '::' y= ID + // ActionSplitter.g:103:2: ( '$' x= ID '[' index= SCOPE_INDEX_EXPR ']' '::' y= ID ) + // ActionSplitter.g:103:4: '$' x= ID '[' index= SCOPE_INDEX_EXPR ']' '::' y= ID { match('$'); if (state.failed) return ; - int xStart278 = getCharIndex(); + int xStart369 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart278, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart369, getCharIndex()-1); match('['); if (state.failed) return ; - int exprStart284 = getCharIndex(); + int indexStart375 = getCharIndex(); mSCOPE_INDEX_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart284, getCharIndex()-1); + index = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, indexStart375, getCharIndex()-1); match(']'); if (state.failed) return ; match("::"); if (state.failed) return ; - int yStart292 = getCharIndex(); + int yStart383 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart292, getCharIndex()-1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart383, getCharIndex()-1); + if ( state.backtracking==1 ) { + delegate.dynamicAbsoluteIndexedScopeAttr(x, y, index); + } } @@ -539,22 +710,26 @@ public class ActionSplitter extends Lexer { try { int _type = SET_ATTR; int _channel = DEFAULT_TOKEN_CHANNEL; + CommonToken x=null; CommonToken expr=null; - // ActionSplitter.g:84:2: ( ATTR ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) - // ActionSplitter.g:84:4: ATTR ( WS )? '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:108:2: ( '$' x= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) + // ActionSplitter.g:108:4: '$' x= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' { - mATTR(); if (state.failed) return ; - // ActionSplitter.g:84:9: ( WS )? - int alt7=2; - int LA7_0 = input.LA(1); + match('$'); if (state.failed) return ; + int xStart402 = getCharIndex(); + mID(); if (state.failed) return ; + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart402, getCharIndex()-1); + // ActionSplitter.g:108:13: ( WS )? + int alt10=2; + int LA10_0 = input.LA(1); - if ( ((LA7_0>='\t' && LA7_0<='\n')||LA7_0=='\r'||LA7_0==' ') ) { - alt7=1; + if ( ((LA10_0>='\t' && LA10_0<='\n')||LA10_0=='\r'||LA10_0==' ') ) { + alt10=1; } - switch (alt7) { + switch (alt10) { case 1 : - // ActionSplitter.g:84:9: WS + // ActionSplitter.g:108:13: WS { mWS(); if (state.failed) return ; @@ -564,10 +739,13 @@ public class ActionSplitter extends Lexer { } match('='); if (state.failed) return ; - int exprStart312 = getCharIndex(); + int exprStart411 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart312, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart411, getCharIndex()-1); match(';'); if (state.failed) return ; + if ( state.backtracking==1 ) { + delegate.setAttr(x, expr); + } } @@ -584,11 +762,18 @@ public class ActionSplitter extends Lexer { try { int _type = ATTR; int _channel = DEFAULT_TOKEN_CHANNEL; - // ActionSplitter.g:88:2: ( '$' ID ) - // ActionSplitter.g:88:4: '$' ID + CommonToken x=null; + + // ActionSplitter.g:112:2: ( '$' x= ID ) + // ActionSplitter.g:112:4: '$' x= ID { match('$'); if (state.failed) return ; + int xStart430 = getCharIndex(); mID(); if (state.failed) return ; + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart430, getCharIndex()-1); + if ( state.backtracking==1 ) { + delegate.attr(x); + } } @@ -605,33 +790,33 @@ public class ActionSplitter extends Lexer { try { int _type = TEMPLATE_INSTANCE; int _channel = DEFAULT_TOKEN_CHANNEL; - // ActionSplitter.g:93:2: ( '%' ID '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' ) - // ActionSplitter.g:93:4: '%' ID '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' + // ActionSplitter.g:117:2: ( '%' ID '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' ) + // ActionSplitter.g:117:4: '%' ID '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' { match('%'); if (state.failed) return ; mID(); if (state.failed) return ; match('('); if (state.failed) return ; - // ActionSplitter.g:93:15: ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? - int alt12=2; - int LA12_0 = input.LA(1); + // ActionSplitter.g:117:15: ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? + int alt15=2; + int LA15_0 = input.LA(1); - if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' '||(LA12_0>='A' && LA12_0<='Z')||LA12_0=='_'||(LA12_0>='a' && LA12_0<='z')) ) { - alt12=1; + if ( ((LA15_0>='\t' && LA15_0<='\n')||LA15_0=='\r'||LA15_0==' '||(LA15_0>='A' && LA15_0<='Z')||LA15_0=='_'||(LA15_0>='a' && LA15_0<='z')) ) { + alt15=1; } - switch (alt12) { + switch (alt15) { case 1 : - // ActionSplitter.g:93:17: ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? + // ActionSplitter.g:117:17: ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? { - // ActionSplitter.g:93:17: ( WS )? - int alt8=2; - int LA8_0 = input.LA(1); + // ActionSplitter.g:117:17: ( WS )? + int alt11=2; + int LA11_0 = input.LA(1); - if ( ((LA8_0>='\t' && LA8_0<='\n')||LA8_0=='\r'||LA8_0==' ') ) { - alt8=1; + if ( ((LA11_0>='\t' && LA11_0<='\n')||LA11_0=='\r'||LA11_0==' ') ) { + alt11=1; } - switch (alt8) { + switch (alt11) { case 1 : - // ActionSplitter.g:93:17: WS + // ActionSplitter.g:117:17: WS { mWS(); if (state.failed) return ; @@ -641,32 +826,32 @@ public class ActionSplitter extends Lexer { } mARG(); if (state.failed) return ; - // ActionSplitter.g:93:25: ( ',' ( WS )? ARG )* - loop10: + // ActionSplitter.g:117:25: ( ',' ( WS )? ARG )* + loop13: do { - int alt10=2; - int LA10_0 = input.LA(1); + int alt13=2; + int LA13_0 = input.LA(1); - if ( (LA10_0==',') ) { - alt10=1; + if ( (LA13_0==',') ) { + alt13=1; } - switch (alt10) { + switch (alt13) { case 1 : - // ActionSplitter.g:93:26: ',' ( WS )? ARG + // ActionSplitter.g:117:26: ',' ( WS )? ARG { match(','); if (state.failed) return ; - // ActionSplitter.g:93:30: ( WS )? - int alt9=2; - int LA9_0 = input.LA(1); + // ActionSplitter.g:117:30: ( WS )? + int alt12=2; + int LA12_0 = input.LA(1); - if ( ((LA9_0>='\t' && LA9_0<='\n')||LA9_0=='\r'||LA9_0==' ') ) { - alt9=1; + if ( ((LA12_0>='\t' && LA12_0<='\n')||LA12_0=='\r'||LA12_0==' ') ) { + alt12=1; } - switch (alt9) { + switch (alt12) { case 1 : - // ActionSplitter.g:93:30: WS + // ActionSplitter.g:117:30: WS { mWS(); if (state.failed) return ; @@ -681,20 +866,20 @@ public class ActionSplitter extends Lexer { break; default : - break loop10; + break loop13; } } while (true); - // ActionSplitter.g:93:40: ( WS )? - int alt11=2; - int LA11_0 = input.LA(1); + // ActionSplitter.g:117:40: ( WS )? + int alt14=2; + int LA14_0 = input.LA(1); - if ( ((LA11_0>='\t' && LA11_0<='\n')||LA11_0=='\r'||LA11_0==' ') ) { - alt11=1; + if ( ((LA14_0>='\t' && LA14_0<='\n')||LA14_0=='\r'||LA14_0==' ') ) { + alt14=1; } - switch (alt11) { + switch (alt14) { case 1 : - // ActionSplitter.g:93:40: WS + // ActionSplitter.g:117:40: WS { mWS(); if (state.failed) return ; @@ -726,35 +911,35 @@ public class ActionSplitter extends Lexer { try { int _type = INDIRECT_TEMPLATE_INSTANCE; int _channel = DEFAULT_TOKEN_CHANNEL; - // ActionSplitter.g:98:2: ( '%' '(' ACTION ')' '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' ) - // ActionSplitter.g:98:4: '%' '(' ACTION ')' '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' + // ActionSplitter.g:122:2: ( '%' '(' ACTION ')' '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' ) + // ActionSplitter.g:122:4: '%' '(' ACTION ')' '(' ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? ')' { match('%'); if (state.failed) return ; match('('); if (state.failed) return ; mACTION(); if (state.failed) return ; match(')'); if (state.failed) return ; match('('); if (state.failed) return ; - // ActionSplitter.g:98:27: ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? - int alt17=2; - int LA17_0 = input.LA(1); + // ActionSplitter.g:122:27: ( ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? )? + int alt20=2; + int LA20_0 = input.LA(1); - if ( ((LA17_0>='\t' && LA17_0<='\n')||LA17_0=='\r'||LA17_0==' '||(LA17_0>='A' && LA17_0<='Z')||LA17_0=='_'||(LA17_0>='a' && LA17_0<='z')) ) { - alt17=1; + if ( ((LA20_0>='\t' && LA20_0<='\n')||LA20_0=='\r'||LA20_0==' '||(LA20_0>='A' && LA20_0<='Z')||LA20_0=='_'||(LA20_0>='a' && LA20_0<='z')) ) { + alt20=1; } - switch (alt17) { + switch (alt20) { case 1 : - // ActionSplitter.g:98:29: ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? + // ActionSplitter.g:122:29: ( WS )? ARG ( ',' ( WS )? ARG )* ( WS )? { - // ActionSplitter.g:98:29: ( WS )? - int alt13=2; - int LA13_0 = input.LA(1); + // ActionSplitter.g:122:29: ( WS )? + int alt16=2; + int LA16_0 = input.LA(1); - if ( ((LA13_0>='\t' && LA13_0<='\n')||LA13_0=='\r'||LA13_0==' ') ) { - alt13=1; + if ( ((LA16_0>='\t' && LA16_0<='\n')||LA16_0=='\r'||LA16_0==' ') ) { + alt16=1; } - switch (alt13) { + switch (alt16) { case 1 : - // ActionSplitter.g:98:29: WS + // ActionSplitter.g:122:29: WS { mWS(); if (state.failed) return ; @@ -764,32 +949,32 @@ public class ActionSplitter extends Lexer { } mARG(); if (state.failed) return ; - // ActionSplitter.g:98:37: ( ',' ( WS )? ARG )* - loop15: + // ActionSplitter.g:122:37: ( ',' ( WS )? ARG )* + loop18: do { - int alt15=2; - int LA15_0 = input.LA(1); + int alt18=2; + int LA18_0 = input.LA(1); - if ( (LA15_0==',') ) { - alt15=1; + if ( (LA18_0==',') ) { + alt18=1; } - switch (alt15) { + switch (alt18) { case 1 : - // ActionSplitter.g:98:38: ',' ( WS )? ARG + // ActionSplitter.g:122:38: ',' ( WS )? ARG { match(','); if (state.failed) return ; - // ActionSplitter.g:98:42: ( WS )? - int alt14=2; - int LA14_0 = input.LA(1); + // ActionSplitter.g:122:42: ( WS )? + int alt17=2; + int LA17_0 = input.LA(1); - if ( ((LA14_0>='\t' && LA14_0<='\n')||LA14_0=='\r'||LA14_0==' ') ) { - alt14=1; + if ( ((LA17_0>='\t' && LA17_0<='\n')||LA17_0=='\r'||LA17_0==' ') ) { + alt17=1; } - switch (alt14) { + switch (alt17) { case 1 : - // ActionSplitter.g:98:42: WS + // ActionSplitter.g:122:42: WS { mWS(); if (state.failed) return ; @@ -804,20 +989,20 @@ public class ActionSplitter extends Lexer { break; default : - break loop15; + break loop18; } } while (true); - // ActionSplitter.g:98:52: ( WS )? - int alt16=2; - int LA16_0 = input.LA(1); + // ActionSplitter.g:122:52: ( WS )? + int alt19=2; + int LA19_0 = input.LA(1); - if ( ((LA16_0>='\t' && LA16_0<='\n')||LA16_0=='\r'||LA16_0==' ') ) { - alt16=1; + if ( ((LA19_0>='\t' && LA19_0<='\n')||LA19_0=='\r'||LA19_0==' ') ) { + alt19=1; } - switch (alt16) { + switch (alt19) { case 1 : - // ActionSplitter.g:98:52: WS + // ActionSplitter.g:122:52: WS { mWS(); if (state.failed) return ; @@ -852,25 +1037,25 @@ public class ActionSplitter extends Lexer { CommonToken a=null; CommonToken expr=null; - // ActionSplitter.g:103:2: ( '%' a= ACTION '.' ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) - // ActionSplitter.g:103:4: '%' a= ACTION '.' ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:127:2: ( '%' a= ACTION '.' ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) + // ActionSplitter.g:127:4: '%' a= ACTION '.' ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' { match('%'); if (state.failed) return ; - int aStart432 = getCharIndex(); + int aStart537 = getCharIndex(); mACTION(); if (state.failed) return ; - a = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, aStart432, getCharIndex()-1); + a = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, aStart537, getCharIndex()-1); match('.'); if (state.failed) return ; mID(); if (state.failed) return ; - // ActionSplitter.g:103:24: ( WS )? - int alt18=2; - int LA18_0 = input.LA(1); + // ActionSplitter.g:127:24: ( WS )? + int alt21=2; + int LA21_0 = input.LA(1); - if ( ((LA18_0>='\t' && LA18_0<='\n')||LA18_0=='\r'||LA18_0==' ') ) { - alt18=1; + if ( ((LA21_0>='\t' && LA21_0<='\n')||LA21_0=='\r'||LA21_0==' ') ) { + alt21=1; } - switch (alt18) { + switch (alt21) { case 1 : - // ActionSplitter.g:103:24: WS + // ActionSplitter.g:127:24: WS { mWS(); if (state.failed) return ; @@ -880,9 +1065,9 @@ public class ActionSplitter extends Lexer { } match('='); if (state.failed) return ; - int exprStart445 = getCharIndex(); + int exprStart550 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart445, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart550, getCharIndex()-1); match(';'); if (state.failed) return ; } @@ -904,27 +1089,27 @@ public class ActionSplitter extends Lexer { CommonToken y=null; CommonToken expr=null; - // ActionSplitter.g:111:2: ( '%' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) - // ActionSplitter.g:111:4: '%' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' + // ActionSplitter.g:135:2: ( '%' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' ) + // ActionSplitter.g:135:4: '%' x= ID '.' y= ID ( WS )? '=' expr= ATTR_VALUE_EXPR ';' { match('%'); if (state.failed) return ; - int xStart465 = getCharIndex(); + int xStart570 = getCharIndex(); mID(); if (state.failed) return ; - x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart465, getCharIndex()-1); + x = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, xStart570, getCharIndex()-1); match('.'); if (state.failed) return ; - int yStart471 = getCharIndex(); + int yStart576 = getCharIndex(); mID(); if (state.failed) return ; - y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart471, getCharIndex()-1); - // ActionSplitter.g:111:22: ( WS )? - int alt19=2; - int LA19_0 = input.LA(1); + y = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, yStart576, getCharIndex()-1); + // ActionSplitter.g:135:22: ( WS )? + int alt22=2; + int LA22_0 = input.LA(1); - if ( ((LA19_0>='\t' && LA19_0<='\n')||LA19_0=='\r'||LA19_0==' ') ) { - alt19=1; + if ( ((LA22_0>='\t' && LA22_0<='\n')||LA22_0=='\r'||LA22_0==' ') ) { + alt22=1; } - switch (alt19) { + switch (alt22) { case 1 : - // ActionSplitter.g:111:22: WS + // ActionSplitter.g:135:22: WS { mWS(); if (state.failed) return ; @@ -934,9 +1119,9 @@ public class ActionSplitter extends Lexer { } match('='); if (state.failed) return ; - int exprStart480 = getCharIndex(); + int exprStart585 = getCharIndex(); mATTR_VALUE_EXPR(); if (state.failed) return ; - expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart480, getCharIndex()-1); + expr = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, exprStart585, getCharIndex()-1); match(';'); if (state.failed) return ; } @@ -956,13 +1141,13 @@ public class ActionSplitter extends Lexer { int _channel = DEFAULT_TOKEN_CHANNEL; CommonToken a=null; - // ActionSplitter.g:116:2: ( '%' a= ACTION ) - // ActionSplitter.g:116:4: '%' a= ACTION + // ActionSplitter.g:140:2: ( '%' a= ACTION ) + // ActionSplitter.g:140:4: '%' a= ACTION { match('%'); if (state.failed) return ; - int aStart499 = getCharIndex(); + int aStart604 = getCharIndex(); mACTION(); if (state.failed) return ; - a = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, aStart499, getCharIndex()-1); + a = new CommonToken(input, Token.INVALID_TOKEN_TYPE, Token.DEFAULT_CHANNEL, aStart604, getCharIndex()-1); } @@ -979,128 +1164,86 @@ public class ActionSplitter extends Lexer { try { int _type = UNKNOWN_SYNTAX; int _channel = DEFAULT_TOKEN_CHANNEL; - // ActionSplitter.g:120:2: ( '$' | '%' ( ID | '.' | '(' | ')' | ',' | '{' | '}' | '\"' )* ) - int alt21=2; - int LA21_0 = input.LA(1); + // ActionSplitter.g:145:2: ( '%' ( ID | '.' | '(' | ')' | ',' | '{' | '}' | '\"' )* ) + // ActionSplitter.g:145:4: '%' ( ID | '.' | '(' | ')' | ',' | '{' | '}' | '\"' )* + { + match('%'); if (state.failed) return ; + // ActionSplitter.g:145:8: ( ID | '.' | '(' | ')' | ',' | '{' | '}' | '\"' )* + loop23: + do { + int alt23=9; + alt23 = dfa23.predict(input); + switch (alt23) { + case 1 : + // ActionSplitter.g:145:9: ID + { + mID(); if (state.failed) return ; - if ( (LA21_0=='$') ) { - alt21=1; - } - else if ( (LA21_0=='%') ) { - alt21=2; - } - else { - if (state.backtracking>0) {state.failed=true; return ;} - NoViableAltException nvae = - new NoViableAltException("", 21, 0, input); + } + break; + case 2 : + // ActionSplitter.g:145:12: '.' + { + match('.'); if (state.failed) return ; - throw nvae; - } - switch (alt21) { - case 1 : - // ActionSplitter.g:120:4: '$' - { - match('$'); if (state.failed) return ; - if ( state.backtracking==1 ) { + } + break; + case 3 : + // ActionSplitter.g:145:16: '(' + { + match('('); if (state.failed) return ; - // chunks.add(getText()); - // shouldn't need an error here. Just accept $ if it doesn't look like anything - - } + } + break; + case 4 : + // ActionSplitter.g:145:20: ')' + { + match(')'); if (state.failed) return ; - } - break; - case 2 : - // ActionSplitter.g:125:4: '%' ( ID | '.' | '(' | ')' | ',' | '{' | '}' | '\"' )* - { - match('%'); if (state.failed) return ; - // ActionSplitter.g:125:8: ( ID | '.' | '(' | ')' | ',' | '{' | '}' | '\"' )* - loop20: - do { - int alt20=9; - alt20 = dfa20.predict(input); - switch (alt20) { - case 1 : - // ActionSplitter.g:125:9: ID - { - mID(); if (state.failed) return ; + } + break; + case 5 : + // ActionSplitter.g:145:24: ',' + { + match(','); if (state.failed) return ; - } - break; - case 2 : - // ActionSplitter.g:125:12: '.' - { - match('.'); if (state.failed) return ; + } + break; + case 6 : + // ActionSplitter.g:145:28: '{' + { + match('{'); if (state.failed) return ; - } - break; - case 3 : - // ActionSplitter.g:125:16: '(' - { - match('('); if (state.failed) return ; + } + break; + case 7 : + // ActionSplitter.g:145:32: '}' + { + match('}'); if (state.failed) return ; - } - break; - case 4 : - // ActionSplitter.g:125:20: ')' - { - match(')'); if (state.failed) return ; + } + break; + case 8 : + // ActionSplitter.g:145:36: '\"' + { + match('\"'); if (state.failed) return ; - } - break; - case 5 : - // ActionSplitter.g:125:24: ',' - { - match(','); if (state.failed) return ; + } + break; - } - break; - case 6 : - // ActionSplitter.g:125:28: '{' - { - match('{'); if (state.failed) return ; + default : + break loop23; + } + } while (true); - } - break; - case 7 : - // ActionSplitter.g:125:32: '}' - { - match('}'); if (state.failed) return ; - - } - break; - case 8 : - // ActionSplitter.g:125:36: '\"' - { - match('\"'); if (state.failed) return ; - - } - break; - - default : - break loop20; - } - } while (true); - - if ( state.backtracking==1 ) { - - /* - chunks.add(getText()); - ErrorManager.grammarError(ErrorManager.MSG_INVALID_TEMPLATE_ACTION, - grammar, - actionToken, - getText()); - */ - - } - - } - break; } + state.type = _type; state.channel = _channel; - } + if ( state.backtracking==1 ) { + delegate.unknownSyntax(getText()); + } } finally { } } @@ -1111,43 +1254,33 @@ public class ActionSplitter extends Lexer { try { int _type = TEXT; int _channel = DEFAULT_TOKEN_CHANNEL; - // ActionSplitter.g:137:5: ( ( '\\\\$' | '\\\\%' | ~ ( '$' | '%' ) )+ ) - // ActionSplitter.g:137:7: ( '\\\\$' | '\\\\%' | ~ ( '$' | '%' ) )+ + // ActionSplitter.g:151:2: ( ( '\\\\$' | '\\\\%' )+ ) + // ActionSplitter.g:151:4: ( '\\\\$' | '\\\\%' )+ { - // ActionSplitter.g:137:7: ( '\\\\$' | '\\\\%' | ~ ( '$' | '%' ) )+ - int cnt22=0; - loop22: + // ActionSplitter.g:151:4: ( '\\\\$' | '\\\\%' )+ + int cnt24=0; + loop24: do { - int alt22=4; - int LA22_0 = input.LA(1); + int alt24=3; + int LA24_0 = input.LA(1); - if ( (LA22_0=='\\') ) { - switch ( input.LA(2) ) { - case '$': - { - alt22=1; - } - break; - case '%': - { - alt22=2; - } - break; + if ( (LA24_0=='\\') ) { + int LA24_2 = input.LA(2); - default: - alt22=3; - break; + if ( (LA24_2=='$') ) { + alt24=1; + } + else if ( (LA24_2=='%') ) { + alt24=2; } - } - else if ( ((LA22_0>='\u0000' && LA22_0<='#')||(LA22_0>='&' && LA22_0<='[')||(LA22_0>=']' && LA22_0<='\uFFFF')) ) { - alt22=3; + } - switch (alt22) { + switch (alt24) { case 1 : - // ActionSplitter.g:137:9: '\\\\$' + // ActionSplitter.g:151:6: '\\\\$' { match("\\$"); if (state.failed) return ; @@ -1155,38 +1288,22 @@ public class ActionSplitter extends Lexer { } break; case 2 : - // ActionSplitter.g:138:5: '\\\\%' + // ActionSplitter.g:152:5: '\\\\%' { match("\\%"); if (state.failed) return ; - } - break; - case 3 : - // ActionSplitter.g:139:5: ~ ( '$' | '%' ) - { - if ( (input.LA(1)>='\u0000' && input.LA(1)<='#')||(input.LA(1)>='&' && input.LA(1)<='\uFFFF') ) { - input.consume(); - state.failed=false; - } - else { - if (state.backtracking>0) {state.failed=true; return ;} - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse;} - - } break; default : - if ( cnt22 >= 1 ) break loop22; + if ( cnt24 >= 1 ) break loop24; if (state.backtracking>0) {state.failed=true; return ;} EarlyExitException eee = - new EarlyExitException(22, input); + new EarlyExitException(24, input); throw eee; } - cnt22++; + cnt24++; } while (true); @@ -1194,7 +1311,9 @@ public class ActionSplitter extends Lexer { state.type = _type; state.channel = _channel; - } + if ( state.backtracking==1 ) { + delegate.text(getText()); + } } finally { } } @@ -1203,45 +1322,45 @@ public class ActionSplitter extends Lexer { // $ANTLR start "ACTION" public final void mACTION() throws RecognitionException { try { - // ActionSplitter.g:145:2: ( '{' ( '\\\\}' | ~ '}' )* '}' ) - // ActionSplitter.g:145:4: '{' ( '\\\\}' | ~ '}' )* '}' + // ActionSplitter.g:158:2: ( '{' ( '\\\\}' | ~ '}' )* '}' ) + // ActionSplitter.g:158:4: '{' ( '\\\\}' | ~ '}' )* '}' { match('{'); if (state.failed) return ; - // ActionSplitter.g:145:8: ( '\\\\}' | ~ '}' )* - loop23: + // ActionSplitter.g:158:8: ( '\\\\}' | ~ '}' )* + loop25: do { - int alt23=3; - int LA23_0 = input.LA(1); + int alt25=3; + int LA25_0 = input.LA(1); - if ( (LA23_0=='\\') ) { - int LA23_2 = input.LA(2); + if ( (LA25_0=='\\') ) { + int LA25_2 = input.LA(2); - if ( (LA23_2=='}') ) { - int LA23_4 = input.LA(3); + if ( (LA25_2=='}') ) { + int LA25_4 = input.LA(3); - if ( ((LA23_4>='\u0000' && LA23_4<='\uFFFF')) ) { - alt23=1; + if ( ((LA25_4>='\u0000' && LA25_4<='\uFFFF')) ) { + alt25=1; } else { - alt23=2; + alt25=2; } } - else if ( ((LA23_2>='\u0000' && LA23_2<='|')||(LA23_2>='~' && LA23_2<='\uFFFF')) ) { - alt23=2; + else if ( ((LA25_2>='\u0000' && LA25_2<='|')||(LA25_2>='~' && LA25_2<='\uFFFF')) ) { + alt25=2; } } - else if ( ((LA23_0>='\u0000' && LA23_0<='[')||(LA23_0>=']' && LA23_0<='|')||(LA23_0>='~' && LA23_0<='\uFFFF')) ) { - alt23=2; + else if ( ((LA25_0>='\u0000' && LA25_0<='[')||(LA25_0>=']' && LA25_0<='|')||(LA25_0>='~' && LA25_0<='\uFFFF')) ) { + alt25=2; } - switch (alt23) { + switch (alt25) { case 1 : - // ActionSplitter.g:145:9: '\\\\}' + // ActionSplitter.g:158:9: '\\\\}' { match("\\}"); if (state.failed) return ; @@ -1249,7 +1368,7 @@ public class ActionSplitter extends Lexer { } break; case 2 : - // ActionSplitter.g:145:15: ~ '}' + // ActionSplitter.g:158:15: ~ '}' { if ( (input.LA(1)>='\u0000' && input.LA(1)<='|')||(input.LA(1)>='~' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1265,148 +1384,148 @@ public class ActionSplitter extends Lexer { } break; - default : - break loop23; - } - } while (true); - - match('}'); if (state.failed) return ; - - } - - } - finally { - } - } - // $ANTLR end "ACTION" - - // $ANTLR start "ARG" - public final void mARG() throws RecognitionException { - try { - // ActionSplitter.g:149:5: ( ID '=' ACTION ) - // ActionSplitter.g:149:7: ID '=' ACTION - { - mID(); if (state.failed) return ; - match('='); if (state.failed) return ; - mACTION(); if (state.failed) return ; - - } - - } - finally { - } - } - // $ANTLR end "ARG" - - // $ANTLR start "ID" - public final void mID() throws RecognitionException { - try { - // ActionSplitter.g:153:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) - // ActionSplitter.g:153:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* - { - if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { - input.consume(); - state.failed=false; - } - else { - if (state.backtracking>0) {state.failed=true; return ;} - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse;} - - // ActionSplitter.g:153:31: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* - loop24: - do { - int alt24=2; - int LA24_0 = input.LA(1); - - if ( ((LA24_0>='0' && LA24_0<='9')||(LA24_0>='A' && LA24_0<='Z')||LA24_0=='_'||(LA24_0>='a' && LA24_0<='z')) ) { - alt24=1; - } - - - switch (alt24) { - case 1 : - // ActionSplitter.g: - { - if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { - input.consume(); - state.failed=false; - } - else { - if (state.backtracking>0) {state.failed=true; return ;} - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse;} - - - } - break; - - default : - break loop24; - } - } while (true); - - - } - - } - finally { - } - } - // $ANTLR end "ID" - - // $ANTLR start "ATTR_VALUE_EXPR" - public final void mATTR_VALUE_EXPR() throws RecognitionException { - try { - // ActionSplitter.g:159:2: (~ '=' (~ ';' )* ) - // ActionSplitter.g:159:4: ~ '=' (~ ';' )* - { - if ( (input.LA(1)>='\u0000' && input.LA(1)<='<')||(input.LA(1)>='>' && input.LA(1)<='\uFFFF') ) { - input.consume(); - state.failed=false; - } - else { - if (state.backtracking>0) {state.failed=true; return ;} - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse;} - - // ActionSplitter.g:159:9: (~ ';' )* - loop25: - do { - int alt25=2; - int LA25_0 = input.LA(1); - - if ( ((LA25_0>='\u0000' && LA25_0<=':')||(LA25_0>='<' && LA25_0<='\uFFFF')) ) { - alt25=1; - } - - - switch (alt25) { - case 1 : - // ActionSplitter.g:159:10: ~ ';' - { - if ( (input.LA(1)>='\u0000' && input.LA(1)<=':')||(input.LA(1)>='<' && input.LA(1)<='\uFFFF') ) { - input.consume(); - state.failed=false; - } - else { - if (state.backtracking>0) {state.failed=true; return ;} - MismatchedSetException mse = new MismatchedSetException(null,input); - recover(mse); - throw mse;} - - - } - break; - default : break loop25; } } while (true); + match('}'); if (state.failed) return ; + + } + + } + finally { + } + } + // $ANTLR end "ACTION" + + // $ANTLR start "ARG" + public final void mARG() throws RecognitionException { + try { + // ActionSplitter.g:162:5: ( ID '=' ACTION ) + // ActionSplitter.g:162:7: ID '=' ACTION + { + mID(); if (state.failed) return ; + match('='); if (state.failed) return ; + mACTION(); if (state.failed) return ; + + } + + } + finally { + } + } + // $ANTLR end "ARG" + + // $ANTLR start "ID" + public final void mID() throws RecognitionException { + try { + // ActionSplitter.g:166:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* ) + // ActionSplitter.g:166:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* + { + if ( (input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + state.failed=false; + } + else { + if (state.backtracking>0) {state.failed=true; return ;} + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // ActionSplitter.g:166:31: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )* + loop26: + do { + int alt26=2; + int LA26_0 = input.LA(1); + + if ( ((LA26_0>='0' && LA26_0<='9')||(LA26_0>='A' && LA26_0<='Z')||LA26_0=='_'||(LA26_0>='a' && LA26_0<='z')) ) { + alt26=1; + } + + + switch (alt26) { + case 1 : + // ActionSplitter.g: + { + if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) { + input.consume(); + state.failed=false; + } + else { + if (state.backtracking>0) {state.failed=true; return ;} + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop26; + } + } while (true); + + + } + + } + finally { + } + } + // $ANTLR end "ID" + + // $ANTLR start "ATTR_VALUE_EXPR" + public final void mATTR_VALUE_EXPR() throws RecognitionException { + try { + // ActionSplitter.g:172:2: (~ '=' (~ ';' )* ) + // ActionSplitter.g:172:4: ~ '=' (~ ';' )* + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<='<')||(input.LA(1)>='>' && input.LA(1)<='\uFFFF') ) { + input.consume(); + state.failed=false; + } + else { + if (state.backtracking>0) {state.failed=true; return ;} + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + // ActionSplitter.g:172:9: (~ ';' )* + loop27: + do { + int alt27=2; + int LA27_0 = input.LA(1); + + if ( ((LA27_0>='\u0000' && LA27_0<=':')||(LA27_0>='<' && LA27_0<='\uFFFF')) ) { + alt27=1; + } + + + switch (alt27) { + case 1 : + // ActionSplitter.g:172:10: ~ ';' + { + if ( (input.LA(1)>='\u0000' && input.LA(1)<=':')||(input.LA(1)>='<' && input.LA(1)<='\uFFFF') ) { + input.consume(); + state.failed=false; + } + else { + if (state.backtracking>0) {state.failed=true; return ;} + MismatchedSetException mse = new MismatchedSetException(null,input); + recover(mse); + throw mse;} + + + } + break; + + default : + break loop27; + } + } while (true); + } @@ -1419,36 +1538,36 @@ public class ActionSplitter extends Lexer { // $ANTLR start "SCOPE_INDEX_EXPR" public final void mSCOPE_INDEX_EXPR() throws RecognitionException { try { - // ActionSplitter.g:164:2: ( ( '\\\\]' | ~ ']' )+ ) - // ActionSplitter.g:164:4: ( '\\\\]' | ~ ']' )+ + // ActionSplitter.g:177:2: ( ( '\\\\]' | ~ ']' )+ ) + // ActionSplitter.g:177:4: ( '\\\\]' | ~ ']' )+ { - // ActionSplitter.g:164:4: ( '\\\\]' | ~ ']' )+ - int cnt26=0; - loop26: + // ActionSplitter.g:177:4: ( '\\\\]' | ~ ']' )+ + int cnt28=0; + loop28: do { - int alt26=3; - int LA26_0 = input.LA(1); + int alt28=3; + int LA28_0 = input.LA(1); - if ( (LA26_0=='\\') ) { - int LA26_2 = input.LA(2); + if ( (LA28_0=='\\') ) { + int LA28_2 = input.LA(2); - if ( (LA26_2==']') ) { - alt26=1; + if ( (LA28_2==']') ) { + alt28=1; } else { - alt26=2; + alt28=2; } } - else if ( ((LA26_0>='\u0000' && LA26_0<='[')||(LA26_0>='^' && LA26_0<='\uFFFF')) ) { - alt26=2; + else if ( ((LA28_0>='\u0000' && LA28_0<='[')||(LA28_0>='^' && LA28_0<='\uFFFF')) ) { + alt28=2; } - switch (alt26) { + switch (alt28) { case 1 : - // ActionSplitter.g:164:5: '\\\\]' + // ActionSplitter.g:177:5: '\\\\]' { match("\\]"); if (state.failed) return ; @@ -1456,7 +1575,7 @@ public class ActionSplitter extends Lexer { } break; case 2 : - // ActionSplitter.g:164:11: ~ ']' + // ActionSplitter.g:177:11: ~ ']' { if ( (input.LA(1)>='\u0000' && input.LA(1)<='\\')||(input.LA(1)>='^' && input.LA(1)<='\uFFFF') ) { input.consume(); @@ -1473,13 +1592,13 @@ public class ActionSplitter extends Lexer { break; default : - if ( cnt26 >= 1 ) break loop26; + if ( cnt28 >= 1 ) break loop28; if (state.backtracking>0) {state.failed=true; return ;} EarlyExitException eee = - new EarlyExitException(26, input); + new EarlyExitException(28, input); throw eee; } - cnt26++; + cnt28++; } while (true); @@ -1494,22 +1613,22 @@ public class ActionSplitter extends Lexer { // $ANTLR start "WS" public final void mWS() throws RecognitionException { try { - // ActionSplitter.g:168:4: ( ( ' ' | '\\t' | '\\n' | '\\r' )+ ) - // ActionSplitter.g:168:6: ( ' ' | '\\t' | '\\n' | '\\r' )+ + // ActionSplitter.g:181:4: ( ( ' ' | '\\t' | '\\n' | '\\r' )+ ) + // ActionSplitter.g:181:6: ( ' ' | '\\t' | '\\n' | '\\r' )+ { - // ActionSplitter.g:168:6: ( ' ' | '\\t' | '\\n' | '\\r' )+ - int cnt27=0; - loop27: + // ActionSplitter.g:181:6: ( ' ' | '\\t' | '\\n' | '\\r' )+ + int cnt29=0; + loop29: do { - int alt27=2; - int LA27_0 = input.LA(1); + int alt29=2; + int LA29_0 = input.LA(1); - if ( ((LA27_0>='\t' && LA27_0<='\n')||LA27_0=='\r'||LA27_0==' ') ) { - alt27=1; + if ( ((LA29_0>='\t' && LA29_0<='\n')||LA29_0=='\r'||LA29_0==' ') ) { + alt29=1; } - switch (alt27) { + switch (alt29) { case 1 : // ActionSplitter.g: { @@ -1528,13 +1647,13 @@ public class ActionSplitter extends Lexer { break; default : - if ( cnt27 >= 1 ) break loop27; + if ( cnt29 >= 1 ) break loop29; if (state.backtracking>0) {state.failed=true; return ;} EarlyExitException eee = - new EarlyExitException(27, input); + new EarlyExitException(29, input); throw eee; } - cnt27++; + cnt29++; } while (true); @@ -1547,124 +1666,138 @@ public class ActionSplitter extends Lexer { // $ANTLR end "WS" public void mTokens() throws RecognitionException { - // ActionSplitter.g:1:39: ( SET_QUALIFIED_ATTR | QUALIFIED_ATTR | SET_DYNAMIC_SCOPE_ATTR | DYNAMIC_SCOPE_ATTR | SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR | DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR | SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR | DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR | SET_ATTR | ATTR | TEMPLATE_INSTANCE | INDIRECT_TEMPLATE_INSTANCE | SET_EXPR_ATTRIBUTE | SET_ATTRIBUTE | TEMPLATE_EXPR | UNKNOWN_SYNTAX | TEXT ) - int alt28=17; - alt28 = dfa28.predict(input); - switch (alt28) { + // ActionSplitter.g:1:39: ( COMMENT | LINE_COMMENT | SET_QUALIFIED_ATTR | QUALIFIED_ATTR | SET_DYNAMIC_SCOPE_ATTR | DYNAMIC_SCOPE_ATTR | SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR | DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR | SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR | DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR | SET_ATTR | ATTR | TEMPLATE_INSTANCE | INDIRECT_TEMPLATE_INSTANCE | SET_EXPR_ATTRIBUTE | SET_ATTRIBUTE | TEMPLATE_EXPR | UNKNOWN_SYNTAX | TEXT ) + int alt30=19; + alt30 = dfa30.predict(input); + switch (alt30) { case 1 : - // ActionSplitter.g:1:41: SET_QUALIFIED_ATTR + // ActionSplitter.g:1:41: COMMENT + { + mCOMMENT(); if (state.failed) return ; + + } + break; + case 2 : + // ActionSplitter.g:1:49: LINE_COMMENT + { + mLINE_COMMENT(); if (state.failed) return ; + + } + break; + case 3 : + // ActionSplitter.g:1:62: SET_QUALIFIED_ATTR { mSET_QUALIFIED_ATTR(); if (state.failed) return ; } break; - case 2 : - // ActionSplitter.g:1:60: QUALIFIED_ATTR + case 4 : + // ActionSplitter.g:1:81: QUALIFIED_ATTR { mQUALIFIED_ATTR(); if (state.failed) return ; } break; - case 3 : - // ActionSplitter.g:1:75: SET_DYNAMIC_SCOPE_ATTR + case 5 : + // ActionSplitter.g:1:96: SET_DYNAMIC_SCOPE_ATTR { mSET_DYNAMIC_SCOPE_ATTR(); if (state.failed) return ; } break; - case 4 : - // ActionSplitter.g:1:98: DYNAMIC_SCOPE_ATTR + case 6 : + // ActionSplitter.g:1:119: DYNAMIC_SCOPE_ATTR { mDYNAMIC_SCOPE_ATTR(); if (state.failed) return ; } break; - case 5 : - // ActionSplitter.g:1:117: SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR + case 7 : + // ActionSplitter.g:1:138: SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR { mSET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } break; - case 6 : - // ActionSplitter.g:1:157: DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR + case 8 : + // ActionSplitter.g:1:178: DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR { mDYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } break; - case 7 : - // ActionSplitter.g:1:193: SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR + case 9 : + // ActionSplitter.g:1:214: SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR { mSET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } break; - case 8 : - // ActionSplitter.g:1:233: DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR + case 10 : + // ActionSplitter.g:1:254: DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR { mDYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } break; - case 9 : - // ActionSplitter.g:1:269: SET_ATTR + case 11 : + // ActionSplitter.g:1:290: SET_ATTR { mSET_ATTR(); if (state.failed) return ; } break; - case 10 : - // ActionSplitter.g:1:278: ATTR + case 12 : + // ActionSplitter.g:1:299: ATTR { mATTR(); if (state.failed) return ; } break; - case 11 : - // ActionSplitter.g:1:283: TEMPLATE_INSTANCE + case 13 : + // ActionSplitter.g:1:304: TEMPLATE_INSTANCE { mTEMPLATE_INSTANCE(); if (state.failed) return ; } break; - case 12 : - // ActionSplitter.g:1:301: INDIRECT_TEMPLATE_INSTANCE + case 14 : + // ActionSplitter.g:1:322: INDIRECT_TEMPLATE_INSTANCE { mINDIRECT_TEMPLATE_INSTANCE(); if (state.failed) return ; } break; - case 13 : - // ActionSplitter.g:1:328: SET_EXPR_ATTRIBUTE + case 15 : + // ActionSplitter.g:1:349: SET_EXPR_ATTRIBUTE { mSET_EXPR_ATTRIBUTE(); if (state.failed) return ; } break; - case 14 : - // ActionSplitter.g:1:347: SET_ATTRIBUTE + case 16 : + // ActionSplitter.g:1:368: SET_ATTRIBUTE { mSET_ATTRIBUTE(); if (state.failed) return ; } break; - case 15 : - // ActionSplitter.g:1:361: TEMPLATE_EXPR + case 17 : + // ActionSplitter.g:1:382: TEMPLATE_EXPR { mTEMPLATE_EXPR(); if (state.failed) return ; } break; - case 16 : - // ActionSplitter.g:1:375: UNKNOWN_SYNTAX + case 18 : + // ActionSplitter.g:1:396: UNKNOWN_SYNTAX { mUNKNOWN_SYNTAX(); if (state.failed) return ; } break; - case 17 : - // ActionSplitter.g:1:390: TEXT + case 19 : + // ActionSplitter.g:1:411: TEXT { mTEXT(); if (state.failed) return ; @@ -1677,10 +1810,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred1_ActionSplitter public final void synpred1_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:41: ( SET_QUALIFIED_ATTR ) - // ActionSplitter.g:1:41: SET_QUALIFIED_ATTR + // ActionSplitter.g:1:41: ( COMMENT ) + // ActionSplitter.g:1:41: COMMENT { - mSET_QUALIFIED_ATTR(); if (state.failed) return ; + mCOMMENT(); if (state.failed) return ; } } @@ -1688,10 +1821,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred2_ActionSplitter public final void synpred2_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:60: ( QUALIFIED_ATTR ) - // ActionSplitter.g:1:60: QUALIFIED_ATTR + // ActionSplitter.g:1:49: ( LINE_COMMENT ) + // ActionSplitter.g:1:49: LINE_COMMENT { - mQUALIFIED_ATTR(); if (state.failed) return ; + mLINE_COMMENT(); if (state.failed) return ; } } @@ -1699,10 +1832,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred3_ActionSplitter public final void synpred3_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:75: ( SET_DYNAMIC_SCOPE_ATTR ) - // ActionSplitter.g:1:75: SET_DYNAMIC_SCOPE_ATTR + // ActionSplitter.g:1:62: ( SET_QUALIFIED_ATTR ) + // ActionSplitter.g:1:62: SET_QUALIFIED_ATTR { - mSET_DYNAMIC_SCOPE_ATTR(); if (state.failed) return ; + mSET_QUALIFIED_ATTR(); if (state.failed) return ; } } @@ -1710,10 +1843,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred4_ActionSplitter public final void synpred4_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:98: ( DYNAMIC_SCOPE_ATTR ) - // ActionSplitter.g:1:98: DYNAMIC_SCOPE_ATTR + // ActionSplitter.g:1:81: ( QUALIFIED_ATTR ) + // ActionSplitter.g:1:81: QUALIFIED_ATTR { - mDYNAMIC_SCOPE_ATTR(); if (state.failed) return ; + mQUALIFIED_ATTR(); if (state.failed) return ; } } @@ -1721,10 +1854,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred5_ActionSplitter public final void synpred5_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:117: ( SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR ) - // ActionSplitter.g:1:117: SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR + // ActionSplitter.g:1:96: ( SET_DYNAMIC_SCOPE_ATTR ) + // ActionSplitter.g:1:96: SET_DYNAMIC_SCOPE_ATTR { - mSET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; + mSET_DYNAMIC_SCOPE_ATTR(); if (state.failed) return ; } } @@ -1732,10 +1865,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred6_ActionSplitter public final void synpred6_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:157: ( DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR ) - // ActionSplitter.g:1:157: DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR + // ActionSplitter.g:1:119: ( DYNAMIC_SCOPE_ATTR ) + // ActionSplitter.g:1:119: DYNAMIC_SCOPE_ATTR { - mDYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; + mDYNAMIC_SCOPE_ATTR(); if (state.failed) return ; } } @@ -1743,10 +1876,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred7_ActionSplitter public final void synpred7_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:193: ( SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR ) - // ActionSplitter.g:1:193: SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR + // ActionSplitter.g:1:138: ( SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR ) + // ActionSplitter.g:1:138: SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR { - mSET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; + mSET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } } @@ -1754,10 +1887,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred8_ActionSplitter public final void synpred8_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:233: ( DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR ) - // ActionSplitter.g:1:233: DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR + // ActionSplitter.g:1:178: ( DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR ) + // ActionSplitter.g:1:178: DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR { - mDYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; + mDYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } } @@ -1765,10 +1898,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred9_ActionSplitter public final void synpred9_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:269: ( SET_ATTR ) - // ActionSplitter.g:1:269: SET_ATTR + // ActionSplitter.g:1:214: ( SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR ) + // ActionSplitter.g:1:214: SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR { - mSET_ATTR(); if (state.failed) return ; + mSET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } } @@ -1776,10 +1909,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred10_ActionSplitter public final void synpred10_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:278: ( ATTR ) - // ActionSplitter.g:1:278: ATTR + // ActionSplitter.g:1:254: ( DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR ) + // ActionSplitter.g:1:254: DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR { - mATTR(); if (state.failed) return ; + mDYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR(); if (state.failed) return ; } } @@ -1787,10 +1920,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred11_ActionSplitter public final void synpred11_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:283: ( TEMPLATE_INSTANCE ) - // ActionSplitter.g:1:283: TEMPLATE_INSTANCE + // ActionSplitter.g:1:290: ( SET_ATTR ) + // ActionSplitter.g:1:290: SET_ATTR { - mTEMPLATE_INSTANCE(); if (state.failed) return ; + mSET_ATTR(); if (state.failed) return ; } } @@ -1798,10 +1931,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred12_ActionSplitter public final void synpred12_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:301: ( INDIRECT_TEMPLATE_INSTANCE ) - // ActionSplitter.g:1:301: INDIRECT_TEMPLATE_INSTANCE + // ActionSplitter.g:1:299: ( ATTR ) + // ActionSplitter.g:1:299: ATTR { - mINDIRECT_TEMPLATE_INSTANCE(); if (state.failed) return ; + mATTR(); if (state.failed) return ; } } @@ -1809,10 +1942,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred13_ActionSplitter public final void synpred13_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:328: ( SET_EXPR_ATTRIBUTE ) - // ActionSplitter.g:1:328: SET_EXPR_ATTRIBUTE + // ActionSplitter.g:1:304: ( TEMPLATE_INSTANCE ) + // ActionSplitter.g:1:304: TEMPLATE_INSTANCE { - mSET_EXPR_ATTRIBUTE(); if (state.failed) return ; + mTEMPLATE_INSTANCE(); if (state.failed) return ; } } @@ -1820,10 +1953,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred14_ActionSplitter public final void synpred14_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:347: ( SET_ATTRIBUTE ) - // ActionSplitter.g:1:347: SET_ATTRIBUTE + // ActionSplitter.g:1:322: ( INDIRECT_TEMPLATE_INSTANCE ) + // ActionSplitter.g:1:322: INDIRECT_TEMPLATE_INSTANCE { - mSET_ATTRIBUTE(); if (state.failed) return ; + mINDIRECT_TEMPLATE_INSTANCE(); if (state.failed) return ; } } @@ -1831,10 +1964,10 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred15_ActionSplitter public final void synpred15_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:361: ( TEMPLATE_EXPR ) - // ActionSplitter.g:1:361: TEMPLATE_EXPR + // ActionSplitter.g:1:349: ( SET_EXPR_ATTRIBUTE ) + // ActionSplitter.g:1:349: SET_EXPR_ATTRIBUTE { - mTEMPLATE_EXPR(); if (state.failed) return ; + mSET_EXPR_ATTRIBUTE(); if (state.failed) return ; } } @@ -1842,14 +1975,36 @@ public class ActionSplitter extends Lexer { // $ANTLR start synpred16_ActionSplitter public final void synpred16_ActionSplitter_fragment() throws RecognitionException { - // ActionSplitter.g:1:375: ( UNKNOWN_SYNTAX ) - // ActionSplitter.g:1:375: UNKNOWN_SYNTAX + // ActionSplitter.g:1:368: ( SET_ATTRIBUTE ) + // ActionSplitter.g:1:368: SET_ATTRIBUTE + { + mSET_ATTRIBUTE(); if (state.failed) return ; + + } + } + // $ANTLR end synpred16_ActionSplitter + + // $ANTLR start synpred17_ActionSplitter + public final void synpred17_ActionSplitter_fragment() throws RecognitionException { + // ActionSplitter.g:1:382: ( TEMPLATE_EXPR ) + // ActionSplitter.g:1:382: TEMPLATE_EXPR + { + mTEMPLATE_EXPR(); if (state.failed) return ; + + } + } + // $ANTLR end synpred17_ActionSplitter + + // $ANTLR start synpred18_ActionSplitter + public final void synpred18_ActionSplitter_fragment() throws RecognitionException { + // ActionSplitter.g:1:396: ( UNKNOWN_SYNTAX ) + // ActionSplitter.g:1:396: UNKNOWN_SYNTAX { mUNKNOWN_SYNTAX(); if (state.failed) return ; } } - // $ANTLR end synpred16_ActionSplitter + // $ANTLR end synpred18_ActionSplitter public final boolean synpred10_ActionSplitter() { state.backtracking++; @@ -1865,11 +2020,11 @@ public class ActionSplitter extends Lexer { state.failed=false; return success; } - public final boolean synpred7_ActionSplitter() { + public final boolean synpred12_ActionSplitter() { state.backtracking++; int start = input.mark(); try { - synpred7_ActionSplitter_fragment(); // can never throw exception + synpred12_ActionSplitter_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } @@ -1879,11 +2034,25 @@ public class ActionSplitter extends Lexer { state.failed=false; return success; } - public final boolean synpred12_ActionSplitter() { + public final boolean synpred17_ActionSplitter() { state.backtracking++; int start = input.mark(); try { - synpred12_ActionSplitter_fragment(); // can never throw exception + synpred17_ActionSplitter_fragment(); // can never throw exception + } catch (RecognitionException re) { + System.err.println("impossible: "+re); + } + boolean success = !state.failed; + input.rewind(start); + state.backtracking--; + state.failed=false; + return success; + } + public final boolean synpred7_ActionSplitter() { + state.backtracking++; + int start = input.mark(); + try { + synpred7_ActionSplitter_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } @@ -1977,11 +2146,11 @@ public class ActionSplitter extends Lexer { state.failed=false; return success; } - public final boolean synpred2_ActionSplitter() { + public final boolean synpred18_ActionSplitter() { state.backtracking++; int start = input.mark(); try { - synpred2_ActionSplitter_fragment(); // can never throw exception + synpred18_ActionSplitter_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } @@ -2005,6 +2174,20 @@ public class ActionSplitter extends Lexer { state.failed=false; return success; } + public final boolean synpred2_ActionSplitter() { + state.backtracking++; + int start = input.mark(); + try { + synpred2_ActionSplitter_fragment(); // can never throw exception + } catch (RecognitionException re) { + System.err.println("impossible: "+re); + } + boolean success = !state.failed; + input.rewind(start); + state.backtracking--; + state.failed=false; + return success; + } public final boolean synpred6_ActionSplitter() { state.backtracking++; int start = input.mark(); @@ -2077,21 +2260,21 @@ public class ActionSplitter extends Lexer { } - protected DFA20 dfa20 = new DFA20(this); - protected DFA28 dfa28 = new DFA28(this); - static final String DFA20_eotS = + protected DFA23 dfa23 = new DFA23(this); + protected DFA30 dfa30 = new DFA30(this); + static final String DFA23_eotS = "\1\1\11\uffff"; - static final String DFA20_eofS = + static final String DFA23_eofS = "\12\uffff"; - static final String DFA20_minS = + static final String DFA23_minS = "\1\42\11\uffff"; - static final String DFA20_maxS = + static final String DFA23_maxS = "\1\175\11\uffff"; - static final String DFA20_acceptS = + static final String DFA23_acceptS = "\1\uffff\1\11\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10"; - static final String DFA20_specialS = + static final String DFA23_specialS = "\12\uffff}>"; - static final String[] DFA20_transitionS = { + static final String[] DFA23_transitionS = { "\1\11\5\uffff\1\4\1\5\2\uffff\1\6\1\uffff\1\3\22\uffff\32\2"+ "\4\uffff\1\2\1\uffff\32\2\1\7\1\uffff\1\10", "", @@ -2105,54 +2288,57 @@ public class ActionSplitter extends Lexer { "" }; - static final short[] DFA20_eot = DFA.unpackEncodedString(DFA20_eotS); - static final short[] DFA20_eof = DFA.unpackEncodedString(DFA20_eofS); - static final char[] DFA20_min = DFA.unpackEncodedStringToUnsignedChars(DFA20_minS); - static final char[] DFA20_max = DFA.unpackEncodedStringToUnsignedChars(DFA20_maxS); - static final short[] DFA20_accept = DFA.unpackEncodedString(DFA20_acceptS); - static final short[] DFA20_special = DFA.unpackEncodedString(DFA20_specialS); - static final short[][] DFA20_transition; + static final short[] DFA23_eot = DFA.unpackEncodedString(DFA23_eotS); + static final short[] DFA23_eof = DFA.unpackEncodedString(DFA23_eofS); + static final char[] DFA23_min = DFA.unpackEncodedStringToUnsignedChars(DFA23_minS); + static final char[] DFA23_max = DFA.unpackEncodedStringToUnsignedChars(DFA23_maxS); + static final short[] DFA23_accept = DFA.unpackEncodedString(DFA23_acceptS); + static final short[] DFA23_special = DFA.unpackEncodedString(DFA23_specialS); + static final short[][] DFA23_transition; static { - int numStates = DFA20_transitionS.length; - DFA20_transition = new short[numStates][]; + int numStates = DFA23_transitionS.length; + DFA23_transition = new short[numStates][]; for (int i=0; i"; - static final String[] DFA28_transitionS = { - "\44\23\1\1\1\15\uffda\23", + static final String DFA30_eotS = + "\27\uffff"; + static final String DFA30_eofS = + "\27\uffff"; + static final String DFA30_minS = + "\1\44\1\0\2\uffff\1\0\6\uffff\1\0\13\uffff"; + static final String DFA30_maxS = + "\1\134\1\0\2\uffff\1\0\6\uffff\1\0\13\uffff"; + static final String DFA30_acceptS = + "\2\uffff\1\1\1\2\1\uffff\1\15\1\16\1\17\1\20\1\21\1\22\1\uffff\1"+ + "\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\23"; + static final String DFA30_specialS = + "\1\uffff\1\0\2\uffff\1\1\6\uffff\1\2\13\uffff}>"; + static final String[] DFA30_transitionS = { + "\1\13\1\4\11\uffff\1\1\54\uffff\1\26", + "\1\uffff", + "", + "", "\1\uffff", "", "", @@ -2160,128 +2346,129 @@ public class ActionSplitter extends Lexer { "", "", "", - "", - "", - "", - "", - "", "\1\uffff", "", "", "", "", "", + "", + "", + "", + "", + "", "" }; - static final short[] DFA28_eot = DFA.unpackEncodedString(DFA28_eotS); - static final short[] DFA28_eof = DFA.unpackEncodedString(DFA28_eofS); - static final char[] DFA28_min = DFA.unpackEncodedStringToUnsignedChars(DFA28_minS); - static final char[] DFA28_max = DFA.unpackEncodedStringToUnsignedChars(DFA28_maxS); - static final short[] DFA28_accept = DFA.unpackEncodedString(DFA28_acceptS); - static final short[] DFA28_special = DFA.unpackEncodedString(DFA28_specialS); - static final short[][] DFA28_transition; + static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS); + static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS); + static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS); + static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS); + static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS); + static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS); + static final short[][] DFA30_transition; static { - int numStates = DFA28_transitionS.length; - DFA28_transition = new short[numStates][]; + int numStates = DFA30_transitionS.length; + DFA30_transition = new short[numStates][]; for (int i=0; i='\u0000' && LA28_0<='#')||(LA28_0>='&' && LA28_0<='\uFFFF')) ) {s = 19;} - - if ( s>=0 ) return s; - break; - case 1 : - int LA28_1 = input.LA(1); + int LA30_1 = input.LA(1); - int index28_1 = input.index(); + int index30_1 = input.index(); input.rewind(); s = -1; if ( (synpred1_ActionSplitter()) ) {s = 2;} else if ( (synpred2_ActionSplitter()) ) {s = 3;} - else if ( (synpred3_ActionSplitter()) ) {s = 4;} - - else if ( (synpred4_ActionSplitter()) ) {s = 5;} - - else if ( (synpred5_ActionSplitter()) ) {s = 6;} - - else if ( (synpred6_ActionSplitter()) ) {s = 7;} - - else if ( (synpred7_ActionSplitter()) ) {s = 8;} - - else if ( (synpred8_ActionSplitter()) ) {s = 9;} - - else if ( (synpred9_ActionSplitter()) ) {s = 10;} - - else if ( (synpred10_ActionSplitter()) ) {s = 11;} - - else if ( (synpred16_ActionSplitter()) ) {s = 12;} + + input.seek(index30_1); + if ( s>=0 ) return s; + break; + case 1 : + int LA30_4 = input.LA(1); - input.seek(index28_1); + int index30_4 = input.index(); + input.rewind(); + s = -1; + if ( (synpred13_ActionSplitter()) ) {s = 5;} + + else if ( (synpred14_ActionSplitter()) ) {s = 6;} + + else if ( (synpred15_ActionSplitter()) ) {s = 7;} + + else if ( (synpred16_ActionSplitter()) ) {s = 8;} + + else if ( (synpred17_ActionSplitter()) ) {s = 9;} + + else if ( (synpred18_ActionSplitter()) ) {s = 10;} + + + input.seek(index30_4); if ( s>=0 ) return s; break; case 2 : - int LA28_13 = input.LA(1); + int LA30_11 = input.LA(1); - int index28_13 = input.index(); + int index30_11 = input.index(); input.rewind(); s = -1; - if ( (synpred11_ActionSplitter()) ) {s = 14;} + if ( (synpred3_ActionSplitter()) ) {s = 12;} - else if ( (synpred12_ActionSplitter()) ) {s = 15;} + else if ( (synpred4_ActionSplitter()) ) {s = 13;} - else if ( (synpred13_ActionSplitter()) ) {s = 16;} + else if ( (synpred5_ActionSplitter()) ) {s = 14;} - else if ( (synpred14_ActionSplitter()) ) {s = 17;} + else if ( (synpred6_ActionSplitter()) ) {s = 15;} - else if ( (synpred15_ActionSplitter()) ) {s = 18;} + else if ( (synpred7_ActionSplitter()) ) {s = 16;} - else if ( (synpred16_ActionSplitter()) ) {s = 12;} + else if ( (synpred8_ActionSplitter()) ) {s = 17;} + + else if ( (synpred9_ActionSplitter()) ) {s = 18;} + + else if ( (synpred10_ActionSplitter()) ) {s = 19;} + + else if ( (synpred11_ActionSplitter()) ) {s = 20;} + + else if ( (synpred12_ActionSplitter()) ) {s = 21;} - input.seek(index28_13); + input.seek(index30_11); if ( s>=0 ) return s; break; } if (state.backtracking>0) {state.failed=true; return -1;} NoViableAltException nvae = - new NoViableAltException(getDescription(), 28, _s, input); + new NoViableAltException(getDescription(), 30, _s, input); error(nvae); throw nvae; } diff --git a/tool/src/org/antlr/v4/parse/ActionSplitter.tokens b/tool/src/org/antlr/v4/parse/ActionSplitter.tokens index 7c02c26d0..883e7341e 100644 --- a/tool/src/org/antlr/v4/parse/ActionSplitter.tokens +++ b/tool/src/org/antlr/v4/parse/ActionSplitter.tokens @@ -1,23 +1,25 @@ -INDIRECT_TEMPLATE_INSTANCE=21 -DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=13 -SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=12 -SET_ATTRIBUTE=23 -TEMPLATE_EXPR=24 -TEXT=26 -ID=4 -QUALIFIED_ATTR=8 -ACTION=20 -UNKNOWN_SYNTAX=25 -SET_QUALIFIED_ATTR=7 -SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=14 -WS=5 -ARG=18 -TEMPLATE_INSTANCE=19 -SET_EXPR_ATTRIBUTE=22 -ATTR_VALUE_EXPR=6 -SET_DYNAMIC_SCOPE_ATTR=9 -SCOPE_INDEX_EXPR=11 -DYNAMIC_SCOPE_ATTR=10 -SET_ATTR=17 -ATTR=16 -DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=15 +INDIRECT_TEMPLATE_INSTANCE=23 +LINE_COMMENT=5 +DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=15 +SET_DYNAMIC_NEGATIVE_INDEXED_SCOPE_ATTR=14 +SET_ATTRIBUTE=25 +TEMPLATE_EXPR=26 +TEXT=28 +ID=6 +QUALIFIED_ATTR=10 +ACTION=22 +UNKNOWN_SYNTAX=27 +SET_QUALIFIED_ATTR=9 +SET_DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=16 +WS=7 +ARG=20 +TEMPLATE_INSTANCE=21 +SET_EXPR_ATTRIBUTE=24 +ATTR_VALUE_EXPR=8 +SET_DYNAMIC_SCOPE_ATTR=11 +SCOPE_INDEX_EXPR=13 +DYNAMIC_SCOPE_ATTR=12 +SET_ATTR=18 +COMMENT=4 +ATTR=19 +DYNAMIC_ABSOLUTE_INDEXED_SCOPE_ATTR=17 diff --git a/tool/src/org/antlr/v4/parse/ActionSplitterListener.java b/tool/src/org/antlr/v4/parse/ActionSplitterListener.java new file mode 100644 index 000000000..bf24a06e7 --- /dev/null +++ b/tool/src/org/antlr/v4/parse/ActionSplitterListener.java @@ -0,0 +1,40 @@ +package org.antlr.v4.parse; + +import org.antlr.runtime.Token; + +/** */ +public interface ActionSplitterListener { + void setQualifiedAttr(Token x, Token y, Token expr); + + void qualifiedAttr(Token x, Token y); + + void setDynamicScopeAttr(Token x, Token y, Token expr); + + void dynamicScopeAttr(Token x, Token y); + + void setDynamicNegativeIndexedScopeAttr(Token x, Token y, Token index, Token expr); + + void dynamicNegativeIndexedScopeAttr(Token x, Token y, Token index); + + void setDynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index, Token expr); + + void dynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index); + + void setAttr(Token x, Token expr); + + void attr(Token x); + + void templateInstance(); + + void indirectTemplateInstance(); + + void setExprAttribute(); + + void setAttribute(); + + void templateExpr(); + + void unknownSyntax(String text); + + void text(String text); +} diff --git a/tool/src/org/antlr/v4/semantics/AttributeChecks.java b/tool/src/org/antlr/v4/semantics/AttributeChecks.java index e8377de59..a9fcf036c 100644 --- a/tool/src/org/antlr/v4/semantics/AttributeChecks.java +++ b/tool/src/org/antlr/v4/semantics/AttributeChecks.java @@ -3,29 +3,58 @@ package org.antlr.v4.semantics; import org.antlr.runtime.ANTLRStringStream; import org.antlr.runtime.Token; import org.antlr.v4.parse.ActionSplitter; +import org.antlr.v4.parse.ActionSplitterListener; import org.antlr.v4.tool.Grammar; +import org.antlr.v4.tool.GrammarAST; +import org.antlr.v4.tool.Rule; /** Trigger checks for various kinds of attribute expressions. no side-effects */ -public class AttributeChecks extends ActionSplitter { +public class AttributeChecks implements ActionSplitterListener { public Grammar g; + public Rule r; + public GrammarAST node; + String action; - public AttributeChecks(Grammar g, String action) { - super(new ANTLRStringStream(action)); + public AttributeChecks(Grammar g, Rule r, GrammarAST node, String action) { this.g = g; + this.r = r; + this.node = node; + this.action = action; } - public void setQualifiedAttr(Token x, Token y, Token expr) { } + public void examine() { + ActionSplitter splitter = + new ActionSplitter(new ANTLRStringStream(action), this); + splitter.getActionChunks(); // forces eval, fills extractor + } + + public void setQualifiedAttr(Token x, Token y, Token expr) { + System.out.println(x+"."+y+"="+expr); + new AttributeChecks(g, r, node, expr.getText()).examine(); + } public void qualifiedAttr(Token x, Token y) { System.out.println(x+"."+y); } - public void setDynamicScopeAttr() { } - public void dynamicScopeAttr() { } - public void setDynamicNegativeIndexedScopeAttr() { } - public void dynamicNegativeIndexedScopeAttr() { } - public void setDynamicAbsoluteIndexedScopeAttr() { } - public void dynamicAbsoluteIndexedScopeAttr() { } - public void setAttr() { } - public void attr() { } - public void unknownSyntax() { } - public void text() { } + public void setDynamicScopeAttr(Token x, Token y, Token expr) { } + public void dynamicScopeAttr(Token x, Token y) { } + public void setDynamicNegativeIndexedScopeAttr(Token x, Token y, Token index, Token expr) { } + public void dynamicNegativeIndexedScopeAttr(Token x, Token y, Token index) { } + public void setDynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index, Token expr) { } + public void dynamicAbsoluteIndexedScopeAttr(Token x, Token y, Token index) { } + public void setAttr(Token x, Token expr) { + System.out.println(x+"="+expr); + new AttributeChecks(g, r, node, expr.getText()).examine(); + } + public void attr(Token x) { + System.out.println(x); + } + public void unknownSyntax(String text) { } + public void text(String text) { } + + // don't care + public void templateInstance() { } + public void indirectTemplateInstance() { } + public void setExprAttribute() { } + public void setAttribute() { } + public void templateExpr() { } } diff --git a/tool/src/org/antlr/v4/semantics/BasicSemanticTriggers.java b/tool/src/org/antlr/v4/semantics/BasicSemanticTriggers.java index 9abecd4d0..35e252a02 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-10 17:19:41 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-11 11:14:49 /* [The "BSD license"] diff --git a/tool/src/org/antlr/v4/semantics/CollectSymbols.java b/tool/src/org/antlr/v4/semantics/CollectSymbols.java index bb30ea359..a5af177d7 100644 --- a/tool/src/org/antlr/v4/semantics/CollectSymbols.java +++ b/tool/src/org/antlr/v4/semantics/CollectSymbols.java @@ -1,4 +1,4 @@ -// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 CollectSymbols.g 2010-02-10 17:19:40 +// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 CollectSymbols.g 2010-02-11 11:14:49 /* [The "BSD license"] diff --git a/tool/src/org/antlr/v4/semantics/SemanticPipeline.java b/tool/src/org/antlr/v4/semantics/SemanticPipeline.java index 84bee1198..c358efccd 100644 --- a/tool/src/org/antlr/v4/semantics/SemanticPipeline.java +++ b/tool/src/org/antlr/v4/semantics/SemanticPipeline.java @@ -59,12 +59,12 @@ public class SemanticPipeline { public void checkAttributeExpressions(Grammar g, CollectSymbols collector) { for (Rule r : collector.rules) { for (GrammarAST a : r.namedActions.values()) { - AttributeChecks extractor = new AttributeChecks(g, a.getText()); - extractor.getActionChunks(); // forces eval, fills extractor + AttributeChecks checker = new AttributeChecks(g, r, a, a.getText()); + checker.examine(); } for (GrammarAST a : r.inlineActions) { - AttributeChecks extractor = new AttributeChecks(g, a.getText()); - extractor.getActionChunks(); // forces eval, fills extractor + AttributeChecks checker = new AttributeChecks(g, r, a, a.getText()); + checker.examine(); } } }