Merge pull request #38 from willfaught/strings
Fix ParserErrors.testContextListGetters to print strings
This commit is contained in:
commit
faeb00a682
|
@ -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\"")>};
|
||||
>>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue