forgot to add

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6668]
This commit is contained in:
parrt 2010-02-05 14:21:25 -08:00
parent 6f7e52ec9e
commit 6d4a521ec0
2 changed files with 1007 additions and 0 deletions

View File

@ -0,0 +1,910 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 CollectSymbols.g 2010-02-05 14:20:12
/*
[The "BSD license"]
Copyright (c) 2010 Terence Parr
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.antlr.v4.semantics;
import org.antlr.runtime.*;
import org.antlr.runtime.tree.TreeNodeStream;
import org.antlr.runtime.tree.TreeRuleReturnScope;
import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.GrammarAST;
import org.antlr.v4.tool.GrammarASTWithOptions;
import org.antlr.v4.tool.Rule;
import java.util.ArrayList;
import java.util.List;
/** Triggers for defining rules, tokens, scopes, and actions.
* Side-effects: ...
*/
public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "SEMPRED", "FORCED_ACTION", "DOC_COMMENT", "SRC", "NLCHARS", "COMMENT", "DOUBLE_QUOTE_STRING_LITERAL", "DOUBLE_ANGLE_STRING_LITERAL", "ACTION_STRING_LITERAL", "ACTION_CHAR_LITERAL", "ARG_ACTION", "NESTED_ACTION", "ACTION", "ACTION_ESC", "WSNLCHARS", "OPTIONS", "TOKENS", "SCOPE", "IMPORT", "FRAGMENT", "LEXER", "PARSER", "TREE", "GRAMMAR", "PROTECTED", "PUBLIC", "PRIVATE", "RETURNS", "THROWS", "CATCH", "FINALLY", "TEMPLATE", "COLON", "COLONCOLON", "COMMA", "SEMI", "LPAREN", "RPAREN", "IMPLIES", "LT", "GT", "ASSIGN", "QUESTION", "BANG", "STAR", "PLUS", "PLUS_ASSIGN", "OR", "ROOT", "DOLLAR", "DOT", "RANGE", "ETC", "RARROW", "TREE_BEGIN", "AT", "NOT", "RBRACE", "TOKEN_REF", "RULE_REF", "INT", "WSCHARS", "ESC_SEQ", "STRING_LITERAL", "HEX_DIGIT", "UNICODE_ESC", "WS", "ERRCHAR", "RULE", "RULES", "RULEMODIFIERS", "RULEACTIONS", "BLOCK", "REWRITE_BLOCK", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "CHAR_RANGE", "EPSILON", "ALT", "ALTLIST", "RESULT", "ID", "ARG", "ARGLIST", "RET", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "WILDCARD", "LIST", "ELEMENT_OPTIONS", "ST_RESULT", "ALT_REWRITE"
};
public static final int LT=43;
public static final int STAR=48;
public static final int BACKTRACK_SEMPRED=95;
public static final int DOUBLE_ANGLE_STRING_LITERAL=11;
public static final int FORCED_ACTION=5;
public static final int ARGLIST=89;
public static final int ALTLIST=85;
public static final int NOT=60;
public static final int EOF=-1;
public static final int SEMPRED=4;
public static final int ACTION=16;
public static final int TOKEN_REF=62;
public static final int RULEMODIFIERS=74;
public static final int ST_RESULT=99;
public static final int RPAREN=41;
public static final int RET=90;
public static final int IMPORT=22;
public static final int STRING_LITERAL=67;
public static final int ARG=88;
public static final int ARG_ACTION=14;
public static final int DOUBLE_QUOTE_STRING_LITERAL=10;
public static final int COMMENT=9;
public static final int ACTION_CHAR_LITERAL=13;
public static final int GRAMMAR=27;
public static final int RULEACTIONS=75;
public static final int WSCHARS=65;
public static final int INITACTION=91;
public static final int ALT_REWRITE=100;
public static final int IMPLIES=42;
public static final int RULE=72;
public static final int RBRACE=61;
public static final int ACTION_ESC=17;
public static final int PRIVATE=30;
public static final int SRC=7;
public static final int THROWS=32;
public static final int CHAR_RANGE=82;
public static final int INT=64;
public static final int EPSILON=83;
public static final int LIST=97;
public static final int COLONCOLON=37;
public static final int WSNLCHARS=18;
public static final int WS=70;
public static final int LEXER=24;
public static final int OR=51;
public static final int GT=44;
public static final int CATCH=33;
public static final int CLOSURE=79;
public static final int PARSER=25;
public static final int DOLLAR=53;
public static final int PROTECTED=28;
public static final int ELEMENT_OPTIONS=98;
public static final int NESTED_ACTION=15;
public static final int FRAGMENT=23;
public static final int ID=87;
public static final int TREE_BEGIN=58;
public static final int LPAREN=40;
public static final int AT=59;
public static final int ESC_SEQ=66;
public static final int ALT=84;
public static final int TREE=26;
public static final int SCOPE=21;
public static final int ETC=56;
public static final int COMMA=38;
public static final int WILDCARD=96;
public static final int DOC_COMMENT=6;
public static final int PLUS=49;
public static final int REWRITE_BLOCK=77;
public static final int DOT=54;
public static final int RETURNS=31;
public static final int RULES=73;
public static final int RARROW=57;
public static final int UNICODE_ESC=69;
public static final int HEX_DIGIT=68;
public static final int RANGE=55;
public static final int TOKENS=20;
public static final int GATED_SEMPRED=93;
public static final int RESULT=86;
public static final int BANG=47;
public static final int ACTION_STRING_LITERAL=12;
public static final int ROOT=52;
public static final int SEMI=39;
public static final int RULE_REF=63;
public static final int NLCHARS=8;
public static final int OPTIONAL=78;
public static final int SYNPRED=81;
public static final int COLON=36;
public static final int QUESTION=46;
public static final int FINALLY=34;
public static final int TEMPLATE=35;
public static final int LABEL=92;
public static final int SYN_SEMPRED=94;
public static final int ERRCHAR=71;
public static final int BLOCK=76;
public static final int ASSIGN=45;
public static final int PLUS_ASSIGN=50;
public static final int PUBLIC=29;
public static final int POSITIVE_CLOSURE=80;
public static final int OPTIONS=19;
// delegates
// delegators
public CollectSymbols(TreeNodeStream input) {
this(input, new RecognizerSharedState());
}
public CollectSymbols(TreeNodeStream input, RecognizerSharedState state) {
super(input, state);
}
public String[] getTokenNames() { return CollectSymbols.tokenNames; }
public String getGrammarFileName() { return "CollectSymbols.g"; }
Rule currentRule = null;
public List<Rule> rules = new ArrayList<Rule>();
public List<GrammarAST> terminals = new ArrayList<GrammarAST>();
public List<GrammarAST> aliases = new ArrayList<GrammarAST>();
public List<GrammarAST> scopes = new ArrayList<GrammarAST>();
public List<GrammarAST> actions = new ArrayList<GrammarAST>();
Grammar g; // which grammar are we checking
public CollectSymbols(TreeNodeStream input, Grammar g) {
this(input);
this.g = g;
}
// $ANTLR start "topdown"
// CollectSymbols.g:84:1: topdown : ( globalScope | action | tokenAlias | rule | ruleArg | ruleReturns | terminal );
public final void topdown() throws RecognitionException {
try {
// CollectSymbols.g:85:5: ( globalScope | action | tokenAlias | rule | ruleArg | ruleReturns | terminal )
int alt1=7;
switch ( input.LA(1) ) {
case SCOPE:
{
alt1=1;
}
break;
case AT:
{
alt1=2;
}
break;
case ASSIGN:
case ID:
{
alt1=3;
}
break;
case RULE:
{
alt1=4;
}
break;
case ARG_ACTION:
{
alt1=5;
}
break;
case RETURNS:
{
alt1=6;
}
break;
case TOKEN_REF:
case STRING_LITERAL:
{
alt1=7;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return ;}
NoViableAltException nvae =
new NoViableAltException("", 1, 0, input);
throw nvae;
}
switch (alt1) {
case 1 :
// CollectSymbols.g:85:7: globalScope
{
pushFollow(FOLLOW_globalScope_in_topdown96);
globalScope();
state._fsp--;
if (state.failed) return ;
}
break;
case 2 :
// CollectSymbols.g:86:7: action
{
pushFollow(FOLLOW_action_in_topdown104);
action();
state._fsp--;
if (state.failed) return ;
}
break;
case 3 :
// CollectSymbols.g:87:7: tokenAlias
{
pushFollow(FOLLOW_tokenAlias_in_topdown112);
tokenAlias();
state._fsp--;
if (state.failed) return ;
}
break;
case 4 :
// CollectSymbols.g:88:7: rule
{
pushFollow(FOLLOW_rule_in_topdown120);
rule();
state._fsp--;
if (state.failed) return ;
}
break;
case 5 :
// CollectSymbols.g:89:7: ruleArg
{
pushFollow(FOLLOW_ruleArg_in_topdown128);
ruleArg();
state._fsp--;
if (state.failed) return ;
}
break;
case 6 :
// CollectSymbols.g:90:7: ruleReturns
{
pushFollow(FOLLOW_ruleReturns_in_topdown136);
ruleReturns();
state._fsp--;
if (state.failed) return ;
}
break;
case 7 :
// CollectSymbols.g:91:7: terminal
{
pushFollow(FOLLOW_terminal_in_topdown144);
terminal();
state._fsp--;
if (state.failed) return ;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "topdown"
// $ANTLR start "bottomup"
// CollectSymbols.g:94:1: bottomup : finishRule ;
public final void bottomup() throws RecognitionException {
try {
// CollectSymbols.g:95:2: ( finishRule )
// CollectSymbols.g:95:4: finishRule
{
pushFollow(FOLLOW_finishRule_in_bottomup155);
finishRule();
state._fsp--;
if (state.failed) return ;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "bottomup"
// $ANTLR start "globalScope"
// CollectSymbols.g:98:1: globalScope : {...}? ^( SCOPE ID ACTION ) ;
public final void globalScope() throws RecognitionException {
GrammarAST ID1=null;
try {
// CollectSymbols.g:99:2: ({...}? ^( SCOPE ID ACTION ) )
// CollectSymbols.g:99:4: {...}? ^( SCOPE ID ACTION )
{
if ( !((inContext("GRAMMAR"))) ) {
if (state.backtracking>0) {state.failed=true; return ;}
throw new FailedPredicateException(input, "globalScope", "inContext(\"GRAMMAR\")");
}
match(input,SCOPE,FOLLOW_SCOPE_in_globalScope169); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
ID1=(GrammarAST)match(input,ID,FOLLOW_ID_in_globalScope171); if (state.failed) return ;
match(input,ACTION,FOLLOW_ACTION_in_globalScope173); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
scopes.add(ID1);
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "globalScope"
// $ANTLR start "action"
// CollectSymbols.g:102:1: action : {...}? ^( AT (sc= ID )? ID ACTION ) ;
public final void action() throws RecognitionException {
GrammarAST sc=null;
GrammarAST AT2=null;
try {
// CollectSymbols.g:103:2: ({...}? ^( AT (sc= ID )? ID ACTION ) )
// CollectSymbols.g:103:4: {...}? ^( AT (sc= ID )? ID ACTION )
{
if ( !((inContext("GRAMMAR"))) ) {
if (state.backtracking>0) {state.failed=true; return ;}
throw new FailedPredicateException(input, "action", "inContext(\"GRAMMAR\")");
}
AT2=(GrammarAST)match(input,AT,FOLLOW_AT_in_action190); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
// CollectSymbols.g:103:35: (sc= ID )?
int alt2=2;
int LA2_0 = input.LA(1);
if ( (LA2_0==ID) ) {
int LA2_1 = input.LA(2);
if ( (LA2_1==ID) ) {
alt2=1;
}
}
switch (alt2) {
case 1 :
// CollectSymbols.g:103:35: sc= ID
{
sc=(GrammarAST)match(input,ID,FOLLOW_ID_in_action194); if (state.failed) return ;
}
break;
}
match(input,ID,FOLLOW_ID_in_action197); if (state.failed) return ;
match(input,ACTION,FOLLOW_ACTION_in_action199); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
actions.add(AT2);
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "action"
// $ANTLR start "tokenAlias"
// CollectSymbols.g:107:1: tokenAlias : {...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID ) ;
public final void tokenAlias() throws RecognitionException {
GrammarAST t=null;
GrammarAST ASSIGN3=null;
try {
// CollectSymbols.g:108:2: ({...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID ) )
// CollectSymbols.g:108:4: {...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID )
{
if ( !((inContext("TOKENS"))) ) {
if (state.backtracking>0) {state.failed=true; return ;}
throw new FailedPredicateException(input, "tokenAlias", "inContext(\"TOKENS\")");
}
// CollectSymbols.g:109:3: ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID )
int alt3=2;
int LA3_0 = input.LA(1);
if ( (LA3_0==ASSIGN) ) {
alt3=1;
}
else if ( (LA3_0==ID) ) {
alt3=2;
}
else {
if (state.backtracking>0) {state.failed=true; return ;}
NoViableAltException nvae =
new NoViableAltException("", 3, 0, input);
throw nvae;
}
switch (alt3) {
case 1 :
// CollectSymbols.g:109:5: ^( ASSIGN t= ID STRING_LITERAL )
{
ASSIGN3=(GrammarAST)match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenAlias222); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
t=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias226); if (state.failed) return ;
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenAlias228); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
terminals.add(t); aliases.add(ASSIGN3);
}
}
break;
case 2 :
// CollectSymbols.g:110:5: t= ID
{
t=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias239); if (state.failed) return ;
if ( state.backtracking==1 ) {
terminals.add(t);
}
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "tokenAlias"
// $ANTLR start "rule"
// CollectSymbols.g:114:1: rule : ^( RULE name= ID ( . )+ ) ;
public final void rule() throws RecognitionException {
GrammarAST name=null;
GrammarAST RULE4=null;
try {
// CollectSymbols.g:114:5: ( ^( RULE name= ID ( . )+ ) )
// CollectSymbols.g:114:9: ^( RULE name= ID ( . )+ )
{
RULE4=(GrammarAST)match(input,RULE,FOLLOW_RULE_in_rule265); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
name=(GrammarAST)match(input,ID,FOLLOW_ID_in_rule269); if (state.failed) return ;
// CollectSymbols.g:114:25: ( . )+
int cnt4=0;
loop4:
do {
int alt4=2;
int LA4_0 = input.LA(1);
if ( ((LA4_0>=SEMPRED && LA4_0<=ALT_REWRITE)) ) {
alt4=1;
}
else if ( (LA4_0==UP) ) {
alt4=2;
}
switch (alt4) {
case 1 :
// CollectSymbols.g:114:25: .
{
matchAny(input); if (state.failed) return ;
}
break;
default :
if ( cnt4 >= 1 ) break loop4;
if (state.backtracking>0) {state.failed=true; return ;}
EarlyExitException eee =
new EarlyExitException(4, input);
throw eee;
}
cnt4++;
} while (true);
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
Rule r = new Rule((name!=null?name.getText():null), (GrammarASTWithOptions)RULE4);
rules.add(r);
currentRule = r;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "rule"
// $ANTLR start "finishRule"
// CollectSymbols.g:122:1: finishRule : RULE ;
public final void finishRule() throws RecognitionException {
try {
// CollectSymbols.g:123:2: ( RULE )
// CollectSymbols.g:123:4: RULE
{
match(input,RULE,FOLLOW_RULE_in_finishRule291); if (state.failed) return ;
if ( state.backtracking==1 ) {
currentRule = null;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "finishRule"
// $ANTLR start "ruleArg"
// CollectSymbols.g:126:1: ruleArg : {...}? ARG_ACTION ;
public final void ruleArg() throws RecognitionException {
GrammarAST ARG_ACTION5=null;
try {
// CollectSymbols.g:127:2: ({...}? ARG_ACTION )
// CollectSymbols.g:127:4: {...}? ARG_ACTION
{
if ( !((inContext("RULE"))) ) {
if (state.backtracking>0) {state.failed=true; return ;}
throw new FailedPredicateException(input, "ruleArg", "inContext(\"RULE\")");
}
ARG_ACTION5=(GrammarAST)match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleArg306); if (state.failed) return ;
if ( state.backtracking==1 ) {
currentRule.arg = ARG_ACTION5;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "ruleArg"
// $ANTLR start "ruleReturns"
// CollectSymbols.g:130:1: ruleReturns : ^( RETURNS ARG_ACTION ) ;
public final void ruleReturns() throws RecognitionException {
GrammarAST ARG_ACTION6=null;
try {
// CollectSymbols.g:131:2: ( ^( RETURNS ARG_ACTION ) )
// CollectSymbols.g:131:4: ^( RETURNS ARG_ACTION )
{
match(input,RETURNS,FOLLOW_RETURNS_in_ruleReturns321); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
ARG_ACTION6=(GrammarAST)match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleReturns323); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
currentRule.ret = ARG_ACTION6;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "ruleReturns"
// $ANTLR start "ruleScopeSpec"
// CollectSymbols.g:134:1: ruleScopeSpec : {...}? ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) ) ;
public final void ruleScopeSpec() throws RecognitionException {
try {
// CollectSymbols.g:135:2: ({...}? ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) ) )
// CollectSymbols.g:135:4: {...}? ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) )
{
if ( !((inContext("RULE"))) ) {
if (state.backtracking>0) {state.failed=true; return ;}
throw new FailedPredicateException(input, "ruleScopeSpec", "inContext(\"RULE\")");
}
// CollectSymbols.g:136:3: ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) )
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==SCOPE) ) {
int LA6_1 = input.LA(2);
if ( (LA6_1==DOWN) ) {
int LA6_2 = input.LA(3);
if ( (LA6_2==ACTION) ) {
alt6=1;
}
else if ( (LA6_2==ID) ) {
alt6=2;
}
else {
if (state.backtracking>0) {state.failed=true; return ;}
NoViableAltException nvae =
new NoViableAltException("", 6, 2, input);
throw nvae;
}
}
else {
if (state.backtracking>0) {state.failed=true; return ;}
NoViableAltException nvae =
new NoViableAltException("", 6, 1, input);
throw nvae;
}
}
else {
if (state.backtracking>0) {state.failed=true; return ;}
NoViableAltException nvae =
new NoViableAltException("", 6, 0, input);
throw nvae;
}
switch (alt6) {
case 1 :
// CollectSymbols.g:136:5: ^( SCOPE ACTION )
{
match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec344); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
match(input,ACTION,FOLLOW_ACTION_in_ruleScopeSpec346); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
}
break;
case 2 :
// CollectSymbols.g:137:5: ^( SCOPE ( ID )+ )
{
match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec354); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
// CollectSymbols.g:137:13: ( ID )+
int cnt5=0;
loop5:
do {
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA5_0==ID) ) {
alt5=1;
}
switch (alt5) {
case 1 :
// CollectSymbols.g:137:13: ID
{
match(input,ID,FOLLOW_ID_in_ruleScopeSpec356); if (state.failed) return ;
}
break;
default :
if ( cnt5 >= 1 ) break loop5;
if (state.backtracking>0) {state.failed=true; return ;}
EarlyExitException eee =
new EarlyExitException(5, input);
throw eee;
}
cnt5++;
} while (true);
match(input, Token.UP, null); if (state.failed) return ;
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "ruleScopeSpec"
public static class terminal_return extends TreeRuleReturnScope {
};
// $ANTLR start "terminal"
// CollectSymbols.g:141:1: terminal : ({...}? STRING_LITERAL | TOKEN_REF );
public final CollectSymbols.terminal_return terminal() throws RecognitionException {
CollectSymbols.terminal_return retval = new CollectSymbols.terminal_return();
retval.start = input.LT(1);
try {
// CollectSymbols.g:142:5: ({...}? STRING_LITERAL | TOKEN_REF )
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0==STRING_LITERAL) ) {
alt7=1;
}
else if ( (LA7_0==TOKEN_REF) ) {
alt7=2;
}
else {
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae =
new NoViableAltException("", 7, 0, input);
throw nvae;
}
switch (alt7) {
case 1 :
// CollectSymbols.g:142:7: {...}? STRING_LITERAL
{
if ( !((!inContext("TOKENS ASSIGN"))) ) {
if (state.backtracking>0) {state.failed=true; return retval;}
throw new FailedPredicateException(input, "terminal", "!inContext(\"TOKENS ASSIGN\")");
}
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal378); if (state.failed) return retval;
if ( state.backtracking==1 ) {
terminals.add(((GrammarAST)retval.start));
}
}
break;
case 2 :
// CollectSymbols.g:143:7: TOKEN_REF
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal388); if (state.failed) return retval;
if ( state.backtracking==1 ) {
terminals.add(((GrammarAST)retval.start));
}
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return retval;
}
// $ANTLR end "terminal"
// Delegated rules
public static final BitSet FOLLOW_globalScope_in_topdown96 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_action_in_topdown104 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_tokenAlias_in_topdown112 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rule_in_topdown120 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleArg_in_topdown128 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleReturns_in_topdown136 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_terminal_in_topdown144 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_finishRule_in_bottomup155 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_SCOPE_in_globalScope169 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_globalScope171 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_globalScope173 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_AT_in_action190 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_action194 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_action197 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_action199 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ASSIGN_in_tokenAlias222 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_tokenAlias226 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_tokenAlias228 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ID_in_tokenAlias239 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_in_rule265 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rule269 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x0000001FFFFFFFFFL});
public static final BitSet FOLLOW_RULE_in_finishRule291 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleArg306 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RETURNS_in_ruleReturns321 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleReturns323 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec344 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec346 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec354 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_ruleScopeSpec356 = new BitSet(new long[]{0x0000000000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal378 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal388 = new BitSet(new long[]{0x0000000000000002L});
}

View File

@ -0,0 +1,97 @@
LT=43
STAR=48
BACKTRACK_SEMPRED=95
DOUBLE_ANGLE_STRING_LITERAL=11
FORCED_ACTION=5
ARGLIST=89
ALTLIST=85
NOT=60
SEMPRED=4
ACTION=16
TOKEN_REF=62
RULEMODIFIERS=74
ST_RESULT=99
RPAREN=41
RET=90
IMPORT=22
STRING_LITERAL=67
ARG=88
ARG_ACTION=14
DOUBLE_QUOTE_STRING_LITERAL=10
COMMENT=9
ACTION_CHAR_LITERAL=13
GRAMMAR=27
RULEACTIONS=75
WSCHARS=65
INITACTION=91
ALT_REWRITE=100
IMPLIES=42
RULE=72
RBRACE=61
ACTION_ESC=17
PRIVATE=30
SRC=7
THROWS=32
CHAR_RANGE=82
INT=64
EPSILON=83
LIST=97
COLONCOLON=37
WSNLCHARS=18
WS=70
LEXER=24
OR=51
GT=44
CATCH=33
CLOSURE=79
PARSER=25
DOLLAR=53
PROTECTED=28
ELEMENT_OPTIONS=98
NESTED_ACTION=15
FRAGMENT=23
ID=87
TREE_BEGIN=58
LPAREN=40
AT=59
ESC_SEQ=66
ALT=84
TREE=26
SCOPE=21
ETC=56
COMMA=38
WILDCARD=96
DOC_COMMENT=6
PLUS=49
REWRITE_BLOCK=77
DOT=54
RETURNS=31
RULES=73
RARROW=57
UNICODE_ESC=69
HEX_DIGIT=68
RANGE=55
TOKENS=20
GATED_SEMPRED=93
RESULT=86
BANG=47
ACTION_STRING_LITERAL=12
ROOT=52
SEMI=39
RULE_REF=63
NLCHARS=8
OPTIONAL=78
SYNPRED=81
COLON=36
QUESTION=46
FINALLY=34
TEMPLATE=35
LABEL=92
SYN_SEMPRED=94
ERRCHAR=71
BLOCK=76
ASSIGN=45
PLUS_ASSIGN=50
PUBLIC=29
POSITIVE_CLOSURE=80
OPTIONS=19