fix some issues with tests after merge

This commit is contained in:
parrt 2016-11-07 13:06:16 -08:00
parent f8bec27d6d
commit 3ee3093f88
18 changed files with 185 additions and 187 deletions

View File

@ -6,6 +6,8 @@ IgnoredTests ::= [
"Visitors.RuleGetters_2": true,
"Visitors.TokenGetters_1": true,
"Visitors.TokenGetters_2": true,
"LeftRecursion.JavaExpressions_10": true,
"LeftRecursion.JavaExpressions_11": true,
default: false
]

View File

@ -33,7 +33,7 @@ grammar(grammarName) ::= <<
grammar <grammarName>;
@parser::members {<InitIntMember("i","0")>}
s : ({<AddMember("i","1")>
<writeList(["\"i=\"", "i"])>} a)+ ;
<PlusMember("\"i=\"","i"):writeln()>} a)+ ;
a : {<ModMemberEquals("i","2","0")>}? ID {<writeln("\"alt 1\"")>}
| {<ModMemberNotEquals("i","2","0")>}? ID {<writeln("\"alt 2\"")>}
;

View File

@ -1,12 +1,12 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.cpp;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.test.runtime.java.ErrorQueue;
import org.antlr.v4.tool.Grammar;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestCompositeParsers extends BaseCppTest {
@ -75,18 +75,18 @@ public class TestCompositeParsers extends BaseCppTest {
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {std::cout << \"T.y\" << std::endl;};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
"x : A {std::cout << \"S.x\" << std::endl;};";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {std::cout << \"T.y\" << std::endl;};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -246,17 +246,17 @@ public class TestCompositeParsers extends BaseCppTest {
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"a : B {std::cout << \"T.a\" << std::endl;};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {std::cout << \"S.a\" << std::endl;};\n" +
"b : B;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {std::cout << \"T.a\" << std::endl;};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -306,18 +306,18 @@ public class TestCompositeParsers extends BaseCppTest {
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {std::cout << \"T.b\" << std::endl;};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {std::cout << \"S.a\" << std::endl;};\n" +
"b : 'b' ;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {std::cout << \"T.b\" << std::endl;};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(101);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");
@ -486,4 +486,4 @@ public class TestCompositeParsers extends BaseCppTest {
}
}
}

View File

@ -1,9 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.cpp;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestParserErrors extends BaseCppTest {
@ -711,9 +712,9 @@ public class TestParserErrors extends BaseCppTest {
assertEquals("", found);
assertEquals("line 1:2 mismatched input '~FORCE_ERROR~' expecting ')'\n", this.stderrDuringParse);
assertEquals("line 1:2 mismatched input '~FORCE_ERROR~' expecting {')', ID}\n", this.stderrDuringParse);
}
}
}

View File

@ -1,9 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.cpp;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestSemPredEvalParser extends BaseCppTest {
@ -669,11 +670,11 @@ public class TestSemPredEvalParser extends BaseCppTest {
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(tmpdir);
StringBuilder grammarBuilder = new StringBuilder(279);
StringBuilder grammarBuilder = new StringBuilder(277);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {int i = 0;}\n");
grammarBuilder.append("s : ({i += 1;\n");
grammarBuilder.append(" std::cout << \"i=\" << i << std::endl;} a)+ ;\n");
grammarBuilder.append("std::cout << \"i=\" + i << std::endl;} a)+ ;\n");
grammarBuilder.append("a : {i % 2 == 0}? ID {std::cout << \"alt 1\" << std::endl;}\n");
grammarBuilder.append(" | {i % 2 != 0}? ID {std::cout << \"alt 2\" << std::endl;}\n");
grammarBuilder.append(" ;\n");
@ -758,4 +759,4 @@ public class TestSemPredEvalParser extends BaseCppTest {
}
}
}

View File

@ -2,10 +2,6 @@
package org.antlr.v4.test.runtime.csharp;
import org.junit.Test;
import org.junit.Ignore;
import org.antlr.v4.test.runtime.java.ErrorQueue;
import org.antlr.v4.tool.Grammar;
@SuppressWarnings("unused")
public class TestCompositeParsers extends BaseTest {
@ -58,18 +54,18 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {Console.WriteLine(\"T.y\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
"x : A {Console.WriteLine(\"S.x\");};";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {Console.WriteLine(\"T.y\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -191,17 +187,17 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"a : B {Console.WriteLine(\"T.a\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {Console.WriteLine(\"S.a\");};\n" +
"b : B;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {Console.WriteLine(\"T.a\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -241,18 +237,18 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {Console.WriteLine(\"T.b\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {Console.WriteLine(\"S.a\");};\n" +
"b : 'b' ;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {Console.WriteLine(\"T.b\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(94);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");

View File

@ -2,7 +2,6 @@
package org.antlr.v4.test.runtime.csharp;
import org.junit.Test;
import org.junit.Ignore;
@SuppressWarnings("unused")
public class TestSemPredEvalParser extends BaseTest {
@ -552,11 +551,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(tmpdir);
StringBuilder grammarBuilder = new StringBuilder(269);
StringBuilder grammarBuilder = new StringBuilder(276);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {int i = 0;}\n");
grammarBuilder.append("s : ({this.i += 1;\n");
grammarBuilder.append("Console.WriteLine(\"i=\"+i);} a)+ ;\n");
grammarBuilder.append("Console.WriteLine(\"i=\" + this.i);} a)+ ;\n");
grammarBuilder.append("a : {this.i % 2 == 0}? ID {Console.WriteLine(\"alt 1\");}\n");
grammarBuilder.append(" | {this.i % 2 != 0}? ID {Console.WriteLine(\"alt 2\");}\n");
grammarBuilder.append(" ;\n");

View File

@ -1,12 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.go;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.tool.Grammar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestCompositeParsers extends BaseTest {
@ -60,18 +58,18 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(parserpkgdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"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\")};";
writeFile(parserpkgdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {fmt.Println(\"T.y\")};";
writeFile(parserpkgdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -200,17 +198,17 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(parserpkgdir);
String slave_T =
"parser grammar T;\n" +
"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" +
"b : B;";
writeFile(parserpkgdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {fmt.Println(\"T.a\")};";
writeFile(parserpkgdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -252,18 +250,18 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(parserpkgdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"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" +
"b : 'b' ;";
writeFile(parserpkgdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {fmt.Println(\"T.b\")};";
writeFile(parserpkgdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(87);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");

View File

@ -4,7 +4,8 @@ package org.antlr.v4.test.runtime.go;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestLeftRecursion extends BaseTest {
@ -759,6 +760,7 @@ public class TestLeftRecursion extends BaseTest {
}
/* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */
@Test
@Ignore("true")
public void testJavaExpressions_10() throws Exception {
mkdir(parserpkgdir);
StringBuilder grammarBuilder = new StringBuilder(1249);
@ -829,6 +831,7 @@ public class TestLeftRecursion extends BaseTest {
}
/* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */
@Test
@Ignore("true")
public void testJavaExpressions_11() throws Exception {
mkdir(parserpkgdir);
StringBuilder grammarBuilder = new StringBuilder(1249);

View File

@ -1,10 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.go;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestSemPredEvalParser extends BaseTest {
@ -579,11 +579,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(parserpkgdir);
StringBuilder grammarBuilder = new StringBuilder(252);
StringBuilder grammarBuilder = new StringBuilder(267);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {var i int = 0; var _ int = i; }\n");
grammarBuilder.append("s : ({i += 1;\n");
grammarBuilder.append("fmt.Print(\"i=\"+i);} a)+ ;\n");
grammarBuilder.append("fmt.Println(\"i=\" + fmt.Sprint(i))} a)+ ;\n");
grammarBuilder.append("a : {i % 2 == 0}? ID {fmt.Println(\"alt 1\")}\n");
grammarBuilder.append(" | {i % 2 != 0}? ID {fmt.Println(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");

View File

@ -1,12 +1,11 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.java;
import org.junit.Ignore;
import org.antlr.v4.tool.Grammar;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.tool.Grammar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestCompositeParsers extends BaseTest {
@ -72,18 +71,18 @@ public class TestCompositeParsers extends BaseTest {
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {System.out.println(\"T.y\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
"x : A {System.out.println(\"S.x\");};";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {System.out.println(\"T.y\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -236,17 +235,17 @@ public class TestCompositeParsers extends BaseTest {
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"a : B {System.out.println(\"T.a\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {System.out.println(\"S.a\");};\n" +
"b : B;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {System.out.println(\"T.a\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -294,18 +293,18 @@ public class TestCompositeParsers extends BaseTest {
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {System.out.println(\"T.b\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {System.out.println(\"S.a\");};\n" +
"b : 'b' ;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {System.out.println(\"T.b\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(95);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");

View File

@ -1,10 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.java;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestSemPredEvalParser extends BaseTest {
@ -646,11 +646,11 @@ public class TestSemPredEvalParser extends BaseTest {
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(tmpdir);
StringBuilder grammarBuilder = new StringBuilder(272);
StringBuilder grammarBuilder = new StringBuilder(279);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {int i = 0;}\n");
grammarBuilder.append("s : ({this.i += 1;\n");
grammarBuilder.append("System.out.println(\"i=\"+i);} a)+ ;\n");
grammarBuilder.append("System.out.println(\"i=\" + this.i);} a)+ ;\n");
grammarBuilder.append("a : {this.i % 2 == 0}? ID {System.out.println(\"alt 1\");}\n");
grammarBuilder.append(" | {this.i % 2 != 0}? ID {System.out.println(\"alt 2\");}\n");
grammarBuilder.append(" ;\n");

View File

@ -1,13 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.javascript.node;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.test.runtime.java.ErrorQueue;
import org.antlr.v4.tool.Grammar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestCompositeParsers extends BaseTest {
@ -64,18 +61,18 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {console.log(\"T.y\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
"x : A {console.log(\"S.x\");};";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {console.log(\"T.y\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -207,17 +204,17 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"a : B {console.log(\"T.a\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {console.log(\"S.a\");};\n" +
"b : B;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {console.log(\"T.a\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -261,18 +258,18 @@ public class TestCompositeParsers extends BaseTest {
@Test
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {console.log(\"T.b\");};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {console.log(\"S.a\");};\n" +
"b : 'b' ;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {console.log(\"T.b\");};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(88);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");

View File

@ -1,10 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.javascript.node;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestSemPredEvalParser extends BaseTest {
@ -600,11 +600,11 @@ public class TestSemPredEvalParser extends BaseTest {
@Test
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(tmpdir);
StringBuilder grammarBuilder = new StringBuilder(253);
StringBuilder grammarBuilder = new StringBuilder(260);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {this.i = 0;}\n");
grammarBuilder.append("s : ({this.i += 1;\n");
grammarBuilder.append("console.log(\"i=\"+i);} a)+ ;\n");
grammarBuilder.append("console.log(\"i=\" + this.i);} a)+ ;\n");
grammarBuilder.append("a : {this.i % 2 === 0}? ID {console.log(\"alt 1\");}\n");
grammarBuilder.append(" | {this.i % 2 != 0}? ID {console.log(\"alt 2\");}\n");
grammarBuilder.append(" ;\n");

View File

@ -1,12 +1,12 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.python2;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.test.runtime.java.ErrorQueue;
import org.antlr.v4.tool.Grammar;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestCompositeParsers extends BasePython2Test {
@ -75,18 +75,18 @@ public class TestCompositeParsers extends BasePython2Test {
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {print(\"T.y\")};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
"x : A {print(\"S.x\")};";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {print(\"T.y\")};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -245,17 +245,17 @@ public class TestCompositeParsers extends BasePython2Test {
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"a : B {print(\"T.a\")};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {print(\"S.a\")};\n" +
"b : B;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {print(\"T.a\")};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -305,18 +305,18 @@ public class TestCompositeParsers extends BasePython2Test {
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {print(\"T.b\")};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {print(\"S.a\")};\n" +
"b : 'b' ;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {print(\"T.b\")};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(81);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");
@ -485,4 +485,4 @@ public class TestCompositeParsers extends BasePython2Test {
}
}
}

View File

@ -1,9 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.python2;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestSemPredEvalParser extends BasePython2Test {
@ -669,11 +670,11 @@ public class TestSemPredEvalParser extends BasePython2Test {
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(tmpdir);
StringBuilder grammarBuilder = new StringBuilder(234);
StringBuilder grammarBuilder = new StringBuilder(236);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {i = 0}\n");
grammarBuilder.append("s : ({self.i += 1\n");
grammarBuilder.append("print(str(\"i=\")+str(i))} a)+ ;\n");
grammarBuilder.append("print(\"i=\" + str(self.i))} a)+ ;\n");
grammarBuilder.append("a : {self.i % 2 == 0}? ID {print(\"alt 1\")}\n");
grammarBuilder.append(" | {self.i % 2 != 0}? ID {print(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
@ -758,4 +759,4 @@ public class TestSemPredEvalParser extends BasePython2Test {
}
}
}

View File

@ -1,12 +1,12 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.python3;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import org.antlr.v4.test.runtime.java.ErrorQueue;
import org.antlr.v4.tool.Grammar;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestCompositeParsers extends BasePython3Test {
@ -75,18 +75,18 @@ public class TestCompositeParsers extends BasePython3Test {
public void testDelegatesSeeSameTokenType() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {print(\"T.y\")};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"tokens { A, B, C }\n" +
"x : A {print(\"S.x\")};";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { C, B, A } // reverse order\n" +
"y : A {print(\"T.y\")};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(598);
grammarBuilder.append("// The lexer will create rules to match letters a, b, c.\n");
grammarBuilder.append("// The associated token types A, B, C must have the same value\n");
@ -245,17 +245,17 @@ public class TestCompositeParsers extends BasePython3Test {
public void testDelegatorInvokesFirstVersionOfDelegateRule() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"a : B {print(\"T.a\")};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {print(\"S.a\")};\n" +
"b : B;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"a : B {print(\"T.a\")};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(106);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S,T;\n");
@ -305,18 +305,18 @@ public class TestCompositeParsers extends BasePython3Test {
public void testDelegatorRuleOverridesDelegates() throws Exception {
mkdir(tmpdir);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {print(\"T.b\")};";
writeFile(tmpdir, "T.g4", slave_T);
String slave_S =
"parser grammar S;\n" +
"a : b {print(\"S.a\")};\n" +
"b : 'b' ;";
writeFile(tmpdir, "S.g4", slave_S);
String slave_T =
"parser grammar T;\n" +
"tokens { A }\n" +
"b : 'b' {print(\"T.b\")};";
writeFile(tmpdir, "T.g4", slave_T);
StringBuilder grammarBuilder = new StringBuilder(81);
grammarBuilder.append("grammar M;\n");
grammarBuilder.append("import S, T;\n");
@ -485,4 +485,4 @@ public class TestCompositeParsers extends BasePython3Test {
}
}
}

View File

@ -1,9 +1,10 @@
/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */
package org.antlr.v4.test.runtime.python3;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@SuppressWarnings("unused")
public class TestSemPredEvalParser extends BasePython3Test {
@ -669,11 +670,11 @@ public class TestSemPredEvalParser extends BasePython3Test {
public void testToLeftWithVaryingPredicate() throws Exception {
mkdir(tmpdir);
StringBuilder grammarBuilder = new StringBuilder(234);
StringBuilder grammarBuilder = new StringBuilder(236);
grammarBuilder.append("grammar T;\n");
grammarBuilder.append("@parser::members {i = 0}\n");
grammarBuilder.append("s : ({self.i += 1\n");
grammarBuilder.append("print(str(\"i=\")+str(i))} a)+ ;\n");
grammarBuilder.append("print(\"i=\" + str(self.i))} a)+ ;\n");
grammarBuilder.append("a : {self.i % 2 == 0}? ID {print(\"alt 1\")}\n");
grammarBuilder.append(" | {self.i % 2 != 0}? ID {print(\"alt 2\")}\n");
grammarBuilder.append(" ;\n");
@ -758,4 +759,4 @@ public class TestSemPredEvalParser extends BasePython3Test {
}
}
}