alter test so it works with all targets
This commit is contained in:
parent
da342af01e
commit
7f16fe6201
|
@ -33,7 +33,8 @@ grammar(grammarName) ::= <<
|
|||
grammar <grammarName>;
|
||||
@parser::members {<InitIntMember("i","0")>}
|
||||
s : ({<AddMember("i","1")>
|
||||
<PlusMember("\"i=\"","i"):writeln()>} a)+ ;
|
||||
<write("\"i=\"")>
|
||||
<writeln(GetMember("i"))>} a)+ ;
|
||||
a : {<ModMemberEquals("i","2","0")>}? ID {<writeln("\"alt 1\"")>}
|
||||
| {<ModMemberNotEquals("i","2","0")>}? ID {<writeln("\"alt 2\"")>}
|
||||
;
|
||||
|
|
|
@ -670,11 +670,12 @@ public class TestSemPredEvalParser extends BaseCppTest {
|
|||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(tmpdir);
|
||||
|
||||
StringBuilder grammarBuilder = new StringBuilder(277);
|
||||
StringBuilder grammarBuilder = new StringBuilder(289);
|
||||
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=\";\n");
|
||||
grammarBuilder.append("std::cout << 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");
|
||||
|
|
|
@ -551,11 +551,12 @@ public class TestSemPredEvalParser extends BaseTest {
|
|||
@Test
|
||||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(tmpdir);
|
||||
StringBuilder grammarBuilder = new StringBuilder(276);
|
||||
StringBuilder grammarBuilder = new StringBuilder(290);
|
||||
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=\" + this.i);} a)+ ;\n");
|
||||
grammarBuilder.append("Console.Write(\"i=\");\n");
|
||||
grammarBuilder.append("Console.WriteLine(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");
|
||||
|
|
|
@ -579,11 +579,12 @@ public class TestSemPredEvalParser extends BaseTest {
|
|||
@Test
|
||||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(parserpkgdir);
|
||||
StringBuilder grammarBuilder = new StringBuilder(267);
|
||||
StringBuilder grammarBuilder = new StringBuilder(264);
|
||||
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.Println(\"i=\" + fmt.Sprint(i))} a)+ ;\n");
|
||||
grammarBuilder.append("fmt.Print(\"i=\")\n");
|
||||
grammarBuilder.append("fmt.Println(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");
|
||||
|
|
|
@ -646,11 +646,12 @@ public class TestSemPredEvalParser extends BaseTest {
|
|||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(tmpdir);
|
||||
|
||||
StringBuilder grammarBuilder = new StringBuilder(279);
|
||||
StringBuilder grammarBuilder = new StringBuilder(296);
|
||||
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=\" + this.i);} a)+ ;\n");
|
||||
grammarBuilder.append("System.out.print(\"i=\");\n");
|
||||
grammarBuilder.append("System.out.println(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");
|
||||
|
|
|
@ -600,11 +600,12 @@ public class TestSemPredEvalParser extends BaseTest {
|
|||
@Test
|
||||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(tmpdir);
|
||||
StringBuilder grammarBuilder = new StringBuilder(260);
|
||||
StringBuilder grammarBuilder = new StringBuilder(281);
|
||||
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=\" + this.i);} a)+ ;\n");
|
||||
grammarBuilder.append("process.stdout.write(\"i=\");\n");
|
||||
grammarBuilder.append("console.log(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");
|
||||
|
|
|
@ -670,11 +670,12 @@ public class TestSemPredEvalParser extends BasePython2Test {
|
|||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(tmpdir);
|
||||
|
||||
StringBuilder grammarBuilder = new StringBuilder(236);
|
||||
StringBuilder grammarBuilder = new StringBuilder(243);
|
||||
grammarBuilder.append("grammar T;\n");
|
||||
grammarBuilder.append("@parser::members {i = 0}\n");
|
||||
grammarBuilder.append("s : ({self.i += 1\n");
|
||||
grammarBuilder.append("print(\"i=\" + str(self.i))} a)+ ;\n");
|
||||
grammarBuilder.append("print(\"i=\",end='')\n");
|
||||
grammarBuilder.append("print(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");
|
||||
|
|
|
@ -670,11 +670,12 @@ public class TestSemPredEvalParser extends BasePython3Test {
|
|||
public void testToLeftWithVaryingPredicate() throws Exception {
|
||||
mkdir(tmpdir);
|
||||
|
||||
StringBuilder grammarBuilder = new StringBuilder(236);
|
||||
StringBuilder grammarBuilder = new StringBuilder(243);
|
||||
grammarBuilder.append("grammar T;\n");
|
||||
grammarBuilder.append("@parser::members {i = 0}\n");
|
||||
grammarBuilder.append("s : ({self.i += 1\n");
|
||||
grammarBuilder.append("print(\"i=\" + str(self.i))} a)+ ;\n");
|
||||
grammarBuilder.append("print(\"i=\",end='')\n");
|
||||
grammarBuilder.append("print(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");
|
||||
|
|
Loading…
Reference in New Issue