added rule and action redef; options copied to lexer now too.

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6670]
This commit is contained in:
parrt 2010-02-06 16:29:05 -08:00
parent 09eb3b5753
commit 1ba8487726
17 changed files with 889 additions and 685 deletions

View File

@ -4,7 +4,7 @@ import org.antlr.runtime.*;
import org.antlr.v4.parse.ANTLRLexer;
import org.antlr.v4.parse.ANTLRParser;
import org.antlr.v4.parse.GrammarASTAdaptor;
import org.antlr.v4.semantics.SemanticsPipeline;
import org.antlr.v4.semantics.SemanticPipeline;
import org.antlr.v4.tool.*;
import java.io.File;
@ -330,12 +330,15 @@ public class Tool {
lexerAST = extractImplicitLexer(ast); // alters ast
}
Grammar g = new Grammar(this, ast);
g.fileName = grammarFileNames.get(0);
process(g);
if ( lexerAST!=null ) {
// todo: don't process if errors in parser
Grammar g2 = new Grammar(this, lexerAST);
g2.implicitLexer = true;
process(g2);
Grammar lexerg = new Grammar(this, lexerAST);
lexerg.fileName = grammarFileNames.get(0);
g.implicitLexer = lexerg;
lexerg.implicitLexerOwner = g;
process(lexerg);
}
}
@ -344,8 +347,10 @@ public class Tool {
g.loadImportedGrammars();
if ( g.ast!=null && internalOption_PrintGrammarTree ) System.out.println(g.ast.toStringTree());
//g.ast.inspect();
SemanticsPipeline sem = new SemanticsPipeline();
SemanticPipeline sem = new SemanticPipeline();
sem.process(g);
// todo: add strings we collected to lexer?
}
// TODO: Move to ast manipulation class?
@ -371,6 +376,7 @@ public class Tool {
public GrammarRootAST extractImplicitLexer(GrammarRootAST combinedAST) {
//System.out.println("before="+combinedAST.toStringTree());
GrammarASTAdaptor adaptor = new GrammarASTAdaptor(combinedAST.token.getInputStream());
List<GrammarAST> elements = combinedAST.getChildren();
// MAKE A GRAMMAR ROOT and ID
String lexerName = combinedAST.getChild(0).getText()+"Lexer";
@ -395,15 +401,16 @@ public class Tool {
}
// MOVE lexer:: actions
List<GrammarAST> elements = combinedAST.getChildren();
List<GrammarAST> actionsWeMoved = new ArrayList<GrammarAST>();
for (GrammarAST e : elements) {
if ( e.getType()==ANTLRParser.AT ) {
if ( e.getChild(0).getText().equals("lexer") ) {
lexerAST.addChild(e);
elements.remove(e);
actionsWeMoved.add(e);
}
}
}
elements.removeAll(actionsWeMoved);
GrammarAST combinedRulesRoot =
(GrammarAST)combinedAST.getFirstChildWithType(ANTLRParser.RULES);
if ( combinedRulesRoot==null ) return lexerAST;

View File

@ -1,4 +1,4 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRLexer.g 2010-02-06 14:39:32
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ANTLRLexer.g 2010-02-06 15:46:36
/*
[The "BSD licence"]
@ -263,7 +263,7 @@ public class ANTLRLexer extends Lexer {
if ( (( input.LA(2) != '/')) ) {
alt3=1;
}
else if ( (((( true )&&( !(input.LA(1) == '*' && input.LA(2) == '/') ))||( true ))) ) {
else if ( ((( true )||(( true )&&( !(input.LA(1) == '*' && input.LA(2) == '/') )))) ) {
alt3=2;
}
else {

View File

@ -722,7 +722,7 @@ block
//
ruleref
: RULE_REF ARG_ACTION?
( (op=ROOT|op=BANG) -> ^($op RULE_REF ARG_ACTION?)
( (op=ROOT|op=BANG) -> ^($op ^(RULE_REF ARG_ACTION?))
| -> ^(RULE_REF ARG_ACTION?)
)
;

File diff suppressed because it is too large Load Diff

View File

@ -302,8 +302,8 @@ block
;
ruleref
: ^(ROOT RULE_REF ARG_ACTION?)
| ^(BANG RULE_REF ARG_ACTION?)
: ^(ROOT ^(RULE_REF ARG_ACTION?))
| ^(BANG ^(RULE_REF ARG_ACTION?))
| ^(RULE_REF ARG_ACTION?)
;

View File

@ -1,4 +1,4 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-06 14:39:35
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-06 15:46:39
/*
[The "BSD license"]
@ -2671,10 +2671,10 @@ public class ASTVerifier extends TreeParser {
// $ANTLR start "ruleref"
// ASTVerifier.g:304:1: ruleref : ( ^( ROOT RULE_REF ( ARG_ACTION )? ) | ^( BANG RULE_REF ( ARG_ACTION )? ) | ^( RULE_REF ( ARG_ACTION )? ) );
// ASTVerifier.g:304:1: ruleref : ( ^( ROOT ^( RULE_REF ( ARG_ACTION )? ) ) | ^( BANG ^( RULE_REF ( ARG_ACTION )? ) ) | ^( RULE_REF ( ARG_ACTION )? ) );
public final void ruleref() throws RecognitionException {
try {
// ASTVerifier.g:305:5: ( ^( ROOT RULE_REF ( ARG_ACTION )? ) | ^( BANG RULE_REF ( ARG_ACTION )? ) | ^( RULE_REF ( ARG_ACTION )? ) )
// ASTVerifier.g:305:5: ( ^( ROOT ^( RULE_REF ( ARG_ACTION )? ) ) | ^( BANG ^( RULE_REF ( ARG_ACTION )? ) ) | ^( RULE_REF ( ARG_ACTION )? ) )
int alt41=3;
switch ( input.LA(1) ) {
case ROOT:
@ -2701,60 +2701,72 @@ public class ASTVerifier extends TreeParser {
switch (alt41) {
case 1 :
// ASTVerifier.g:305:7: ^( ROOT RULE_REF ( ARG_ACTION )? )
// ASTVerifier.g:305:7: ^( ROOT ^( RULE_REF ( ARG_ACTION )? ) )
{
match(input,ROOT,FOLLOW_ROOT_in_ruleref1201);
match(input, Token.DOWN, null);
match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref1203);
// ASTVerifier.g:305:23: ( ARG_ACTION )?
int alt38=2;
int LA38_0 = input.LA(1);
match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref1204);
if ( (LA38_0==ARG_ACTION) ) {
alt38=1;
if ( input.LA(1)==Token.DOWN ) {
match(input, Token.DOWN, null);
// ASTVerifier.g:305:25: ( ARG_ACTION )?
int alt38=2;
int LA38_0 = input.LA(1);
if ( (LA38_0==ARG_ACTION) ) {
alt38=1;
}
switch (alt38) {
case 1 :
// ASTVerifier.g:305:25: ARG_ACTION
{
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref1206);
}
break;
}
match(input, Token.UP, null);
}
switch (alt38) {
case 1 :
// ASTVerifier.g:305:23: ARG_ACTION
{
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref1205);
}
break;
}
match(input, Token.UP, null);
}
break;
case 2 :
// ASTVerifier.g:306:7: ^( BANG RULE_REF ( ARG_ACTION )? )
// ASTVerifier.g:306:7: ^( BANG ^( RULE_REF ( ARG_ACTION )? ) )
{
match(input,BANG,FOLLOW_BANG_in_ruleref1216);
match(input,BANG,FOLLOW_BANG_in_ruleref1218);
match(input, Token.DOWN, null);
match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref1218);
// ASTVerifier.g:306:23: ( ARG_ACTION )?
int alt39=2;
int LA39_0 = input.LA(1);
match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref1221);
if ( (LA39_0==ARG_ACTION) ) {
alt39=1;
if ( input.LA(1)==Token.DOWN ) {
match(input, Token.DOWN, null);
// ASTVerifier.g:306:25: ( ARG_ACTION )?
int alt39=2;
int LA39_0 = input.LA(1);
if ( (LA39_0==ARG_ACTION) ) {
alt39=1;
}
switch (alt39) {
case 1 :
// ASTVerifier.g:306:25: ARG_ACTION
{
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref1223);
}
break;
}
match(input, Token.UP, null);
}
switch (alt39) {
case 1 :
// ASTVerifier.g:306:23: ARG_ACTION
{
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref1220);
}
break;
}
match(input, Token.UP, null);
@ -2763,7 +2775,7 @@ public class ASTVerifier extends TreeParser {
case 3 :
// ASTVerifier.g:307:7: ^( RULE_REF ( ARG_ACTION )? )
{
match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref1231);
match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref1235);
if ( input.LA(1)==Token.DOWN ) {
match(input, Token.DOWN, null);
@ -2778,7 +2790,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:307:18: ARG_ACTION
{
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref1233);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref1237);
}
break;
@ -2812,15 +2824,15 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:311:5: ( ^( RANGE rangeElement rangeElement ) )
// ASTVerifier.g:311:7: ^( RANGE rangeElement rangeElement )
{
match(input,RANGE,FOLLOW_RANGE_in_range1253);
match(input,RANGE,FOLLOW_RANGE_in_range1257);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_rangeElement_in_range1255);
pushFollow(FOLLOW_rangeElement_in_range1259);
rangeElement();
state._fsp--;
pushFollow(FOLLOW_rangeElement_in_range1257);
pushFollow(FOLLOW_rangeElement_in_range1261);
rangeElement();
state._fsp--;
@ -2884,10 +2896,10 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:321:8: ^( STRING_LITERAL elementOptions )
{
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal1310);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal1314);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_elementOptions_in_terminal1312);
pushFollow(FOLLOW_elementOptions_in_terminal1316);
elementOptions();
state._fsp--;
@ -2900,18 +2912,18 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:322:7: STRING_LITERAL
{
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal1321);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal1325);
}
break;
case 3 :
// ASTVerifier.g:323:7: ^( TOKEN_REF ARG_ACTION elementOptions )
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1330);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1334);
match(input, Token.DOWN, null);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_terminal1332);
pushFollow(FOLLOW_elementOptions_in_terminal1334);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_terminal1336);
pushFollow(FOLLOW_elementOptions_in_terminal1338);
elementOptions();
state._fsp--;
@ -2924,10 +2936,10 @@ public class ASTVerifier extends TreeParser {
case 4 :
// ASTVerifier.g:324:7: ^( TOKEN_REF ARG_ACTION )
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1344);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1348);
match(input, Token.DOWN, null);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_terminal1346);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_terminal1350);
match(input, Token.UP, null);
@ -2936,10 +2948,10 @@ public class ASTVerifier extends TreeParser {
case 5 :
// ASTVerifier.g:325:7: ^( TOKEN_REF elementOptions )
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1356);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1360);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_elementOptions_in_terminal1358);
pushFollow(FOLLOW_elementOptions_in_terminal1362);
elementOptions();
state._fsp--;
@ -2952,17 +2964,17 @@ public class ASTVerifier extends TreeParser {
case 6 :
// ASTVerifier.g:326:7: TOKEN_REF
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1367);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal1371);
}
break;
case 7 :
// ASTVerifier.g:327:7: ^( WILDCARD elementOptions )
{
match(input,WILDCARD,FOLLOW_WILDCARD_in_terminal1376);
match(input,WILDCARD,FOLLOW_WILDCARD_in_terminal1380);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_elementOptions_in_terminal1378);
pushFollow(FOLLOW_elementOptions_in_terminal1382);
elementOptions();
state._fsp--;
@ -2975,17 +2987,17 @@ public class ASTVerifier extends TreeParser {
case 8 :
// ASTVerifier.g:328:7: WILDCARD
{
match(input,WILDCARD,FOLLOW_WILDCARD_in_terminal1387);
match(input,WILDCARD,FOLLOW_WILDCARD_in_terminal1391);
}
break;
case 9 :
// ASTVerifier.g:329:7: ^( ROOT terminal )
{
match(input,ROOT,FOLLOW_ROOT_in_terminal1396);
match(input,ROOT,FOLLOW_ROOT_in_terminal1400);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_terminal_in_terminal1398);
pushFollow(FOLLOW_terminal_in_terminal1402);
terminal();
state._fsp--;
@ -2998,10 +3010,10 @@ public class ASTVerifier extends TreeParser {
case 10 :
// ASTVerifier.g:330:7: ^( BANG terminal )
{
match(input,BANG,FOLLOW_BANG_in_terminal1408);
match(input,BANG,FOLLOW_BANG_in_terminal1412);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_terminal_in_terminal1410);
pushFollow(FOLLOW_terminal_in_terminal1414);
terminal();
state._fsp--;
@ -3032,7 +3044,7 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:334:5: ( ^( ELEMENT_OPTIONS ( elementOption )+ ) )
// ASTVerifier.g:334:7: ^( ELEMENT_OPTIONS ( elementOption )+ )
{
match(input,ELEMENT_OPTIONS,FOLLOW_ELEMENT_OPTIONS_in_elementOptions1429);
match(input,ELEMENT_OPTIONS,FOLLOW_ELEMENT_OPTIONS_in_elementOptions1433);
match(input, Token.DOWN, null);
// ASTVerifier.g:334:25: ( elementOption )+
@ -3051,7 +3063,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:334:25: elementOption
{
pushFollow(FOLLOW_elementOption_in_elementOptions1431);
pushFollow(FOLLOW_elementOption_in_elementOptions1435);
elementOption();
state._fsp--;
@ -3143,18 +3155,18 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:338:7: ID
{
match(input,ID,FOLLOW_ID_in_elementOption1450);
match(input,ID,FOLLOW_ID_in_elementOption1454);
}
break;
case 2 :
// ASTVerifier.g:339:9: ^( ASSIGN ID ID )
{
match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption1461);
match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption1465);
match(input, Token.DOWN, null);
match(input,ID,FOLLOW_ID_in_elementOption1463);
match(input,ID,FOLLOW_ID_in_elementOption1465);
match(input,ID,FOLLOW_ID_in_elementOption1467);
match(input,ID,FOLLOW_ID_in_elementOption1469);
match(input, Token.UP, null);
@ -3163,11 +3175,11 @@ public class ASTVerifier extends TreeParser {
case 3 :
// ASTVerifier.g:340:9: ^( ASSIGN ID STRING_LITERAL )
{
match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption1477);
match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption1481);
match(input, Token.DOWN, null);
match(input,ID,FOLLOW_ID_in_elementOption1479);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_elementOption1481);
match(input,ID,FOLLOW_ID_in_elementOption1483);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_elementOption1485);
match(input, Token.UP, null);
@ -3236,7 +3248,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:344:4: predicatedRewrite
{
pushFollow(FOLLOW_predicatedRewrite_in_rewrite1496);
pushFollow(FOLLOW_predicatedRewrite_in_rewrite1500);
predicatedRewrite();
state._fsp--;
@ -3250,7 +3262,7 @@ public class ASTVerifier extends TreeParser {
}
} while (true);
pushFollow(FOLLOW_nakedRewrite_in_rewrite1499);
pushFollow(FOLLOW_nakedRewrite_in_rewrite1503);
nakedRewrite();
state._fsp--;
@ -3294,11 +3306,11 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:348:4: ^( ST_RESULT SEMPRED rewriteAlt )
{
match(input,ST_RESULT,FOLLOW_ST_RESULT_in_predicatedRewrite1511);
match(input,ST_RESULT,FOLLOW_ST_RESULT_in_predicatedRewrite1515);
match(input, Token.DOWN, null);
match(input,SEMPRED,FOLLOW_SEMPRED_in_predicatedRewrite1513);
pushFollow(FOLLOW_rewriteAlt_in_predicatedRewrite1515);
match(input,SEMPRED,FOLLOW_SEMPRED_in_predicatedRewrite1517);
pushFollow(FOLLOW_rewriteAlt_in_predicatedRewrite1519);
rewriteAlt();
state._fsp--;
@ -3311,11 +3323,11 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:349:4: ^( RESULT SEMPRED rewriteAlt )
{
match(input,RESULT,FOLLOW_RESULT_in_predicatedRewrite1522);
match(input,RESULT,FOLLOW_RESULT_in_predicatedRewrite1526);
match(input, Token.DOWN, null);
match(input,SEMPRED,FOLLOW_SEMPRED_in_predicatedRewrite1524);
pushFollow(FOLLOW_rewriteAlt_in_predicatedRewrite1526);
match(input,SEMPRED,FOLLOW_SEMPRED_in_predicatedRewrite1528);
pushFollow(FOLLOW_rewriteAlt_in_predicatedRewrite1530);
rewriteAlt();
state._fsp--;
@ -3363,10 +3375,10 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:353:4: ^( ST_RESULT rewriteAlt )
{
match(input,ST_RESULT,FOLLOW_ST_RESULT_in_nakedRewrite1540);
match(input,ST_RESULT,FOLLOW_ST_RESULT_in_nakedRewrite1544);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_rewriteAlt_in_nakedRewrite1542);
pushFollow(FOLLOW_rewriteAlt_in_nakedRewrite1546);
rewriteAlt();
state._fsp--;
@ -3379,10 +3391,10 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:354:4: ^( RESULT rewriteAlt )
{
match(input,RESULT,FOLLOW_RESULT_in_nakedRewrite1549);
match(input,RESULT,FOLLOW_RESULT_in_nakedRewrite1553);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_rewriteAlt_in_nakedRewrite1551);
pushFollow(FOLLOW_rewriteAlt_in_nakedRewrite1555);
rewriteAlt();
state._fsp--;
@ -3445,7 +3457,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:358:7: rewriteTemplate
{
pushFollow(FOLLOW_rewriteTemplate_in_rewriteAlt1567);
pushFollow(FOLLOW_rewriteTemplate_in_rewriteAlt1571);
rewriteTemplate();
state._fsp--;
@ -3456,7 +3468,7 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:359:7: rewriteTreeAlt
{
pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteAlt1575);
pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteAlt1579);
rewriteTreeAlt();
state._fsp--;
@ -3467,14 +3479,14 @@ public class ASTVerifier extends TreeParser {
case 3 :
// ASTVerifier.g:360:7: ETC
{
match(input,ETC,FOLLOW_ETC_in_rewriteAlt1583);
match(input,ETC,FOLLOW_ETC_in_rewriteAlt1587);
}
break;
case 4 :
// ASTVerifier.g:361:7: EPSILON
{
match(input,EPSILON,FOLLOW_EPSILON_in_rewriteAlt1591);
match(input,EPSILON,FOLLOW_EPSILON_in_rewriteAlt1595);
}
break;
@ -3499,7 +3511,7 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:365:5: ( ^( ALT ( rewriteTreeElement )+ ) )
// ASTVerifier.g:365:7: ^( ALT ( rewriteTreeElement )+ )
{
match(input,ALT,FOLLOW_ALT_in_rewriteTreeAlt1610);
match(input,ALT,FOLLOW_ALT_in_rewriteTreeAlt1614);
match(input, Token.DOWN, null);
// ASTVerifier.g:365:13: ( rewriteTreeElement )+
@ -3518,7 +3530,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:365:13: rewriteTreeElement
{
pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTreeAlt1612);
pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTreeAlt1616);
rewriteTreeElement();
state._fsp--;
@ -3592,7 +3604,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:369:4: rewriteTreeAtom
{
pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTreeElement1628);
pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTreeElement1632);
rewriteTreeAtom();
state._fsp--;
@ -3603,7 +3615,7 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:370:4: rewriteTree
{
pushFollow(FOLLOW_rewriteTree_in_rewriteTreeElement1633);
pushFollow(FOLLOW_rewriteTree_in_rewriteTreeElement1637);
rewriteTree();
state._fsp--;
@ -3614,7 +3626,7 @@ public class ASTVerifier extends TreeParser {
case 3 :
// ASTVerifier.g:371:6: rewriteTreeEbnf
{
pushFollow(FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement1640);
pushFollow(FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement1644);
rewriteTreeEbnf();
state._fsp--;
@ -3647,15 +3659,15 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:375:9: ^( TOKEN_REF elementOptions ARG_ACTION )
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1657);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1661);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1659);
pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1663);
elementOptions();
state._fsp--;
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1661);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1665);
match(input, Token.UP, null);
@ -3664,10 +3676,10 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:376:9: ^( TOKEN_REF elementOptions )
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1673);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1677);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1675);
pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1679);
elementOptions();
state._fsp--;
@ -3680,10 +3692,10 @@ public class ASTVerifier extends TreeParser {
case 3 :
// ASTVerifier.g:377:9: ^( TOKEN_REF ARG_ACTION )
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1687);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1691);
match(input, Token.DOWN, null);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1689);
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_rewriteTreeAtom1693);
match(input, Token.UP, null);
@ -3692,24 +3704,24 @@ public class ASTVerifier extends TreeParser {
case 4 :
// ASTVerifier.g:378:6: TOKEN_REF
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1697);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_rewriteTreeAtom1701);
}
break;
case 5 :
// ASTVerifier.g:379:9: RULE_REF
{
match(input,RULE_REF,FOLLOW_RULE_REF_in_rewriteTreeAtom1707);
match(input,RULE_REF,FOLLOW_RULE_REF_in_rewriteTreeAtom1711);
}
break;
case 6 :
// ASTVerifier.g:380:6: ^( STRING_LITERAL elementOptions )
{
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1715);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1719);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1717);
pushFollow(FOLLOW_elementOptions_in_rewriteTreeAtom1721);
elementOptions();
state._fsp--;
@ -3722,21 +3734,21 @@ public class ASTVerifier extends TreeParser {
case 7 :
// ASTVerifier.g:381:6: STRING_LITERAL
{
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1725);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1729);
}
break;
case 8 :
// ASTVerifier.g:382:6: LABEL
{
match(input,LABEL,FOLLOW_LABEL_in_rewriteTreeAtom1733);
match(input,LABEL,FOLLOW_LABEL_in_rewriteTreeAtom1737);
}
break;
case 9 :
// ASTVerifier.g:383:4: ACTION
{
match(input,ACTION,FOLLOW_ACTION_in_rewriteTreeAtom1738);
match(input,ACTION,FOLLOW_ACTION_in_rewriteTreeAtom1742);
}
break;
@ -3761,17 +3773,17 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:387:2: ( ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) )
// ASTVerifier.g:387:4: ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) )
{
pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1750);
pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1754);
ebnfSuffix();
state._fsp--;
match(input, Token.DOWN, null);
match(input,REWRITE_BLOCK,FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1753);
match(input,REWRITE_BLOCK,FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1757);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1755);
pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1759);
rewriteTreeAlt();
state._fsp--;
@ -3802,10 +3814,10 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:390:2: ( ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* ) )
// ASTVerifier.g:390:4: ^( TREE_BEGIN rewriteTreeAtom ( rewriteTreeElement )* )
{
match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewriteTree1768);
match(input,TREE_BEGIN,FOLLOW_TREE_BEGIN_in_rewriteTree1772);
match(input, Token.DOWN, null);
pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTree1770);
pushFollow(FOLLOW_rewriteTreeAtom_in_rewriteTree1774);
rewriteTreeAtom();
state._fsp--;
@ -3825,7 +3837,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:390:33: rewriteTreeElement
{
pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTree1772);
pushFollow(FOLLOW_rewriteTreeElement_in_rewriteTree1776);
rewriteTreeElement();
state._fsp--;
@ -3867,7 +3879,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:394:4: ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_QUOTE_STRING_LITERAL )
{
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1787);
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1791);
match(input, Token.DOWN, null);
// ASTVerifier.g:394:15: ( rewriteTemplateArgs )?
@ -3881,7 +3893,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:394:15: rewriteTemplateArgs
{
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1789);
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1793);
rewriteTemplateArgs();
state._fsp--;
@ -3892,7 +3904,7 @@ public class ASTVerifier extends TreeParser {
}
match(input,DOUBLE_QUOTE_STRING_LITERAL,FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1792);
match(input,DOUBLE_QUOTE_STRING_LITERAL,FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1796);
match(input, Token.UP, null);
@ -3901,7 +3913,7 @@ public class ASTVerifier extends TreeParser {
case 2 :
// ASTVerifier.g:395:4: ^( TEMPLATE ( rewriteTemplateArgs )? DOUBLE_ANGLE_STRING_LITERAL )
{
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1799);
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplate1803);
match(input, Token.DOWN, null);
// ASTVerifier.g:395:15: ( rewriteTemplateArgs )?
@ -3915,7 +3927,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:395:15: rewriteTemplateArgs
{
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1801);
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1805);
rewriteTemplateArgs();
state._fsp--;
@ -3926,7 +3938,7 @@ public class ASTVerifier extends TreeParser {
}
match(input,DOUBLE_ANGLE_STRING_LITERAL,FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate1804);
match(input,DOUBLE_ANGLE_STRING_LITERAL,FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate1808);
match(input, Token.UP, null);
@ -3935,7 +3947,7 @@ public class ASTVerifier extends TreeParser {
case 3 :
// ASTVerifier.g:396:4: rewriteTemplateRef
{
pushFollow(FOLLOW_rewriteTemplateRef_in_rewriteTemplate1810);
pushFollow(FOLLOW_rewriteTemplateRef_in_rewriteTemplate1814);
rewriteTemplateRef();
state._fsp--;
@ -3946,7 +3958,7 @@ public class ASTVerifier extends TreeParser {
case 4 :
// ASTVerifier.g:397:4: rewriteIndirectTemplateHead
{
pushFollow(FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1815);
pushFollow(FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1819);
rewriteIndirectTemplateHead();
state._fsp--;
@ -3957,7 +3969,7 @@ public class ASTVerifier extends TreeParser {
case 5 :
// ASTVerifier.g:398:4: ACTION
{
match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplate1820);
match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplate1824);
}
break;
@ -3982,10 +3994,10 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:402:2: ( ^( TEMPLATE ID ( rewriteTemplateArgs )? ) )
// ASTVerifier.g:402:4: ^( TEMPLATE ID ( rewriteTemplateArgs )? )
{
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplateRef1832);
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteTemplateRef1836);
match(input, Token.DOWN, null);
match(input,ID,FOLLOW_ID_in_rewriteTemplateRef1834);
match(input,ID,FOLLOW_ID_in_rewriteTemplateRef1838);
// ASTVerifier.g:402:18: ( rewriteTemplateArgs )?
int alt56=2;
int LA56_0 = input.LA(1);
@ -3997,7 +4009,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:402:18: rewriteTemplateArgs
{
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1836);
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1840);
rewriteTemplateArgs();
state._fsp--;
@ -4032,10 +4044,10 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:406:2: ( ^( TEMPLATE ACTION ( rewriteTemplateArgs )? ) )
// ASTVerifier.g:406:4: ^( TEMPLATE ACTION ( rewriteTemplateArgs )? )
{
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1850);
match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1854);
match(input, Token.DOWN, null);
match(input,ACTION,FOLLOW_ACTION_in_rewriteIndirectTemplateHead1852);
match(input,ACTION,FOLLOW_ACTION_in_rewriteIndirectTemplateHead1856);
// ASTVerifier.g:406:22: ( rewriteTemplateArgs )?
int alt57=2;
int LA57_0 = input.LA(1);
@ -4047,7 +4059,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:406:22: rewriteTemplateArgs
{
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1854);
pushFollow(FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1858);
rewriteTemplateArgs();
state._fsp--;
@ -4082,7 +4094,7 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:410:2: ( ^( ARGLIST ( rewriteTemplateArg )+ ) )
// ASTVerifier.g:410:4: ^( ARGLIST ( rewriteTemplateArg )+ )
{
match(input,ARGLIST,FOLLOW_ARGLIST_in_rewriteTemplateArgs1868);
match(input,ARGLIST,FOLLOW_ARGLIST_in_rewriteTemplateArgs1872);
match(input, Token.DOWN, null);
// ASTVerifier.g:410:14: ( rewriteTemplateArg )+
@ -4101,7 +4113,7 @@ public class ASTVerifier extends TreeParser {
case 1 :
// ASTVerifier.g:410:14: rewriteTemplateArg
{
pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1870);
pushFollow(FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1874);
rewriteTemplateArg();
state._fsp--;
@ -4143,11 +4155,11 @@ public class ASTVerifier extends TreeParser {
// ASTVerifier.g:414:2: ( ^( ARG ID ACTION ) )
// ASTVerifier.g:414:6: ^( ARG ID ACTION )
{
match(input,ARG,FOLLOW_ARG_in_rewriteTemplateArg1886);
match(input,ARG,FOLLOW_ARG_in_rewriteTemplateArg1890);
match(input, Token.DOWN, null);
match(input,ID,FOLLOW_ID_in_rewriteTemplateArg1888);
match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplateArg1890);
match(input,ID,FOLLOW_ID_in_rewriteTemplateArg1892);
match(input,ACTION,FOLLOW_ACTION_in_rewriteTemplateArg1894);
match(input, Token.UP, null);
@ -4668,104 +4680,104 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_ACTION_in_block1179 = new BitSet(new long[]{0x0800000100290000L,0x0000002000100000L});
public static final BitSet FOLLOW_altList_in_block1182 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ROOT_in_ruleref1201 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1203 = new BitSet(new long[]{0x0000000000004008L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref1205 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_BANG_in_ruleref1216 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1218 = new BitSet(new long[]{0x0000000000004008L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref1220 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1231 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref1233 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RANGE_in_range1253 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rangeElement_in_range1255 = new BitSet(new long[]{0xC000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_rangeElement_in_range1257 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1204 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref1206 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_BANG_in_ruleref1218 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1221 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref1223 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1235 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref1237 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RANGE_in_range1257 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rangeElement_in_range1259 = new BitSet(new long[]{0xC000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_rangeElement_in_range1261 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_set_in_rangeElement0 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal1310 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_terminal1312 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal1321 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1330 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_terminal1332 = new BitSet(new long[]{0x0000000000000000L,0x0000000800000000L});
public static final BitSet FOLLOW_elementOptions_in_terminal1334 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1344 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_terminal1346 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1356 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_terminal1358 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1367 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_WILDCARD_in_terminal1376 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_terminal1378 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_WILDCARD_in_terminal1387 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ROOT_in_terminal1396 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_terminal_in_terminal1398 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_BANG_in_terminal1408 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_terminal_in_terminal1410 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOptions1429 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOption_in_elementOptions1431 = new BitSet(new long[]{0x0000200000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption1450 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption1461 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption1463 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption1465 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption1477 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption1479 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption1481 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_predicatedRewrite_in_rewrite1496 = new BitSet(new long[]{0x0000000000000000L,0x0000001000400000L});
public static final BitSet FOLLOW_nakedRewrite_in_rewrite1499 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ST_RESULT_in_predicatedRewrite1511 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1513 = new BitSet(new long[]{0x0100000800010000L,0x0000000000180000L});
public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1515 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RESULT_in_predicatedRewrite1522 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1524 = new BitSet(new long[]{0x0100000800010000L,0x0000000000180000L});
public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1526 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ST_RESULT_in_nakedRewrite1540 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteAlt_in_nakedRewrite1542 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RESULT_in_nakedRewrite1549 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteAlt_in_nakedRewrite1551 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_rewriteTemplate_in_rewriteAlt1567 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteAlt1575 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ETC_in_rewriteAlt1583 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_EPSILON_in_rewriteAlt1591 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ALT_in_rewriteTreeAlt1610 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTreeAlt1612 = new BitSet(new long[]{0xC400000000010008L,0x000000002001C008L});
public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTreeElement1628 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTree_in_rewriteTreeElement1633 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement1640 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1657 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom1659 = new BitSet(new long[]{0x0000000000004000L});
public static final BitSet FOLLOW_ARG_ACTION_in_rewriteTreeAtom1661 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1673 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom1675 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1687 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_rewriteTreeAtom1689 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1697 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_REF_in_rewriteTreeAtom1707 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1715 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom1717 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1725 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_LABEL_in_rewriteTreeAtom1733 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ACTION_in_rewriteTreeAtom1738 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1750 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1753 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1755 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TREE_BEGIN_in_rewriteTree1768 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTree1770 = new BitSet(new long[]{0xC400000000010008L,0x000000002001C008L});
public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTree1772 = new BitSet(new long[]{0xC400000000010008L,0x000000002001C008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate1787 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1789 = new BitSet(new long[]{0x0000000000000400L});
public static final BitSet FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1792 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate1799 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1801 = new BitSet(new long[]{0x0000000000000800L});
public static final BitSet FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate1804 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_rewriteTemplateRef_in_rewriteTemplate1810 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1815 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ACTION_in_rewriteTemplate1820 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplateRef1832 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rewriteTemplateRef1834 = new BitSet(new long[]{0x0000000000000008L,0x0000000002000000L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1836 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1850 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ACTION_in_rewriteIndirectTemplateHead1852 = new BitSet(new long[]{0x0000000000000008L,0x0000000002000000L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1854 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ARGLIST_in_rewriteTemplateArgs1868 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1870 = new BitSet(new long[]{0x0000000000000008L,0x0000000001000000L});
public static final BitSet FOLLOW_ARG_in_rewriteTemplateArg1886 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rewriteTemplateArg1888 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_rewriteTemplateArg1890 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal1314 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_terminal1316 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal1325 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1334 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_terminal1336 = new BitSet(new long[]{0x0000000000000000L,0x0000000800000000L});
public static final BitSet FOLLOW_elementOptions_in_terminal1338 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1348 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_terminal1350 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1360 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_terminal1362 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1371 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_WILDCARD_in_terminal1380 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_terminal1382 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_WILDCARD_in_terminal1391 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ROOT_in_terminal1400 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_terminal_in_terminal1402 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_BANG_in_terminal1412 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_terminal_in_terminal1414 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOptions1433 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOption_in_elementOptions1435 = new BitSet(new long[]{0x0000200000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption1454 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption1465 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption1467 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption1469 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption1481 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption1483 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption1485 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_predicatedRewrite_in_rewrite1500 = new BitSet(new long[]{0x0000000000000000L,0x0000001000400000L});
public static final BitSet FOLLOW_nakedRewrite_in_rewrite1503 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ST_RESULT_in_predicatedRewrite1515 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1517 = new BitSet(new long[]{0x0100000800010000L,0x0000000000180000L});
public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1519 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RESULT_in_predicatedRewrite1526 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1528 = new BitSet(new long[]{0x0100000800010000L,0x0000000000180000L});
public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1530 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ST_RESULT_in_nakedRewrite1544 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteAlt_in_nakedRewrite1546 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RESULT_in_nakedRewrite1553 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteAlt_in_nakedRewrite1555 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_rewriteTemplate_in_rewriteAlt1571 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteAlt1579 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ETC_in_rewriteAlt1587 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_EPSILON_in_rewriteAlt1595 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ALT_in_rewriteTreeAlt1614 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTreeAlt1616 = new BitSet(new long[]{0xC400000000010008L,0x000000002001C008L});
public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTreeElement1632 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTree_in_rewriteTreeElement1637 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement1644 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1661 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom1663 = new BitSet(new long[]{0x0000000000004000L});
public static final BitSet FOLLOW_ARG_ACTION_in_rewriteTreeAtom1665 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1677 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom1679 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1691 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_rewriteTreeAtom1693 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_rewriteTreeAtom1701 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_REF_in_rewriteTreeAtom1711 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1719 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOptions_in_rewriteTreeAtom1721 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_rewriteTreeAtom1729 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_LABEL_in_rewriteTreeAtom1737 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ACTION_in_rewriteTreeAtom1742 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1754 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1757 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1759 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TREE_BEGIN_in_rewriteTree1772 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTree1774 = new BitSet(new long[]{0xC400000000010008L,0x000000002001C008L});
public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTree1776 = new BitSet(new long[]{0xC400000000010008L,0x000000002001C008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate1791 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1793 = new BitSet(new long[]{0x0000000000000400L});
public static final BitSet FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1796 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate1803 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1805 = new BitSet(new long[]{0x0000000000000800L});
public static final BitSet FOLLOW_DOUBLE_ANGLE_STRING_LITERAL_in_rewriteTemplate1808 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_rewriteTemplateRef_in_rewriteTemplate1814 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1819 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ACTION_in_rewriteTemplate1824 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplateRef1836 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rewriteTemplateRef1838 = new BitSet(new long[]{0x0000000000000008L,0x0000000002000000L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1840 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1854 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ACTION_in_rewriteIndirectTemplateHead1856 = new BitSet(new long[]{0x0000000000000008L,0x0000000002000000L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1858 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ARGLIST_in_rewriteTemplateArgs1872 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1874 = new BitSet(new long[]{0x0000000000000008L,0x0000000001000000L});
public static final BitSet FOLLOW_ARG_in_rewriteTemplateArg1890 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rewriteTemplateArg1892 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_rewriteTemplateArg1894 = new BitSet(new long[]{0x0000000000000008L});
}

View File

@ -117,7 +117,7 @@ public class BasicSemanticChecks {
// TODO: track errors?
protected static void checkGrammarName(Grammar g, Token nameToken) {
if ( g.implicitLexer ) return;
if ( g.implicitLexer==null ) return;
String fullyQualifiedName = nameToken.getInputStream().getSourceName();
File f = new File(fullyQualifiedName);
String fileName = f.getName();

View File

@ -1,4 +1,4 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-06 14:39:36
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-06 15:47:26
/*
[The "BSD license"]

View File

@ -24,8 +24,8 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** Triggers for defining rules, tokens, scopes, and actions.
* Side-effects: ...
/** Collects rules, terminals, strings, actions, scopes etc... from AST
* Side-effects: None
*/
tree grammar CollectSymbols;
options {
@ -70,7 +70,9 @@ import org.antlr.v4.tool.*;
@members {
Rule currentRule = null;
public List<Rule> rules = new ArrayList<Rule>();
public List<GrammarAST> rulerefs = new ArrayList<GrammarAST>();
public List<GrammarAST> terminals = new ArrayList<GrammarAST>();
public List<GrammarAST> strings = new ArrayList<GrammarAST>();
public List<GrammarAST> aliases = new ArrayList<GrammarAST>();
public List<GrammarAST> scopes = new ArrayList<GrammarAST>();
public List<GrammarAST> actions = new ArrayList<GrammarAST>();
@ -88,6 +90,7 @@ topdown
| rule
| ruleArg
| ruleReturns
| ruleref
| terminal
;
@ -100,14 +103,16 @@ globalScope
;
action
: {inContext("GRAMMAR")}? ^(AT sc=ID? ID ACTION)
: {inContext("GRAMMAR")}? ^(AT ID? ID ACTION)
{actions.add($AT);}
;
tokenAlias
: {inContext("TOKENS")}?
( ^(ASSIGN t=ID STRING_LITERAL) {terminals.add($t); aliases.add($ASSIGN);}
| t=ID {terminals.add($t);}
( ^(ASSIGN t=ID STRING_LITERAL)
{terminals.add($t); aliases.add($ASSIGN); strings.add($STRING_LITERAL);}
| t=ID
{terminals.add($t);}
)
;
@ -139,14 +144,11 @@ ruleScopeSpec
;
terminal
: {!inContext("TOKENS ASSIGN")}? STRING_LITERAL {terminals.add($start);}
: {!inContext("TOKENS ASSIGN")}? STRING_LITERAL {terminals.add($start);
strings.add($STRING_LITERAL);}
| TOKEN_REF {terminals.add($start);}
;
/*
ruleref
: ^(ROOT RULE_REF ARG_ACTION?)
| ^(BANG RULE_REF ARG_ACTION?)
| ^(RULE_REF ARG_ACTION?)
: ^(RULE_REF ARG_ACTION?) {rulerefs.add($RULE_REF);}
;
*/

View File

@ -1,4 +1,4 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 CollectSymbols.g 2010-02-05 14:20:12
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 CollectSymbols.g 2010-02-06 15:47:26
/*
[The "BSD license"]
@ -37,16 +37,17 @@ import org.antlr.v4.tool.Rule;
import java.util.ArrayList;
import java.util.List;
/** Triggers for defining rules, tokens, scopes, and actions.
* Side-effects: ...
/** Collects rules, terminals, strings, actions, scopes etc... from AST
* Side-effects: None
*/
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"
"<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", "COMBINED", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "WILDCARD", "LIST", "ELEMENT_OPTIONS", "ST_RESULT", "ALT_REWRITE"
};
public static final int COMBINED=91;
public static final int LT=43;
public static final int STAR=48;
public static final int BACKTRACK_SEMPRED=95;
public static final int BACKTRACK_SEMPRED=96;
public static final int DOUBLE_ANGLE_STRING_LITERAL=11;
public static final int FORCED_ACTION=5;
public static final int ARGLIST=89;
@ -57,7 +58,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 ST_RESULT=100;
public static final int RPAREN=41;
public static final int RET=90;
public static final int IMPORT=22;
@ -70,8 +71,8 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 INITACTION=92;
public static final int ALT_REWRITE=101;
public static final int IMPLIES=42;
public static final int RULE=72;
public static final int RBRACE=61;
@ -82,7 +83,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 LIST=98;
public static final int COLONCOLON=37;
public static final int WSNLCHARS=18;
public static final int WS=70;
@ -94,7 +95,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 ELEMENT_OPTIONS=99;
public static final int NESTED_ACTION=15;
public static final int FRAGMENT=23;
public static final int ID=87;
@ -107,7 +108,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 WILDCARD=97;
public static final int DOC_COMMENT=6;
public static final int PLUS=49;
public static final int REWRITE_BLOCK=77;
@ -119,7 +120,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 GATED_SEMPRED=94;
public static final int RESULT=86;
public static final int BANG=47;
public static final int ACTION_STRING_LITERAL=12;
@ -133,8 +134,8 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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 LABEL=93;
public static final int SYN_SEMPRED=95;
public static final int ERRCHAR=71;
public static final int BLOCK=76;
public static final int ASSIGN=45;
@ -162,7 +163,9 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
Rule currentRule = null;
public List<Rule> rules = new ArrayList<Rule>();
public List<GrammarAST> rulerefs = new ArrayList<GrammarAST>();
public List<GrammarAST> terminals = new ArrayList<GrammarAST>();
public List<GrammarAST> strings = new ArrayList<GrammarAST>();
public List<GrammarAST> aliases = new ArrayList<GrammarAST>();
public List<GrammarAST> scopes = new ArrayList<GrammarAST>();
public List<GrammarAST> actions = new ArrayList<GrammarAST>();
@ -175,11 +178,11 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "topdown"
// CollectSymbols.g:84:1: topdown : ( globalScope | action | tokenAlias | rule | ruleArg | ruleReturns | terminal );
// CollectSymbols.g:86:1: topdown : ( globalScope | action | tokenAlias | rule | ruleArg | ruleReturns | ruleref | terminal );
public final void topdown() throws RecognitionException {
try {
// CollectSymbols.g:85:5: ( globalScope | action | tokenAlias | rule | ruleArg | ruleReturns | terminal )
int alt1=7;
// CollectSymbols.g:87:5: ( globalScope | action | tokenAlias | rule | ruleArg | ruleReturns | ruleref | terminal )
int alt1=8;
switch ( input.LA(1) ) {
case SCOPE:
{
@ -212,10 +215,15 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
alt1=6;
}
break;
case RULE_REF:
{
alt1=7;
}
break;
case TOKEN_REF:
case STRING_LITERAL:
{
alt1=7;
alt1=8;
}
break;
default:
@ -228,7 +236,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
switch (alt1) {
case 1 :
// CollectSymbols.g:85:7: globalScope
// CollectSymbols.g:87:7: globalScope
{
pushFollow(FOLLOW_globalScope_in_topdown96);
globalScope();
@ -239,7 +247,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
break;
case 2 :
// CollectSymbols.g:86:7: action
// CollectSymbols.g:88:7: action
{
pushFollow(FOLLOW_action_in_topdown104);
action();
@ -250,7 +258,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
break;
case 3 :
// CollectSymbols.g:87:7: tokenAlias
// CollectSymbols.g:89:7: tokenAlias
{
pushFollow(FOLLOW_tokenAlias_in_topdown112);
tokenAlias();
@ -261,7 +269,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
break;
case 4 :
// CollectSymbols.g:88:7: rule
// CollectSymbols.g:90:7: rule
{
pushFollow(FOLLOW_rule_in_topdown120);
rule();
@ -272,7 +280,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
break;
case 5 :
// CollectSymbols.g:89:7: ruleArg
// CollectSymbols.g:91:7: ruleArg
{
pushFollow(FOLLOW_ruleArg_in_topdown128);
ruleArg();
@ -283,7 +291,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
break;
case 6 :
// CollectSymbols.g:90:7: ruleReturns
// CollectSymbols.g:92:7: ruleReturns
{
pushFollow(FOLLOW_ruleReturns_in_topdown136);
ruleReturns();
@ -294,9 +302,20 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
break;
case 7 :
// CollectSymbols.g:91:7: terminal
// CollectSymbols.g:93:7: ruleref
{
pushFollow(FOLLOW_terminal_in_topdown144);
pushFollow(FOLLOW_ruleref_in_topdown144);
ruleref();
state._fsp--;
if (state.failed) return ;
}
break;
case 8 :
// CollectSymbols.g:94:7: terminal
{
pushFollow(FOLLOW_terminal_in_topdown152);
terminal();
state._fsp--;
@ -319,13 +338,13 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "bottomup"
// CollectSymbols.g:94:1: bottomup : finishRule ;
// CollectSymbols.g:97:1: bottomup : finishRule ;
public final void bottomup() throws RecognitionException {
try {
// CollectSymbols.g:95:2: ( finishRule )
// CollectSymbols.g:95:4: finishRule
// CollectSymbols.g:98:2: ( finishRule )
// CollectSymbols.g:98:4: finishRule
{
pushFollow(FOLLOW_finishRule_in_bottomup155);
pushFollow(FOLLOW_finishRule_in_bottomup163);
finishRule();
state._fsp--;
@ -346,23 +365,23 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "globalScope"
// CollectSymbols.g:98:1: globalScope : {...}? ^( SCOPE ID ACTION ) ;
// CollectSymbols.g:101: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 )
// CollectSymbols.g:102:2: ({...}? ^( SCOPE ID ACTION ) )
// CollectSymbols.g:102: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,SCOPE,FOLLOW_SCOPE_in_globalScope177); 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 ;
ID1=(GrammarAST)match(input,ID,FOLLOW_ID_in_globalScope179); if (state.failed) return ;
match(input,ACTION,FOLLOW_ACTION_in_globalScope181); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
@ -384,23 +403,23 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "action"
// CollectSymbols.g:102:1: action : {...}? ^( AT (sc= ID )? ID ACTION ) ;
// CollectSymbols.g:105: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 )
// CollectSymbols.g:106:2: ({...}? ^( AT (sc= ID )? ID ACTION ) )
// CollectSymbols.g:106: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 ;
AT2=(GrammarAST)match(input,AT,FOLLOW_AT_in_action198); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
// CollectSymbols.g:103:35: (sc= ID )?
// CollectSymbols.g:106:35: (sc= ID )?
int alt2=2;
int LA2_0 = input.LA(1);
@ -413,17 +432,17 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
switch (alt2) {
case 1 :
// CollectSymbols.g:103:35: sc= ID
// CollectSymbols.g:106:35: sc= ID
{
sc=(GrammarAST)match(input,ID,FOLLOW_ID_in_action194); if (state.failed) return ;
sc=(GrammarAST)match(input,ID,FOLLOW_ID_in_action202); 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,ID,FOLLOW_ID_in_action205); if (state.failed) return ;
match(input,ACTION,FOLLOW_ACTION_in_action207); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
@ -445,20 +464,21 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "tokenAlias"
// CollectSymbols.g:107:1: tokenAlias : {...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID ) ;
// CollectSymbols.g:110:1: tokenAlias : {...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID ) ;
public final void tokenAlias() throws RecognitionException {
GrammarAST t=null;
GrammarAST ASSIGN3=null;
GrammarAST STRING_LITERAL4=null;
try {
// CollectSymbols.g:108:2: ({...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID ) )
// CollectSymbols.g:108:4: {...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID )
// CollectSymbols.g:111:2: ({...}? ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID ) )
// CollectSymbols.g:111: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 )
// CollectSymbols.g:112:3: ( ^( ASSIGN t= ID STRING_LITERAL ) | t= ID )
int alt3=2;
int LA3_0 = input.LA(1);
@ -477,25 +497,25 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
switch (alt3) {
case 1 :
// CollectSymbols.g:109:5: ^( ASSIGN t= ID STRING_LITERAL )
// CollectSymbols.g:112:5: ^( ASSIGN t= ID STRING_LITERAL )
{
ASSIGN3=(GrammarAST)match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenAlias222); if (state.failed) return ;
ASSIGN3=(GrammarAST)match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenAlias230); 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 ;
t=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias234); if (state.failed) return ;
STRING_LITERAL4=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenAlias236); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
terminals.add(t); aliases.add(ASSIGN3);
terminals.add(t); aliases.add(ASSIGN3); strings.add(STRING_LITERAL4);
}
}
break;
case 2 :
// CollectSymbols.g:110:5: t= ID
// CollectSymbols.g:114:5: t= ID
{
t=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias239); if (state.failed) return ;
t=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias250); if (state.failed) return ;
if ( state.backtracking==1 ) {
terminals.add(t);
}
@ -521,20 +541,20 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "rule"
// CollectSymbols.g:114:1: rule : ^( RULE name= ID ( . )+ ) ;
// CollectSymbols.g:119:1: rule : ^( RULE name= ID ( . )+ ) ;
public final void rule() throws RecognitionException {
GrammarAST name=null;
GrammarAST RULE4=null;
GrammarAST RULE5=null;
try {
// CollectSymbols.g:114:5: ( ^( RULE name= ID ( . )+ ) )
// CollectSymbols.g:114:9: ^( RULE name= ID ( . )+ )
// CollectSymbols.g:119:5: ( ^( RULE name= ID ( . )+ ) )
// CollectSymbols.g:119:9: ^( RULE name= ID ( . )+ )
{
RULE4=(GrammarAST)match(input,RULE,FOLLOW_RULE_in_rule265); if (state.failed) return ;
RULE5=(GrammarAST)match(input,RULE,FOLLOW_RULE_in_rule272); 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: ( . )+
name=(GrammarAST)match(input,ID,FOLLOW_ID_in_rule276); if (state.failed) return ;
// CollectSymbols.g:119:25: ( . )+
int cnt4=0;
loop4:
do {
@ -551,7 +571,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
switch (alt4) {
case 1 :
// CollectSymbols.g:114:25: .
// CollectSymbols.g:119:25: .
{
matchAny(input); if (state.failed) return ;
@ -572,7 +592,7 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
Rule r = new Rule((name!=null?name.getText():null), (GrammarASTWithOptions)RULE4);
Rule r = new Rule((name!=null?name.getText():null), (GrammarASTWithOptions)RULE5);
rules.add(r);
currentRule = r;
@ -593,13 +613,13 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "finishRule"
// CollectSymbols.g:122:1: finishRule : RULE ;
// CollectSymbols.g:127:1: finishRule : RULE ;
public final void finishRule() throws RecognitionException {
try {
// CollectSymbols.g:123:2: ( RULE )
// CollectSymbols.g:123:4: RULE
// CollectSymbols.g:128:2: ( RULE )
// CollectSymbols.g:128:4: RULE
{
match(input,RULE,FOLLOW_RULE_in_finishRule291); if (state.failed) return ;
match(input,RULE,FOLLOW_RULE_in_finishRule298); if (state.failed) return ;
if ( state.backtracking==1 ) {
currentRule = null;
}
@ -619,21 +639,21 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "ruleArg"
// CollectSymbols.g:126:1: ruleArg : {...}? ARG_ACTION ;
// CollectSymbols.g:131:1: ruleArg : {...}? ARG_ACTION ;
public final void ruleArg() throws RecognitionException {
GrammarAST ARG_ACTION5=null;
GrammarAST ARG_ACTION6=null;
try {
// CollectSymbols.g:127:2: ({...}? ARG_ACTION )
// CollectSymbols.g:127:4: {...}? ARG_ACTION
// CollectSymbols.g:132:2: ({...}? ARG_ACTION )
// CollectSymbols.g:132: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 ;
ARG_ACTION6=(GrammarAST)match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleArg313); if (state.failed) return ;
if ( state.backtracking==1 ) {
currentRule.arg = ARG_ACTION5;
currentRule.arg = ARG_ACTION6;
}
}
@ -651,22 +671,22 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "ruleReturns"
// CollectSymbols.g:130:1: ruleReturns : ^( RETURNS ARG_ACTION ) ;
// CollectSymbols.g:135:1: ruleReturns : ^( RETURNS ARG_ACTION ) ;
public final void ruleReturns() throws RecognitionException {
GrammarAST ARG_ACTION6=null;
GrammarAST ARG_ACTION7=null;
try {
// CollectSymbols.g:131:2: ( ^( RETURNS ARG_ACTION ) )
// CollectSymbols.g:131:4: ^( RETURNS ARG_ACTION )
// CollectSymbols.g:136:2: ( ^( RETURNS ARG_ACTION ) )
// CollectSymbols.g:136:4: ^( RETURNS ARG_ACTION )
{
match(input,RETURNS,FOLLOW_RETURNS_in_ruleReturns321); if (state.failed) return ;
match(input,RETURNS,FOLLOW_RETURNS_in_ruleReturns328); 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 ;
ARG_ACTION7=(GrammarAST)match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleReturns330); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) {
currentRule.ret = ARG_ACTION6;
currentRule.ret = ARG_ACTION7;
}
}
@ -684,17 +704,17 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
// $ANTLR start "ruleScopeSpec"
// CollectSymbols.g:134:1: ruleScopeSpec : {...}? ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) ) ;
// CollectSymbols.g:139: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 )+ ) )
// CollectSymbols.g:140:2: ({...}? ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) ) )
// CollectSymbols.g:140: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 )+ ) )
// CollectSymbols.g:141:3: ( ^( SCOPE ACTION ) | ^( SCOPE ( ID )+ ) )
int alt6=2;
int LA6_0 = input.LA(1);
@ -735,24 +755,24 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
switch (alt6) {
case 1 :
// CollectSymbols.g:136:5: ^( SCOPE ACTION )
// CollectSymbols.g:141:5: ^( SCOPE ACTION )
{
match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec344); if (state.failed) return ;
match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec351); 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,ACTION,FOLLOW_ACTION_in_ruleScopeSpec353); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ;
}
break;
case 2 :
// CollectSymbols.g:137:5: ^( SCOPE ( ID )+ )
// CollectSymbols.g:142:5: ^( SCOPE ( ID )+ )
{
match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec354); if (state.failed) return ;
match(input,SCOPE,FOLLOW_SCOPE_in_ruleScopeSpec361); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ;
// CollectSymbols.g:137:13: ( ID )+
// CollectSymbols.g:142:13: ( ID )+
int cnt5=0;
loop5:
do {
@ -766,9 +786,9 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
switch (alt5) {
case 1 :
// CollectSymbols.g:137:13: ID
// CollectSymbols.g:142:13: ID
{
match(input,ID,FOLLOW_ID_in_ruleScopeSpec356); if (state.failed) return ;
match(input,ID,FOLLOW_ID_in_ruleScopeSpec363); if (state.failed) return ;
}
break;
@ -809,13 +829,15 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
};
// $ANTLR start "terminal"
// CollectSymbols.g:141:1: terminal : ({...}? STRING_LITERAL | TOKEN_REF );
// CollectSymbols.g:146: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);
GrammarAST STRING_LITERAL8=null;
try {
// CollectSymbols.g:142:5: ({...}? STRING_LITERAL | TOKEN_REF )
// CollectSymbols.g:147:5: ({...}? STRING_LITERAL | TOKEN_REF )
int alt7=2;
int LA7_0 = input.LA(1);
@ -834,23 +856,24 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
switch (alt7) {
case 1 :
// CollectSymbols.g:142:7: {...}? STRING_LITERAL
// CollectSymbols.g:147: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;
STRING_LITERAL8=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_terminal385); if (state.failed) return retval;
if ( state.backtracking==1 ) {
terminals.add(((GrammarAST)retval.start));
strings.add(STRING_LITERAL8);
}
}
break;
case 2 :
// CollectSymbols.g:143:7: TOKEN_REF
// CollectSymbols.g:149:7: TOKEN_REF
{
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal388); if (state.failed) return retval;
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_terminal395); if (state.failed) return retval;
if ( state.backtracking==1 ) {
terminals.add(((GrammarAST)retval.start));
}
@ -870,6 +893,58 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
}
// $ANTLR end "terminal"
// $ANTLR start "ruleref"
// CollectSymbols.g:152:1: ruleref : ^( RULE_REF ( ARG_ACTION )? ) ;
public final void ruleref() throws RecognitionException {
GrammarAST RULE_REF9=null;
try {
// CollectSymbols.g:153:5: ( ^( RULE_REF ( ARG_ACTION )? ) )
// CollectSymbols.g:153:7: ^( RULE_REF ( ARG_ACTION )? )
{
RULE_REF9=(GrammarAST)match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref424); if (state.failed) return ;
if ( input.LA(1)==Token.DOWN ) {
match(input, Token.DOWN, null); if (state.failed) return ;
// CollectSymbols.g:153:18: ( ARG_ACTION )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==ARG_ACTION) ) {
alt8=1;
}
switch (alt8) {
case 1 :
// CollectSymbols.g:153:18: ARG_ACTION
{
match(input,ARG_ACTION,FOLLOW_ARG_ACTION_in_ruleref426); if (state.failed) return ;
}
break;
}
match(input, Token.UP, null); if (state.failed) return ;
}
if ( state.backtracking==1 ) {
rulerefs.add(RULE_REF9);
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "ruleref"
// Delegated rules
@ -881,30 +956,33 @@ public class CollectSymbols extends org.antlr.v4.runtime.tree.TreeFilter {
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});
public static final BitSet FOLLOW_ruleref_in_topdown144 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_terminal_in_topdown152 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_finishRule_in_bottomup163 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_SCOPE_in_globalScope177 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_globalScope179 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_globalScope181 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_AT_in_action198 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_action202 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_action205 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_action207 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ASSIGN_in_tokenAlias230 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_tokenAlias234 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_tokenAlias236 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ID_in_tokenAlias250 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_in_rule272 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rule276 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF0L,0x0000003FFFFFFFFFL});
public static final BitSet FOLLOW_RULE_in_finishRule298 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleArg313 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RETURNS_in_ruleReturns328 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleReturns330 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec351 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec353 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec361 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_ruleScopeSpec363 = new BitSet(new long[]{0x0000000000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal385 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal395 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref424 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleref426 = new BitSet(new long[]{0x0000000000000008L});
}

View File

@ -1,6 +1,7 @@
COMBINED=91
LT=43
STAR=48
BACKTRACK_SEMPRED=95
BACKTRACK_SEMPRED=96
DOUBLE_ANGLE_STRING_LITERAL=11
FORCED_ACTION=5
ARGLIST=89
@ -10,7 +11,7 @@ SEMPRED=4
ACTION=16
TOKEN_REF=62
RULEMODIFIERS=74
ST_RESULT=99
ST_RESULT=100
RPAREN=41
RET=90
IMPORT=22
@ -23,8 +24,8 @@ ACTION_CHAR_LITERAL=13
GRAMMAR=27
RULEACTIONS=75
WSCHARS=65
INITACTION=91
ALT_REWRITE=100
INITACTION=92
ALT_REWRITE=101
IMPLIES=42
RULE=72
RBRACE=61
@ -35,7 +36,7 @@ THROWS=32
CHAR_RANGE=82
INT=64
EPSILON=83
LIST=97
LIST=98
COLONCOLON=37
WSNLCHARS=18
WS=70
@ -47,7 +48,7 @@ CLOSURE=79
PARSER=25
DOLLAR=53
PROTECTED=28
ELEMENT_OPTIONS=98
ELEMENT_OPTIONS=99
NESTED_ACTION=15
FRAGMENT=23
ID=87
@ -60,7 +61,7 @@ TREE=26
SCOPE=21
ETC=56
COMMA=38
WILDCARD=96
WILDCARD=97
DOC_COMMENT=6
PLUS=49
REWRITE_BLOCK=77
@ -72,7 +73,7 @@ UNICODE_ESC=69
HEX_DIGIT=68
RANGE=55
TOKENS=20
GATED_SEMPRED=93
GATED_SEMPRED=94
RESULT=86
BANG=47
ACTION_STRING_LITERAL=12
@ -86,8 +87,8 @@ COLON=36
QUESTION=46
FINALLY=34
TEMPLATE=35
LABEL=92
SYN_SEMPRED=94
LABEL=93
SYN_SEMPRED=95
ERRCHAR=71
BLOCK=76
ASSIGN=45

View File

@ -0,0 +1,31 @@
package org.antlr.v4.semantics;
import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.GrammarAST;
import org.antlr.v4.tool.Rule;
/** */
public class DefineSymbols {
Grammar g;
CollectSymbols collector;
public DefineSymbols(Grammar g, CollectSymbols collector) {
this.g = g;
this.collector = collector;
}
public void define() {
for (Rule r : collector.rules) {
if ( g.getRule(r.name)==null ) {
g.defineRule(r);
}
else {
//error
}
}
for (GrammarAST t : collector.actions) {
}
}
}

View File

@ -8,7 +8,7 @@ import org.antlr.v4.tool.ErrorManager;
import org.antlr.v4.tool.Grammar;
/** */
public class SemanticsPipeline {
public class SemanticPipeline {
public void process(Grammar g) {
// VALIDATE AST STRUCTURE
// use buffered node stream as we will look around in stream
@ -38,15 +38,18 @@ public class SemanticsPipeline {
}
}
// CHECK FOR SYMBOL COLLISIONS
// DEFINE SYMBOLS
// COLLECT SYMBOLS: RULES, ACTIONS, TERMINALS, ...
nodes.reset();
CollectSymbols sym = new CollectSymbols(nodes,g);
sym.downup(g.ast);
System.out.println("rules="+sym.rules);
System.out.println("terminals="+sym.terminals);
System.out.println("aliases="+sym.aliases);
System.out.println("aliases="+sym.actions);
CollectSymbols collector = new CollectSymbols(nodes,g);
collector.downup(g.ast); // no side-effects; compute lists
// DEFINE RULES, ACTIONS
// DefineSymbols def = new DefineSymbols(g, collector);
// def.define(); // updates g
// CHECK FOR SYMBOL COLLISIONS
SymbolChecks symcheck = new SymbolChecks(g, collector);
symcheck.examine();
// ASSIGN TOKEN TYPES

View File

@ -0,0 +1,69 @@
package org.antlr.v4.semantics;
import org.antlr.v4.tool.*;
import java.util.*;
public class SymbolChecks {
Grammar g;
CollectSymbols collector;
Map<String, Rule> nameToRuleMap = new HashMap<String, Rule>();
Map<String, Set<String>> scopeToActionNames = new HashMap<String, Set<String>>();
public SymbolChecks(Grammar g, CollectSymbols collector) {
this.g = g;
this.collector = collector;
System.out.println("rules="+collector.rules);
System.out.println("rulerefs="+collector.rulerefs);
System.out.println("terminals="+collector.terminals);
System.out.println("strings="+collector.strings);
System.out.println("aliases="+collector.aliases);
System.out.println("actions="+collector.actions);
}
public void examine() {
checkRuleRedefinitions(collector.rules);
checkActionRedefinitions(collector.actions);
}
public void checkRuleRedefinitions(List<Rule> rules) {
for (Rule r : collector.rules) {
if ( nameToRuleMap.get(r.name)==null ) {
nameToRuleMap.put(r.name, r);
}
else {
GrammarAST idNode = (GrammarAST)r.ast.getChild(0);
ErrorManager.grammarError(ErrorType.RULE_REDEFINITION,
g.fileName, idNode.token, r.name);
}
}
}
public void checkActionRedefinitions(List<GrammarAST> actions) {
String scope = g.getDefaultActionScope();
String name = null;
GrammarAST nameNode = null;
for (GrammarAST ampersandAST : actions) {
nameNode = (GrammarAST)ampersandAST.getChild(0);
if ( ampersandAST.getChildCount()==2 ) {
name = nameNode.getText();
}
else {
scope = nameNode.getText();
name = ampersandAST.getChild(1).getText();
}
Set<String> scopeActions = scopeToActionNames.get(scope);
if ( scopeActions==null ) { // init scope
scopeActions = new HashSet<String>();
scopeToActionNames.put(scope, scopeActions);
}
if ( !scopeActions.contains(name) ) {
scopeActions.add(name);
}
else {
ErrorManager.grammarError(ErrorType.ACTION_REDEFINITION,
g.fileName, nameNode.token, name);
}
}
}
}

View File

@ -1,44 +0,0 @@
package org.antlr.v4.semantics;
import org.antlr.v4.tool.GrammarAST;
import org.antlr.v4.tool.Rule;
import java.util.List;
/** check for the following errors:
*
* RULE_REDEFINITION
RULE_HAS_NO_ARGS
UNDEFINED_RULE_REF
MISSING_RULE_ARGS
SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE
LABEL_CONFLICTS_WITH_RULE
LABEL_CONFLICTS_WITH_TOKEN
LABEL_TYPE_CONFLICT
ACTION_REDEFINITION
NO_SUCH_RULE_IN_SCOPE
TOKEN_ALIAS_CONFLICT
TOKEN_ALIAS_REASSIGNMENT
The
*/
public class SymbolCollisionChecks {
public List<Rule> rules;
public List<GrammarAST> terminals;
public List<GrammarAST> aliases;
public List<GrammarAST> scopes;
public List<GrammarAST> actions;
public void check(List<Rule> rules,
List<GrammarAST> terminals,
List<GrammarAST> aliases,
List<GrammarAST> scopes,
List<GrammarAST> actions)
{
checkRuleRedefinition(rules);
}
public void checkRuleRedefinition(List<Rule> rules) {
}
}

View File

@ -27,12 +27,20 @@ public class Grammar {
public String fileName;
/** Was this created from a COMBINED grammar? */
public boolean implicitLexer;
public Grammar implicitLexer;
public Grammar implicitLexerOwner;
/** If we're imported, who imported us? If null, implies grammar is root */
public Grammar parent;
protected List<Grammar> importedGrammars;
protected Map<String, Rule> rules = new HashMap<String, Rule>();
protected Map<String, Rule> rules = new LinkedHashMap<String, Rule>();
/** Map a scope to a map of name:action pairs.
* The code generator will use this to fill holes in the output files.
* I track the AST node for the action in case I need the line number
* for errors.
*/
Map<String, Map<String,GrammarAST>> actions = new HashMap<String, Map<String,GrammarAST>>();
/** A list of options specified at the grammar level such as language=Java. */
protected Map<String, String> options;
@ -86,10 +94,23 @@ public class Grammar {
}
}
public Rule getRule(String name) {
return null;
public void defineAction(GrammarAST ampersandAST) {
String scope = null;
String name = null;
if ( ampersandAST.getChildCount()==1 ) {
name = ampersandAST.getChild(0).getText();
}
else {
scope = ampersandAST.getChild(0).getText();
name = ampersandAST.getChild(1).getText();
Map<String,GrammarAST> f = actions.get(scope);
}
}
public void defineRule(Rule r) { rules.put(r.name, r); }
public Rule getRule(String name) { return rules.get(name); }
/** Get list of all delegates from all grammars in the delegate subtree of g.
* The grammars are in delegation tree preorder. Don't include ourselves
* in list as we're not a delegate of ourselves.
@ -160,7 +181,7 @@ public class Grammar {
qualifiedName = buf.toString();
}
if ( getType()==ANTLRParser.COMBINED ||
(getType()==ANTLRParser.LEXER && implicitLexer) )
(getType()==ANTLRParser.LEXER && implicitLexer!=null) )
{
suffix = Grammar.getGrammarTypeToFileNameSuffix(getType());
}
@ -176,6 +197,23 @@ public class Grammar {
return null;
}
/** Given a grammar type, what should be the default action scope?
* If I say @members in a COMBINED grammar, for example, the
* default scope should be "parser".
*/
public String getDefaultActionScope() {
switch ( getType() ) {
case ANTLRParser.LEXER :
return "lexer";
case ANTLRParser.PARSER :
case ANTLRParser.COMBINED :
return "parser";
case ANTLRParser.TREE :
return "treeparser";
}
return null;
}
public int getType() {
if ( ast!=null ) return ast.grammarType;
return 0;

View File

@ -1,7 +1,7 @@
package org.antlr.v4.test;
import org.antlr.runtime.RecognitionException;
import org.antlr.v4.semantics.SemanticsPipeline;
import org.antlr.v4.semantics.SemanticPipeline;
import org.antlr.v4.tool.ErrorManager;
import org.antlr.v4.tool.Grammar;
import org.junit.Test;
@ -93,7 +93,7 @@ public class TestBasicSemanticErrors extends BaseTest {
String fileName = lines[0].substring(lastSpace+1, semi)+".g";
Grammar g = new Grammar(fileName, input);
g.loadImportedGrammars();
SemanticsPipeline sem = new SemanticsPipeline();
SemanticPipeline sem = new SemanticPipeline();
sem.process(g);
}
catch (RecognitionException re) {