"
-BuildParseTrees() ::= "SetBuildParseTree(true);"
+BuildParseTrees() ::= "this.BuildParseTrees = true"
-BailErrorStrategy() ::= <%SetErrorHandler(new BailErrorStrategy());%>
+BailErrorStrategy() ::= <%SetErrorHandler(NewBailErrorStrategy());%>
ToStringTree(s) ::= <%.toStringTree(this)%>
@@ -243,7 +243,7 @@ package antlrtest
//@Override
func (this *PositionAdjustingLexer) NextToken() *Token {
if (!(_interp instanceof PositionAdjustingLexerATNSimulator)) {
- _interp = new PositionAdjustingLexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);
+ _interp = NewPositionAdjustingLexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);
}
return super.nextToken();
@@ -323,8 +323,8 @@ type LeafListener extends TBaseListener {
>>
WalkListener(s) ::= <<
-ParseTreeWalker walker = new ParseTreeWalker();
-walker.walk(new LeafListener(), );
+ParseTreeWalker walker = NewParseTreeWalker();
+walker.walk(NewLeafListener(), );
>>
TokenGetterListener(X) ::= <<
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java
index db8a2da00..d54e1bcd0 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java
@@ -14,7 +14,7 @@ public class TestCompositeLexers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"lexer grammar S;\n" +
- "A : 'a' {fmt.Println(\"S.A\");};\n" +
+ "A : 'a' {fmt.Println(\"S.A\")};\n" +
"C : 'c' ;";
writeFile(parserpkgdir, "S.g4", slave_S);
@@ -42,15 +42,15 @@ public class TestCompositeLexers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"lexer grammar S;\n" +
- "A : 'a' {fmt.Println(\"S.A\");} ;\n" +
- "B : 'b' {fmt.Println(\"S.B\");} ;";
+ "A : 'a' {fmt.Println(\"S.A\")} ;\n" +
+ "B : 'b' {fmt.Println(\"S.B\")} ;";
writeFile(parserpkgdir, "S.g4", slave_S);
- StringBuilder grammarBuilder = new StringBuilder(86);
+ StringBuilder grammarBuilder = new StringBuilder(85);
grammarBuilder.append("lexer grammar M;\n");
grammarBuilder.append("import S;\n");
- grammarBuilder.append("A : 'a' B {fmt.Println(\"M.A\");} ;\n");
+ grammarBuilder.append("A : 'a' B {fmt.Println(\"M.A\")} ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
String grammar = grammarBuilder.toString();
String input ="ab";
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java
index 65c5e71a5..35e51b1e1 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java
@@ -16,7 +16,7 @@ public class TestCompositeParsers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"parser grammar S;\n" +
- "a : '=' 'a' {fmt.Print(\"S.a\");};";
+ "a : '=' 'a' {fmt.Print(\"S.a\")};";
writeFile(parserpkgdir, "S.g4", slave_S);
StringBuilder grammarBuilder = new StringBuilder(54);
@@ -40,7 +40,7 @@ public class TestCompositeParsers extends BaseTest {
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
- "x : 'x' INT {fmt.Println(\"S.x\");};\n" +
+ "x : 'x' INT {fmt.Println(\"S.x\")};\n" +
"INT : '0'..'9'+ ;\n" +
"WS : (' '|'\\n') -> skip ;";
writeFile(parserpkgdir, "S.g4", slave_S);
@@ -65,13 +65,13 @@ public class TestCompositeParsers extends BaseTest {
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
- "y : A {fmt.Println(\"T.y\");};";
+ "y : A {fmt.Println(\"T.y\")};";
writeFile(parserpkgdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
- "x : A {fmt.Println(\"S.x\");};";
+ "x : A {fmt.Println(\"S.x\")};";
writeFile(parserpkgdir, "S.g4", slave_S);
StringBuilder grammarBuilder = new StringBuilder(598);
@@ -135,7 +135,7 @@ public class TestCompositeParsers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"parser grammar S;\n" +
- "a : B {fmt.Println(\"S.a\");};";
+ "a : B {fmt.Println(\"S.a\")};";
writeFile(parserpkgdir, "S.g4", slave_S);
StringBuilder grammarBuilder = new StringBuilder(104);
@@ -159,13 +159,13 @@ public class TestCompositeParsers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"parser grammar S;\n" +
- "a[int x] returns [int y] : B {fmt.Print(\"S.a\");} {$y=1000;} ;";
+ "a[int x] returns [int y] : B {fmt.Print(\"S.a\")} {$y=1000;} ;";
writeFile(parserpkgdir, "S.g4", slave_S);
- StringBuilder grammarBuilder = new StringBuilder(138);
+ StringBuilder grammarBuilder = new StringBuilder(137);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S;\n");
- grammarBuilder.append("s : label=a[3] {fmt.Println($label.y);} ;\n");
+ grammarBuilder.append("s : label=a[3] {fmt.Println($label.y)} ;\n");
grammarBuilder.append("B : 'b' ; // defines B from inherited token space\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
String grammar = grammarBuilder.toString();
@@ -183,13 +183,13 @@ public class TestCompositeParsers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"parser grammar S;\n" +
- "a : B {fmt.Print(\"S.a\");} ;";
+ "a : B {fmt.Print(\"S.a\")} ;";
writeFile(parserpkgdir, "S.g4", slave_S);
- StringBuilder grammarBuilder = new StringBuilder(126);
+ StringBuilder grammarBuilder = new StringBuilder(125);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S;\n");
- grammarBuilder.append("s : a {fmt.Print($a.text);} ;\n");
+ grammarBuilder.append("s : a {fmt.Print($a.text)} ;\n");
grammarBuilder.append("B : 'b' ; // defines B from inherited token space\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
String grammar = grammarBuilder.toString();
@@ -207,12 +207,12 @@ public class TestCompositeParsers extends BaseTest {
mkdir(parserpkgdir);
String slave_T =
"parser grammar T;\n" +
- "a : B {fmt.Println(\"T.a\");};";
+ "a : B {fmt.Println(\"T.a\")};";
writeFile(parserpkgdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
- "a : b {fmt.Println(\"S.a\");};\n" +
+ "a : b {fmt.Println(\"S.a\")};\n" +
"b : B;";
writeFile(parserpkgdir, "S.g4", slave_S);
@@ -237,7 +237,7 @@ public class TestCompositeParsers extends BaseTest {
mkdir(parserpkgdir);
String slave_S =
"parser grammar S;\n" +
- "a : b {fmt.Print(\"S.a\");};\n" +
+ "a : b {fmt.Print(\"S.a\")};\n" +
"b : B ;";
writeFile(parserpkgdir, "S.g4", slave_S);
@@ -262,19 +262,19 @@ public class TestCompositeParsers extends BaseTest {
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
- "b : 'b' {fmt.Println(\"T.b\");};";
+ "b : 'b' {fmt.Println(\"T.b\")};";
writeFile(parserpkgdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
- "a : b {fmt.Println(\"S.a\");};\n" +
+ "a : b {fmt.Println(\"S.a\")};\n" +
"b : 'b' ;";
writeFile(parserpkgdir, "S.g4", slave_S);
- StringBuilder grammarBuilder = new StringBuilder(88);
+ StringBuilder grammarBuilder = new StringBuilder(87);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");
- grammarBuilder.append("b : 'b'|'c' {fmt.Println(\"M.b\");}|B|A;\n");
+ grammarBuilder.append("b : 'b'|'c' {fmt.Println(\"M.b\")}|B|A;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
String grammar = grammarBuilder.toString();
String input ="c";
@@ -295,7 +295,7 @@ public class TestCompositeParsers extends BaseTest {
"parser grammar S;\n" +
"type_ : 'int' ;\n" +
"decl : type_ ID ';'\n" +
- " | type_ ID init ';' {fmt.Print(\"JavaDecl: \" + $text);};\n" +
+ " | type_ ID init ';' {fmt.Print(\"JavaDecl: \" + $text)};\n" +
"init : '=' INT;";
writeFile(parserpkgdir, "S.g4", slave_S);
@@ -404,11 +404,11 @@ public class TestCompositeParsers extends BaseTest {
"ID : 'a'..'z'+;";
writeFile(parserpkgdir, "S.g4", slave_S);
- StringBuilder grammarBuilder = new StringBuilder(115);
+ StringBuilder grammarBuilder = new StringBuilder(113);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S;\n");
- grammarBuilder.append("a : A {fmt.Println(\"M.a: \" + $A);};\n");
- grammarBuilder.append("A : 'abc' {fmt.Println(\"M.A\");};\n");
+ grammarBuilder.append("a : A {fmt.Println(\"M.a: \" + $A)};\n");
+ grammarBuilder.append("A : 'abc' {fmt.Println(\"M.A\")};\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
String grammar = grammarBuilder.toString();
String input ="abc";
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java
index 6cd26c13b..ed840ccc5 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java
@@ -12,9 +12,9 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testAmbigYieldsCtxSensitiveDFA() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(101);
+ StringBuilder grammarBuilder = new StringBuilder(97);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {this.DumpDFA();}\n");
+ grammarBuilder.append("s @after {p.DumpDFA()}\n");
grammarBuilder.append(" : ID | ID {} ;\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\t'|'\\n')+ -> skip ;");
@@ -34,11 +34,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testAmbiguityNoLoop() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(209);
+ StringBuilder grammarBuilder = new StringBuilder(208);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("prog\n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append(" : expr expr {fmt.Println(\"alt 1\");}\n");
+ grammarBuilder.append(" : expr expr {fmt.Println(\"alt 1\")}\n");
grammarBuilder.append(" | expr\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("expr: '@'\n");
@@ -65,9 +65,9 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testCtxSensitiveDFATwoDiffInput() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(165);
+ StringBuilder grammarBuilder = new StringBuilder(161);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {this.DumpDFA();}\n");
+ grammarBuilder.append("s @after {p.DumpDFA()}\n");
grammarBuilder.append(" : ('$' a | '@' b)+ ;\n");
grammarBuilder.append("a : e ID ;\n");
grammarBuilder.append("b : e INT ID ;\n");
@@ -96,9 +96,9 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testCtxSensitiveDFA_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(162);
+ StringBuilder grammarBuilder = new StringBuilder(158);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {this.DumpDFA();}\n");
+ grammarBuilder.append("s @after {p.DumpDFA()}\n");
grammarBuilder.append(" : '$' a | '@' b ;\n");
grammarBuilder.append("a : e ID ;\n");
grammarBuilder.append("b : e INT ID ;\n");
@@ -125,9 +125,9 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testCtxSensitiveDFA_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(162);
+ StringBuilder grammarBuilder = new StringBuilder(158);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {this.DumpDFA();}\n");
+ grammarBuilder.append("s @after {p.DumpDFA()}\n");
grammarBuilder.append(" : '$' a | '@' b ;\n");
grammarBuilder.append("a : e ID ;\n");
grammarBuilder.append("b : e INT ID ;\n");
@@ -154,11 +154,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testExprAmbiguity_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(283);
+ StringBuilder grammarBuilder = new StringBuilder(282);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append(": expr[0] {fmt.Println($expr.ctx.toStringTree(this));};\n");
+ grammarBuilder.append(": expr[0] {fmt.Println($expr.ctx.toStringTree(this))};\n");
grammarBuilder.append(" expr[int _p]\n");
grammarBuilder.append(" : ID \n");
grammarBuilder.append(" ( \n");
@@ -184,11 +184,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testExprAmbiguity_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(283);
+ StringBuilder grammarBuilder = new StringBuilder(282);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append(": expr[0] {fmt.Println($expr.ctx.toStringTree(this));};\n");
+ grammarBuilder.append(": expr[0] {fmt.Println($expr.ctx.toStringTree(this))};\n");
grammarBuilder.append(" expr[int _p]\n");
grammarBuilder.append(" : ID \n");
grammarBuilder.append(" ( \n");
@@ -216,11 +216,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testFullContextIF_THEN_ELSEParse_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(237);
+ StringBuilder grammarBuilder = new StringBuilder(233);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s \n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append("@after {this.DumpDFA();}\n");
+ grammarBuilder.append("@after {p.DumpDFA()}\n");
grammarBuilder.append(" : '{' stat* '}' ;\n");
grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n");
grammarBuilder.append(" | 'return'\n");
@@ -242,11 +242,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testFullContextIF_THEN_ELSEParse_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(237);
+ StringBuilder grammarBuilder = new StringBuilder(233);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s \n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append("@after {this.DumpDFA();}\n");
+ grammarBuilder.append("@after {p.DumpDFA()}\n");
grammarBuilder.append(" : '{' stat* '}' ;\n");
grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n");
grammarBuilder.append(" | 'return'\n");
@@ -271,11 +271,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testFullContextIF_THEN_ELSEParse_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(237);
+ StringBuilder grammarBuilder = new StringBuilder(233);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s \n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append("@after {this.DumpDFA();}\n");
+ grammarBuilder.append("@after {p.DumpDFA()}\n");
grammarBuilder.append(" : '{' stat* '}' ;\n");
grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n");
grammarBuilder.append(" | 'return'\n");
@@ -301,11 +301,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testFullContextIF_THEN_ELSEParse_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(237);
+ StringBuilder grammarBuilder = new StringBuilder(233);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s \n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append("@after {this.DumpDFA();}\n");
+ grammarBuilder.append("@after {p.DumpDFA()}\n");
grammarBuilder.append(" : '{' stat* '}' ;\n");
grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n");
grammarBuilder.append(" | 'return'\n");
@@ -332,11 +332,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testFullContextIF_THEN_ELSEParse_5() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(237);
+ StringBuilder grammarBuilder = new StringBuilder(233);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s \n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append("@after {this.DumpDFA();}\n");
+ grammarBuilder.append("@after {p.DumpDFA()}\n");
grammarBuilder.append(" : '{' stat* '}' ;\n");
grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n");
grammarBuilder.append(" | 'return'\n");
@@ -366,11 +366,11 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testFullContextIF_THEN_ELSEParse_6() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(237);
+ StringBuilder grammarBuilder = new StringBuilder(233);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s \n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
- grammarBuilder.append("@after {this.DumpDFA();}\n");
+ grammarBuilder.append("@after {p.DumpDFA()}\n");
grammarBuilder.append(" : '{' stat* '}' ;\n");
grammarBuilder.append("stat: 'if' ID 'then' stat ('else' ID)?\n");
grammarBuilder.append(" | 'return'\n");
@@ -400,14 +400,14 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testLoopsSimulateTailRecursion() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(309);
+ StringBuilder grammarBuilder = new StringBuilder(307);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("prog\n");
grammarBuilder.append("@init {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);}\n");
grammarBuilder.append(" : expr_or_assign*;\n");
grammarBuilder.append("expr_or_assign\n");
- grammarBuilder.append(" : expr '++' {fmt.Println(\"fail.\");}\n");
- grammarBuilder.append(" | expr {fmt.Println(\"pass: \"+$expr.text);}\n");
+ grammarBuilder.append(" : expr '++' {fmt.Println(\"fail.\")}\n");
+ grammarBuilder.append(" | expr {fmt.Println(\"pass: \"+$expr.text)}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("expr: expr_primary ('<-' ID)?;\n");
grammarBuilder.append("expr_primary\n");
@@ -432,9 +432,9 @@ public class TestFullContextParsing extends BaseTest {
@Test
public void testSLLSeesEOFInLLGrammar() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(149);
+ StringBuilder grammarBuilder = new StringBuilder(145);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {this.DumpDFA();}\n");
+ grammarBuilder.append("s @after {p.DumpDFA()}\n");
grammarBuilder.append(" : a;\n");
grammarBuilder.append("a : e ID ;\n");
grammarBuilder.append("b : e INT ID ;\n");
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java
index b91bad961..781650f04 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java
@@ -187,9 +187,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -215,9 +215,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_10() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -243,9 +243,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -271,9 +271,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -299,9 +299,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -327,9 +327,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_5() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -355,9 +355,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_6() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -383,9 +383,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_7() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -411,9 +411,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_8() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -439,9 +439,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDeclarations_9() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(392);
+ StringBuilder grammarBuilder = new StringBuilder(391);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : declarator EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : declarator EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("declarator\n");
grammarBuilder.append(" : declarator '[' e ']'\n");
grammarBuilder.append(" | declarator '[' ']'\n");
@@ -467,9 +467,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDirectCallToLeftRecursiveRule_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(120);
+ StringBuilder grammarBuilder = new StringBuilder(119);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a @after {fmt.Println($ctx.toStringTree(this));} : a ID\n");
+ grammarBuilder.append("a @after {fmt.Println($ctx.toStringTree(this))} : a ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -487,9 +487,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDirectCallToLeftRecursiveRule_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(120);
+ StringBuilder grammarBuilder = new StringBuilder(119);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a @after {fmt.Println($ctx.toStringTree(this));} : a ID\n");
+ grammarBuilder.append("a @after {fmt.Println($ctx.toStringTree(this))} : a ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -507,9 +507,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testDirectCallToLeftRecursiveRule_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(120);
+ StringBuilder grammarBuilder = new StringBuilder(119);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a @after {fmt.Println($ctx.toStringTree(this));} : a ID\n");
+ grammarBuilder.append("a @after {fmt.Println($ctx.toStringTree(this))} : a ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -527,9 +527,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -554,9 +554,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -581,9 +581,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -608,9 +608,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -635,9 +635,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_5() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -662,9 +662,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_6() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -689,9 +689,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testExpressions_7() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(251);
+ StringBuilder grammarBuilder = new StringBuilder(250);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("e : e '.' ID\n");
grammarBuilder.append(" | e '.' 'this'\n");
grammarBuilder.append(" | '-' e\n");
@@ -716,9 +716,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -787,9 +787,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_10() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -858,9 +858,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_11() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -929,9 +929,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_12() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1000,9 +1000,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1071,9 +1071,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1142,9 +1142,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1213,9 +1213,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_5() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1284,9 +1284,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_6() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1355,9 +1355,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_7() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1426,9 +1426,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_8() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1497,9 +1497,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testJavaExpressions_9() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(1248);
+ StringBuilder grammarBuilder = new StringBuilder(1247);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow\n");
grammarBuilder.append("expressionList\n");
grammarBuilder.append(" : e (',' e)*\n");
grammarBuilder.append(" ;\n");
@@ -1568,9 +1568,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testLabelsOnOpSubrule_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(171);
+ StringBuilder grammarBuilder = new StringBuilder(170);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}\n");
grammarBuilder.append(" | INT {}\n");
grammarBuilder.append(" | '(' x=e ')' {}\n");
@@ -1590,9 +1590,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testLabelsOnOpSubrule_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(171);
+ StringBuilder grammarBuilder = new StringBuilder(170);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}\n");
grammarBuilder.append(" | INT {}\n");
grammarBuilder.append(" | '(' x=e ')' {}\n");
@@ -1612,9 +1612,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testLabelsOnOpSubrule_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(171);
+ StringBuilder grammarBuilder = new StringBuilder(170);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}\n");
grammarBuilder.append(" | INT {}\n");
grammarBuilder.append(" | '(' x=e ')' {}\n");
@@ -1634,9 +1634,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleActionsPredicatesOptions_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(240);
+ StringBuilder grammarBuilder = new StringBuilder(239);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e ;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{true}?\n");
grammarBuilder.append(" | a=e op=('+'|'-') b=e {}{true}?\n");
grammarBuilder.append(" | INT {}{}\n");
@@ -1657,9 +1657,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleActionsPredicatesOptions_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(240);
+ StringBuilder grammarBuilder = new StringBuilder(239);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e ;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{true}?\n");
grammarBuilder.append(" | a=e op=('+'|'-') b=e {}{true}?\n");
grammarBuilder.append(" | INT {}{}\n");
@@ -1680,9 +1680,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleActionsPredicatesOptions_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(240);
+ StringBuilder grammarBuilder = new StringBuilder(239);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e ;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{true}?\n");
grammarBuilder.append(" | a=e op=('+'|'-') b=e {}{true}?\n");
grammarBuilder.append(" | INT {}{}\n");
@@ -1703,9 +1703,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleActions_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(178);
+ StringBuilder grammarBuilder = new StringBuilder(177);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e ;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{}\n");
grammarBuilder.append(" | INT {}{}\n");
grammarBuilder.append(" | '(' x=e ')' {}{}\n");
@@ -1725,9 +1725,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleActions_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(178);
+ StringBuilder grammarBuilder = new StringBuilder(177);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e ;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{}\n");
grammarBuilder.append(" | INT {}{}\n");
grammarBuilder.append(" | '(' x=e ')' {}{}\n");
@@ -1747,9 +1747,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleActions_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(178);
+ StringBuilder grammarBuilder = new StringBuilder(177);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e ;\n");
grammarBuilder.append("e : a=e op=('*'|'/') b=e {}{}\n");
grammarBuilder.append(" | INT {}{}\n");
grammarBuilder.append(" | '(' x=e ')' {}{}\n");
@@ -1769,16 +1769,16 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleAlternativesWithCommonLabel_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(723);
+ StringBuilder grammarBuilder = new StringBuilder(720);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);};\n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)};\n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : e '*' e {$v = ((BinaryContext)$ctx).e(0).v * ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | e '+' e {$v = ((BinaryContext)$ctx).e(0).v + ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n");
grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n");
- grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null);$v = $left.v + 1;} # unary\n");
- grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null);$v = $left.v - 1;} # unary\n");
+ grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null)$v = $left.v + 1;} # unary\n");
+ grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null)$v = $left.v - 1;} # unary\n");
grammarBuilder.append(" | ID {$v = 3;} # anID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -1799,16 +1799,16 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleAlternativesWithCommonLabel_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(723);
+ StringBuilder grammarBuilder = new StringBuilder(720);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);};\n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)};\n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : e '*' e {$v = ((BinaryContext)$ctx).e(0).v * ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | e '+' e {$v = ((BinaryContext)$ctx).e(0).v + ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n");
grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n");
- grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null);$v = $left.v + 1;} # unary\n");
- grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null);$v = $left.v - 1;} # unary\n");
+ grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null)$v = $left.v + 1;} # unary\n");
+ grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null)$v = $left.v - 1;} # unary\n");
grammarBuilder.append(" | ID {$v = 3;} # anID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -1829,16 +1829,16 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleAlternativesWithCommonLabel_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(723);
+ StringBuilder grammarBuilder = new StringBuilder(720);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);};\n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)};\n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : e '*' e {$v = ((BinaryContext)$ctx).e(0).v * ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | e '+' e {$v = ((BinaryContext)$ctx).e(0).v + ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n");
grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n");
- grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null);$v = $left.v + 1;} # unary\n");
- grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null);$v = $left.v - 1;} # unary\n");
+ grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null)$v = $left.v + 1;} # unary\n");
+ grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null)$v = $left.v - 1;} # unary\n");
grammarBuilder.append(" | ID {$v = 3;} # anID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -1859,16 +1859,16 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testMultipleAlternativesWithCommonLabel_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(723);
+ StringBuilder grammarBuilder = new StringBuilder(720);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);};\n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)};\n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : e '*' e {$v = ((BinaryContext)$ctx).e(0).v * ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | e '+' e {$v = ((BinaryContext)$ctx).e(0).v + ((BinaryContext)$ctx).e(1).v;} # binary\n");
grammarBuilder.append(" | INT {$v = $INT.int;} # anInt\n");
grammarBuilder.append(" | '(' e ')' {$v = $e.v;} # parens\n");
- grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null);$v = $left.v + 1;} # unary\n");
- grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null);$v = $left.v - 1;} # unary\n");
+ grammarBuilder.append(" | left=e INC {assert(((UnaryContext)$ctx).INC() != null)$v = $left.v + 1;} # unary\n");
+ grammarBuilder.append(" | left=e DEC {assert(((UnaryContext)$ctx).DEC() != null)$v = $left.v - 1;} # unary\n");
grammarBuilder.append(" | ID {$v = 3;} # anID\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -1889,10 +1889,10 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testPrecedenceFilterConsidersContext() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(143);
+ StringBuilder grammarBuilder = new StringBuilder(142);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("prog \n");
- grammarBuilder.append("@after {fmt.Println($ctx.toStringTree(this));}\n");
+ grammarBuilder.append("@after {fmt.Println($ctx.toStringTree(this))}\n");
grammarBuilder.append(": statement* EOF {};\n");
grammarBuilder.append("statement: letterA | statement letterA 'b' ;\n");
grammarBuilder.append("letterA: 'a';");
@@ -1909,9 +1909,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testPrefixOpWithActionAndLabel_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(336);
+ StringBuilder grammarBuilder = new StringBuilder(335);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.result);} ;\n");
+ grammarBuilder.append("s : e {fmt.Println($e.result)} ;\n");
grammarBuilder.append("e returns [String result]\n");
grammarBuilder.append(" : ID '=' e1=e {$result = \"(\" + $ID.text + \"=\" + $e1.result + \")\";}\n");
grammarBuilder.append(" | ID {$result = $ID.text;}\n");
@@ -1933,9 +1933,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testPrefixOpWithActionAndLabel_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(336);
+ StringBuilder grammarBuilder = new StringBuilder(335);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.result);} ;\n");
+ grammarBuilder.append("s : e {fmt.Println($e.result)} ;\n");
grammarBuilder.append("e returns [String result]\n");
grammarBuilder.append(" : ID '=' e1=e {$result = \"(\" + $ID.text + \"=\" + $e1.result + \")\";}\n");
grammarBuilder.append(" | ID {$result = $ID.text;}\n");
@@ -1957,9 +1957,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testPrefixOpWithActionAndLabel_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(336);
+ StringBuilder grammarBuilder = new StringBuilder(335);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.result);} ;\n");
+ grammarBuilder.append("s : e {fmt.Println($e.result)} ;\n");
grammarBuilder.append("e returns [String result]\n");
grammarBuilder.append(" : ID '=' e1=e {$result = \"(\" + $ID.text + \"=\" + $e1.result + \")\";}\n");
grammarBuilder.append(" | ID {$result = $ID.text;}\n");
@@ -1981,9 +1981,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsAndLabels_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(454);
+ StringBuilder grammarBuilder = new StringBuilder(453);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : q=e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : q=e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n");
@@ -2009,9 +2009,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsAndLabels_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(454);
+ StringBuilder grammarBuilder = new StringBuilder(453);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : q=e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : q=e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n");
@@ -2037,9 +2037,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsAndLabels_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(454);
+ StringBuilder grammarBuilder = new StringBuilder(453);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : q=e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : q=e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n");
@@ -2065,9 +2065,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsAndLabels_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(454);
+ StringBuilder grammarBuilder = new StringBuilder(453);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : q=e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : q=e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v]\n");
grammarBuilder.append(" : a=e op='*' b=e {$v = $a.v * $b.v;} # mult\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;} # add\n");
@@ -2093,9 +2093,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList1_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(301);
+ StringBuilder grammarBuilder = new StringBuilder(300);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n");
@@ -2120,9 +2120,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList1_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(301);
+ StringBuilder grammarBuilder = new StringBuilder(300);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n");
@@ -2147,9 +2147,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList1_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(301);
+ StringBuilder grammarBuilder = new StringBuilder(300);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n");
@@ -2174,9 +2174,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList1_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(301);
+ StringBuilder grammarBuilder = new StringBuilder(300);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr (',' b+=expr)* '>>' c=expr #Send\n");
@@ -2201,9 +2201,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList2_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(318);
+ StringBuilder grammarBuilder = new StringBuilder(317);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n");
@@ -2227,9 +2227,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList2_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(318);
+ StringBuilder grammarBuilder = new StringBuilder(317);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n");
@@ -2253,9 +2253,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList2_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(318);
+ StringBuilder grammarBuilder = new StringBuilder(317);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n");
@@ -2279,9 +2279,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActionsList2_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(318);
+ StringBuilder grammarBuilder = new StringBuilder(317);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : expr EOF;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : expr EOF;\n");
grammarBuilder.append("expr:\n");
grammarBuilder.append(" a=expr '*' a=expr #Factor\n");
grammarBuilder.append(" | b+=expr ',' b+=expr #Comma\n");
@@ -2305,9 +2305,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActions_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(254);
+ StringBuilder grammarBuilder = new StringBuilder(253);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v, List ignored]\n");
grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n");
@@ -2329,9 +2329,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActions_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(254);
+ StringBuilder grammarBuilder = new StringBuilder(253);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v, List ignored]\n");
grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n");
@@ -2353,9 +2353,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActions_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(254);
+ StringBuilder grammarBuilder = new StringBuilder(253);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v, List ignored]\n");
grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n");
@@ -2377,9 +2377,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testReturnValueAndActions_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(254);
+ StringBuilder grammarBuilder = new StringBuilder(253);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : e {fmt.Println($e.v);}; \n");
+ grammarBuilder.append("s : e {fmt.Println($e.v)}; \n");
grammarBuilder.append("e returns [int v, List ignored]\n");
grammarBuilder.append(" : a=e '*' b=e {$v = $a.v * $b.v;}\n");
grammarBuilder.append(" | a=e '+' b=e {$v = $a.v + $b.v;}\n");
@@ -2401,9 +2401,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testSemPred() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(136);
+ StringBuilder grammarBuilder = new StringBuilder(135);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : a ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : a ;\n");
grammarBuilder.append("a : a {true}? ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
@@ -2422,9 +2422,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testSemPredFailOption() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(160);
+ StringBuilder grammarBuilder = new StringBuilder(159);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : a ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : a ;\n");
grammarBuilder.append("a : a ID {false}?\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
@@ -2444,9 +2444,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testSimple_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(128);
+ StringBuilder grammarBuilder = new StringBuilder(127);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : a ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : a ;\n");
grammarBuilder.append("a : a ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
@@ -2465,9 +2465,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testSimple_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(128);
+ StringBuilder grammarBuilder = new StringBuilder(127);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : a ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : a ;\n");
grammarBuilder.append("a : a ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
@@ -2486,9 +2486,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testSimple_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(128);
+ StringBuilder grammarBuilder = new StringBuilder(127);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : a ;\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : a ;\n");
grammarBuilder.append("a : a ID\n");
grammarBuilder.append(" | ID\n");
grammarBuilder.append(" ;\n");
@@ -2507,9 +2507,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2531,9 +2531,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2555,9 +2555,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2579,9 +2579,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2603,9 +2603,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_5() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2627,9 +2627,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_6() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2651,9 +2651,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_7() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2675,9 +2675,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_8() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2699,9 +2699,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExprExplicitAssociativity_9() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(284);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2723,9 +2723,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2747,9 +2747,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2771,9 +2771,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2795,9 +2795,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_4() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2819,9 +2819,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_5() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2843,9 +2843,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_6() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2867,9 +2867,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_7() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2891,9 +2891,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_8() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
@@ -2915,9 +2915,9 @@ public class TestLeftRecursion extends BaseTest {
@Test
public void testTernaryExpr_9() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(259);
+ StringBuilder grammarBuilder = new StringBuilder(258);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this));} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
+ grammarBuilder.append("s @after {fmt.Println($ctx.toStringTree(this))} : e EOF ; // must indicate EOF can follow or 'a' won't match\n");
grammarBuilder.append("e : e '*' e\n");
grammarBuilder.append(" | e '+' e\n");
grammarBuilder.append(" | e '?' e ':' e\n");
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java
index 6af499853..1deac6765 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java
@@ -13,13 +13,13 @@ public class TestLexerExec extends BaseTest {
public void testActionPlacement() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(288);
+ StringBuilder grammarBuilder = new StringBuilder(283);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : ({fmt.Println(\"stuff fail: \" + this.GetText());} 'a'\n");
- grammarBuilder.append("| {fmt.Println(\"stuff0: \" + this.GetText());}\n");
- grammarBuilder.append(" 'a' {fmt.Println(\"stuff1: \" + this.GetText());}\n");
- grammarBuilder.append(" 'b' {fmt.Println(\"stuff2: \" + this.GetText());})\n");
- grammarBuilder.append(" {fmt.Println(this.GetText());} ;\n");
+ grammarBuilder.append("I : ({fmt.Println(\"stuff fail: \" + this.GetText())} 'a'\n");
+ grammarBuilder.append("| {fmt.Println(\"stuff0: \" + this.GetText())}\n");
+ grammarBuilder.append(" 'a' {fmt.Println(\"stuff1: \" + this.GetText())}\n");
+ grammarBuilder.append(" 'b' {fmt.Println(\"stuff2: \" + this.GetText())})\n");
+ grammarBuilder.append(" {fmt.Println(this.GetText())} ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n");
grammarBuilder.append("J : .;");
String grammar = grammarBuilder.toString();
@@ -40,9 +40,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(79);
+ StringBuilder grammarBuilder = new StringBuilder(78);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : '0'..'9'+ {fmt.Println(\"I\");} ;\n");
+ grammarBuilder.append("I : '0'..'9'+ {fmt.Println(\"I\")} ;\n");
grammarBuilder.append("WS : [ \\n\\u000D] -> skip ;");
String grammar = grammarBuilder.toString();
String input =
@@ -63,9 +63,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetInSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(86);
+ StringBuilder grammarBuilder = new StringBuilder(85);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : (~[ab \\n]|'a') {fmt.Println(\"I\");} ;\n");
+ grammarBuilder.append("I : (~[ab \\n]|'a') {fmt.Println(\"I\")} ;\n");
grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="a x";
@@ -84,9 +84,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetNot() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(89);
+ StringBuilder grammarBuilder = new StringBuilder(88);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : ~[ab \\n] ~[ \\ncd]* {fmt.Println(\"I\");} ;\n");
+ grammarBuilder.append("I : ~[ab \\n] ~[ \\ncd]* {fmt.Println(\"I\")} ;\n");
grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="xaf";
@@ -103,9 +103,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetPlus() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(80);
+ StringBuilder grammarBuilder = new StringBuilder(79);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : '0'..'9'+ {fmt.Println(\"I\");} ;\n");
+ grammarBuilder.append("I : '0'..'9'+ {fmt.Println(\"I\")} ;\n");
grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input =
@@ -126,10 +126,10 @@ public class TestLexerExec extends BaseTest {
public void testCharSetRange() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(129);
+ StringBuilder grammarBuilder = new StringBuilder(127);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : [0-9]+ {fmt.Println(\"I\");} ;\n");
- grammarBuilder.append("ID : [a-zA-Z] [a-zA-Z0-9]* {fmt.Println(\"ID\");} ;\n");
+ grammarBuilder.append("I : [0-9]+ {fmt.Println(\"I\")} ;\n");
+ grammarBuilder.append("ID : [a-zA-Z] [a-zA-Z0-9]* {fmt.Println(\"ID\")} ;\n");
grammarBuilder.append("WS : [ \\n\\u0009\\r]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input =
@@ -155,9 +155,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetWithEscapedChar() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(88);
+ StringBuilder grammarBuilder = new StringBuilder(87);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("DASHBRACK : [\\-\\]]+ {fmt.Println(\"DASHBRACK\");} ;\n");
+ grammarBuilder.append("DASHBRACK : [\\-\\]]+ {fmt.Println(\"DASHBRACK\")} ;\n");
grammarBuilder.append("WS : [ \\u]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="- ] ";
@@ -176,9 +176,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetWithMissingEndRange() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(76);
+ StringBuilder grammarBuilder = new StringBuilder(75);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : [0-]+ {fmt.Println(\"I\");} ;\n");
+ grammarBuilder.append("I : [0-]+ {fmt.Println(\"I\")} ;\n");
grammarBuilder.append("WS : [ \\n\\u000D]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="00\n";
@@ -195,9 +195,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetWithMissingEscapeChar() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(71);
+ StringBuilder grammarBuilder = new StringBuilder(70);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : [0-9]+ {fmt.Println(\"I\");} ;\n");
+ grammarBuilder.append("I : [0-9]+ {fmt.Println(\"I\")} ;\n");
grammarBuilder.append("WS : [ \\u]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="34 ";
@@ -214,9 +214,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetWithQuote1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(74);
+ StringBuilder grammarBuilder = new StringBuilder(73);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("A : [\"a-z]+ {fmt.Println(\"A\");} ;\n");
+ grammarBuilder.append("A : [\"a-z]+ {fmt.Println(\"A\")} ;\n");
grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="b\"a";
@@ -233,9 +233,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetWithQuote2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(75);
+ StringBuilder grammarBuilder = new StringBuilder(74);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("A : [\"\\\\ab]+ {fmt.Println(\"A\");} ;\n");
+ grammarBuilder.append("A : [\"\\\\ab]+ {fmt.Println(\"A\")} ;\n");
grammarBuilder.append("WS : [ \\n\\t]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="b\"\\a";
@@ -252,9 +252,9 @@ public class TestLexerExec extends BaseTest {
public void testCharSetWithReversedRange() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(72);
+ StringBuilder grammarBuilder = new StringBuilder(71);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("A : [z-a9]+ {fmt.Println(\"A\");} ;\n");
+ grammarBuilder.append("A : [z-a9]+ {fmt.Println(\"A\")} ;\n");
grammarBuilder.append("WS : [ \\u]+ -> skip ;");
String grammar = grammarBuilder.toString();
String input ="9";
@@ -345,9 +345,9 @@ public class TestLexerExec extends BaseTest {
public void testGreedyConfigs() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(99);
+ StringBuilder grammarBuilder = new StringBuilder(98);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : ('a' | 'ab') {fmt.Println(this.GetText());} ;\n");
+ grammarBuilder.append("I : ('a' | 'ab') {fmt.Println(this.GetText())} ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n");
grammarBuilder.append("J : .;");
String grammar = grammarBuilder.toString();
@@ -4503,11 +4503,11 @@ public class TestLexerExec extends BaseTest {
public void testNonGreedyConfigs() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(134);
+ StringBuilder grammarBuilder = new StringBuilder(132);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("I : .*? ('a' | 'ab') {fmt.Println(this.GetText());} ;\n");
+ grammarBuilder.append("I : .*? ('a' | 'ab') {fmt.Println(this.GetText())} ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;\n");
- grammarBuilder.append("J : . {fmt.Println(this.GetText());};");
+ grammarBuilder.append("J : . {fmt.Println(this.GetText())};");
String grammar = grammarBuilder.toString();
String input ="ab";
String found = execLexer("L.g4", grammar, "L", input, false);
@@ -4625,7 +4625,7 @@ public class TestLexerExec extends BaseTest {
public void testPositionAdjustingLexer() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(2634);
+ StringBuilder grammarBuilder = new StringBuilder(2633);
grammarBuilder.append("lexer grammar PositionAdjustingLexer;\n");
grammarBuilder.append("\n");
grammarBuilder.append("@members {\n");
@@ -4634,7 +4634,7 @@ public class TestLexerExec extends BaseTest {
grammarBuilder.append("//@Override\n");
grammarBuilder.append("func (this *PositionAdjustingLexer) NextToken() *Token {\n");
grammarBuilder.append(" if (!(_interp instanceof PositionAdjustingLexerATNSimulator)) {\n");
- grammarBuilder.append(" _interp = new PositionAdjustingLexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);\n");
+ grammarBuilder.append(" _interp = NewPositionAdjustingLexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);\n");
grammarBuilder.append(" }\n");
grammarBuilder.append("\n");
grammarBuilder.append(" return super.nextToken();\n");
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java
index 183ff6f00..4290649fe 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java
@@ -12,7 +12,7 @@ public class TestListeners extends BaseTest {
@Test
public void testBasic() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(436);
+ StringBuilder grammarBuilder = new StringBuilder(433);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -27,9 +27,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : INT INT\n");
@@ -56,7 +56,7 @@ public class TestListeners extends BaseTest {
@Test
public void testLR() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(610);
+ StringBuilder grammarBuilder = new StringBuilder(607);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -75,9 +75,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=e ;\n");
grammarBuilder.append("e : e op='*' e\n");
@@ -108,7 +108,7 @@ public class TestListeners extends BaseTest {
@Test
public void testLRWithLabels() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(600);
+ StringBuilder grammarBuilder = new StringBuilder(597);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -126,9 +126,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=e ;\n");
grammarBuilder.append("e : e '(' eList ')' # Call\n");
@@ -158,7 +158,7 @@ public class TestListeners extends BaseTest {
@Test
public void testRuleGetters_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(627);
+ StringBuilder grammarBuilder = new StringBuilder(624);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -177,9 +177,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : b b // forces list\n");
@@ -206,7 +206,7 @@ public class TestListeners extends BaseTest {
@Test
public void testRuleGetters_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(627);
+ StringBuilder grammarBuilder = new StringBuilder(624);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -225,9 +225,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : b b // forces list\n");
@@ -254,7 +254,7 @@ public class TestListeners extends BaseTest {
@Test
public void testTokenGetters_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(571);
+ StringBuilder grammarBuilder = new StringBuilder(568);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -273,9 +273,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : INT INT\n");
@@ -301,7 +301,7 @@ public class TestListeners extends BaseTest {
@Test
public void testTokenGetters_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(571);
+ StringBuilder grammarBuilder = new StringBuilder(568);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::header {\n");
grammarBuilder.append("}\n");
@@ -320,9 +320,9 @@ public class TestListeners extends BaseTest {
grammarBuilder.append("\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this));\n");
- grammarBuilder.append("ParseTreeWalker walker = new ParseTreeWalker();\n");
- grammarBuilder.append("walker.walk(new LeafListener(), $ctx.r);\n");
+ grammarBuilder.append("fmt.Println($ctx.r.toStringTree(this))\n");
+ grammarBuilder.append("ParseTreeWalker walker = NewParseTreeWalker();\n");
+ grammarBuilder.append("walker.walk(NewLeafListener(), $ctx.r);\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : INT INT\n");
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java
index 4c1fccee3..c7bc9a312 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java
@@ -12,14 +12,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void test2AltLoop() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(133);
+ StringBuilder grammarBuilder = new StringBuilder(135);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : ('x' | 'y')* 'z'\n");
@@ -37,14 +37,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void test2Alts() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(126);
+ StringBuilder grammarBuilder = new StringBuilder(128);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : 'x' | 'y'\n");
@@ -62,14 +62,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void testExtraToken() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(139);
+ StringBuilder grammarBuilder = new StringBuilder(141);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : 'x' 'y'\n");
@@ -91,14 +91,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void testNoViableAlt() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(141);
+ StringBuilder grammarBuilder = new StringBuilder(143);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : 'x' | 'y'\n");
@@ -120,14 +120,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void testRuleRef() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(135);
+ StringBuilder grammarBuilder = new StringBuilder(137);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : b 'x'\n");
@@ -147,14 +147,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void testSync() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(142);
+ StringBuilder grammarBuilder = new StringBuilder(144);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : 'x' 'y'* '!'\n");
@@ -175,14 +175,14 @@ public class TestParseTrees extends BaseTest {
@Test
public void testToken2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(124);
+ StringBuilder grammarBuilder = new StringBuilder(126);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : 'x' 'y'\n");
@@ -200,18 +200,18 @@ public class TestParseTrees extends BaseTest {
@Test
public void testTokenAndRuleContextString() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(162);
+ StringBuilder grammarBuilder = new StringBuilder(163);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s\n");
grammarBuilder.append("@init {\n");
- grammarBuilder.append("SetBuildParseTree(true);\n");
+ grammarBuilder.append("this.BuildParseTrees = true\n");
grammarBuilder.append("}\n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($r.ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : r=a ;\n");
grammarBuilder.append("a : 'x' { \n");
- grammarBuilder.append("fmt.Println(GetRuleInvocationStack());\n");
+ grammarBuilder.append("fmt.Println(GetRuleInvocationStack())\n");
grammarBuilder.append("} ;");
String grammar = grammarBuilder.toString();
String input ="x";
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java
index 2ff97c036..587ecddc7 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java
@@ -12,9 +12,9 @@ public class TestParserErrors extends BaseTest {
@Test
public void testConjuringUpToken() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(63);
+ StringBuilder grammarBuilder = new StringBuilder(62);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : 'a' x='b' {fmt.Println(\"conjured=\" + $x);} 'c' ;");
+ grammarBuilder.append("a : 'a' x='b' {fmt.Println(\"conjured=\" + $x)} 'c' ;");
String grammar = grammarBuilder.toString();
String input ="ac";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -29,9 +29,9 @@ public class TestParserErrors extends BaseTest {
@Test
public void testConjuringUpTokenFromSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(69);
+ StringBuilder grammarBuilder = new StringBuilder(68);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : 'a' x=('b'|'c') {fmt.Println(\"conjured=\" + $x);} 'd' ;");
+ grammarBuilder.append("a : 'a' x=('b'|'c') {fmt.Println(\"conjured=\" + $x)} 'd' ;");
String grammar = grammarBuilder.toString();
String input ="ad";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -46,7 +46,7 @@ public class TestParserErrors extends BaseTest {
@Test
public void testContextListGetters() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(207);
+ StringBuilder grammarBuilder = new StringBuilder(205);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members{\n");
grammarBuilder.append("func foo() {\n");
@@ -56,8 +56,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append("}\n");
grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n");
- grammarBuilder.append("a : 'a' {fmt.Print('a');};\n");
- grammarBuilder.append("b : 'b' {fmt.Print('b');};");
+ grammarBuilder.append("a : 'a' {fmt.Print('a')};\n");
+ grammarBuilder.append("b : 'b' {fmt.Print('b')};");
String grammar = grammarBuilder.toString();
String input ="abab";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -184,7 +184,7 @@ public class TestParserErrors extends BaseTest {
@Test
public void testLL1ErrorInfo() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(299);
+ StringBuilder grammarBuilder = new StringBuilder(298);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("start : animal (AND acClass)? service EOF;\n");
grammarBuilder.append("animal : (DOG | CAT );\n");
@@ -197,7 +197,7 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append("WS : ' ' -> skip ;\n");
grammarBuilder.append("acClass\n");
grammarBuilder.append("@init\n");
- grammarBuilder.append("{fmt.Println(this.GetExpectedTokens().toString(this.tokenNames));}\n");
+ grammarBuilder.append("{fmt.Println(this.GetExpectedTokens().toString(this.tokenNames))}\n");
grammarBuilder.append(" : ;");
String grammar = grammarBuilder.toString();
String input ="dog and software";
@@ -383,10 +383,10 @@ public class TestParserErrors extends BaseTest {
@Test
public void testSingleSetInsertionConsumption() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(82);
+ StringBuilder grammarBuilder = new StringBuilder(81);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("myset: ('b'|'c') ;\n");
- grammarBuilder.append("a: 'a' myset 'd' {fmt.Println(\"\" + $myset.stop);} ; ");
+ grammarBuilder.append("a: 'a' myset 'd' {fmt.Println(\"\" + $myset.stop)} ; ");
String grammar = grammarBuilder.toString();
String input ="ad";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -496,10 +496,10 @@ public class TestParserErrors extends BaseTest {
@Test
public void testSingleTokenDeletionConsumption() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(82);
+ StringBuilder grammarBuilder = new StringBuilder(81);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("myset: ('b'|'c') ;\n");
- grammarBuilder.append("a: 'a' myset 'd' {fmt.Println(\"\" + $myset.stop);} ; ");
+ grammarBuilder.append("a: 'a' myset 'd' {fmt.Println(\"\" + $myset.stop)} ; ");
String grammar = grammarBuilder.toString();
String input ="aabd";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java
index 8a128c126..60eb9726f 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java
@@ -12,10 +12,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testAPlus() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(84);
+ StringBuilder grammarBuilder = new StringBuilder(83);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : ID+ {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -32,10 +32,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testAStar_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(84);
+ StringBuilder grammarBuilder = new StringBuilder(83);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : ID* {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -52,10 +52,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testAStar_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(84);
+ StringBuilder grammarBuilder = new StringBuilder(83);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : ID* {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -72,10 +72,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorAPlus() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(89);
+ StringBuilder grammarBuilder = new StringBuilder(88);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|ID)+ {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -92,10 +92,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorAStar_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(89);
+ StringBuilder grammarBuilder = new StringBuilder(88);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|ID)* {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -112,10 +112,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorAStar_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(89);
+ StringBuilder grammarBuilder = new StringBuilder(88);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|ID)* {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -132,12 +132,12 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorB() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(136);
+ StringBuilder grammarBuilder = new StringBuilder(134);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : ID {\n");
- grammarBuilder.append("fmt.Println(\"alt 1\");\n");
+ grammarBuilder.append("fmt.Println(\"alt 1\")\n");
grammarBuilder.append("} | INT {\n");
- grammarBuilder.append("fmt.Println(\"alt 2\");\n");
+ grammarBuilder.append("fmt.Println(\"alt 2\")\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -155,11 +155,11 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorBPlus() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(112);
+ StringBuilder grammarBuilder = new StringBuilder(111);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|INT{\n");
grammarBuilder.append("})+ {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -177,11 +177,11 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorBStar_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(112);
+ StringBuilder grammarBuilder = new StringBuilder(111);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|INT{\n");
grammarBuilder.append("})* {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -199,11 +199,11 @@ public class TestParserExec extends BaseTest {
@Test
public void testAorBStar_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(112);
+ StringBuilder grammarBuilder = new StringBuilder(111);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|INT{\n");
grammarBuilder.append("})* {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -221,10 +221,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testBasic() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(105);
+ StringBuilder grammarBuilder = new StringBuilder(104);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : ID INT {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -259,12 +259,12 @@ public class TestParserExec extends BaseTest {
@Test
public void testIfIfElseGreedyBinding1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(193);
+ StringBuilder grammarBuilder = new StringBuilder(192);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("start : statement+ ;\n");
grammarBuilder.append("statement : 'x' | ifStatement;\n");
grammarBuilder.append("ifStatement : 'if' 'y' statement ('else' statement)? {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);");
@@ -283,12 +283,12 @@ public class TestParserExec extends BaseTest {
@Test
public void testIfIfElseGreedyBinding2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(193);
+ StringBuilder grammarBuilder = new StringBuilder(192);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("start : statement+ ;\n");
grammarBuilder.append("statement : 'x' | ifStatement;\n");
grammarBuilder.append("ifStatement : 'if' 'y' statement ('else' statement|) {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);");
@@ -307,12 +307,12 @@ public class TestParserExec extends BaseTest {
@Test
public void testIfIfElseNonGreedyBinding1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(194);
+ StringBuilder grammarBuilder = new StringBuilder(193);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("start : statement+ ;\n");
grammarBuilder.append("statement : 'x' | ifStatement;\n");
grammarBuilder.append("ifStatement : 'if' 'y' statement ('else' statement)?? {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);");
@@ -331,12 +331,12 @@ public class TestParserExec extends BaseTest {
@Test
public void testIfIfElseNonGreedyBinding2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(193);
+ StringBuilder grammarBuilder = new StringBuilder(192);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("start : statement+ ;\n");
grammarBuilder.append("statement : 'x' | ifStatement;\n");
grammarBuilder.append("ifStatement : 'if' 'y' statement (|'else' statement) {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> channel(HIDDEN);");
@@ -355,10 +355,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testLL1OptionalBlock_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(110);
+ StringBuilder grammarBuilder = new StringBuilder(109);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|{}INT)? {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("INT : '0'..'9'+ ;\n");
@@ -376,10 +376,10 @@ public class TestParserExec extends BaseTest {
@Test
public void testLL1OptionalBlock_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(110);
+ StringBuilder grammarBuilder = new StringBuilder(109);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("a : (ID|{}INT)? {\n");
- grammarBuilder.append("fmt.Println($text);\n");
+ grammarBuilder.append("fmt.Println($text)\n");
grammarBuilder.append("};\n");
grammarBuilder.append("ID : 'a'..'z'+;\n");
grammarBuilder.append("INT : '0'..'9'+ ;\n");
@@ -397,12 +397,12 @@ public class TestParserExec extends BaseTest {
@Test
public void testLabelAliasingAcrossLabeledAlternatives() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(171);
+ StringBuilder grammarBuilder = new StringBuilder(169);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("start : a* EOF;\n");
grammarBuilder.append("a\n");
- grammarBuilder.append(" : label=subrule {fmt.Println($label.text);} #One\n");
- grammarBuilder.append(" | label='y' {fmt.Println($label.text);} #Two\n");
+ grammarBuilder.append(" : label=subrule {fmt.Println($label.text)} #One\n");
+ grammarBuilder.append(" | label='y' {fmt.Println($label.text)} #Two\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("subrule : 'x';\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
@@ -584,14 +584,14 @@ public class TestParserExec extends BaseTest {
@Test
public void testParserProperty() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(158);
+ StringBuilder grammarBuilder = new StringBuilder(157);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {\n");
grammarBuilder.append("bool Property() {\n");
grammarBuilder.append(" return true;\n");
grammarBuilder.append("}\n");
grammarBuilder.append("}\n");
- grammarBuilder.append("a : {$parser.Property()}? ID {fmt.Println(\"valid\");}\n");
+ grammarBuilder.append("a : {$parser.Property()}? ID {fmt.Println(\"valid\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
@@ -629,13 +629,13 @@ public class TestParserExec extends BaseTest {
@Test
public void testPredictionIssue334() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(248);
+ StringBuilder grammarBuilder = new StringBuilder(246);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("file_ @init{\n");
- grammarBuilder.append("SetErrorHandler(new BailErrorStrategy());\n");
+ grammarBuilder.append("SetErrorHandler(NewBailErrorStrategy());\n");
grammarBuilder.append("} \n");
grammarBuilder.append("@after {\n");
- grammarBuilder.append("fmt.Println($ctx.toStringTree(this));\n");
+ grammarBuilder.append("fmt.Println($ctx.toStringTree(this))\n");
grammarBuilder.append("}\n");
grammarBuilder.append(" : item (SEMICOLON item)* SEMICOLON? EOF ;\n");
grammarBuilder.append("item : A B?;\n");
@@ -656,9 +656,9 @@ public class TestParserExec extends BaseTest {
@Test
public void testReferenceToATN_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(113);
+ StringBuilder grammarBuilder = new StringBuilder(112);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : (ID|ATN)* ATN? {fmt.Println($text);} ;\n");
+ grammarBuilder.append("a : (ID|ATN)* ATN? {fmt.Println($text)} ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("ATN : '0'..'9'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
@@ -675,9 +675,9 @@ public class TestParserExec extends BaseTest {
@Test
public void testReferenceToATN_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(113);
+ StringBuilder grammarBuilder = new StringBuilder(112);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : (ID|ATN)* ATN? {fmt.Println($text);} ;\n");
+ grammarBuilder.append("a : (ID|ATN)* ATN? {fmt.Println($text)} ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("ATN : '0'..'9'+;\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip ;");
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java
index c161d75d1..7fe2e84a7 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java
@@ -113,11 +113,11 @@ public class TestSemPredEvalLexer extends BaseTest {
public void testIndent() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(154);
+ StringBuilder grammarBuilder = new StringBuilder(153);
grammarBuilder.append("lexer grammar L;\n");
grammarBuilder.append("ID : [a-z]+ ;\n");
grammarBuilder.append("INDENT : [ \\t]+ { this._tokenStartCharPositionInLine==0 }?\n");
- grammarBuilder.append(" { fmt.Println(\"INDENT\"); } ;\n");
+ grammarBuilder.append(" { fmt.Println(\"INDENT\") } ;\n");
grammarBuilder.append("NL : '\\n';\n");
grammarBuilder.append("WS : [ \\t]+ ;");
String grammar = grammarBuilder.toString();
@@ -150,10 +150,10 @@ public class TestSemPredEvalLexer extends BaseTest {
public void testLexerInputPositionSensitivePredicates() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(264);
+ StringBuilder grammarBuilder = new StringBuilder(262);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("WORD1 : ID1+ { fmt.Println(this.GetText()); } ;\n");
- grammarBuilder.append("WORD2 : ID2+ { fmt.Println(this.GetText()); } ;\n");
+ grammarBuilder.append("WORD1 : ID1+ { fmt.Println(this.GetText()) } ;\n");
+ grammarBuilder.append("WORD2 : ID2+ { fmt.Println(this.GetText()) } ;\n");
grammarBuilder.append("fragment ID1 : { this.GetCharPositionInLine() < 2 }? [a-zA-Z];\n");
grammarBuilder.append("fragment ID2 : { this.GetCharPositionInLine() >= 2 }? [a-zA-Z];\n");
grammarBuilder.append("WS : (' '|'\\n') -> skip;");
@@ -180,10 +180,10 @@ public class TestSemPredEvalLexer extends BaseTest {
public void testPredicatedKeywords() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(173);
+ StringBuilder grammarBuilder = new StringBuilder(171);
grammarBuilder.append("lexer grammar L;\n");
- grammarBuilder.append("ENUM : [a-z]+ { this.GetText().equals(\"enum\") }? { fmt.Println(\"enum!\"); } ;\n");
- grammarBuilder.append("ID : [a-z]+ { fmt.Println(\"ID \" + this.GetText()); } ;\n");
+ grammarBuilder.append("ENUM : [a-z]+ { this.GetText().equals(\"enum\") }? { fmt.Println(\"enum!\") } ;\n");
+ grammarBuilder.append("ID : [a-z]+ { fmt.Println(\"ID \" + this.GetText()) } ;\n");
grammarBuilder.append("WS : [ \\n] -> skip ;");
String grammar = grammarBuilder.toString();
String input ="enum enu a";
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java
index a7e4bf201..545e0de1f 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java
@@ -12,12 +12,12 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void test2UnpredicatedAlts() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(293);
+ StringBuilder grammarBuilder = new StringBuilder(290);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);} a ';' a; // do 2x: once in ATN, next in DFA\n");
- grammarBuilder.append("a : ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | ID {fmt.Println(\"alt 2\");}\n");
- grammarBuilder.append(" | {false}? ID {fmt.Println(\"alt 3\");}\n");
+ grammarBuilder.append("a : ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | ID {fmt.Println(\"alt 2\")}\n");
+ grammarBuilder.append(" | {false}? ID {fmt.Println(\"alt 3\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -42,13 +42,13 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void test2UnpredicatedAltsAndOneOrthogonalAlt() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(345);
+ StringBuilder grammarBuilder = new StringBuilder(341);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : {_interp.SetPredictionMode(PredictionModeLL_EXACT_AMBIG_DETECTION);} a ';' a ';' a;\n");
- grammarBuilder.append("a : INT {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | ID {fmt.Println(\"alt 2\");} // must pick this one for ID since pred is false\n");
- grammarBuilder.append(" | ID {fmt.Println(\"alt 3\");}\n");
- grammarBuilder.append(" | {false}? ID {fmt.Println(\"alt 4\");}\n");
+ grammarBuilder.append("a : INT {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | ID {fmt.Println(\"alt 2\")} // must pick this one for ID since pred is false\n");
+ grammarBuilder.append(" | ID {fmt.Println(\"alt 3\")}\n");
+ grammarBuilder.append(" | {false}? ID {fmt.Println(\"alt 4\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -74,12 +74,12 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testActionHidesPreds() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(225);
+ StringBuilder grammarBuilder = new StringBuilder(223);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {int i = 0;}\n");
grammarBuilder.append("s : a+ ;\n");
- grammarBuilder.append("a : {this.i = 1;} ID {this.i == 1}? {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {this.i = 2;} ID {this.i == 2}? {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {this.i = 1;} ID {this.i == 1}? {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {this.i = 2;} ID {this.i == 2}? {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -100,7 +100,7 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testActionsHidePredsInGlobalFOLLOW() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(281);
+ StringBuilder grammarBuilder = new StringBuilder(280);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {\n");
grammarBuilder.append("bool pred(bool v) {\n");
@@ -108,7 +108,7 @@ public class TestSemPredEvalParser extends BaseTest {
grammarBuilder.append(" return v\n");
grammarBuilder.append("}\n");
grammarBuilder.append("}\n");
- grammarBuilder.append("s : e {} {this.pred(true)}? {fmt.Println(\"parse\");} '!' ;\n");
+ grammarBuilder.append("s : e {} {this.pred(true)}? {fmt.Println(\"parse\")} '!' ;\n");
grammarBuilder.append("t : e {} {this.pred(false)}? ID ;\n");
grammarBuilder.append("e : ID | ; // non-LL(1) so we use ATN\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -148,7 +148,7 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testDepedentPredsInGlobalFOLLOW() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(304);
+ StringBuilder grammarBuilder = new StringBuilder(303);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {\n");
grammarBuilder.append("bool pred(bool v) {\n");
@@ -157,7 +157,7 @@ public class TestSemPredEvalParser extends BaseTest {
grammarBuilder.append("}\n");
grammarBuilder.append("}\n");
grammarBuilder.append("s : a[99] ;\n");
- grammarBuilder.append("a[int i] : e {this.pred($i==99)}? {fmt.Println(\"parse\");} '!' ;\n");
+ grammarBuilder.append("a[int i] : e {this.pred($i==99)}? {fmt.Println(\"parse\")} '!' ;\n");
grammarBuilder.append("b[int i] : e {this.pred($i==99)}? ID ;\n");
grammarBuilder.append("e : ID | ; // non-LL(1) so we use ATN\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -178,13 +178,13 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testDependentPredNotInOuterCtxShouldBeIgnored() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(270);
+ StringBuilder grammarBuilder = new StringBuilder(268);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : b[2] ';' | b[2] '.' ; // decision in s drills down to ctx-dependent pred in a;\n");
grammarBuilder.append("b[int i] : a[i] ;\n");
grammarBuilder.append("a[int i]\n");
- grammarBuilder.append(" : {$i==1}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {$i==2}? ID {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append(" : {$i==1}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {$i==2}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -221,13 +221,13 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testIndependentPredNotPassedOuterCtxToAvoidCastException() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(183);
+ StringBuilder grammarBuilder = new StringBuilder(181);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : b ';' | b '.' ;\n");
grammarBuilder.append("b : a ;\n");
grammarBuilder.append("a\n");
- grammarBuilder.append(" : {false}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append(" : {false}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -245,11 +245,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testNoTruePredsThrowsNoViableAlt() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(171);
+ StringBuilder grammarBuilder = new StringBuilder(169);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a a;\n");
- grammarBuilder.append("a : {false}? ID INT {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {false}? ID INT {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {false}? ID INT {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {false}? ID INT {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -268,13 +268,13 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testOrder() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(297);
+ StringBuilder grammarBuilder = new StringBuilder(295);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a {} a; // do 2x: once in ATN, next in DFA;\n");
grammarBuilder.append("// action blocks lookahead from falling off of 'a'\n");
grammarBuilder.append("// and looking into 2nd 'a' ref. !ctx dependent pred\n");
- grammarBuilder.append("a : ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -294,10 +294,10 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testPredFromAltTestedInLoopBack_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(204);
+ StringBuilder grammarBuilder = new StringBuilder(203);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("file_\n");
- grammarBuilder.append("@after {fmt.Println($ctx.toStringTree(this));}\n");
+ grammarBuilder.append("@after {fmt.Println($ctx.toStringTree(this))}\n");
grammarBuilder.append(" : para para EOF ;\n");
grammarBuilder.append("para: paraContent NL NL ;\n");
grammarBuilder.append("paraContent : ('s'|'x'|{this._input.LA(2)!=TParser.NL}? NL)+ ;\n");
@@ -324,10 +324,10 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testPredFromAltTestedInLoopBack_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(204);
+ StringBuilder grammarBuilder = new StringBuilder(203);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("file_\n");
- grammarBuilder.append("@after {fmt.Println($ctx.toStringTree(this));}\n");
+ grammarBuilder.append("@after {fmt.Println($ctx.toStringTree(this))}\n");
grammarBuilder.append(" : para para EOF ;\n");
grammarBuilder.append("para: paraContent NL NL ;\n");
grammarBuilder.append("paraContent : ('s'|'x'|{this._input.LA(2)!=TParser.NL}? NL)+ ;\n");
@@ -352,12 +352,12 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testPredTestedEvenWhenUnAmbig_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(201);
+ StringBuilder grammarBuilder = new StringBuilder(199);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {bool enumKeyword = true;}\n");
grammarBuilder.append("primary\n");
- grammarBuilder.append(" : ID {fmt.Println(\"ID \"+$ID.text);}\n");
- grammarBuilder.append(" | {!this.enumKeyword}? 'enum' {fmt.Println(\"enum\");}\n");
+ grammarBuilder.append(" : ID {fmt.Println(\"ID \"+$ID.text)}\n");
+ grammarBuilder.append(" | {!this.enumKeyword}? 'enum' {fmt.Println(\"enum\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : [a-z]+ ;\n");
grammarBuilder.append("WS : [ \\t\\n\\r]+ -> skip ;");
@@ -374,12 +374,12 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testPredTestedEvenWhenUnAmbig_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(201);
+ StringBuilder grammarBuilder = new StringBuilder(199);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {bool enumKeyword = true;}\n");
grammarBuilder.append("primary\n");
- grammarBuilder.append(" : ID {fmt.Println(\"ID \"+$ID.text);}\n");
- grammarBuilder.append(" | {!this.enumKeyword}? 'enum' {fmt.Println(\"enum\");}\n");
+ grammarBuilder.append(" : ID {fmt.Println(\"ID \"+$ID.text)}\n");
+ grammarBuilder.append(" | {!this.enumKeyword}? 'enum' {fmt.Println(\"enum\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : [a-z]+ ;\n");
grammarBuilder.append("WS : [ \\t\\n\\r]+ -> skip ;");
@@ -397,13 +397,13 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testPredicateDependentOnArg() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(200);
+ StringBuilder grammarBuilder = new StringBuilder(198);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {int i = 0;}\n");
grammarBuilder.append("s : a[2] a[1];\n");
grammarBuilder.append("a[int i]\n");
- grammarBuilder.append(" : {$i==1}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {$i==2}? ID {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append(" : {$i==1}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {$i==2}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -447,7 +447,7 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testPredsInGlobalFOLLOW() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(275);
+ StringBuilder grammarBuilder = new StringBuilder(274);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {\n");
grammarBuilder.append("bool pred(bool v) {\n");
@@ -455,7 +455,7 @@ public class TestSemPredEvalParser extends BaseTest {
grammarBuilder.append(" return v\n");
grammarBuilder.append("}\n");
grammarBuilder.append("}\n");
- grammarBuilder.append("s : e {this.pred(true)}? {fmt.Println(\"parse\");} '!' ;\n");
+ grammarBuilder.append("s : e {this.pred(true)}? {fmt.Println(\"parse\")} '!' ;\n");
grammarBuilder.append("t : e {this.pred(false)}? ID ;\n");
grammarBuilder.append("e : ID | ; // non-LL(1) so we use ATN\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
@@ -476,11 +476,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testRewindBeforePredEval() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(239);
+ StringBuilder grammarBuilder = new StringBuilder(237);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a a;\n");
- grammarBuilder.append("a : {this._input.LT(1).GetText().equals(\"x\")}? ID INT {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {this._input.LT(1).GetText().equals(\"y\")}? ID INT {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {this._input.LT(1).GetText().equals(\"x\")}? ID INT {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {this._input.LT(1).GetText().equals(\"y\")}? ID INT {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -500,12 +500,12 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testSimple() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(256);
+ StringBuilder grammarBuilder = new StringBuilder(253);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a a a; // do 3x: once in ATN, next in DFA then INT in ATN\n");
- grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\");}\n");
- grammarBuilder.append(" | INT {fmt.Println(\"alt 3\");}\n");
+ grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\")}\n");
+ grammarBuilder.append(" | INT {fmt.Println(\"alt 3\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -526,11 +526,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testSimpleValidate() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(164);
+ StringBuilder grammarBuilder = new StringBuilder(162);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a ;\n");
- grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? INT {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? INT {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -549,11 +549,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testSimpleValidate2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(167);
+ StringBuilder grammarBuilder = new StringBuilder(165);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a a a;\n");
- grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? INT {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? INT {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -574,11 +574,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testToLeft() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(164);
+ StringBuilder grammarBuilder = new StringBuilder(162);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append(" s : a+ ;\n");
- grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -599,13 +599,13 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(250);
+ StringBuilder grammarBuilder = new StringBuilder(247);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@members {int i = 0;}\n");
grammarBuilder.append("s : ({this.i += 1;\n");
- grammarBuilder.append("fmt.Println(\"i=\" + this.i);} a)+ ;\n");
- grammarBuilder.append("a : {this.i % 2 == 0}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {this.i % 2 != 0}? ID {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("fmt.Println(\"i=\" + this.i)} a)+ ;\n");
+ grammarBuilder.append("a : {this.i % 2 == 0}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {this.i % 2 != 0}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
@@ -629,10 +629,10 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testUnpredicatedPathsInAlt() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(183);
+ StringBuilder grammarBuilder = new StringBuilder(181);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("s : a {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | b {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("s : a {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | b {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("a : {false}? ID INT\n");
grammarBuilder.append(" | ID INT\n");
@@ -655,14 +655,14 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testValidateInDFA() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(332);
+ StringBuilder grammarBuilder = new StringBuilder(330);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("s : a ';' a;\n");
grammarBuilder.append("// ';' helps us to resynchronize without consuming\n");
grammarBuilder.append("// 2nd 'a' reference. We our testing that the DFA also\n");
grammarBuilder.append("// throws an exception if the validating predicate fails\n");
- grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\");}\n");
- grammarBuilder.append(" | {true}? INT {fmt.Println(\"alt 2\");}\n");
+ grammarBuilder.append("a : {false}? ID {fmt.Println(\"alt 1\")}\n");
+ grammarBuilder.append(" | {true}? INT {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
grammarBuilder.append("ID : 'a'..'z'+ ;\n");
grammarBuilder.append("INT : '0'..'9'+;\n");
diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java
index 01acec9eb..9471ac6ee 100644
--- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java
+++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java
@@ -12,9 +12,9 @@ public class TestSets extends BaseTest {
@Test
public void testCharSetLiteral() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(85);
+ StringBuilder grammarBuilder = new StringBuilder(84);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : (A {fmt.Println($A.text);})+ ;\n");
+ grammarBuilder.append("a : (A {fmt.Println($A.text)})+ ;\n");
grammarBuilder.append("A : [AaBb] ;\n");
grammarBuilder.append("WS : (' '|'\\n')+ -> skip ;");
String grammar = grammarBuilder.toString();
@@ -54,9 +54,9 @@ public class TestSets extends BaseTest {
@Test
public void testLexerOptionalSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(77);
+ StringBuilder grammarBuilder = new StringBuilder(76);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : ('a'|'b')? 'c' ;");
String grammar = grammarBuilder.toString();
String input ="ac";
@@ -71,9 +71,9 @@ public class TestSets extends BaseTest {
@Test
public void testLexerPlusSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(77);
+ StringBuilder grammarBuilder = new StringBuilder(76);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : ('a'|'b')+ 'c' ;");
String grammar = grammarBuilder.toString();
String input ="abaac";
@@ -88,9 +88,9 @@ public class TestSets extends BaseTest {
@Test
public void testLexerStarSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(77);
+ StringBuilder grammarBuilder = new StringBuilder(76);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : ('a'|'b')* 'c' ;");
String grammar = grammarBuilder.toString();
String input ="abaac";
@@ -105,9 +105,9 @@ public class TestSets extends BaseTest {
@Test
public void testNotChar() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(53);
+ StringBuilder grammarBuilder = new StringBuilder(52);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println($A.text);} ;\n");
+ grammarBuilder.append("a : A {fmt.Println($A.text)} ;\n");
grammarBuilder.append("A : ~'b' ;");
String grammar = grammarBuilder.toString();
String input ="x";
@@ -122,9 +122,9 @@ public class TestSets extends BaseTest {
@Test
public void testNotCharSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(59);
+ StringBuilder grammarBuilder = new StringBuilder(58);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println($A.text);} ;\n");
+ grammarBuilder.append("a : A {fmt.Println($A.text)} ;\n");
grammarBuilder.append("A : ~('b'|'c') ;");
String grammar = grammarBuilder.toString();
String input ="x";
@@ -139,9 +139,9 @@ public class TestSets extends BaseTest {
@Test
public void testNotCharSetWithLabel() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(61);
+ StringBuilder grammarBuilder = new StringBuilder(60);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println($A.text);} ;\n");
+ grammarBuilder.append("a : A {fmt.Println($A.text)} ;\n");
grammarBuilder.append("A : h=~('b'|'c') ;");
String grammar = grammarBuilder.toString();
String input ="x";
@@ -156,9 +156,9 @@ public class TestSets extends BaseTest {
@Test
public void testNotCharSetWithRuleRef3() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(125);
+ StringBuilder grammarBuilder = new StringBuilder(124);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println($A.text);} ;\n");
+ grammarBuilder.append("a : A {fmt.Println($A.text)} ;\n");
grammarBuilder.append("A : ('a'|B) ; // this doesn't collapse to set but works\n");
grammarBuilder.append("fragment\n");
grammarBuilder.append("B : ~('a'|'c') ;");
@@ -175,9 +175,9 @@ public class TestSets extends BaseTest {
@Test
public void testOptionalLexerSingleElement() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(71);
+ StringBuilder grammarBuilder = new StringBuilder(70);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : 'b'? 'c' ;");
String grammar = grammarBuilder.toString();
String input ="bc";
@@ -192,9 +192,9 @@ public class TestSets extends BaseTest {
@Test
public void testOptionalSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(69);
+ StringBuilder grammarBuilder = new StringBuilder(68);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : ('a'|'b')? 'c' {fmt.Println(this._input.GetText());} ;");
+ grammarBuilder.append("a : ('a'|'b')? 'c' {fmt.Println(this._input.GetText())} ;");
String grammar = grammarBuilder.toString();
String input ="ac";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -208,9 +208,9 @@ public class TestSets extends BaseTest {
@Test
public void testOptionalSingleElement() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(71);
+ StringBuilder grammarBuilder = new StringBuilder(70);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A? 'c' {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A? 'c' {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : 'b' ;");
String grammar = grammarBuilder.toString();
String input ="bc";
@@ -225,9 +225,9 @@ public class TestSets extends BaseTest {
@Test
public void testParserNotSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(57);
+ StringBuilder grammarBuilder = new StringBuilder(56);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : t=~('x'|'y') 'z' {fmt.Println($t.text);} ;");
+ grammarBuilder.append("a : t=~('x'|'y') 'z' {fmt.Println($t.text)} ;");
String grammar = grammarBuilder.toString();
String input ="zz";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -241,9 +241,9 @@ public class TestSets extends BaseTest {
@Test
public void testParserNotToken() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(63);
+ StringBuilder grammarBuilder = new StringBuilder(62);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : ~'x' 'z' {fmt.Println(this._input.GetText());} ;");
+ grammarBuilder.append("a : ~'x' 'z' {fmt.Println(this._input.GetText())} ;");
String grammar = grammarBuilder.toString();
String input ="zz";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -257,9 +257,9 @@ public class TestSets extends BaseTest {
@Test
public void testParserNotTokenWithLabel() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(51);
+ StringBuilder grammarBuilder = new StringBuilder(50);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : t=~'x' 'z' {fmt.Println($t.text);} ;");
+ grammarBuilder.append("a : t=~'x' 'z' {fmt.Println($t.text)} ;");
String grammar = grammarBuilder.toString();
String input ="zz";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -273,9 +273,9 @@ public class TestSets extends BaseTest {
@Test
public void testParserSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(52);
+ StringBuilder grammarBuilder = new StringBuilder(51);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : t=('x'|'y') {fmt.Println($t.text);} ;");
+ grammarBuilder.append("a : t=('x'|'y') {fmt.Println($t.text)} ;");
String grammar = grammarBuilder.toString();
String input ="x";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -289,9 +289,9 @@ public class TestSets extends BaseTest {
@Test
public void testPlusLexerSingleElement() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(71);
+ StringBuilder grammarBuilder = new StringBuilder(70);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : 'b'+ 'c' ;");
String grammar = grammarBuilder.toString();
String input ="bbbbc";
@@ -306,9 +306,9 @@ public class TestSets extends BaseTest {
@Test
public void testPlusSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(69);
+ StringBuilder grammarBuilder = new StringBuilder(68);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : ('a'|'b')+ 'c' {fmt.Println(this._input.GetText());} ;");
+ grammarBuilder.append("a : ('a'|'b')+ 'c' {fmt.Println(this._input.GetText())} ;");
String grammar = grammarBuilder.toString();
String input ="abaac";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -322,9 +322,9 @@ public class TestSets extends BaseTest {
@Test
public void testRuleAsSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(76);
+ StringBuilder grammarBuilder = new StringBuilder(75);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a @after {fmt.Println(this._input.GetText());} : 'a' | 'b' |'c' ;");
+ grammarBuilder.append("a @after {fmt.Println(this._input.GetText())} : 'a' | 'b' |'c' ;");
String grammar = grammarBuilder.toString();
String input ="b";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
@@ -338,9 +338,9 @@ public class TestSets extends BaseTest {
@Test
public void testSeqDoesNotBecomeSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(113);
+ StringBuilder grammarBuilder = new StringBuilder(112);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : C {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : C {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("fragment A : '1' | '2';\n");
grammarBuilder.append("fragment B : '3' '4';\n");
grammarBuilder.append("C : A | B;");
@@ -357,9 +357,9 @@ public class TestSets extends BaseTest {
@Test
public void testStarLexerSingleElement_1() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(71);
+ StringBuilder grammarBuilder = new StringBuilder(70);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : 'b'* 'c' ;");
String grammar = grammarBuilder.toString();
String input ="bbbbc";
@@ -374,9 +374,9 @@ public class TestSets extends BaseTest {
@Test
public void testStarLexerSingleElement_2() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(71);
+ StringBuilder grammarBuilder = new StringBuilder(70);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : A {fmt.Println(this._input.GetText());} ;\n");
+ grammarBuilder.append("a : A {fmt.Println(this._input.GetText())} ;\n");
grammarBuilder.append("A : 'b'* 'c' ;");
String grammar = grammarBuilder.toString();
String input ="c";
@@ -391,9 +391,9 @@ public class TestSets extends BaseTest {
@Test
public void testStarSet() throws Exception {
mkdir(parserpkgdir);
- StringBuilder grammarBuilder = new StringBuilder(69);
+ StringBuilder grammarBuilder = new StringBuilder(68);
grammarBuilder.append("grammar T;\n");
- grammarBuilder.append("a : ('a'|'b')* 'c' {fmt.Println(this._input.GetText());} ;");
+ grammarBuilder.append("a : ('a'|'b')* 'c' {fmt.Println(this._input.GetText())} ;");
String grammar = grammarBuilder.toString();
String input ="abaac";
String found = execParser("T.g4", grammar, "TParser", "TLexer",
diff --git a/runtime/Go/src/antlr4/Parser.go b/runtime/Go/src/antlr4/Parser.go
index f09b78d4c..45da48279 100644
--- a/runtime/Go/src/antlr4/Parser.go
+++ b/runtime/Go/src/antlr4/Parser.go
@@ -1,6 +1,9 @@
package antlr4
-import "fmt"
+import (
+ "fmt"
+ "strconv"
+)
type Parser interface {
Recognizer
@@ -673,27 +676,23 @@ func (this *BaseParser) getRuleInvocationStack(p ParserRuleContext) []string {
}
// For debugging and other purposes.//
-func (p *BaseParser) getDFAStrings() {
- panic("dumpDFA Not implemented!")
- // return p._interp.decisionToDFA.String()
+func (p *BaseParser) GetDFAStrings() string {
+ return fmt.Sprint(p.Interpreter.decisionToDFA)
}
// For debugging and other purposes.//
-func (p *BaseParser) dumpDFA() {
- panic("dumpDFA Not implemented!")
-
- // var seenOne = false
- // for i := 0; i < p._interp.decisionToDFA.length; i++ {
- // var dfa = p._interp.decisionToDFA[i]
- // if ( len(dfa.states) > 0) {
- // if (seenOne) {
- // fmt.Println()
- // }
- // p.printer.println("Decision " + dfa.decision + ":")
- // p.printer.print(dfa.String(p.LiteralNames, p.SymbolicNames))
- // seenOne = true
- // }
- // }
+func (p *BaseParser) DumpDFA() {
+ var seenOne = false
+ for _, dfa := range p.Interpreter.decisionToDFA {
+ if ( len(dfa.GetStates()) > 0) {
+ if (seenOne) {
+ fmt.Println()
+ }
+ fmt.Println("Decision " + strconv.Itoa(dfa.decision) + ":")
+ fmt.Print(dfa.String(p.LiteralNames, p.SymbolicNames))
+ seenOne = true
+ }
+ }
}
func (p *BaseParser) GetSourceName() string {
diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg
index e858edd38..1734298ba 100644
--- a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg
+++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg
@@ -251,7 +251,7 @@ RuleFunction(currentRule,args,code,locals,ruleCtx,altLabelCtxs,namedActions,fina
}; separator="\n">
-func (p *) (}; separator=", ">) * {
+func (p *) ( }; separator=", ">) * {
localctx := New(p, p.GetParserRuleContext(), p.GetState()}>)
p.EnterRule(localctx, , RULE_)
@@ -295,7 +295,7 @@ LeftRecursiveRuleFunction(currentRule,args,code,locals,ruleCtx,altLabelCtxs,
}; separator="\n">
-func (p *) (_p int, }>) * {
+func (p *) (_p int, }>) * {
_parentctx := p.GetParserRuleContext()
_parentState := p.GetState()
@@ -575,8 +575,8 @@ LabelRef(t) ::= "."
ListLabelRef(t) ::= "."
SetAttr(s,rhsChunks) ::= ". = "
-TokenLabelType() ::= ""
-InputSymbolType() ::= ""
+TokenLabelType() ::= ""
+InputSymbolType() ::= ""
TokenPropertyRef_text(t) ::= "(.==null ? null : ..GetText())"
TokenPropertyRef_type(t) ::= "(. == null ? 0 : ..GetTokenType())"
@@ -588,26 +588,26 @@ TokenPropertyRef_int(t) ::= "(. == null ? 0 : strconv.Atoi(() interface{} {
@@ -629,7 +629,6 @@ ContextTokenListIndexedGetterDecl(t) ::= <<
return s.GetToken(, i)
}
}
-
>>
ContextRuleGetterDecl(r) ::= <<
@@ -677,9 +676,10 @@ type struct {
*antlr4.BaseParserRuleContext
parser antlr4.Parser
+ }; separator="\n">
}
-func New(parser antlr4.Parser, parent antlr4.ParserRuleContext, invokingState int}>) * {
+func New(parser antlr4.Parser, parent antlr4.ParserRuleContext, invokingState int }>) * {
var p = new()
@@ -687,7 +687,6 @@ func New(parser antlr4.Parser, parent antlr4.ParserRuleContext, inv
p.parser = parser
p.RuleIndex = RULE_
- }; separator="\n">
= }; separator="\n">
return p
}
@@ -715,6 +714,8 @@ AltLabelStructDecl(struct,attrs,getters,dispatchMethods) ::= <<
type struct {
*Context
+
+ }; separator="\n">
}
func New(parser antlr4.Parser, ctx antlr4.ParserRuleContext) * {
@@ -723,8 +724,6 @@ func New(parser antlr4.Parser, ctx antlr4.ParserRuleContext) *Context = new(Context)
- ;}; separator="\n">
-
p.parser = parser
p.CopyFrom(ctx)
@@ -743,7 +742,9 @@ func (s *) GetRuleContext() antlr4.RuleContext {
ListenerDispatchMethod(method) ::= <<
func (s *) EnterExitRule(listener antlr4.ParseTreeListener) {
- listener.(Listener).EnterExit(s)
+ if listenerT, ok := listener.(Listener); ok {
+ listenerT.EnterExit(s)
+ }
}
>>
@@ -758,7 +759,7 @@ func (s *) Accept(visitor antlr4.ParseTreeVisitor) interface{} {
}
>>
-AttributeDecl(d) ::= "p. = null"
+AttributeDecl(d) ::= " // TODO = "
/** If we don't know location of label def x, use this template */
labelref(x) ::= "localctx."
@@ -773,7 +774,7 @@ recRuleSetStopToken() ::= "p.GetParserRuleContext().SetStop( p.G
recRuleAltStartAction(ruleName, ctxName, label) ::= <<
localctx = NewContext(p, _parentctx, _parentState)
-localctx.