increased specificity of tree node types. Got options stored into AST properly. Added <...> token options for hetero trees. Using ID to allow more syntax in some cases instead of TOKEN_REF.

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6650]
This commit is contained in:
parrt 2010-02-01 17:41:32 -08:00
parent 004f15bfb1
commit c7b6dff683
24 changed files with 2591 additions and 2423 deletions

View File

@ -97,6 +97,8 @@ LEXER_RULES_NOT_ALLOWED(arg) ::=
"lexer rule <arg> not allowed in parser" "lexer rule <arg> not allowed in parser"
PARSER_RULES_NOT_ALLOWED(arg) ::= PARSER_RULES_NOT_ALLOWED(arg) ::=
"parser rule <arg> not allowed in lexer" "parser rule <arg> not allowed in lexer"
TOKEN_NAMES_MUST_START_UPPER(arg) ::=
"token names must start with an uppercase letter: <arg>"
CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL(arg) ::= CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL(arg) ::=
"cannot find an attribute name in attribute declaration" "cannot find an attribute name in attribute declaration"
NO_TOKEN_DEFINITION(arg) ::= NO_TOKEN_DEFINITION(arg) ::=

View File

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

View File

@ -63,6 +63,7 @@ tokens {
RULEMODIFIERS; RULEMODIFIERS;
RULEACTIONS; RULEACTIONS;
BLOCK; BLOCK;
REWRITE_BLOCK;
OPTIONAL; OPTIONAL;
CLOSURE; CLOSURE;
POSITIVE_CLOSURE; POSITIVE_CLOSURE;
@ -200,18 +201,18 @@ grammarSpec
// //
grammarType grammarType
: ( // A standalone lexer specification : ( // A standalone lexer specification
LEXER -> LEXER_GRAMMAR LEXER GRAMMAR -> LEXER_GRAMMAR<GrammarRootAST>[$LEXER, "LEXER_GRAMMAR"]
| // A standalone parser specification | // A standalone parser specification
PARSER -> PARSER_GRAMMAR PARSER GRAMMAR -> PARSER_GRAMMAR<GrammarRootAST>[$PARSER, "PARSER_GRAMMAR"]
| // A standalone tree parser specification | // A standalone tree parser specification
TREE -> TREE_GRAMMAR TREE GRAMMAR -> TREE_GRAMMAR<GrammarRootAST>[$TREE, "TREE_GRAMMAR"]
| // A combined lexer and parser specification // A combined lexer and parser specification
-> COMBINED_GRAMMAR | g=GRAMMAR -> COMBINED_GRAMMAR<GrammarRootAST>[$g, "COMBINED_GRAMMAR"]
) )
GRAMMAR
; ;
// This is the list of all constructs that can be declared before // This is the list of all constructs that can be declared before
@ -267,7 +268,7 @@ optionValue
| // The value is a long string | // The value is a long string
// //
STRING_LITERAL STRING_LITERAL<TerminalAST>
| // The value was an integer number | // The value was an integer number
// //
@ -302,9 +303,9 @@ tokensSpec
; ;
tokenSpec tokenSpec
: TOKEN_REF : id
( ASSIGN STRING_LITERAL -> ^(ASSIGN TOKEN_REF STRING_LITERAL) ( ASSIGN STRING_LITERAL -> ^(ASSIGN id STRING_LITERAL<TerminalAST>)
| -> TOKEN_REF | -> id
) )
SEMI SEMI
| RULE_REF // INVALID! (an error alt) | RULE_REF // INVALID! (an error alt)
@ -402,7 +403,7 @@ rule
exceptionGroup exceptionGroup
-> ^( RULE id DOC_COMMENT? ruleModifiers? ARG_ACTION? -> ^( RULE<RuleAST> id DOC_COMMENT? ruleModifiers? ARG_ACTION?
ruleReturns? rulePrequel* altListAsBlock exceptionGroup* ruleReturns? rulePrequel* altListAsBlock exceptionGroup*
) )
; ;
@ -519,7 +520,7 @@ altList
// use a separate rule so that the BLOCK node has start and stop // use a separate rule so that the BLOCK node has start and stop
// boundaries set correctly by rule post processing of rewrites. // boundaries set correctly by rule post processing of rewrites.
altListAsBlock altListAsBlock
: altList -> ^(BLOCK altList) : altList -> ^(BLOCK<BlockAST> altList)
; ;
// An individual alt with an optional rewrite clause for the // An individual alt with an optional rewrite clause for the
@ -539,11 +540,11 @@ elements
element element
: labeledElement : labeledElement
( ebnfSuffix -> ^( ebnfSuffix ^(BLOCK["BLOCK"] ^(ALT["ALT"] labeledElement ) )) ( ebnfSuffix -> ^( ebnfSuffix ^(BLOCK<BlockAST> ^(ALT labeledElement ) ))
| -> labeledElement | -> labeledElement
) )
| atom | atom
( ebnfSuffix -> ^( ebnfSuffix ^(BLOCK["BLOCK"] ^(ALT["ALT"] atom ) ) ) ( ebnfSuffix -> ^( ebnfSuffix ^(BLOCK<BlockAST> ^(ALT atom ) ) )
| -> atom | -> atom
) )
| ebnf | ebnf
@ -553,7 +554,7 @@ element
| -> SEMPRED | -> SEMPRED
) )
| treeSpec | treeSpec
( ebnfSuffix -> ^( ebnfSuffix ^(BLOCK["BLOCK"] ^(ALT["ALT"] treeSpec ) ) ) ( ebnfSuffix -> ^( ebnfSuffix ^(BLOCK<BlockAST> ^(ALT treeSpec ) ) )
| -> treeSpec | -> treeSpec
) )
; ;
@ -655,8 +656,8 @@ notSet
// matching anything BUT these) // matching anything BUT these)
// //
notTerminal notTerminal
: TOKEN_REF : TOKEN_REF<TerminalAST>
| STRING_LITERAL | STRING_LITERAL<TerminalAST>
; ;
// ------------- // -------------
@ -695,7 +696,7 @@ block
// Rewrite as a block // Rewrite as a block
// //
-> ^(BLOCK optionsSpec? $ra* ACTION? altList ) -> ^(BLOCK<BlockAST> optionsSpec? $ra* ACTION? altList )
; ;
// ---------------- // ----------------
@ -733,21 +734,21 @@ range
// say 'expecting STRING_LITERAL'. Instead we will check these semantically // say 'expecting STRING_LITERAL'. Instead we will check these semantically
// //
rangeElement rangeElement
: STRING_LITERAL : STRING_LITERAL<TerminalAST>
| RULE_REF // Invalid | RULE_REF // Invalid
| TOKEN_REF // Invalid | TOKEN_REF<TerminalAST> // Invalid
; ;
terminal terminal
: ( // Args are only valid for lexer rules : ( // Args are only valid for lexer rules
TOKEN_REF ARG_ACTION? elementOptions? -> ^(TOKEN_REF ARG_ACTION? elementOptions?) TOKEN_REF ARG_ACTION? elementOptions? -> ^(TOKEN_REF<TerminalAST> ARG_ACTION? elementOptions?)
| STRING_LITERAL elementOptions? -> ^(STRING_LITERAL elementOptions?) | STRING_LITERAL elementOptions? -> ^(STRING_LITERAL<TerminalAST> elementOptions?)
| // Wildcard '.' means any character in a lexer, any | // Wildcard '.' means any character in a lexer, any
// token in parser and any token or node in a tree parser // token in parser and any token or node in a tree parser
// Because the terminal rule is allowed to be the node // Because the terminal rule is allowed to be the node
// specification for the start of a tree rule, we must // specification for the start of a tree rule, we must
// later check that wildcard was not used for that. // later check that wildcard was not used for that.
DOT elementOptions? -> ^(WILDCARD[$DOT] elementOptions?) DOT elementOptions? -> ^(WILDCARD<TerminalAST>[$DOT] elementOptions?)
) )
( ROOT -> ^(ROOT $terminal) ( ROOT -> ^(ROOT $terminal)
| BANG -> ^(BANG $terminal) | BANG -> ^(BANG $terminal)
@ -773,7 +774,7 @@ elementOption
qid qid
| // This format indicates option assignment | // This format indicates option assignment
id ASSIGN^ (qid | STRING_LITERAL) id ASSIGN^ (qid | STRING_LITERAL<TerminalAST>)
; ;
rewrite rewrite
@ -810,25 +811,25 @@ options {backtrack=true;}
; ;
rewriteTreeAlt rewriteTreeAlt
: rewriteTreeElement+ -> ^(ALT["ALT"] rewriteTreeElement+) : rewriteTreeElement+ -> ^(ALT rewriteTreeElement+)
; ;
rewriteTreeElement rewriteTreeElement
: rewriteTreeAtom : rewriteTreeAtom
| rewriteTreeAtom ebnfSuffix | rewriteTreeAtom ebnfSuffix
-> ^( ebnfSuffix ^(BLOCK["BLOCK"] ^(ALT["ALT"] rewriteTreeAtom)) ) -> ^( ebnfSuffix ^(REWRITE_BLOCK ^(ALT rewriteTreeAtom)) )
| rewriteTree | rewriteTree
( ebnfSuffix ( ebnfSuffix
-> ^(ebnfSuffix ^(BLOCK["BLOCK"] ^(ALT["ALT"] rewriteTree)) ) -> ^(ebnfSuffix ^(REWRITE_BLOCK ^(ALT rewriteTree)) )
| -> rewriteTree | -> rewriteTree
) )
| rewriteTreeEbnf | rewriteTreeEbnf
; ;
rewriteTreeAtom rewriteTreeAtom
: TOKEN_REF ARG_ACTION? -> ^(TOKEN_REF ARG_ACTION?) // for imaginary nodes : TOKEN_REF ARG_ACTION? -> ^(TOKEN_REF<TerminalAST> ARG_ACTION?) // for imaginary nodes
| RULE_REF | RULE_REF
| STRING_LITERAL | STRING_LITERAL<TerminalAST>
| DOLLAR id -> LABEL[$DOLLAR,$id.text] // reference to a label in a rewrite rule | DOLLAR id -> LABEL[$DOLLAR,$id.text] // reference to a label in a rewrite rule
| ACTION | ACTION
; ;
@ -841,7 +842,7 @@ rewriteTreeEbnf
$rewriteTreeEbnf.tree.getToken().setLine(firstToken.getLine()); $rewriteTreeEbnf.tree.getToken().setLine(firstToken.getLine());
$rewriteTreeEbnf.tree.getToken().setCharPositionInLine(firstToken.getCharPositionInLine()); $rewriteTreeEbnf.tree.getToken().setCharPositionInLine(firstToken.getCharPositionInLine());
} }
: lp=LPAREN rewriteTreeAlt RPAREN ebnfSuffix -> ^(ebnfSuffix ^(BLOCK[$lp,"BLOCK"] rewriteTreeAlt)) : lp=LPAREN rewriteTreeAlt RPAREN ebnfSuffix -> ^(ebnfSuffix ^(REWRITE_BLOCK[$lp] rewriteTreeAlt))
; ;
rewriteTree rewriteTree

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -153,7 +153,7 @@ tokensSpec
; ;
tokenSpec tokenSpec
: ^(ASSIGN TOKEN_REF STRING_LITERAL) : ^(ASSIGN ID STRING_LITERAL)
| TOKEN_REF | TOKEN_REF
| RULE_REF | RULE_REF
; ;
@ -380,7 +380,7 @@ rewriteTreeAtom
; ;
rewriteTreeEbnf rewriteTreeEbnf
: ^(ebnfSuffix ^(BLOCK rewriteTreeAlt)) : ^(ebnfSuffix ^(REWRITE_BLOCK rewriteTreeAlt))
; ;
rewriteTree rewriteTree
: ^(TREE_BEGIN rewriteTreeAtom rewriteTreeElement* ) : ^(TREE_BEGIN rewriteTreeAtom rewriteTreeElement* )

View File

