Fix ParserErrors.testContextListGetters to print strings

This commit is contained in:
Will Faught 2016-07-06 10:51:00 -07:00
parent 53fab2c61c
commit 5feca3e334
7 changed files with 14 additions and 14 deletions

View File

@ -29,6 +29,6 @@ grammar <grammarName>;
<DeclareContextListGettersFunction()> <DeclareContextListGettersFunction()>
} }
s : (a | b)+; s : (a | b)+;
a : 'a' {<write("'a'")>}; a : 'a' {<write("\"a\"")>};
b : 'b' {<write("'b'")>}; b : 'b' {<write("\"b\"")>};
>> >>

View File

@ -51,8 +51,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n"); grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {Console.Write('a');};\n"); grammarBuilder.append("a : 'a' {Console.Write(\"a\");};\n");
grammarBuilder.append("b : 'b' {Console.Write('b');};"); grammarBuilder.append("b : 'b' {Console.Write(\"b\");};");
String grammar = grammarBuilder.toString(); String grammar = grammarBuilder.toString();
String input ="abab"; String input ="abab";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s", input, true); String found = execParser("T.g4", grammar, "TParser", "TLexer", "s", input, true);

View File

@ -55,8 +55,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n"); grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {fmt.Print('a')};\n"); grammarBuilder.append("a : 'a' {fmt.Print(\"a\")};\n");
grammarBuilder.append("b : 'b' {fmt.Print('b')};"); grammarBuilder.append("b : 'b' {fmt.Print(\"b\")};");
String grammar = grammarBuilder.toString(); String grammar = grammarBuilder.toString();
String input ="abab"; String input ="abab";
String found = execParser("T.g4", grammar, "TParser", "TLexer", String found = execParser("T.g4", grammar, "TParser", "TLexer",

View File

@ -61,8 +61,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n"); grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {System.out.print('a');};\n"); grammarBuilder.append("a : 'a' {System.out.print(\"a\");};\n");
grammarBuilder.append("b : 'b' {System.out.print('b');};"); grammarBuilder.append("b : 'b' {System.out.print(\"b\");};");
String grammar = grammarBuilder.toString(); String grammar = grammarBuilder.toString();

View File

@ -57,8 +57,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append(" };\n"); grammarBuilder.append(" };\n");
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n"); grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {process.stdout.write('a');};\n"); grammarBuilder.append("a : 'a' {process.stdout.write(\"a\");};\n");
grammarBuilder.append("b : 'b' {process.stdout.write('b');};"); grammarBuilder.append("b : 'b' {process.stdout.write(\"b\");};");
String grammar = grammarBuilder.toString(); String grammar = grammarBuilder.toString();
String input ="abab"; String input ="abab";
String found = execParser("T.g4", grammar, "TParser", "TLexer", String found = execParser("T.g4", grammar, "TParser", "TLexer",

View File

@ -62,8 +62,8 @@ public class TestParserErrors extends BasePython2Test {
grammarBuilder.append(" b = s.b()\n"); grammarBuilder.append(" b = s.b()\n");
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n"); grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {print('a',end='')};\n"); grammarBuilder.append("a : 'a' {print(\"a\",end='')};\n");
grammarBuilder.append("b : 'b' {print('b',end='')};"); grammarBuilder.append("b : 'b' {print(\"b\",end='')};");
String grammar = grammarBuilder.toString(); String grammar = grammarBuilder.toString();

View File

@ -62,8 +62,8 @@ public class TestParserErrors extends BasePython3Test {
grammarBuilder.append(" b = s.b()\n"); grammarBuilder.append(" b = s.b()\n");
grammarBuilder.append("}\n"); grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n"); grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {print('a',end='')};\n"); grammarBuilder.append("a : 'a' {print(\"a\",end='')};\n");
grammarBuilder.append("b : 'b' {print('b',end='')};"); grammarBuilder.append("b : 'b' {print(\"b\",end='')};");
String grammar = grammarBuilder.toString(); String grammar = grammarBuilder.toString();