Merge pull request #38 from willfaught/strings

Fix ParserErrors.testContextListGetters to print strings
This commit is contained in:
Peter Boyer 2016-07-18 09:52:28 -04:00 committed by GitHub
commit faeb00a682
7 changed files with 14 additions and 14 deletions

View File

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

View File

@ -51,8 +51,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append("}\n");
grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {Console.Write('a');};\n");
grammarBuilder.append("b : 'b' {Console.Write('b');};");
grammarBuilder.append("a : 'a' {Console.Write(\"a\");};\n");
grammarBuilder.append("b : 'b' {Console.Write(\"b\");};");
String grammar = grammarBuilder.toString();
String input ="abab";
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("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",

View File

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

View File

@ -57,8 +57,8 @@ public class TestParserErrors extends BaseTest {
grammarBuilder.append(" };\n");
grammarBuilder.append("}\n");
grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {process.stdout.write('a');};\n");
grammarBuilder.append("b : 'b' {process.stdout.write('b');};");
grammarBuilder.append("a : 'a' {process.stdout.write(\"a\");};\n");
grammarBuilder.append("b : 'b' {process.stdout.write(\"b\");};");
String grammar = grammarBuilder.toString();
String input ="abab";
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("}\n");
grammarBuilder.append("s : (a | b)+;\n");
grammarBuilder.append("a : 'a' {print('a',end='')};\n");
grammarBuilder.append("b : 'b' {print('b',end='')};");
grammarBuilder.append("a : 'a' {print(\"a\",end='')};\n");
grammarBuilder.append("b : 'b' {print(\"b\",end='')};");
String grammar = grammarBuilder.toString();

View File

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