@ -1,4 +1,4 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-01 14:18:34 // $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 ASTVerifier.g 2010-02-01 17:39:12
/* /*
[The "BSD license"] [The "BSD license"]
@ -40,28 +40,28 @@ import java.util.ArrayList;
*/ */
public class ASTVerifier extends TreeParser { public class ASTVerifier extends TreeParser {
public static final String[] tokenNames = new String[] { 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", "WILDCARD", "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", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "CHAR_RANGE", "EPSILON", "ALT", "ALTLIST", "RESULT", "ID", "ARG", "ARGLIST", "RET", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "DOT", "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", "WILDCARD", "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", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "DOT", "LIST", "ELEMENT_OPTIONS", "ST_RESULT", "ALT_REWRITE"
}; };
public static final int LT=43; public static final int LT=43;
public static final int STAR=48; public static final int STAR=48;
public static final int BACKTRACK_SEMPRED=98; public static final int BACKTRACK_SEMPRED=99;
public static final int DOUBLE_ANGLE_STRING_LITERAL=11; public static final int DOUBLE_ANGLE_STRING_LITERAL=11;
public static final int FORCED_ACTION=5; public static final int FORCED_ACTION=5;
public static final int LEXER_GRAMMAR=90; public static final int LEXER_GRAMMAR=91;
public static final int ARGLIST=88; public static final int ARGLIST=89;
public static final int ALTLIST=84; public static final int ALTLIST=85;
public static final int NOT=60; public static final int NOT=60;
public static final int EOF=-1; public static final int EOF=-1;
public static final int SEMPRED=4; public static final int SEMPRED=4;
public static final int ACTION=16; public static final int ACTION=16;
public static final int TOKEN_REF=62; public static final int TOKEN_REF=62;
public static final int RULEMODIFIERS=74; public static final int RULEMODIFIERS=74;
public static final int ST_RESULT=102; public static final int ST_RESULT=103;
public static final int RPAREN=41; public static final int RPAREN=41;
public static final int RET=89; public static final int RET=90;
public static final int IMPORT=22; public static final int IMPORT=22;
public static final int STRING_LITERAL=67; public static final int STRING_LITERAL=67;
public static final int ARG=87; public static final int ARG=88;
public static final int ARG_ACTION=14; public static final int ARG_ACTION=14;
public static final int DOUBLE_QUOTE_STRING_LITERAL=10; public static final int DOUBLE_QUOTE_STRING_LITERAL=10;
public static final int COMMENT=9; public static final int COMMENT=9;
@ -69,42 +69,42 @@ public class ASTVerifier extends TreeParser {
public static final int GRAMMAR=27; public static final int GRAMMAR=27;
public static final int RULEACTIONS=75; public static final int RULEACTIONS=75;
public static final int WSCHARS=65; public static final int WSCHARS=65;
public static final int INITACTION=94; public static final int INITACTION=95;
public static final int ALT_REWRITE=103; public static final int ALT_REWRITE=104;
public static final int IMPLIES=42; public static final int IMPLIES=42;
public static final int RULE=72; public static final int RULE=72;
public static final int RBRACE=61; public static final int RBRACE=61;
public static final int ACTION_ESC=17; public static final int ACTION_ESC=17;
public static final int PARSER_GRAMMAR=91; public static final int PARSER_GRAMMAR=92;
public static final int PRIVATE=30; public static final int PRIVATE=30;
public static final int SRC=7; public static final int SRC=7;
public static final int THROWS=32; public static final int THROWS=32;
public static final int CHAR_RANGE=81; public static final int CHAR_RANGE=82;
public static final int INT=64; public static final int INT=64;
public static final int EPSILON=82; public static final int EPSILON=83;
public static final int LIST=100; public static final int LIST=101;
public static final int COLONCOLON=37; public static final int COLONCOLON=37;
public static final int WSNLCHARS=18; public static final int WSNLCHARS=18;
public static final int WS=70; public static final int WS=70;
public static final int COMBINED_GRAMMAR=93; public static final int COMBINED_GRAMMAR=94;
public static final int LEXER=24; public static final int LEXER=24;
public static final int OR=51; public static final int OR=51;
public static final int GT=44; public static final int GT=44;
public static final int TREE_GRAMMAR=92; public static final int TREE_GRAMMAR=93;
public static final int CATCH=33; public static final int CATCH=33;
public static final int CLOSURE=78; public static final int CLOSURE=79;
public static final int PARSER=25; public static final int PARSER=25;
public static final int DOLLAR=53; public static final int DOLLAR=53;
public static final int PROTECTED=28; public static final int PROTECTED=28;
public static final int ELEMENT_OPTIONS=101; public static final int ELEMENT_OPTIONS=102;
public static final int NESTED_ACTION=15; public static final int NESTED_ACTION=15;
public static final int FRAGMENT=23; public static final int FRAGMENT=23;
public static final int ID=86; public static final int ID=87;
public static final int TREE_BEGIN=58; public static final int TREE_BEGIN=58;
public static final int LPAREN=40; public static final int LPAREN=40;
public static final int AT=59; public static final int AT=59;
public static final int ESC_SEQ=66; public static final int ESC_SEQ=66;
public static final int ALT=83; public static final int ALT=84;
public static final int TREE=26; public static final int TREE=26;
public static final int SCOPE=21; public static final int SCOPE=21;
public static final int ETC=56; public static final int ETC=56;
@ -112,7 +112,8 @@ public class ASTVerifier extends TreeParser {
public static final int WILDCARD=54; public static final int WILDCARD=54;
public static final int DOC_COMMENT=6; public static final int DOC_COMMENT=6;
public static final int PLUS=49; public static final int PLUS=49;
public static final int DOT=99; public static final int REWRITE_BLOCK=77;
public static final int DOT=100;
public static final int RETURNS=31; public static final int RETURNS=31;
public static final int RULES=73; public static final int RULES=73;
public static final int RARROW=57; public static final int RARROW=57;
@ -120,28 +121,28 @@ public class ASTVerifier extends TreeParser {
public static final int HEX_DIGIT=68; public static final int HEX_DIGIT=68;
public static final int RANGE=55; public static final int RANGE=55;
public static final int TOKENS=20; public static final int TOKENS=20;
public static final int GATED_SEMPRED=96; public static final int GATED_SEMPRED=97;
public static final int RESULT=85; public static final int RESULT=86;
public static final int BANG=47; public static final int BANG=47;
public static final int ACTION_STRING_LITERAL=12; public static final int ACTION_STRING_LITERAL=12;
public static final int ROOT=52; public static final int ROOT=52;
public static final int SEMI=39; public static final int SEMI=39;
public static final int RULE_REF=63; public static final int RULE_REF=63;
public static final int NLCHARS=8; public static final int NLCHARS=8;
public static final int OPTIONAL=77; public static final int OPTIONAL=78;
public static final int SYNPRED=80; public static final int SYNPRED=81;
public static final int COLON=36; public static final int COLON=36;
public static final int QUESTION=46; public static final int QUESTION=46;
public static final int FINALLY=34; public static final int FINALLY=34;
public static final int TEMPLATE=35; public static final int TEMPLATE=35;
public static final int LABEL=95; public static final int LABEL=96;
public static final int SYN_SEMPRED=97; public static final int SYN_SEMPRED=98;
public static final int ERRCHAR=71; public static final int ERRCHAR=71;
public static final int BLOCK=76; public static final int BLOCK=76;
public static final int ASSIGN=45; public static final int ASSIGN=45;
public static final int PLUS_ASSIGN=50; public static final int PLUS_ASSIGN=50;
public static final int PUBLIC=29; public static final int PUBLIC=29;
public static final int POSITIVE_CLOSURE=79; public static final int POSITIVE_CLOSURE=80;
public static final int OPTIONS=19; public static final int OPTIONS=19;
// delegates // delegates
@ -736,10 +737,10 @@ public class ASTVerifier extends TreeParser {
// $ANTLR start "tokenSpec" // $ANTLR start "tokenSpec"
// ASTVerifier.g:155:1: tokenSpec : ( ^( ASSIGN TOKEN_REF STRING_LITERAL ) | TOKEN_REF | RULE_REF ); // ASTVerifier.g:155:1: tokenSpec : ( ^( ASSIGN ID STRING_LITERAL ) | TOKEN_REF | RULE_REF );
public final void tokenSpec() throws RecognitionException { public final void tokenSpec() throws RecognitionException {
try { try {
// ASTVerifier.g:156:2: ( ^( ASSIGN TOKEN_REF STRING_LITERAL ) | TOKEN_REF | RULE_REF ) // ASTVerifier.g:156:2: ( ^( ASSIGN ID STRING_LITERAL ) | TOKEN_REF | RULE_REF )
int alt8=3; int alt8=3;
switch ( input.LA(1) ) { switch ( input.LA(1) ) {
case ASSIGN: case ASSIGN:
@ -766,12 +767,12 @@ public class ASTVerifier extends TreeParser {
switch (alt8) { switch (alt8) {
case 1 : case 1 :
// ASTVerifier.g:156:4: ^( ASSIGN TOKEN_REF STRING_LITERAL ) // ASTVerifier.g:156:4: ^( ASSIGN ID STRING_LITERAL )
{ {
match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenSpec368); match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenSpec368);
match(input, Token.DOWN, null); match(input, Token.DOWN, null);
match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenSpec370); match(input,ID,FOLLOW_ID_in_tokenSpec370);
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenSpec372); match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenSpec372);
match(input, Token.UP, null); match(input, Token.UP, null);
@ -1736,7 +1737,7 @@ public class ASTVerifier extends TreeParser {
if ( (LA24_3==EPSILON) ) { if ( (LA24_3==EPSILON) ) {
alt24=2; alt24=2;
} }
else if ( (LA24_3==SEMPRED||LA24_3==ACTION||LA24_3==IMPLIES||LA24_3==ASSIGN||LA24_3==BANG||LA24_3==PLUS_ASSIGN||LA24_3==ROOT||(LA24_3>=WILDCARD && LA24_3<=RANGE)||LA24_3==TREE_BEGIN||(LA24_3>=TOKEN_REF && LA24_3<=RULE_REF)||LA24_3==STRING_LITERAL||(LA24_3>=BLOCK && LA24_3<=POSITIVE_CLOSURE)||LA24_3==GATED_SEMPRED||LA24_3==DOT) ) { else if ( (LA24_3==SEMPRED||LA24_3==ACTION||LA24_3==IMPLIES||LA24_3==ASSIGN||LA24_3==BANG||LA24_3==PLUS_ASSIGN||LA24_3==ROOT||(LA24_3>=WILDCARD && LA24_3<=RANGE)||LA24_3==TREE_BEGIN||(LA24_3>=TOKEN_REF && LA24_3<=RULE_REF)||LA24_3==STRING_LITERAL||LA24_3==BLOCK||(LA24_3>=OPTIONAL && LA24_3<=POSITIVE_CLOSURE)||LA24_3==GATED_SEMPRED||LA24_3==DOT) ) {
alt24=3; alt24=3;
} }
else { else {
@ -1835,7 +1836,7 @@ public class ASTVerifier extends TreeParser {
int alt25=2; int alt25=2;
int LA25_0 = input.LA(1); int LA25_0 = input.LA(1);
if ( (LA25_0==SEMPRED||LA25_0==ACTION||LA25_0==IMPLIES||LA25_0==ASSIGN||LA25_0==BANG||LA25_0==PLUS_ASSIGN||LA25_0==ROOT||(LA25_0>=WILDCARD && LA25_0<=RANGE)||LA25_0==TREE_BEGIN||(LA25_0>=TOKEN_REF && LA25_0<=RULE_REF)||LA25_0==STRING_LITERAL||(LA25_0>=BLOCK && LA25_0<=POSITIVE_CLOSURE)||LA25_0==GATED_SEMPRED||LA25_0==DOT) ) { if ( (LA25_0==SEMPRED||LA25_0==ACTION||LA25_0==IMPLIES||LA25_0==ASSIGN||LA25_0==BANG||LA25_0==PLUS_ASSIGN||LA25_0==ROOT||(LA25_0>=WILDCARD && LA25_0<=RANGE)||LA25_0==TREE_BEGIN||(LA25_0>=TOKEN_REF && LA25_0<=RULE_REF)||LA25_0==STRING_LITERAL||LA25_0==BLOCK||(LA25_0>=OPTIONAL && LA25_0<=POSITIVE_CLOSURE)||LA25_0==GATED_SEMPRED||LA25_0==DOT) ) {
alt25=1; alt25=1;
} }
@ -2126,7 +2127,7 @@ public class ASTVerifier extends TreeParser {
int alt30=2; int alt30=2;
int LA30_0 = input.LA(1); int LA30_0 = input.LA(1);
if ( (LA30_0==SEMPRED||LA30_0==ACTION||LA30_0==IMPLIES||LA30_0==ASSIGN||LA30_0==BANG||LA30_0==PLUS_ASSIGN||LA30_0==ROOT||(LA30_0>=WILDCARD && LA30_0<=RANGE)||LA30_0==TREE_BEGIN||(LA30_0>=TOKEN_REF && LA30_0<=RULE_REF)||LA30_0==STRING_LITERAL||(LA30_0>=BLOCK && LA30_0<=POSITIVE_CLOSURE)||LA30_0==GATED_SEMPRED||LA30_0==DOT) ) { if ( (LA30_0==SEMPRED||LA30_0==ACTION||LA30_0==IMPLIES||LA30_0==ASSIGN||LA30_0==BANG||LA30_0==PLUS_ASSIGN||LA30_0==ROOT||(LA30_0>=WILDCARD && LA30_0<=RANGE)||LA30_0==TREE_BEGIN||(LA30_0>=TOKEN_REF && LA30_0<=RULE_REF)||LA30_0==STRING_LITERAL||LA30_0==BLOCK||(LA30_0>=OPTIONAL && LA30_0<=POSITIVE_CLOSURE)||LA30_0==GATED_SEMPRED||LA30_0==DOT) ) {
alt30=1; alt30=1;
} }
@ -3803,11 +3804,11 @@ public class ASTVerifier extends TreeParser {
// $ANTLR start "rewriteTreeEbnf" // $ANTLR start "rewriteTreeEbnf"
// ASTVerifier.g:382:1: rewriteTreeEbnf : ^( ebnfSuffix ^( BLOCK rewriteTreeAlt ) ) ; // ASTVerifier.g:382:1: rewriteTreeEbnf : ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) ;
public final void rewriteTreeEbnf() throws RecognitionException { public final void rewriteTreeEbnf() throws RecognitionException {
try { try {
// ASTVerifier.g:383:2: ( ^( ebnfSuffix ^( BLOCK rewriteTreeAlt ) ) ) // ASTVerifier.g:383:2: ( ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) ) )
// ASTVerifier.g:383:4: ^( ebnfSuffix ^( BLOCK rewriteTreeAlt ) ) // ASTVerifier.g:383:4: ^( ebnfSuffix ^( REWRITE_BLOCK rewriteTreeAlt ) )
{ {
pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1744); pushFollow(FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1744);
ebnfSuffix(); ebnfSuffix();
@ -3816,7 +3817,7 @@ public class ASTVerifier extends TreeParser {
match(input, Token.DOWN, null); match(input, Token.DOWN, null);
match(input,BLOCK,FOLLOW_BLOCK_in_rewriteTreeEbnf1747); match(input,REWRITE_BLOCK,FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1747);
match(input, Token.DOWN, null); match(input, Token.DOWN, null);
pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1749); pushFollow(FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1749);
@ -4226,7 +4227,7 @@ public class ASTVerifier extends TreeParser {
static final String DFA26_minS = static final String DFA26_minS =
"\1\4\1\uffff\2\2\6\uffff\2\57"; "\1\4\1\uffff\2\2\6\uffff\2\57";
static final String DFA26_maxS = static final String DFA26_maxS =
"\1\143\1\uffff\2\2\6\uffff\2\114"; "\1\144\1\uffff\2\2\6\uffff\2\114";
static final String DFA26_acceptS = static final String DFA26_acceptS =
"\1\uffff\1\1\2\uffff\1\2\1\3\1\4\1\5\1\6\1\7\2\uffff"; "\1\uffff\1\1\2\uffff\1\2\1\3\1\4\1\5\1\6\1\7\2\uffff";
static final String DFA26_specialS = static final String DFA26_specialS =
@ -4234,7 +4235,7 @@ public class ASTVerifier extends TreeParser {
static final String[] DFA26_transitionS = { static final String[] DFA26_transitionS = {
"\1\7\13\uffff\1\6\31\uffff\1\5\2\uffff\1\1\1\uffff\1\3\2\uffff"+ "\1\7\13\uffff\1\6\31\uffff\1\5\2\uffff\1\1\1\uffff\1\3\2\uffff"+
"\1\1\1\uffff\1\2\1\uffff\2\4\2\uffff\1\11\3\uffff\2\4\3\uffff"+ "\1\1\1\uffff\1\2\1\uffff\2\4\2\uffff\1\11\3\uffff\2\4\3\uffff"+
"\1\4\10\uffff\4\5\20\uffff\1\10\2\uffff\1\4", "\1\4\10\uffff\1\5\1\uffff\3\5\20\uffff\1\10\2\uffff\1\4",
"", "",
"\1\12", "\1\12",
"\1\13", "\1\13",
@ -4288,10 +4289,10 @@ public class ASTVerifier extends TreeParser {
static final String DFA33_eofS = static final String DFA33_eofS =
"\25\uffff"; "\25\uffff";
static final String DFA33_minS = static final String DFA33_minS =
"\1\57\2\2\1\uffff\1\2\2\uffff\2\57\1\126\4\uffff\1\57\2\2\2\uffff"+ "\1\57\2\2\1\uffff\1\2\2\uffff\2\57\1\127\4\uffff\1\57\2\2\2\uffff"+
"\2\57"; "\2\57";
static final String DFA33_maxS = static final String DFA33_maxS =
"\1\143\2\2\1\uffff\1\2\2\uffff\2\103\1\126\4\uffff\1\103\2\2\2\uffff"+ "\1\144\2\2\1\uffff\1\2\2\uffff\2\103\1\127\4\uffff\1\103\2\2\2\uffff"+
"\2\103"; "\2\103";
static final String DFA33_acceptS = static final String DFA33_acceptS =
"\3\uffff\1\5\1\uffff\1\10\1\11\3\uffff\1\3\1\1\1\2\1\4\3\uffff\1"+ "\3\uffff\1\5\1\uffff\1\10\1\11\3\uffff\1\3\1\1\1\2\1\4\3\uffff\1"+
@ -4300,7 +4301,7 @@ public class ASTVerifier extends TreeParser {
"\25\uffff}>"; "\25\uffff}>";
static final String[] DFA33_transitionS = { static final String[] DFA33_transitionS = {
"\1\2\4\uffff\1\1\1\uffff\1\5\1\3\6\uffff\1\5\1\6\3\uffff\1\5"+ "\1\2\4\uffff\1\1\1\uffff\1\5\1\3\6\uffff\1\5\1\6\3\uffff\1\5"+
"\37\uffff\1\4", "\40\uffff\1\4",
"\1\7", "\1\7",
"\1\10", "\1\10",
"", "",
@ -4368,7 +4369,7 @@ public class ASTVerifier extends TreeParser {
static final String DFA42_minS = static final String DFA42_minS =
"\1\57\3\2\4\uffff\1\16\3\uffff\1\3\3\uffff"; "\1\57\3\2\4\uffff\1\16\3\uffff\1\3\3\uffff";
static final String DFA42_maxS = static final String DFA42_maxS =
"\1\103\3\143\4\uffff\1\145\3\uffff\1\145\3\uffff"; "\1\103\3\144\4\uffff\1\146\3\uffff\1\146\3\uffff";
static final String DFA42_acceptS = static final String DFA42_acceptS =
"\4\uffff\1\11\1\12\1\1\1\2\1\uffff\1\6\1\7\1\10\1\uffff\1\5\1\4"+ "\4\uffff\1\11\1\12\1\1\1\2\1\uffff\1\6\1\7\1\10\1\uffff\1\5\1\4"+
"\1\3"; "\1\3";
@ -4378,24 +4379,25 @@ public class ASTVerifier extends TreeParser {
"\1\5\4\uffff\1\4\1\uffff\1\3\7\uffff\1\2\4\uffff\1\1", "\1\5\4\uffff\1\4\1\uffff\1\3\7\uffff\1\2\4\uffff\1\1",
"\1\6\2\7\13\uffff\1\7\31\uffff\1\7\2\uffff\1\7\1\uffff\1\7"+ "\1\6\2\7\13\uffff\1\7\31\uffff\1\7\2\uffff\1\7\1\uffff\1\7"+
"\2\uffff\1\7\1\uffff\1\7\1\uffff\2\7\2\uffff\1\7\3\uffff\2\7"+ "\2\uffff\1\7\1\uffff\1\7\1\uffff\2\7\2\uffff\1\7\3\uffff\2\7"+
"\3\uffff\1\7\10\uffff\4\7\20\uffff\1\7\2\uffff\1\7", "\3\uffff\1\7\10\uffff\1\7\1\uffff\3\7\20\uffff\1\7\2\uffff\1"+
"\7",
"\1\10\2\11\13\uffff\1\11\31\uffff\1\11\2\uffff\1\11\1\uffff"+ "\1\10\2\11\13\uffff\1\11\31\uffff\1\11\2\uffff\1\11\1\uffff"+
"\1\11\2\uffff\1\11\1\uffff\1\11\1\uffff\2\11\2\uffff\1\11\3"+ "\1\11\2\uffff\1\11\1\uffff\1\11\1\uffff\2\11\2\uffff\1\11\3"+
"\uffff\2\11\3\uffff\1\11\10\uffff\4\11\20\uffff\1\11\2\uffff"+ "\uffff\2\11\3\uffff\1\11\10\uffff\1\11\1\uffff\3\11\20\uffff"+
"\1\11", "\1\11\2\uffff\1\11",
"\1\12\2\13\13\uffff\1\13\31\uffff\1\13\2\uffff\1\13\1\uffff"+ "\1\12\2\13\13\uffff\1\13\31\uffff\1\13\2\uffff\1\13\1\uffff"+
"\1\13\2\uffff\1\13\1\uffff\1\13\1\uffff\2\13\2\uffff\1\13\3"+ "\1\13\2\uffff\1\13\1\uffff\1\13\1\uffff\2\13\2\uffff\1\13\3"+
"\uffff\2\13\3\uffff\1\13\10\uffff\4\13\20\uffff\1\13\2\uffff"+ "\uffff\2\13\3\uffff\1\13\10\uffff\1\13\1\uffff\3\13\20\uffff"+
"\1\13", "\1\13\2\uffff\1\13",
"", "",
"", "",
"", "",
"", "",
"\1\14\126\uffff\1\15", "\1\14\127\uffff\1\15",
"", "",
"", "",
"", "",
"\1\16\141\uffff\1\17", "\1\16\142\uffff\1\17",
"", "",
"", "",
"" ""
@ -4439,11 +4441,11 @@ public class ASTVerifier extends TreeParser {
static final String DFA55_eofS = static final String DFA55_eofS =
"\20\uffff"; "\20\uffff";
static final String DFA55_minS = static final String DFA55_minS =
"\1\20\1\2\1\uffff\1\12\2\uffff\1\2\2\uffff\1\127\1\2\1\126\1\20"+ "\1\20\1\2\1\uffff\1\12\2\uffff\1\2\2\uffff\1\130\1\2\1\127\1\20"+
"\2\3\1\12"; "\2\3\1\12";
static final String DFA55_maxS = static final String DFA55_maxS =
"\1\43\1\2\1\uffff\1\130\2\uffff\1\2\2\uffff\1\127\1\2\1\126\1\20"+ "\1\43\1\2\1\uffff\1\131\2\uffff\1\2\2\uffff\1\130\1\2\1\127\1\20"+
"\1\3\1\127\1\13"; "\1\3\1\130\1\13";
static final String DFA55_acceptS = static final String DFA55_acceptS =
"\2\uffff\1\5\1\uffff\1\3\1\4\1\uffff\1\2\1\1\7\uffff"; "\2\uffff\1\5\1\uffff\1\3\1\4\1\uffff\1\2\1\1\7\uffff";
static final String DFA55_specialS = static final String DFA55_specialS =
@ -4452,7 +4454,7 @@ public class ASTVerifier extends TreeParser {
"\1\2\22\uffff\1\1", "\1\2\22\uffff\1\1",
"\1\3", "\1\3",
"", "",
"\1\10\1\7\4\uffff\1\5\105\uffff\1\4\1\uffff\1\6", "\1\10\1\7\4\uffff\1\5\106\uffff\1\4\1\uffff\1\6",
"", "",
"", "",
"\1\11", "\1\11",
@ -4463,7 +4465,7 @@ public class ASTVerifier extends TreeParser {
"\1\14", "\1\14",
"\1\15", "\1\15",
"\1\16", "\1\16",
"\1\17\123\uffff\1\12", "\1\17\124\uffff\1\12",
"\1\10\1\7" "\1\10\1\7"
}; };
@ -4516,19 +4518,19 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_OPTIONS_in_optionsSpec186 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_OPTIONS_in_optionsSpec186 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_option_in_optionsSpec188 = new BitSet(new long[]{0x0000200000000008L}); public static final BitSet FOLLOW_option_in_optionsSpec188 = new BitSet(new long[]{0x0000200000000008L});
public static final BitSet FOLLOW_ASSIGN_in_option210 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_option210 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_option212 = new BitSet(new long[]{0x0001000000000000L,0x0000000000400009L}); public static final BitSet FOLLOW_ID_in_option212 = new BitSet(new long[]{0x0001000000000000L,0x0000000000800009L});
public static final BitSet FOLLOW_optionValue_in_option214 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_optionValue_in_option214 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_set_in_optionValue0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_optionValue0 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_IMPORT_in_delegateGrammars299 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_IMPORT_in_delegateGrammars299 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_delegateGrammar_in_delegateGrammars301 = new BitSet(new long[]{0x0000200000000008L,0x0000000000400000L}); public static final BitSet FOLLOW_delegateGrammar_in_delegateGrammars301 = new BitSet(new long[]{0x0000200000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_ASSIGN_in_delegateGrammar320 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_delegateGrammar320 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_delegateGrammar322 = new BitSet(new long[]{0x0000000000000000L,0x0000000000400000L}); public static final BitSet FOLLOW_ID_in_delegateGrammar322 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_delegateGrammar324 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ID_in_delegateGrammar324 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ID_in_delegateGrammar335 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_delegateGrammar335 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKENS_in_tokensSpec352 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TOKENS_in_tokensSpec352 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_tokenSpec_in_tokensSpec354 = new BitSet(new long[]{0xC000200000000008L}); public static final BitSet FOLLOW_tokenSpec_in_tokensSpec354 = new BitSet(new long[]{0xC000200000000008L});
public static final BitSet FOLLOW_ASSIGN_in_tokenSpec368 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_tokenSpec368 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec370 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_ID_in_tokenSpec370 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_tokenSpec372 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_STRING_LITERAL_in_tokenSpec372 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec380 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_TOKEN_REF_in_tokenSpec380 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_REF_in_tokenSpec385 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_RULE_REF_in_tokenSpec385 = new BitSet(new long[]{0x0000000000000002L});
@ -4536,7 +4538,7 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_ID_in_attrScope399 = new BitSet(new long[]{0x0000000000010000L}); public static final BitSet FOLLOW_ID_in_attrScope399 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_attrScope401 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ACTION_in_attrScope401 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_AT_in_action414 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_AT_in_action414 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_action416 = new BitSet(new long[]{0x0000000000000000L,0x0000000000400000L}); public static final BitSet FOLLOW_ID_in_action416 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_action419 = new BitSet(new long[]{0x0000000000010000L}); public static final BitSet FOLLOW_ID_in_action419 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_action421 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ACTION_in_action421 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RULES_in_rules437 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_RULES_in_rules437 = new BitSet(new long[]{0x0000000000000004L});
@ -4564,28 +4566,28 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_RETURNS_in_ruleReturns615 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_RETURNS_in_ruleReturns615 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_ruleReturns617 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ARG_ACTION_in_ruleReturns617 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_THROWS_in_throwsSpec632 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_THROWS_in_throwsSpec632 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_throwsSpec634 = new BitSet(new long[]{0x0000000000000008L,0x0000000000400000L}); public static final BitSet FOLLOW_ID_in_throwsSpec634 = new BitSet(new long[]{0x0000000000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec651 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec651 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec653 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ACTION_in_ruleScopeSpec653 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec660 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_SCOPE_in_ruleScopeSpec660 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_ruleScopeSpec662 = new BitSet(new long[]{0x0000000000000008L,0x0000000000400000L}); public static final BitSet FOLLOW_ID_in_ruleScopeSpec662 = new BitSet(new long[]{0x0000000000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_AT_in_ruleAction676 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_AT_in_ruleAction676 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_ruleAction678 = new BitSet(new long[]{0x0000000000010000L}); public static final BitSet FOLLOW_ID_in_ruleAction678 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_ruleAction680 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ACTION_in_ruleAction680 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RULEMODIFIERS_in_ruleModifiers696 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_RULEMODIFIERS_in_ruleModifiers696 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ruleModifier_in_ruleModifiers698 = new BitSet(new long[]{0x0000000070800008L}); public static final BitSet FOLLOW_ruleModifier_in_ruleModifiers698 = new BitSet(new long[]{0x0000000070800008L});
public static final BitSet FOLLOW_set_in_ruleModifier0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_ruleModifier0 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_alternative_in_altList758 = new BitSet(new long[]{0x0000000000000002L,0x0000008000080000L}); public static final BitSet FOLLOW_alternative_in_altList758 = new BitSet(new long[]{0x0000000000000002L,0x0000010000100000L});
public static final BitSet FOLLOW_BLOCK_in_altListAsBlock777 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_BLOCK_in_altListAsBlock777 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_altList_in_altListAsBlock779 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_altList_in_altListAsBlock779 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ALT_REWRITE_in_alternative798 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ALT_REWRITE_in_alternative798 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_alternative_in_alternative800 = new BitSet(new long[]{0x0000000000000000L,0x0000004000200000L}); public static final BitSet FOLLOW_alternative_in_alternative800 = new BitSet(new long[]{0x0000000000000000L,0x0000008000400000L});
public static final BitSet FOLLOW_rewrite_in_alternative802 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewrite_in_alternative802 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ALT_in_alternative812 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ALT_in_alternative812 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_EPSILON_in_alternative814 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_EPSILON_in_alternative814 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_elements_in_alternative825 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_elements_in_alternative825 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ALT_in_elements843 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ALT_in_elements843 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_element_in_elements845 = new BitSet(new long[]{0xC4D4A40000010018L,0x000000090000F008L}); public static final BitSet FOLLOW_element_in_elements845 = new BitSet(new long[]{0xC4D4A40000010018L,0x000000120001D008L});
public static final BitSet FOLLOW_labeledElement_in_element861 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_labeledElement_in_element861 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_atom_in_element866 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_atom_in_element866 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ebnf_in_element871 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ebnf_in_element871 = new BitSet(new long[]{0x0000000000000002L});
@ -4594,15 +4596,15 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_GATED_SEMPRED_in_element890 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_GATED_SEMPRED_in_element890 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_treeSpec_in_element895 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_treeSpec_in_element895 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ASSIGN_in_labeledElement908 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_labeledElement908 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_labeledElement910 = new BitSet(new long[]{0xC0D0840000000000L,0x000000080000F008L}); public static final BitSet FOLLOW_ID_in_labeledElement910 = new BitSet(new long[]{0xC0D0840000000000L,0x000000100001D008L});
public static final BitSet FOLLOW_atom_in_labeledElement913 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_atom_in_labeledElement913 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_block_in_labeledElement915 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_block_in_labeledElement915 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_PLUS_ASSIGN_in_labeledElement923 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_PLUS_ASSIGN_in_labeledElement923 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_labeledElement925 = new BitSet(new long[]{0xC0D0840000000000L,0x000000080000F008L}); public static final BitSet FOLLOW_ID_in_labeledElement925 = new BitSet(new long[]{0xC0D0840000000000L,0x000000100001D008L});
public static final BitSet FOLLOW_atom_in_labeledElement928 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_atom_in_labeledElement928 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_block_in_labeledElement930 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_block_in_labeledElement930 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TREE_BEGIN_in_treeSpec947 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TREE_BEGIN_in_treeSpec947 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_element_in_treeSpec949 = new BitSet(new long[]{0xC4D4A40000010018L,0x000000090000F008L}); public static final BitSet FOLLOW_element_in_treeSpec949 = new BitSet(new long[]{0xC4D4A40000010018L,0x000000120001D008L});
public static final BitSet FOLLOW_blockSuffix_in_ebnf964 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_blockSuffix_in_ebnf964 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_block_in_ebnf966 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_block_in_ebnf966 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_block_in_ebnf973 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_block_in_ebnf973 = new BitSet(new long[]{0x0000000000000002L});
@ -4624,7 +4626,7 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_ID_in_atom1097 = new BitSet(new long[]{0x4050800000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_ID_in_atom1097 = new BitSet(new long[]{0x4050800000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_terminal_in_atom1099 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_terminal_in_atom1099 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_DOT_in_atom1106 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_DOT_in_atom1106 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_atom1108 = new BitSet(new long[]{0xC0D0800000000000L,0x0000000800000008L}); public static final BitSet FOLLOW_ID_in_atom1108 = new BitSet(new long[]{0xC0D0800000000000L,0x0000001000000008L});
public static final BitSet FOLLOW_ruleref_in_atom1110 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ruleref_in_atom1110 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_terminal_in_atom1121 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_terminal_in_atom1121 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ruleref_in_atom1131 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ruleref_in_atom1131 = new BitSet(new long[]{0x0000000000000002L});
@ -4634,9 +4636,9 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_block_in_notSet1163 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_block_in_notSet1163 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_set_in_notTerminal0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_notTerminal0 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_BLOCK_in_block1207 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_BLOCK_in_block1207 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_optionsSpec_in_block1209 = new BitSet(new long[]{0x0800000100290000L,0x0000008000080000L}); public static final BitSet FOLLOW_optionsSpec_in_block1209 = new BitSet(new long[]{0x0800000100290000L,0x0000010000100000L});
public static final BitSet FOLLOW_ruleAction_in_block1212 = new BitSet(new long[]{0x0800000100290000L,0x0000008000080000L}); public static final BitSet FOLLOW_ruleAction_in_block1212 = new BitSet(new long[]{0x0800000100290000L,0x0000010000100000L});
public static final BitSet FOLLOW_ACTION_in_block1215 = new BitSet(new long[]{0x0800000100290000L,0x0000008000080000L}); public static final BitSet FOLLOW_ACTION_in_block1215 = new BitSet(new long[]{0x0800000100290000L,0x0000010000100000L});
public static final BitSet FOLLOW_altList_in_block1218 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_altList_in_block1218 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ROOT_in_ruleref1237 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ROOT_in_ruleref1237 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_RULE_REF_in_ruleref1239 = new BitSet(new long[]{0x0000000000004008L}); public static final BitSet FOLLOW_RULE_REF_in_ruleref1239 = new BitSet(new long[]{0x0000000000004008L});
@ -4654,7 +4656,7 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_elementOptions_in_terminal1348 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_elementOptions_in_terminal1348 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_terminal1357 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_STRING_LITERAL_in_terminal1357 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1366 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TOKEN_REF_in_terminal1366 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_terminal1368 = new BitSet(new long[]{0x0000000000000000L,0x0000002000000000L}); public static final BitSet FOLLOW_ARG_ACTION_in_terminal1368 = new BitSet(new long[]{0x0000000000000000L,0x0000004000000000L});
public static final BitSet FOLLOW_elementOptions_in_terminal1370 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_elementOptions_in_terminal1370 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_terminal1380 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TOKEN_REF_in_terminal1380 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_terminal1382 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ARG_ACTION_in_terminal1382 = new BitSet(new long[]{0x0000000000000008L});
@ -4669,21 +4671,21 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_BANG_in_terminal1444 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_BANG_in_terminal1444 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_terminal_in_terminal1446 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_terminal_in_terminal1446 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOptions1465 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOptions1465 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_elementOption_in_elementOptions1467 = new BitSet(new long[]{0x0000200000000008L,0x0000000000400000L}); public static final BitSet FOLLOW_elementOption_in_elementOptions1467 = new BitSet(new long[]{0x0000200000000008L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption1486 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ID_in_elementOption1486 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption1497 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_elementOption1497 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption1499 = new BitSet(new long[]{0x0000000000000000L,0x0000000000400000L}); public static final BitSet FOLLOW_ID_in_elementOption1499 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption1501 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ID_in_elementOption1501 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption1513 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_elementOption1513 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption1515 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_ID_in_elementOption1515 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption1517 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption1517 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_predicatedRewrite_in_rewrite1532 = new BitSet(new long[]{0x0000000000000000L,0x0000004000200000L}); public static final BitSet FOLLOW_predicatedRewrite_in_rewrite1532 = new BitSet(new long[]{0x0000000000000000L,0x0000008000400000L});
public static final BitSet FOLLOW_nakedRewrite_in_rewrite1535 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_nakedRewrite_in_rewrite1535 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ST_RESULT_in_predicatedRewrite1547 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ST_RESULT_in_predicatedRewrite1547 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1549 = new BitSet(new long[]{0x0100000800010000L,0x00000000000C0000L}); public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1549 = new BitSet(new long[]{0x0100000800010000L,0x0000000000180000L});
public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1551 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1551 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_RESULT_in_predicatedRewrite1558 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_RESULT_in_predicatedRewrite1558 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1560 = new BitSet(new long[]{0x0100000800010000L,0x00000000000C0000L}); public static final BitSet FOLLOW_SEMPRED_in_predicatedRewrite1560 = new BitSet(new long[]{0x0100000800010000L,0x0000000000180000L});
public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1562 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewriteAlt_in_predicatedRewrite1562 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ST_RESULT_in_nakedRewrite1576 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ST_RESULT_in_nakedRewrite1576 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteAlt_in_nakedRewrite1578 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewriteAlt_in_nakedRewrite1578 = new BitSet(new long[]{0x0000000000000008L});
@ -4694,7 +4696,7 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_ETC_in_rewriteAlt1619 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ETC_in_rewriteAlt1619 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_EPSILON_in_rewriteAlt1627 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_EPSILON_in_rewriteAlt1627 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ALT_in_rewriteTreeAlt1646 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ALT_in_rewriteTreeAlt1646 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTreeAlt1648 = new BitSet(new long[]{0xC400000000010008L,0x000000008000E008L}); public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTreeAlt1648 = new BitSet(new long[]{0xC400000000010008L,0x000000010001C008L});
public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTreeElement1664 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTreeElement1664 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTree_in_rewriteTreeElement1669 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteTree_in_rewriteTreeElement1669 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement1676 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteTreeEbnf_in_rewriteTreeElement1676 = new BitSet(new long[]{0x0000000000000002L});
@ -4706,11 +4708,11 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_LABEL_in_rewriteTreeAtom1727 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_LABEL_in_rewriteTreeAtom1727 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ACTION_in_rewriteTreeAtom1732 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ACTION_in_rewriteTreeAtom1732 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1744 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ebnfSuffix_in_rewriteTreeEbnf1744 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_BLOCK_in_rewriteTreeEbnf1747 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_REWRITE_BLOCK_in_rewriteTreeEbnf1747 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1749 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewriteTreeAlt_in_rewriteTreeEbnf1749 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TREE_BEGIN_in_rewriteTree1762 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TREE_BEGIN_in_rewriteTree1762 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTree1764 = new BitSet(new long[]{0xC400000000010008L,0x000000008000E008L}); public static final BitSet FOLLOW_rewriteTreeAtom_in_rewriteTree1764 = new BitSet(new long[]{0xC400000000010008L,0x000000010001C008L});
public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTree1766 = new BitSet(new long[]{0xC400000000010008L,0x000000008000E008L}); public static final BitSet FOLLOW_rewriteTreeElement_in_rewriteTree1766 = new BitSet(new long[]{0xC400000000010008L,0x000000010001C008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate1781 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplate1781 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1783 = new BitSet(new long[]{0x0000000000000400L}); public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplate1783 = new BitSet(new long[]{0x0000000000000400L});
public static final BitSet FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1786 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_DOUBLE_QUOTE_STRING_LITERAL_in_rewriteTemplate1786 = new BitSet(new long[]{0x0000000000000008L});
@ -4721,13 +4723,13 @@ public class ASTVerifier extends TreeParser {
public static final BitSet FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1809 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_rewriteIndirectTemplateHead_in_rewriteTemplate1809 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ACTION_in_rewriteTemplate1814 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_ACTION_in_rewriteTemplate1814 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplateRef1826 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TEMPLATE_in_rewriteTemplateRef1826 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rewriteTemplateRef1828 = new BitSet(new long[]{0x0000000000000008L,0x0000000001000000L}); public static final BitSet FOLLOW_ID_in_rewriteTemplateRef1828 = new BitSet(new long[]{0x0000000000000008L,0x0000000002000000L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1830 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteTemplateRef1830 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1844 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TEMPLATE_in_rewriteIndirectTemplateHead1844 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ACTION_in_rewriteIndirectTemplateHead1846 = new BitSet(new long[]{0x0000000000000008L,0x0000000001000000L}); public static final BitSet FOLLOW_ACTION_in_rewriteIndirectTemplateHead1846 = new BitSet(new long[]{0x0000000000000008L,0x0000000002000000L});
public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1848 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_rewriteTemplateArgs_in_rewriteIndirectTemplateHead1848 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ARGLIST_in_rewriteTemplateArgs1862 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ARGLIST_in_rewriteTemplateArgs1862 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1864 = new BitSet(new long[]{0x0000000000000008L,0x0000000000800000L}); public static final BitSet FOLLOW_rewriteTemplateArg_in_rewriteTemplateArgs1864 = new BitSet(new long[]{0x0000000000000008L,0x0000000001000000L});
public static final BitSet FOLLOW_ARG_in_rewriteTemplateArg1880 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ARG_in_rewriteTemplateArg1880 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rewriteTemplateArg1882 = new BitSet(new long[]{0x0000000000010000L}); public static final BitSet FOLLOW_ID_in_rewriteTemplateArg1882 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_ACTION_in_rewriteTemplateArg1884 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ACTION_in_rewriteTemplateArg1884 = new BitSet(new long[]{0x0000000000000008L});

View File

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

View File

@ -2,23 +2,25 @@ package org.antlr.v4.parse;
import org.antlr.runtime.*; import org.antlr.runtime.*;
import org.antlr.runtime.tree.CommonTreeAdaptor; import org.antlr.runtime.tree.CommonTreeAdaptor;
import org.antlr.v4.tool.BlockAST; import org.antlr.v4.tool.*;
import org.antlr.v4.tool.GrammarAST;
import org.antlr.v4.tool.GrammarASTErrorNode;
public class GrammarASTAdaptor extends CommonTreeAdaptor { public class GrammarASTAdaptor extends CommonTreeAdaptor {
CharStream input; // where we can find chars ref'd by tokens in tree CharStream input; // where we can find chars ref'd by tokens in tree
//TokenStream tokens; public GrammarASTAdaptor() { ; }
public GrammarASTAdaptor(CharStream input) { this.input = input; } public GrammarASTAdaptor(CharStream input) { this.input = input; }
//public GrammarASTAdaptor(TokenStream tokens) { this.tokens = tokens; }
public Object create(Token token) { public Object create(Token token) {
if ( token==null ) return new GrammarAST(token); if ( token==null ) return new GrammarAST(token);
switch ( token.getType() ) { switch ( token.getType() ) {
case ANTLRParser.BLOCK : return new BlockAST(token); // case ANTLRParser.BLOCK :
case ANTLRParser.TOKEN_REF : // return new BlockAST(token);
case ANTLRParser.STRING_LITERAL : // case ANTLRParser.RULE :
case ANTLRParser.WILDCARD : // return new RuleAST(token);
return new BlockAST(token); // case ANTLRParser.PARSER_GRAMMAR :
// case ANTLRParser.COMBINED_GRAMMAR :
// case ANTLRParser.TREE_GRAMMAR :
// case ANTLRParser.LEXER_GRAMMAR :
// return new GrammarRootAST(token);
default : default :
return new GrammarAST(token); return new GrammarAST(token);
} }

View File

@ -109,6 +109,12 @@ public class BasicSemanticChecks {
protected static void checkTokenAlias(int gtype, Token tokenID) { protected static void checkTokenAlias(int gtype, Token tokenID) {
String fileName = tokenID.getInputStream().getSourceName(); String fileName = tokenID.getInputStream().getSourceName();
if ( Character.isLowerCase(tokenID.getText().charAt(0)) ) {
ErrorManager.grammarError(ErrorType.TOKEN_NAMES_MUST_START_UPPER,
fileName,
tokenID,
tokenID.getText());
}
if ( gtype==ANTLRParser.LEXER_GRAMMAR ) { if ( gtype==ANTLRParser.LEXER_GRAMMAR ) {
ErrorManager.grammarError(ErrorType.CANNOT_ALIAS_TOKENS_IN_LEXER, ErrorManager.grammarError(ErrorType.CANNOT_ALIAS_TOKENS_IN_LEXER,
fileName, fileName,
@ -135,10 +141,24 @@ public class BasicSemanticChecks {
{ {
String fileName = optionID.getInputStream().getSourceName(); String fileName = optionID.getInputStream().getSourceName();
if ( parent.getType()==ANTLRParser.BLOCK ) { if ( parent.getType()==ANTLRParser.BLOCK ) {
if ( !legalBlockOptions.contains(optionID.getText()) ) { // grammar
ErrorManager.grammarError(ErrorType.ILLEGAL_OPTION,
fileName,
optionID,
optionID.getText());
return false;
}
} }
if ( parent.getType()==ANTLRParser.RULE ) { else if ( parent.getType()==ANTLRParser.RULE ) {
if ( !legalRuleOptions.contains(optionID.getText()) ) { // grammar
ErrorManager.grammarError(ErrorType.ILLEGAL_OPTION,
fileName,
optionID,
optionID.getText());
return false;
}
} }
if ( !legalGrammarOption(gtype, optionID.getText()) ) { // grammar else if ( !legalGrammarOption(gtype, optionID.getText()) ) { // grammar
ErrorManager.grammarError(ErrorType.ILLEGAL_OPTION, ErrorManager.grammarError(ErrorType.ILLEGAL_OPTION,
fileName, fileName,
optionID, optionID,

View File

@ -74,7 +74,7 @@ import org.antlr.v4.tool.*;
// tree grammar. 'course we won't try codegen if errors. // tree grammar. 'course we won't try codegen if errors.
public String name; public String name;
public String fileName; public String fileName;
public Map<String,String> options = new HashMap<String,String>(); //public Map<String,String> options = new HashMap<String,String>();
protected int gtype; protected int gtype;
//Grammar g; // which grammar are we checking //Grammar g; // which grammar are we checking
public BasicSemanticTriggers(TreeNodeStream input, String fileName) { public BasicSemanticTriggers(TreeNodeStream input, String fileName) {
@ -113,7 +113,10 @@ option // TODO: put in grammar, or rule, or block
GrammarAST parentWithOptionKind = (GrammarAST)parent.getParent(); GrammarAST parentWithOptionKind = (GrammarAST)parent.getParent();
boolean ok = BasicSemanticChecks.checkOptions(gtype, parentWithOptionKind, boolean ok = BasicSemanticChecks.checkOptions(gtype, parentWithOptionKind,
$ID.token, $optionValue.v); $ID.token, $optionValue.v);
if ( ok ) options.put($o.text, $optionValue.v); // store options into XXX_GRAMMAR, RULE, BLOCK nodes
if ( ok ) {
((GrammarASTWithOptions)parentWithOptionKind).setOption($o.text, $optionValue.v);
}
} }
; ;
@ -133,8 +136,8 @@ ruleref
; ;
tokenAlias tokenAlias
: {inContext("TOKENS")}? ^(ASSIGN TOKEN_REF STRING_LITERAL) : {inContext("TOKENS")}? ^(ASSIGN ID STRING_LITERAL)
{BasicSemanticChecks.checkTokenAlias(gtype, $TOKEN_REF.token);} {BasicSemanticChecks.checkTokenAlias(gtype, $ID.token);}
; ;
tokenRefWithArgs tokenRefWithArgs
@ -144,8 +147,7 @@ tokenRefWithArgs
elementOption elementOption
: ^( ELEMENT_OPTIONS : ^( ELEMENT_OPTIONS
( o=ID ( ^(ASSIGN o=ID value=ID)
| ^(ASSIGN o=ID value=ID)
| ^(ASSIGN o=ID value=STRING_LITERAL) | ^(ASSIGN o=ID value=STRING_LITERAL)
) )
) )
@ -155,7 +157,7 @@ elementOption
if ( ok ) { if ( ok ) {
GrammarAST parent = (GrammarAST)$start.getParent(); // ELEMENT_OPTIONS GrammarAST parent = (GrammarAST)$start.getParent(); // ELEMENT_OPTIONS
TerminalAST terminal = (TerminalAST)parent.getParent(); TerminalAST terminal = (TerminalAST)parent.getParent();
terminal.options.put($o.text, $value.text); terminal.setOption($o.text, $value.text);
} }
} }
; ;

View File

@ -1,4 +1,4 @@
// $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-01 14:30:07 // $ANTLR 3.2.1-SNAPSHOT Jan 26, 2010 15:12:28 BasicSemanticTriggers.g 2010-02-01 17:39:13
/* /*
[The "BSD license"] [The "BSD license"]
@ -41,28 +41,28 @@ import java.util.HashMap;
*/ */
public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter { public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter {
public static final String[] tokenNames = new String[] { 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", "WILDCARD", "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", "OPTIONAL", "CLOSURE", "POSITIVE_CLOSURE", "SYNPRED", "CHAR_RANGE", "EPSILON", "ALT", "ALTLIST", "RESULT", "ID", "ARG", "ARGLIST", "RET", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "DOT", "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", "WILDCARD", "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", "LEXER_GRAMMAR", "PARSER_GRAMMAR", "TREE_GRAMMAR", "COMBINED_GRAMMAR", "INITACTION", "LABEL", "GATED_SEMPRED", "SYN_SEMPRED", "BACKTRACK_SEMPRED", "DOT", "LIST", "ELEMENT_OPTIONS", "ST_RESULT", "ALT_REWRITE"
}; };
public static final int LT=43; public static final int LT=43;
public static final int STAR=48; public static final int STAR=48;
public static final int BACKTRACK_SEMPRED=98; public static final int BACKTRACK_SEMPRED=99;
public static final int DOUBLE_ANGLE_STRING_LITERAL=11; public static final int DOUBLE_ANGLE_STRING_LITERAL=11;
public static final int FORCED_ACTION=5; public static final int FORCED_ACTION=5;
public static final int LEXER_GRAMMAR=90; public static final int LEXER_GRAMMAR=91;
public static final int ARGLIST=88; public static final int ARGLIST=89;
public static final int ALTLIST=84; public static final int ALTLIST=85;
public static final int NOT=60; public static final int NOT=60;
public static final int EOF=-1; public static final int EOF=-1;
public static final int SEMPRED=4; public static final int SEMPRED=4;
public static final int ACTION=16; public static final int ACTION=16;
public static final int TOKEN_REF=62; public static final int TOKEN_REF=62;
public static final int RULEMODIFIERS=74; public static final int RULEMODIFIERS=74;
public static final int ST_RESULT=102; public static final int ST_RESULT=103;
public static final int RPAREN=41; public static final int RPAREN=41;
public static final int RET=89; public static final int RET=90;
public static final int IMPORT=22; public static final int IMPORT=22;
public static final int STRING_LITERAL=67; public static final int STRING_LITERAL=67;
public static final int ARG=87; public static final int ARG=88;
public static final int ARG_ACTION=14; public static final int ARG_ACTION=14;
public static final int DOUBLE_QUOTE_STRING_LITERAL=10; public static final int DOUBLE_QUOTE_STRING_LITERAL=10;
public static final int COMMENT=9; public static final int COMMENT=9;
@ -70,42 +70,42 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
public static final int GRAMMAR=27; public static final int GRAMMAR=27;
public static final int RULEACTIONS=75; public static final int RULEACTIONS=75;
public static final int WSCHARS=65; public static final int WSCHARS=65;
public static final int INITACTION=94; public static final int INITACTION=95;
public static final int ALT_REWRITE=103; public static final int ALT_REWRITE=104;
public static final int IMPLIES=42; public static final int IMPLIES=42;
public static final int RULE=72; public static final int RULE=72;
public static final int RBRACE=61; public static final int RBRACE=61;
public static final int ACTION_ESC=17; public static final int ACTION_ESC=17;
public static final int PARSER_GRAMMAR=91; public static final int PARSER_GRAMMAR=92;
public static final int PRIVATE=30; public static final int PRIVATE=30;
public static final int SRC=7; public static final int SRC=7;
public static final int THROWS=32; public static final int THROWS=32;
public static final int CHAR_RANGE=81; public static final int CHAR_RANGE=82;
public static final int INT=64; public static final int INT=64;
public static final int EPSILON=82; public static final int EPSILON=83;
public static final int LIST=100; public static final int LIST=101;
public static final int COLONCOLON=37; public static final int COLONCOLON=37;
public static final int WSNLCHARS=18; public static final int WSNLCHARS=18;
public static final int WS=70; public static final int WS=70;
public static final int COMBINED_GRAMMAR=93; public static final int COMBINED_GRAMMAR=94;
public static final int LEXER=24; public static final int LEXER=24;
public static final int OR=51; public static final int OR=51;
public static final int GT=44; public static final int GT=44;
public static final int TREE_GRAMMAR=92; public static final int TREE_GRAMMAR=93;
public static final int CATCH=33; public static final int CATCH=33;
public static final int CLOSURE=78; public static final int CLOSURE=79;
public static final int PARSER=25; public static final int PARSER=25;
public static final int DOLLAR=53; public static final int DOLLAR=53;
public static final int PROTECTED=28; public static final int PROTECTED=28;
public static final int ELEMENT_OPTIONS=101; public static final int ELEMENT_OPTIONS=102;
public static final int NESTED_ACTION=15; public static final int NESTED_ACTION=15;
public static final int FRAGMENT=23; public static final int FRAGMENT=23;
public static final int ID=86; public static final int ID=87;
public static final int TREE_BEGIN=58; public static final int TREE_BEGIN=58;
public static final int LPAREN=40; public static final int LPAREN=40;
public static final int AT=59; public static final int AT=59;
public static final int ESC_SEQ=66; public static final int ESC_SEQ=66;
public static final int ALT=83; public static final int ALT=84;
public static final int TREE=26; public static final int TREE=26;
public static final int SCOPE=21; public static final int SCOPE=21;
public static final int ETC=56; public static final int ETC=56;
@ -113,7 +113,8 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
public static final int WILDCARD=54; public static final int WILDCARD=54;
public static final int DOC_COMMENT=6; public static final int DOC_COMMENT=6;
public static final int PLUS=49; public static final int PLUS=49;
public static final int DOT=99; public static final int REWRITE_BLOCK=77;
public static final int DOT=100;
public static final int RETURNS=31; public static final int RETURNS=31;
public static final int RULES=73; public static final int RULES=73;
public static final int RARROW=57; public static final int RARROW=57;
@ -121,28 +122,28 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
public static final int HEX_DIGIT=68; public static final int HEX_DIGIT=68;
public static final int RANGE=55; public static final int RANGE=55;
public static final int TOKENS=20; public static final int TOKENS=20;
public static final int GATED_SEMPRED=96; public static final int GATED_SEMPRED=97;
public static final int RESULT=85; public static final int RESULT=86;
public static final int BANG=47; public static final int BANG=47;
public static final int ACTION_STRING_LITERAL=12; public static final int ACTION_STRING_LITERAL=12;
public static final int ROOT=52; public static final int ROOT=52;
public static final int SEMI=39; public static final int SEMI=39;
public static final int RULE_REF=63; public static final int RULE_REF=63;
public static final int NLCHARS=8; public static final int NLCHARS=8;
public static final int OPTIONAL=77; public static final int OPTIONAL=78;
public static final int SYNPRED=80; public static final int SYNPRED=81;
public static final int COLON=36; public static final int COLON=36;
public static final int QUESTION=46; public static final int QUESTION=46;
public static final int FINALLY=34; public static final int FINALLY=34;
public static final int TEMPLATE=35; public static final int TEMPLATE=35;
public static final int LABEL=95; public static final int LABEL=96;
public static final int SYN_SEMPRED=97; public static final int SYN_SEMPRED=98;
public static final int ERRCHAR=71; public static final int ERRCHAR=71;
public static final int BLOCK=76; public static final int BLOCK=76;
public static final int ASSIGN=45; public static final int ASSIGN=45;
public static final int PLUS_ASSIGN=50; public static final int PLUS_ASSIGN=50;
public static final int PUBLIC=29; public static final int PUBLIC=29;
public static final int POSITIVE_CLOSURE=79; public static final int POSITIVE_CLOSURE=80;
public static final int OPTIONS=19; public static final int OPTIONS=19;
// delegates // delegates
@ -167,7 +168,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
// tree grammar. 'course we won't try codegen if errors. // tree grammar. 'course we won't try codegen if errors.
public String name; public String name;
public String fileName; public String fileName;
public Map<String,String> options = new HashMap<String,String>(); //public Map<String,String> options = new HashMap<String,String>();
protected int gtype; protected int gtype;
//Grammar g; // which grammar are we checking //Grammar g; // which grammar are we checking
public BasicSemanticTriggers(TreeNodeStream input, String fileName) { public BasicSemanticTriggers(TreeNodeStream input, String fileName) {
@ -419,7 +420,10 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
GrammarAST parentWithOptionKind = (GrammarAST)parent.getParent(); GrammarAST parentWithOptionKind = (GrammarAST)parent.getParent();
boolean ok = BasicSemanticChecks.checkOptions(gtype, parentWithOptionKind, boolean ok = BasicSemanticChecks.checkOptions(gtype, parentWithOptionKind,
o.token, (optionValue2!=null?optionValue2.v:null)); o.token, (optionValue2!=null?optionValue2.v:null));
if ( ok ) options.put((o!=null?o.getText():null), (optionValue2!=null?optionValue2.v:null)); // store options into XXX_GRAMMAR, RULE, BLOCK nodes
if ( ok ) {
((GrammarASTWithOptions)parentWithOptionKind).setOption((o!=null?o.getText():null), (optionValue2!=null?optionValue2.v:null));
}
} }
@ -441,14 +445,14 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
}; };
// $ANTLR start "optionValue" // $ANTLR start "optionValue"
// BasicSemanticTriggers.g:120:1: optionValue returns [String v] : ( ID | STRING_LITERAL | INT | STAR ); // BasicSemanticTriggers.g:123:1: optionValue returns [String v] : ( ID | STRING_LITERAL | INT | STAR );
public final BasicSemanticTriggers.optionValue_return optionValue() throws RecognitionException { public final BasicSemanticTriggers.optionValue_return optionValue() throws RecognitionException {
BasicSemanticTriggers.optionValue_return retval = new BasicSemanticTriggers.optionValue_return(); BasicSemanticTriggers.optionValue_return retval = new BasicSemanticTriggers.optionValue_return();
retval.start = input.LT(1); retval.start = input.LT(1);
retval.v = ((GrammarAST)retval.start).token.getText(); retval.v = ((GrammarAST)retval.start).token.getText();
try { try {
// BasicSemanticTriggers.g:122:5: ( ID | STRING_LITERAL | INT | STAR ) // BasicSemanticTriggers.g:125:5: ( ID | STRING_LITERAL | INT | STAR )
// BasicSemanticTriggers.g: // BasicSemanticTriggers.g:
{ {
if ( input.LA(1)==STAR||input.LA(1)==INT||input.LA(1)==STRING_LITERAL||input.LA(1)==ID ) { if ( input.LA(1)==STAR||input.LA(1)==INT||input.LA(1)==STRING_LITERAL||input.LA(1)==ID ) {
@ -477,19 +481,19 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
// $ANTLR start "rule" // $ANTLR start "rule"
// BasicSemanticTriggers.g:128:1: rule : ^( RULE r= ID ( . )* ) ; // BasicSemanticTriggers.g:131:1: rule : ^( RULE r= ID ( . )* ) ;
public final void rule() throws RecognitionException { public final void rule() throws RecognitionException {
GrammarAST r=null; GrammarAST r=null;
try { try {
// BasicSemanticTriggers.g:128:5: ( ^( RULE r= ID ( . )* ) ) // BasicSemanticTriggers.g:131:5: ( ^( RULE r= ID ( . )* ) )
// BasicSemanticTriggers.g:128:9: ^( RULE r= ID ( . )* ) // BasicSemanticTriggers.g:131:9: ^( RULE r= ID ( . )* )
{ {
match(input,RULE,FOLLOW_RULE_in_rule299); if (state.failed) return ; match(input,RULE,FOLLOW_RULE_in_rule299); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ;
r=(GrammarAST)match(input,ID,FOLLOW_ID_in_rule303); if (state.failed) return ; r=(GrammarAST)match(input,ID,FOLLOW_ID_in_rule303); if (state.failed) return ;
// BasicSemanticTriggers.g:128:22: ( . )* // BasicSemanticTriggers.g:131:22: ( . )*
loop3: loop3:
do { do {
int alt3=2; int alt3=2;
@ -505,7 +509,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
switch (alt3) { switch (alt3) {
case 1 : case 1 :
// BasicSemanticTriggers.g:128:22: . // BasicSemanticTriggers.g:131:22: .
{ {
matchAny(input); if (state.failed) return ; matchAny(input); if (state.failed) return ;
@ -538,13 +542,13 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
// $ANTLR start "ruleref" // $ANTLR start "ruleref"
// BasicSemanticTriggers.g:131:1: ruleref : RULE_REF ; // BasicSemanticTriggers.g:134:1: ruleref : RULE_REF ;
public final void ruleref() throws RecognitionException { public final void ruleref() throws RecognitionException {
GrammarAST RULE_REF3=null; GrammarAST RULE_REF3=null;
try { try {
// BasicSemanticTriggers.g:132:5: ( RULE_REF ) // BasicSemanticTriggers.g:135:5: ( RULE_REF )
// BasicSemanticTriggers.g:132:7: RULE_REF // BasicSemanticTriggers.g:135:7: RULE_REF
{ {
RULE_REF3=(GrammarAST)match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref326); if (state.failed) return ; RULE_REF3=(GrammarAST)match(input,RULE_REF,FOLLOW_RULE_REF_in_ruleref326); if (state.failed) return ;
if ( state.backtracking==1 ) { if ( state.backtracking==1 ) {
@ -566,13 +570,13 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
// $ANTLR start "tokenAlias" // $ANTLR start "tokenAlias"
// BasicSemanticTriggers.g:135:1: tokenAlias : {...}? ^( ASSIGN TOKEN_REF STRING_LITERAL ) ; // BasicSemanticTriggers.g:138:1: tokenAlias : {...}? ^( ASSIGN ID STRING_LITERAL ) ;
public final void tokenAlias() throws RecognitionException { public final void tokenAlias() throws RecognitionException {
GrammarAST TOKEN_REF4=null; GrammarAST ID4=null;
try { try {
// BasicSemanticTriggers.g:136:2: ({...}? ^( ASSIGN TOKEN_REF STRING_LITERAL ) ) // BasicSemanticTriggers.g:139:2: ({...}? ^( ASSIGN ID STRING_LITERAL ) )
// BasicSemanticTriggers.g:136:4: {...}? ^( ASSIGN TOKEN_REF STRING_LITERAL ) // BasicSemanticTriggers.g:139:4: {...}? ^( ASSIGN ID STRING_LITERAL )
{ {
if ( !((inContext("TOKENS"))) ) { if ( !((inContext("TOKENS"))) ) {
if (state.backtracking>0) {state.failed=true; return ;} if (state.backtracking>0) {state.failed=true; return ;}
@ -581,12 +585,12 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenAlias345); if (state.failed) return ; match(input,ASSIGN,FOLLOW_ASSIGN_in_tokenAlias345); if (state.failed) return ;
match(input, Token.DOWN, null); if (state.failed) return ; match(input, Token.DOWN, null); if (state.failed) return ;
TOKEN_REF4=(GrammarAST)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenAlias347); if (state.failed) return ; ID4=(GrammarAST)match(input,ID,FOLLOW_ID_in_tokenAlias347); if (state.failed) return ;
match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenAlias349); if (state.failed) return ; match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_tokenAlias349); if (state.failed) return ;
match(input, Token.UP, null); if (state.failed) return ; match(input, Token.UP, null); if (state.failed) return ;
if ( state.backtracking==1 ) { if ( state.backtracking==1 ) {
BasicSemanticChecks.checkTokenAlias(gtype, TOKEN_REF4.token); BasicSemanticChecks.checkTokenAlias(gtype, ID4.token);
} }
} }
@ -604,13 +608,13 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
// $ANTLR start "tokenRefWithArgs" // $ANTLR start "tokenRefWithArgs"
// BasicSemanticTriggers.g:140:1: tokenRefWithArgs : ^( TOKEN_REF ARG_ACTION ) ; // BasicSemanticTriggers.g:143:1: tokenRefWithArgs : ^( TOKEN_REF ARG_ACTION ) ;
public final void tokenRefWithArgs() throws RecognitionException { public final void tokenRefWithArgs() throws RecognitionException {
GrammarAST TOKEN_REF5=null; GrammarAST TOKEN_REF5=null;
try { try {
// BasicSemanticTriggers.g:141:2: ( ^( TOKEN_REF ARG_ACTION ) ) // BasicSemanticTriggers.g:144:2: ( ^( TOKEN_REF ARG_ACTION ) )
// BasicSemanticTriggers.g:141:4: ^( TOKEN_REF ARG_ACTION ) // BasicSemanticTriggers.g:144:4: ^( TOKEN_REF ARG_ACTION )
{ {
TOKEN_REF5=(GrammarAST)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenRefWithArgs366); if (state.failed) return ; TOKEN_REF5=(GrammarAST)match(input,TOKEN_REF,FOLLOW_TOKEN_REF_in_tokenRefWithArgs366); if (state.failed) return ;
@ -639,7 +643,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
}; };
// $ANTLR start "elementOption" // $ANTLR start "elementOption"
// BasicSemanticTriggers.g:145:1: elementOption : ^( ELEMENT_OPTIONS (o= ID | ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) ) ; // BasicSemanticTriggers.g:148:1: elementOption : ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) ) ;
public final BasicSemanticTriggers.elementOption_return elementOption() throws RecognitionException { public final BasicSemanticTriggers.elementOption_return elementOption() throws RecognitionException {
BasicSemanticTriggers.elementOption_return retval = new BasicSemanticTriggers.elementOption_return(); BasicSemanticTriggers.elementOption_return retval = new BasicSemanticTriggers.elementOption_return();
retval.start = input.LT(1); retval.start = input.LT(1);
@ -648,38 +652,35 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
GrammarAST value=null; GrammarAST value=null;
try { try {
// BasicSemanticTriggers.g:146:5: ( ^( ELEMENT_OPTIONS (o= ID | ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) ) ) // BasicSemanticTriggers.g:149:5: ( ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) ) )
// BasicSemanticTriggers.g:146:7: ^( ELEMENT_OPTIONS (o= ID | ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) ) // BasicSemanticTriggers.g:149:7: ^( ELEMENT_OPTIONS ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) )
{ {
match(input,ELEMENT_OPTIONS,FOLLOW_ELEMENT_OPTIONS_in_elementOption390); if (state.failed) return retval; match(input,ELEMENT_OPTIONS,FOLLOW_ELEMENT_OPTIONS_in_elementOption390); if (state.failed) return retval;
match(input, Token.DOWN, null); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval;
// BasicSemanticTriggers.g:147:7: (o= ID | ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) ) // BasicSemanticTriggers.g:150:7: ( ^( ASSIGN o= ID value= ID ) | ^( ASSIGN o= ID value= STRING_LITERAL ) )
int alt4=3; int alt4=2;
int LA4_0 = input.LA(1); int LA4_0 = input.LA(1);
if ( (LA4_0==ID) ) { if ( (LA4_0==ASSIGN) ) {
alt4=1; int LA4_1 = input.LA(2);
}
else if ( (LA4_0==ASSIGN) ) {
int LA4_2 = input.LA(2);
if ( (LA4_2==DOWN) ) { if ( (LA4_1==DOWN) ) {
int LA4_3 = input.LA(3); int LA4_2 = input.LA(3);
if ( (LA4_3==ID) ) { if ( (LA4_2==ID) ) {
int LA4_4 = input.LA(4); int LA4_3 = input.LA(4);
if ( (LA4_4==ID) ) { if ( (LA4_3==ID) ) {
alt4=2; alt4=1;
} }
else if ( (LA4_4==STRING_LITERAL) ) { else if ( (LA4_3==STRING_LITERAL) ) {
alt4=3; alt4=2;
} }
else { else {
if (state.backtracking>0) {state.failed=true; return retval;} if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = NoViableAltException nvae =
new NoViableAltException("", 4, 4, input); new NoViableAltException("", 4, 3, input);
throw nvae; throw nvae;
} }
@ -687,7 +688,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
else { else {
if (state.backtracking>0) {state.failed=true; return retval;} if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = NoViableAltException nvae =
new NoViableAltException("", 4, 3, input); new NoViableAltException("", 4, 2, input);
throw nvae; throw nvae;
} }
@ -695,7 +696,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
else { else {
if (state.backtracking>0) {state.failed=true; return retval;} if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = NoViableAltException nvae =
new NoViableAltException("", 4, 2, input); new NoViableAltException("", 4, 1, input);
throw nvae; throw nvae;
} }
@ -709,33 +710,26 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
} }
switch (alt4) { switch (alt4) {
case 1 : case 1 :
// BasicSemanticTriggers.g:147:9: o= ID // BasicSemanticTriggers.g:150:9: ^( ASSIGN o= ID value= ID )
{ {
o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption402); if (state.failed) return retval; match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption401); if (state.failed) return retval;
}
break;
case 2 :
// BasicSemanticTriggers.g:148:11: ^( ASSIGN o= ID value= ID )
{
match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption415); if (state.failed) return retval;
match(input, Token.DOWN, null); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval;
o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption419); if (state.failed) return retval; o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption405); if (state.failed) return retval;
value=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption423); if (state.failed) return retval; value=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption409); if (state.failed) return retval;
match(input, Token.UP, null); if (state.failed) return retval; match(input, Token.UP, null); if (state.failed) return retval;
} }
break; break;
case 3 : case 2 :
// BasicSemanticTriggers.g:149:11: ^( ASSIGN o= ID value= STRING_LITERAL ) // BasicSemanticTriggers.g:151:11: ^( ASSIGN o= ID value= STRING_LITERAL )
{ {
match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption437); if (state.failed) return retval; match(input,ASSIGN,FOLLOW_ASSIGN_in_elementOption423); if (state.failed) return retval;
match(input, Token.DOWN, null); if (state.failed) return retval; match(input, Token.DOWN, null); if (state.failed) return retval;
o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption441); if (state.failed) return retval; o=(GrammarAST)match(input,ID,FOLLOW_ID_in_elementOption427); if (state.failed) return retval;
value=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_elementOption445); if (state.failed) return retval; value=(GrammarAST)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_elementOption431); if (state.failed) return retval;
match(input, Token.UP, null); if (state.failed) return retval; match(input, Token.UP, null); if (state.failed) return retval;
@ -753,7 +747,7 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
if ( ok ) { if ( ok ) {
GrammarAST parent = (GrammarAST)((GrammarAST)retval.start).getParent(); // ELEMENT_OPTIONS GrammarAST parent = (GrammarAST)((GrammarAST)retval.start).getParent(); // ELEMENT_OPTIONS
TerminalAST terminal = (TerminalAST)parent.getParent(); TerminalAST terminal = (TerminalAST)parent.getParent();
terminal.options.put((o!=null?o.getText():null), (value!=null?value.getText():null)); terminal.setOption((o!=null?o.getText():null), (value!=null?value.getText():null));
} }
} }
@ -776,27 +770,30 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
protected DFA1 dfa1 = new DFA1(this); protected DFA1 dfa1 = new DFA1(this);
static final String DFA1_eotS = static final String DFA1_eotS =
"\12\uffff"; "\15\uffff";
static final String DFA1_eofS = static final String DFA1_eofS =
"\12\uffff"; "\15\uffff";
static final String DFA1_minS = static final String DFA1_minS =
"\1\55\1\uffff\1\2\4\uffff\1\76\2\uffff"; "\1\55\1\uffff\1\2\4\uffff\1\127\1\60\1\3\1\uffff\1\0\1\uffff";
static final String DFA1_maxS = static final String DFA1_maxS =
"\1\145\1\uffff\1\2\4\uffff\1\126\2\uffff"; "\1\146\1\uffff\1\2\4\uffff\2\127\1\3\1\uffff\1\0\1\uffff";
static final String DFA1_acceptS = static final String DFA1_acceptS =
"\1\uffff\1\1\1\uffff\1\3\1\4\1\6\1\7\1\uffff\1\2\1\5"; "\1\uffff\1\1\1\uffff\1\3\1\4\1\6\1\7\3\uffff\1\2\1\uffff\1\5";
static final String DFA1_specialS = static final String DFA1_specialS =
"\12\uffff}>"; "\13\uffff\1\0\1\uffff}>";
static final String[] DFA1_transitionS = { static final String[] DFA1_transitionS = {
"\1\2\20\uffff\1\5\1\4\10\uffff\1\3\21\uffff\4\1\7\uffff\1\6", "\1\2\20\uffff\1\5\1\4\10\uffff\1\3\22\uffff\4\1\7\uffff\1\6",
"", "",
"\1\7", "\1\7",
"", "",
"", "",
"", "",
"", "",
"\1\11\27\uffff\1\10", "\1\10",
"\1\12\17\uffff\1\12\2\uffff\1\11\23\uffff\1\12",
"\1\13",
"", "",
"\1\uffff",
"" ""
}; };
@ -832,6 +829,32 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
public String getDescription() { public String getDescription() {
return "86:1: topdown : ( grammarSpec | option | rule | ruleref | tokenAlias | tokenRefWithArgs | elementOption );"; return "86:1: topdown : ( grammarSpec | option | rule | ruleref | tokenAlias | tokenRefWithArgs | elementOption );";
} }
public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
TreeNodeStream input = (TreeNodeStream)_input;
int _s = s;
switch ( s ) {
case 0 :
int LA1_11 = input.LA(1);
int index1_11 = input.index();
input.rewind();
s = -1;
if ( ((inContext("OPTIONS"))) ) {s = 10;}
else if ( ((inContext("TOKENS"))) ) {s = 12;}
input.seek(index1_11);
if ( s>=0 ) return s;
break;
}
if (state.backtracking>0) {state.failed=true; return -1;}
NoViableAltException nvae =
new NoViableAltException(getDescription(), 1, _s, input);
error(nvae);
throw nvae;
}
} }
@ -843,27 +866,26 @@ public class BasicSemanticTriggers extends org.antlr.v4.runtime.tree.TreeFilter
public static final BitSet FOLLOW_tokenRefWithArgs_in_topdown118 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_tokenRefWithArgs_in_topdown118 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_elementOption_in_topdown123 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_elementOption_in_topdown123 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_grammarType_in_grammarSpec140 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_grammarType_in_grammarSpec140 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_grammarSpec142 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x000000FFFFFFFFFFL}); public static final BitSet FOLLOW_ID_in_grammarSpec142 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x000001FFFFFFFFFFL});
public static final BitSet FOLLOW_set_in_grammarType0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_grammarType0 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ASSIGN_in_option211 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_option211 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_option215 = new BitSet(new long[]{0x0001000000000000L,0x0000000000400009L}); public static final BitSet FOLLOW_ID_in_option215 = new BitSet(new long[]{0x0001000000000000L,0x0000000000800009L});
public static final BitSet FOLLOW_optionValue_in_option217 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_optionValue_in_option217 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_set_in_optionValue0 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_set_in_optionValue0 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_RULE_in_rule299 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_RULE_in_rule299 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_rule303 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x000000FFFFFFFFFFL}); public static final BitSet FOLLOW_ID_in_rule303 = new BitSet(new long[]{0xFFFFFFFFFFFFFFF8L,0x000001FFFFFFFFFFL});
public static final BitSet FOLLOW_RULE_REF_in_ruleref326 = new BitSet(new long[]{0x0000000000000002L}); public static final BitSet FOLLOW_RULE_REF_in_ruleref326 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_ASSIGN_in_tokenAlias345 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ASSIGN_in_tokenAlias345 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_TOKEN_REF_in_tokenAlias347 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_ID_in_tokenAlias347 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_tokenAlias349 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_STRING_LITERAL_in_tokenAlias349 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_TOKEN_REF_in_tokenRefWithArgs366 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_TOKEN_REF_in_tokenRefWithArgs366 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ARG_ACTION_in_tokenRefWithArgs368 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ARG_ACTION_in_tokenRefWithArgs368 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOption390 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ELEMENT_OPTIONS_in_elementOption390 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ID_in_elementOption402 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ASSIGN_in_elementOption401 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption415 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ID_in_elementOption405 = new BitSet(new long[]{0x0000000000000000L,0x0000000000800000L});
public static final BitSet FOLLOW_ID_in_elementOption419 = new BitSet(new long[]{0x0000000000000000L,0x0000000000400000L}); public static final BitSet FOLLOW_ID_in_elementOption409 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_ID_in_elementOption423 = new BitSet(new long[]{0x0000000000000008L}); public static final BitSet FOLLOW_ASSIGN_in_elementOption423 = new BitSet(new long[]{0x0000000000000004L});
public static final BitSet FOLLOW_ASSIGN_in_elementOption437 = new BitSet(new long[]{0x0000000000000004L}); public static final BitSet FOLLOW_ID_in_elementOption427 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L});
public static final BitSet FOLLOW_ID_in_elementOption441 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000008L}); public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption431 = new BitSet(new long[]{0x0000000000000008L});
public static final BitSet FOLLOW_STRING_LITERAL_in_elementOption445 = new BitSet(new long[]{0x0000000000000008L});
} }

View File

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

View File

@ -3,6 +3,8 @@ package org.antlr.v4.semantics;
import org.antlr.runtime.RecognitionException; import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.Token; import org.antlr.runtime.Token;
import org.antlr.runtime.tree.BufferedTreeNodeStream; import org.antlr.runtime.tree.BufferedTreeNodeStream;
import org.antlr.runtime.tree.TreeVisitor;
import org.antlr.runtime.tree.TreeVisitorAction;
import org.antlr.v4.Tool; import org.antlr.v4.Tool;
import org.antlr.v4.parse.ANTLRParser; import org.antlr.v4.parse.ANTLRParser;
import org.antlr.v4.parse.ASTVerifier; import org.antlr.v4.parse.ASTVerifier;
@ -10,6 +12,7 @@ import org.antlr.v4.parse.GrammarASTAdaptor;
import org.antlr.v4.tool.ErrorManager; import org.antlr.v4.tool.ErrorManager;
import org.antlr.v4.tool.ErrorType; import org.antlr.v4.tool.ErrorType;
import org.antlr.v4.tool.Grammar; import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.GrammarASTWithOptions;
/** */ /** */
public class SemanticsPipeline { public class SemanticsPipeline {
@ -18,8 +21,9 @@ public class SemanticsPipeline {
// use buffered node stream as we will look around in stream // use buffered node stream as we will look around in stream
// to give good error messages. // to give good error messages.
// TODO: send parse errors to buffer not stderr // TODO: send parse errors to buffer not stderr
GrammarASTAdaptor adaptor = new GrammarASTAdaptor();
BufferedTreeNodeStream nodes = BufferedTreeNodeStream nodes =
new BufferedTreeNodeStream(new GrammarASTAdaptor(null),g.ast); new BufferedTreeNodeStream(adaptor,g.ast);
ASTVerifier walker = new ASTVerifier(nodes); ASTVerifier walker = new ASTVerifier(nodes);
try {walker.grammarSpec();} try {walker.grammarSpec();}
catch (RecognitionException re) { catch (RecognitionException re) {
@ -30,5 +34,20 @@ public class SemanticsPipeline {
nodes.reset(); nodes.reset();
BasicSemanticTriggers basics = new BasicSemanticTriggers(nodes,g.fileName); BasicSemanticTriggers basics = new BasicSemanticTriggers(nodes,g.fileName);
basics.downup(g.ast); basics.downup(g.ast);
TreeVisitor v = new TreeVisitor(adaptor);
v.visit(g.ast,
new TreeVisitorAction() {
public Object pre(Object t) {
if ( t instanceof GrammarASTWithOptions ) {
GrammarASTWithOptions gt = (GrammarASTWithOptions)t;
if ( gt.getOptions()!=null ) {
System.out.println("options @ "+gt.toStringTree()+"="+gt.getOptions());
}
}
return t;
}
public Object post(Object t) { return t; }
});
} }
} }

View File

@ -1,11 +1,13 @@
package org.antlr.v4.tool; package org.antlr.v4.tool;
import org.antlr.runtime.CommonToken;
import org.antlr.runtime.Token; import org.antlr.runtime.Token;
import org.antlr.v4.parse.ANTLRParser;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class BlockAST extends GrammarAST { public class BlockAST extends GrammarASTWithOptions {
// TODO: maybe I need a Subrule object like Rule so these options mov to that? // TODO: maybe I need a Subrule object like Rule so these options mov to that?
/** What are the default options for a subrule? */ /** What are the default options for a subrule? */
public static final Map defaultBlockOptions = public static final Map defaultBlockOptions =
@ -13,9 +15,8 @@ public class BlockAST extends GrammarAST {
public static final Map defaultLexerBlockOptions = public static final Map defaultLexerBlockOptions =
new HashMap() {{put("greedy","true");}}; new HashMap() {{put("greedy","true");}};
protected Map<String, String> options;
public BlockAST(Token t) { super(t); } public BlockAST(Token t) { super(t); }
public BlockAST(int type) { super(type); }
public BlockAST(int type, Token t) { super(type, t); }
} }

View File

@ -39,6 +39,7 @@ package org.antlr.v4.tool;
* @since 4.0 * @since 4.0
*/ */
public enum ErrorType { public enum ErrorType {
// TODO: set all of the true, true appropriately
CANNOT_WRITE_FILE(ErrorSeverity.ERROR, true, true), CANNOT_WRITE_FILE(ErrorSeverity.ERROR, true, true),
CANNOT_CLOSE_FILE(ErrorSeverity.ERROR, true, true), CANNOT_CLOSE_FILE(ErrorSeverity.ERROR, true, true),
CANNOT_FIND_TOKENS_FILE(ErrorSeverity.ERROR, true, true), CANNOT_FIND_TOKENS_FILE(ErrorSeverity.ERROR, true, true),
@ -69,6 +70,7 @@ public enum ErrorType {
UNDEFINED_RULE_REF(ErrorSeverity.ERROR, true, true), UNDEFINED_RULE_REF(ErrorSeverity.ERROR, true, true),
LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE(ErrorSeverity.ERROR, true, true), LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE(ErrorSeverity.ERROR, true, true),
CANNOT_ALIAS_TOKENS_IN_LEXER(ErrorSeverity.ERROR, true, true), CANNOT_ALIAS_TOKENS_IN_LEXER(ErrorSeverity.ERROR, true, true),
TOKEN_NAMES_MUST_START_UPPER(ErrorSeverity.ERROR, true, true),
ATTRIBUTE_REF_NOT_IN_RULE(ErrorSeverity.ERROR, true, true), ATTRIBUTE_REF_NOT_IN_RULE(ErrorSeverity.ERROR, true, true),
INVALID_RULE_SCOPE_ATTRIBUTE_REF(ErrorSeverity.ERROR, true, true), INVALID_RULE_SCOPE_ATTRIBUTE_REF(ErrorSeverity.ERROR, true, true),
UNKNOWN_SIMPLE_ATTRIBUTE(ErrorSeverity.ERROR, true, true), UNKNOWN_SIMPLE_ATTRIBUTE(ErrorSeverity.ERROR, true, true),

View File

@ -17,13 +17,6 @@ public class Grammar {
} }
}; };
public static final Map defaultOptions =
new HashMap() {
{
put("language","Java");
}
};
public Tool tool; public Tool tool;
public String name; public String name;
public GrammarAST ast; public GrammarAST ast;

View File

@ -1,6 +1,8 @@
package org.antlr.v4.tool; package org.antlr.v4.tool;
import org.antlr.runtime.CommonToken;
import org.antlr.runtime.Token; import org.antlr.runtime.Token;
import org.antlr.v4.parse.ANTLRParser;
import org.antlr.v4.runtime.tree.CommonTree; import org.antlr.v4.runtime.tree.CommonTree;
import org.antlr.runtime.tree.Tree; import org.antlr.runtime.tree.Tree;
@ -8,6 +10,13 @@ public class GrammarAST extends CommonTree {
public GrammarAST() {;} public GrammarAST() {;}
public GrammarAST(Token t) { super(t); } public GrammarAST(Token t) { super(t); }
public GrammarAST(GrammarAST node) { super(node); } public GrammarAST(GrammarAST node) { super(node); }
public GrammarAST(int type) { super(new CommonToken(type, ANTLRParser.tokenNames[type])); }
public GrammarAST(int type, Token t) { this(t); t.setType(type); }
public GrammarAST(int type, Token t, String text) {
this(t);
t.setType(type);
t.setText(text);
}
@Override @Override
public Tree dupNode() { public Tree dupNode() {

View File

@ -0,0 +1,27 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import java.util.HashMap;
import java.util.Map;
public class GrammarASTWithOptions extends GrammarAST {
protected Map<String, String> options;
public GrammarASTWithOptions(Token t) { super(t); }
public GrammarASTWithOptions(int type) { super(type); }
public GrammarASTWithOptions(int type, Token t) { super(type, t); }
public GrammarASTWithOptions(int type, Token t, String text) { super(type,t,text); }
public void setOption(String key, String value) {
if ( options==null ) options = new HashMap<String, String>();
options.put(key, value);
}
public String getOption(String key) {
if ( options==null ) return null;
return options.get(key);
}
public Map<String, String> getOptions() { return options; }
}

View File

@ -0,0 +1,22 @@
package org.antlr.v4.tool;
import org.antlr.runtime.CommonToken;
import org.antlr.runtime.Token;
import org.antlr.v4.parse.ANTLRParser;
import java.util.HashMap;
import java.util.Map;
public class GrammarRootAST extends GrammarASTWithOptions {
public static final Map defaultOptions =
new HashMap() {
{
put("language","Java");
}
};
public GrammarRootAST(int type) { super(type); }
public GrammarRootAST(Token t) { super(t); }
public GrammarRootAST(int type, Token t) { super(type, t); }
public GrammarRootAST(int type, Token t, String text) { super(type,t,text); }
}

View File

@ -0,0 +1,8 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
public class RuleAST extends GrammarASTWithOptions {
public RuleAST(Token t) { super(t); }
public RuleAST(int type) { super(type); }
}

View File

@ -2,13 +2,10 @@ package org.antlr.v4.tool;
import org.antlr.runtime.Token; import org.antlr.runtime.Token;
import java.util.Map; public class TerminalAST extends GrammarASTWithOptions {
public class TerminalAST extends GrammarAST {
public static final String defaultTokenOption = "node"; public static final String defaultTokenOption = "node";
public Map<String, String> options;
public TerminalAST(Token t) { super(t); } public TerminalAST(Token t) { super(t); }
public TerminalAST(int type) { super(type); }
public TerminalAST(int type, Token t) { super(type, t); }
} }

View File

@ -127,7 +127,7 @@ alternative:
"x+=ID* -> $x*" -> "x+=ID* -> $x*" ->
(ALT_REWRITE (ALT_REWRITE
(ALT (* (BLOCK (ALT (+= x ID))))) (ALT (* (BLOCK (ALT (+= x ID)))))
(-> (ALT (* (BLOCK (ALT x)))))) (-> (ALT (* (REWRITE_BLOCK (ALT x))))))
"A -> ..." -> (ALT_REWRITE (ALT A) (-> ...)) "A -> ..." -> (ALT_REWRITE (ALT A) (-> ...))
"A -> " -> (ALT_REWRITE (ALT A) (-> EPSILON)) "A -> " -> (ALT_REWRITE (ALT A) (-> EPSILON))
@ -166,15 +166,15 @@ alternative:
(ALT a A (? (BLOCK (ALT X))) (* (BLOCK (ALT Y)))) (ALT a A (? (BLOCK (ALT X))) (* (BLOCK (ALT Y))))
(-> (ALT (-> (ALT
A a A a
(? (BLOCK (ALT ("^(" TOP X)))) (? (REWRITE_BLOCK (ALT ("^(" TOP X))))
(* (BLOCK (ALT Y)))))) (* (REWRITE_BLOCK (ALT Y))))))
"A -> A[33]" -> (ALT_REWRITE (ALT A) (-> (ALT (A 33)))) "A -> A[33]" -> (ALT_REWRITE (ALT A) (-> (ALT (A 33))))
"A -> 'int' ^(A A)*" -> "A -> 'int' ^(A A)*" ->
(ALT_REWRITE (ALT_REWRITE
(ALT A) (ALT A)
(-> (ALT 'int' (* (BLOCK (ALT ("^(" A A))))))) (-> (ALT 'int' (* (REWRITE_BLOCK (ALT ("^(" A A)))))))
<< <<
A -> {p1}? A A -> {p1}? A

View File

@ -12,414 +12,414 @@ public class TestASTStructure extends org.antlr.v4.gunit.jUnitBaseTest {
parserClassName = "org.antlr.v4.parse.ANTLRParser"; parserClassName = "org.antlr.v4.parse.ANTLRParser";
adaptorClassName = "org.antlr.v4.parse.GrammarASTAdaptor"; } adaptorClassName = "org.antlr.v4.parse.GrammarASTAdaptor"; }
@Test public void test_grammarSpec1() throws Exception { @Test public void test_grammarSpec1() throws Exception {
// gunit test on line 21 // gunit test on line 15
RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "parser grammar P; a : A;", 21); RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "parser grammar P; a : A;", 15);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(PARSER_GRAMMAR P (RULES (RULE a (BLOCK (ALT A)))))"; Object expecting = "(PARSER_GRAMMAR P (RULES (RULE a (BLOCK (ALT A)))))";
assertEquals("testing rule grammarSpec", expecting, actual); assertEquals("testing rule grammarSpec", expecting, actual);
} }
@Test public void test_grammarSpec2() throws Exception { @Test public void test_grammarSpec2() throws Exception {
// gunit test on line 24 // gunit test on line 18
RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "\n parser grammar P;\n options {k=2; output=AST;}\n scope S {int x}\n tokens { A; B='33'; }\n @header {foo}\n a : A;\n ", 24); RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "\n parser grammar P;\n options {k=2; output=AST;}\n scope S {int x}\n tokens { A; B='33'; }\n @header {foo}\n a : A;\n ", 18);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(PARSER_GRAMMAR P (OPTIONS (= k 2) (= output AST)) (scope S {int x}) (tokens { A (= B '33')) (@ header {foo}) (RULES (RULE a (BLOCK (ALT A)))))"; Object expecting = "(PARSER_GRAMMAR P (OPTIONS (= k 2) (= output AST)) (scope S {int x}) (tokens { A (= B '33')) (@ header {foo}) (RULES (RULE a (BLOCK (ALT A)))))";
assertEquals("testing rule grammarSpec", expecting, actual); assertEquals("testing rule grammarSpec", expecting, actual);
} }
@Test public void test_grammarSpec3() throws Exception { @Test public void test_grammarSpec3() throws Exception {
// gunit test on line 40 // gunit test on line 34
RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "\n parser grammar P;\n @header {foo}\n tokens { A; B='33'; }\n options {k=2; ASTLabel=a.b.c; output=AST;}\n scope S {int x}\n a : A;\n ", 40); RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "\n parser grammar P;\n @header {foo}\n tokens { A; B='33'; }\n options {k=2; ASTLabel=a.b.c; output=AST;}\n scope S {int x}\n a : A;\n ", 34);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(PARSER_GRAMMAR P (@ header {foo}) (tokens { A (= B '33')) (OPTIONS (= k 2) (= ASTLabel a.b.c) (= output AST)) (scope S {int x}) (RULES (RULE a (BLOCK (ALT A)))))"; Object expecting = "(PARSER_GRAMMAR P (@ header {foo}) (tokens { A (= B '33')) (OPTIONS (= k 2) (= ASTLabel a.b.c) (= output AST)) (scope S {int x}) (RULES (RULE a (BLOCK (ALT A)))))";
assertEquals("testing rule grammarSpec", expecting, actual); assertEquals("testing rule grammarSpec", expecting, actual);
} }
@Test public void test_grammarSpec4() throws Exception { @Test public void test_grammarSpec4() throws Exception {
// gunit test on line 56 // gunit test on line 50
RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "\n parser grammar P;\n import A=B, C;\n a : A;\n ", 56); RuleReturnScope rstruct = (RuleReturnScope)execParser("grammarSpec", "\n parser grammar P;\n import A=B, C;\n a : A;\n ", 50);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(PARSER_GRAMMAR P (import (= A B) C) (RULES (RULE a (BLOCK (ALT A)))))"; Object expecting = "(PARSER_GRAMMAR P (import (= A B) C) (RULES (RULE a (BLOCK (ALT A)))))";
assertEquals("testing rule grammarSpec", expecting, actual); assertEquals("testing rule grammarSpec", expecting, actual);
} @Test public void test_delegateGrammars1() throws Exception { } @Test public void test_delegateGrammars1() throws Exception {
// gunit test on line 67 // gunit test on line 61
RuleReturnScope rstruct = (RuleReturnScope)execParser("delegateGrammars", "import A;", 67); RuleReturnScope rstruct = (RuleReturnScope)execParser("delegateGrammars", "import A;", 61);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(import A)"; Object expecting = "(import A)";
assertEquals("testing rule delegateGrammars", expecting, actual); assertEquals("testing rule delegateGrammars", expecting, actual);
} @Test public void test_rule1() throws Exception { } @Test public void test_rule1() throws Exception {
// gunit test on line 70 // gunit test on line 64
RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "a : A<X,Y=a.b.c>;", 70); RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "a : A<X,Y=a.b.c>;", 64);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(RULE a (BLOCK (ALT (A (ELEMENT_OPTIONS X (= Y a.b.c))))))"; Object expecting = "(RULE a (BLOCK (ALT (A (ELEMENT_OPTIONS X (= Y a.b.c))))))";
assertEquals("testing rule rule", expecting, actual); assertEquals("testing rule rule", expecting, actual);
} }
@Test public void test_rule2() throws Exception { @Test public void test_rule2() throws Exception {
// gunit test on line 72 // gunit test on line 66
RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "A : B+;", 72); RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "A : B+;", 66);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(RULE A (BLOCK (ALT (+ (BLOCK (ALT B))))))"; Object expecting = "(RULE A (BLOCK (ALT (+ (BLOCK (ALT B))))))";
assertEquals("testing rule rule", expecting, actual); assertEquals("testing rule rule", expecting, actual);
} }
@Test public void test_rule3() throws Exception { @Test public void test_rule3() throws Exception {
// gunit test on line 74 // gunit test on line 68
RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n public a[int i] returns [int y]\n options {backtrack=true;}\n scope {int ss;}\n scope S,T;\n @init {blort}\n : ID ;\n ", 74); RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n public a[int i] returns [int y]\n options {backtrack=true;}\n scope {int ss;}\n scope S,T;\n @init {blort}\n : ID ;\n ", 68);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(RULE a (RULEMODIFIERS public) int i (returns int y) (OPTIONS (= backtrack true)) (scope {int ss;}) (scope S T) (@ init {blort}) (BLOCK (ALT ID)))"; Object expecting = "(RULE a (RULEMODIFIERS public) int i (returns int y) (OPTIONS (= backtrack true)) (scope {int ss;}) (scope S T) (@ init {blort}) (BLOCK (ALT ID)))";
assertEquals("testing rule rule", expecting, actual); assertEquals("testing rule rule", expecting, actual);
} }
@Test public void test_rule4() throws Exception { @Test public void test_rule4() throws Exception {
// gunit test on line 93 // gunit test on line 87
RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n a[int i] returns [int y]\n @init {blort}\n scope {int ss;}\n options {backtrack=true;}\n scope S,T;\n : ID;\n ", 93); RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n a[int i] returns [int y]\n @init {blort}\n scope {int ss;}\n options {backtrack=true;}\n scope S,T;\n : ID;\n ", 87);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(RULE a int i (returns int y) (@ init {blort}) (scope {int ss;}) (OPTIONS (= backtrack true)) (scope S T) (BLOCK (ALT ID)))"; Object expecting = "(RULE a int i (returns int y) (@ init {blort}) (scope {int ss;}) (OPTIONS (= backtrack true)) (scope S T) (BLOCK (ALT ID)))";
assertEquals("testing rule rule", expecting, actual); assertEquals("testing rule rule", expecting, actual);
} }
@Test public void test_rule5() throws Exception { @Test public void test_rule5() throws Exception {
// gunit test on line 110 // gunit test on line 104
RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n a : ID ;\n catch[A b] {foo}\n finally {bar}\n ", 110); RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n a : ID ;\n catch[A b] {foo}\n finally {bar}\n ", 104);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(RULE a (BLOCK (ALT ID)) (catch A b {foo}) (finally {bar}))"; Object expecting = "(RULE a (BLOCK (ALT ID)) (catch A b {foo}) (finally {bar}))";
assertEquals("testing rule rule", expecting, actual); assertEquals("testing rule rule", expecting, actual);
} }
@Test public void test_rule6() throws Exception { @Test public void test_rule6() throws Exception {
// gunit test on line 119 // gunit test on line 113
RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n a : ID ;\n catch[A a] {foo}\n catch[B b] {fu}\n finally {bar}\n ", 119); RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n a : ID ;\n catch[A a] {foo}\n catch[B b] {fu}\n finally {bar}\n ", 113);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(RULE a (BLOCK (ALT ID)) (catch A a {foo}) (catch B b {fu}) (finally {bar}))"; Object expecting = "(RULE a (BLOCK (ALT ID)) (catch A a {foo}) (catch B b {fu}) (finally {bar}))";
assertEquals("testing rule rule", expecting, actual); assertEquals("testing rule rule", expecting, actual);
} @Test public void test_block1() throws Exception { } @Test public void test_block1() throws Exception {
// gunit test on line 130 // gunit test on line 124
RuleReturnScope rstruct = (RuleReturnScope)execParser("block", "( ^(A B) | ^(b C) )", 130); RuleReturnScope rstruct = (RuleReturnScope)execParser("block", "( ^(A B) | ^(b C) )", 124);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(BLOCK (ALT (^( A B)) (ALT (^( b C)))"; Object expecting = "(BLOCK (ALT (^( A B)) (ALT (^( b C)))";
assertEquals("testing rule block", expecting, actual); assertEquals("testing rule block", expecting, actual);
} @Test public void test_alternative1() throws Exception { } @Test public void test_alternative1() throws Exception {
// gunit test on line 133 // gunit test on line 127
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "x+=ID* -> $x*", 133); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "x+=ID* -> $x*", 127);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT (* (BLOCK (ALT (+= x ID))))) (-> (ALT (* (BLOCK (ALT x))))))"; Object expecting = "(ALT_REWRITE (ALT (* (BLOCK (ALT (+= x ID))))) (-> (ALT (* (REWRITE_BLOCK (ALT x))))))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative2() throws Exception { @Test public void test_alternative2() throws Exception {
// gunit test on line 138 // gunit test on line 132
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> ...", 138); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> ...", 132);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> ...))"; Object expecting = "(ALT_REWRITE (ALT A) (-> ...))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative3() throws Exception { @Test public void test_alternative3() throws Exception {
// gunit test on line 139 // gunit test on line 133
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> ", 139); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> ", 133);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> EPSILON))"; Object expecting = "(ALT_REWRITE (ALT A) (-> EPSILON))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative4() throws Exception { @Test public void test_alternative4() throws Exception {
// gunit test on line 141 // gunit test on line 135
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> foo(a={x}, b={y})", 141); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> foo(a={x}, b={y})", 135);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> (TEMPLATE foo (ARGLIST (= a {x}) (= b {y})))))"; Object expecting = "(ALT_REWRITE (ALT A) (-> (TEMPLATE foo (ARGLIST (= a {x}) (= b {y})))))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative5() throws Exception { @Test public void test_alternative5() throws Exception {
// gunit test on line 146 // gunit test on line 140
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> template(a={x}, b={y}) <<ick>>", 146); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> template(a={x}, b={y}) <<ick>>", 140);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> (TEMPLATE (ARGLIST (= a {x}) (= b {y})) <<ick>>)))"; Object expecting = "(ALT_REWRITE (ALT A) (-> (TEMPLATE (ARGLIST (= a {x}) (= b {y})) <<ick>>)))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative6() throws Exception { @Test public void test_alternative6() throws Exception {
// gunit test on line 151 // gunit test on line 145
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> ({name})()", 151); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> ({name})()", 145);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> (TEMPLATE {name})))"; Object expecting = "(ALT_REWRITE (ALT A) (-> (TEMPLATE {name})))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative7() throws Exception { @Test public void test_alternative7() throws Exception {
// gunit test on line 153 // gunit test on line 147
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> {expr}", 153); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> {expr}", 147);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> {expr}))"; Object expecting = "(ALT_REWRITE (ALT A) (-> {expr}))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative8() throws Exception { @Test public void test_alternative8() throws Exception {
// gunit test on line 155 // gunit test on line 149
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "\n A -> {p1}? {e1}\n -> {e2}\n ->\n ", 155); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "\n A -> {p1}? {e1}\n -> {e2}\n ->\n ", 149);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> {p1}? {e1}) (-> {e2}))"; Object expecting = "(ALT_REWRITE (ALT A) (-> {p1}? {e1}) (-> {e2}))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative9() throws Exception { @Test public void test_alternative9() throws Exception {
// gunit test on line 166 // gunit test on line 160
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> A", 166); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> A", 160);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> (ALT A)))"; Object expecting = "(ALT_REWRITE (ALT A) (-> (ALT A)))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative10() throws Exception { @Test public void test_alternative10() throws Exception {
// gunit test on line 168 // gunit test on line 162
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "a -> a", 168); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "a -> a", 162);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT a) (-> (ALT a)))"; Object expecting = "(ALT_REWRITE (ALT a) (-> (ALT a)))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative11() throws Exception { @Test public void test_alternative11() throws Exception {
// gunit test on line 170 // gunit test on line 164
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "a A X? Y* -> A a ^(TOP X)? Y*", 170); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "a A X? Y* -> A a ^(TOP X)? Y*", 164);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT a A (? (BLOCK (ALT X))) (* (BLOCK (ALT Y)))) (-> (ALT A a (? (BLOCK (ALT (^( TOP X)))) (* (BLOCK (ALT Y))))))"; Object expecting = "(ALT_REWRITE (ALT a A (? (BLOCK (ALT X))) (* (BLOCK (ALT Y)))) (-> (ALT A a (? (REWRITE_BLOCK (ALT (^( TOP X)))) (* (REWRITE_BLOCK (ALT Y))))))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative12() throws Exception { @Test public void test_alternative12() throws Exception {
// gunit test on line 178 // gunit test on line 172
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> A[33]", 178); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> A[33]", 172);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> (ALT (A 33))))"; Object expecting = "(ALT_REWRITE (ALT A) (-> (ALT (A 33))))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative13() throws Exception { @Test public void test_alternative13() throws Exception {
// gunit test on line 180 // gunit test on line 174
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> 'int' ^(A A)*", 180); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "A -> 'int' ^(A A)*", 174);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> (ALT 'int' (* (BLOCK (ALT (^( A A)))))))"; Object expecting = "(ALT_REWRITE (ALT A) (-> (ALT 'int' (* (REWRITE_BLOCK (ALT (^( A A)))))))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} }
@Test public void test_alternative14() throws Exception { @Test public void test_alternative14() throws Exception {
// gunit test on line 185 // gunit test on line 179
RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "\n A -> {p1}? A\n -> {p2}? B\n ->\n ", 185); RuleReturnScope rstruct = (RuleReturnScope)execParser("alternative", "\n A -> {p1}? A\n -> {p2}? B\n ->\n ", 179);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(ALT_REWRITE (ALT A) (-> {p1}? (ALT A)) (-> {p2}? (ALT B)) (-> EPSILON))"; Object expecting = "(ALT_REWRITE (ALT A) (-> {p1}? (ALT A)) (-> {p2}? (ALT B)) (-> EPSILON))";
assertEquals("testing rule alternative", expecting, actual); assertEquals("testing rule alternative", expecting, actual);
} @Test public void test_element1() throws Exception { } @Test public void test_element1() throws Exception {
// gunit test on line 197 // gunit test on line 191
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "b+", 197); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "b+", 191);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT b)))"; Object expecting = "(+ (BLOCK (ALT b)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element2() throws Exception { @Test public void test_element2() throws Exception {
// gunit test on line 198 // gunit test on line 192
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "(b)+", 198); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "(b)+", 192);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT b)))"; Object expecting = "(+ (BLOCK (ALT b)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element3() throws Exception { @Test public void test_element3() throws Exception {
// gunit test on line 199 // gunit test on line 193
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "b?", 199); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "b?", 193);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(? (BLOCK (ALT b)))"; Object expecting = "(? (BLOCK (ALT b)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element4() throws Exception { @Test public void test_element4() throws Exception {
// gunit test on line 200 // gunit test on line 194
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "(b)?", 200); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "(b)?", 194);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(? (BLOCK (ALT b)))"; Object expecting = "(? (BLOCK (ALT b)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element5() throws Exception { @Test public void test_element5() throws Exception {
// gunit test on line 201 // gunit test on line 195
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "(b)*", 201); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "(b)*", 195);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT b)))"; Object expecting = "(* (BLOCK (ALT b)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element6() throws Exception { @Test public void test_element6() throws Exception {
// gunit test on line 202 // gunit test on line 196
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "b*", 202); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "b*", 196);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT b)))"; Object expecting = "(* (BLOCK (ALT b)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element7() throws Exception { @Test public void test_element7() throws Exception {
// gunit test on line 203 // gunit test on line 197
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "'while'*", 203); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "'while'*", 197);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT 'while')))"; Object expecting = "(* (BLOCK (ALT 'while')))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element8() throws Exception { @Test public void test_element8() throws Exception {
// gunit test on line 204 // gunit test on line 198
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "'a'+", 204); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "'a'+", 198);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT 'a')))"; Object expecting = "(+ (BLOCK (ALT 'a')))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element9() throws Exception { @Test public void test_element9() throws Exception {
// gunit test on line 205 // gunit test on line 199
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "a[3]", 205); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "a[3]", 199);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(a 3)"; Object expecting = "(a 3)";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element10() throws Exception { @Test public void test_element10() throws Exception {
// gunit test on line 206 // gunit test on line 200
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "'a'..'z'+", 206); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "'a'..'z'+", 200);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT (.. 'a' 'z'))))"; Object expecting = "(+ (BLOCK (ALT (.. 'a' 'z'))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element11() throws Exception { @Test public void test_element11() throws Exception {
// gunit test on line 207 // gunit test on line 201
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=ID", 207); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=ID", 201);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(= x ID)"; Object expecting = "(= x ID)";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element12() throws Exception { @Test public void test_element12() throws Exception {
// gunit test on line 208 // gunit test on line 202
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=ID?", 208); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=ID?", 202);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(? (BLOCK (ALT (= x ID))))"; Object expecting = "(? (BLOCK (ALT (= x ID))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element13() throws Exception { @Test public void test_element13() throws Exception {
// gunit test on line 209 // gunit test on line 203
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=ID*", 209); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=ID*", 203);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT (= x ID))))"; Object expecting = "(* (BLOCK (ALT (= x ID))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element14() throws Exception { @Test public void test_element14() throws Exception {
// gunit test on line 210 // gunit test on line 204
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=b", 210); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=b", 204);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(= x b)"; Object expecting = "(= x b)";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element15() throws Exception { @Test public void test_element15() throws Exception {
// gunit test on line 211 // gunit test on line 205
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=(A|B)", 211); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=(A|B)", 205);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(= x (BLOCK (ALT A) (ALT B)))"; Object expecting = "(= x (BLOCK (ALT A) (ALT B)))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element16() throws Exception { @Test public void test_element16() throws Exception {
// gunit test on line 212 // gunit test on line 206
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=~(A|B)", 212); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=~(A|B)", 206);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(= x (~ (BLOCK (ALT A) (ALT B))))"; Object expecting = "(= x (~ (BLOCK (ALT A) (ALT B))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element17() throws Exception { @Test public void test_element17() throws Exception {
// gunit test on line 213 // gunit test on line 207
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=~(A|B)", 213); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=~(A|B)", 207);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+= x (~ (BLOCK (ALT A) (ALT B))))"; Object expecting = "(+= x (~ (BLOCK (ALT A) (ALT B))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element18() throws Exception { @Test public void test_element18() throws Exception {
// gunit test on line 214 // gunit test on line 208
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=~(A|B)+", 214); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=~(A|B)+", 208);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT (+= x (~ (BLOCK (ALT A) (ALT B)))))))"; Object expecting = "(+ (BLOCK (ALT (+= x (~ (BLOCK (ALT A) (ALT B)))))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element19() throws Exception { @Test public void test_element19() throws Exception {
// gunit test on line 215 // gunit test on line 209
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=b+", 215); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=b+", 209);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT (= x b))))"; Object expecting = "(+ (BLOCK (ALT (= x b))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element20() throws Exception { @Test public void test_element20() throws Exception {
// gunit test on line 216 // gunit test on line 210
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=ID*", 216); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=ID*", 210);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT (+= x ID))))"; Object expecting = "(* (BLOCK (ALT (+= x ID))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element21() throws Exception { @Test public void test_element21() throws Exception {
// gunit test on line 217 // gunit test on line 211
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+='int'*", 217); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+='int'*", 211);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT (+= x 'int'))))"; Object expecting = "(* (BLOCK (ALT (+= x 'int'))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element22() throws Exception { @Test public void test_element22() throws Exception {
// gunit test on line 218 // gunit test on line 212
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=b+", 218); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=b+", 212);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(+ (BLOCK (ALT (+= x b))))"; Object expecting = "(+ (BLOCK (ALT (+= x b))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element23() throws Exception { @Test public void test_element23() throws Exception {
// gunit test on line 219 // gunit test on line 213
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "('*'^)*", 219); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "('*'^)*", 213);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT (^ '*'))))"; Object expecting = "(* (BLOCK (ALT (^ '*'))))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element24() throws Exception { @Test public void test_element24() throws Exception {
// gunit test on line 220 // gunit test on line 214
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "({blort} 'x')*", 220); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "({blort} 'x')*", 214);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(* (BLOCK (ALT {blort} 'x')))"; Object expecting = "(* (BLOCK (ALT {blort} 'x')))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element25() throws Exception { @Test public void test_element25() throws Exception {
// gunit test on line 221 // gunit test on line 215
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "A!", 221); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "A!", 215);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(! A)"; Object expecting = "(! A)";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element26() throws Exception { @Test public void test_element26() throws Exception {
// gunit test on line 222 // gunit test on line 216
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "A^", 222); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "A^", 216);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(^ A)"; Object expecting = "(^ A)";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);
} }
@Test public void test_element27() throws Exception { @Test public void test_element27() throws Exception {
// gunit test on line 223 // gunit test on line 217
RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=A^", 223); RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=A^", 217);
Object actual = ((Tree)rstruct.getTree()).toStringTree(); Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(= x (^ A))"; Object expecting = "(= x (^ A))";
assertEquals("testing rule element", expecting, actual); assertEquals("testing rule element", expecting, actual);