forked from jasder/antlr
test added
This commit is contained in:
parent
fb0e1c0cdb
commit
a63df8b088
|
@ -14,6 +14,23 @@ public class TestParserErrors extends BaseTest {
|
||||||
assertEquals("line 1:1 mismatched input 'a' expecting 'b'\n", this.stderrDuringParse);
|
assertEquals("line 1:1 mismatched input 'a' expecting 'b'\n", this.stderrDuringParse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this file and method are generated, any edit will be overwritten by the next generation */
|
||||||
|
@Test
|
||||||
|
public void testTokenMismatch2() throws Exception {
|
||||||
|
String grammar = "grammar T;\n" +
|
||||||
|
"\n" +
|
||||||
|
"stat: ( '(' expr? ')' )? EOF ;\n" +
|
||||||
|
"expr: ID '=' STR ;\n" +
|
||||||
|
"\n" +
|
||||||
|
"ERR : '~FORCE_ERROR~' ;\n" +
|
||||||
|
"ID : [a-zA-Z]+ ;\n" +
|
||||||
|
"STR : '\"' ~[\"]* '\"' ;\n" +
|
||||||
|
"WS : [ \\t\\r\\n]+ -> skip ;";
|
||||||
|
String found = execParser("T.g4", grammar, "TParser", "TLexer", "stat", "( ~FORCE_ERROR~ ", false);
|
||||||
|
assertEquals("", found);
|
||||||
|
assertEquals("line 1:2 mismatched input '~FORCE_ERROR~' expecting ')'\n", this.stderrDuringParse);
|
||||||
|
}
|
||||||
|
|
||||||
/* this file and method are generated, any edit will be overwritten by the next generation */
|
/* this file and method are generated, any edit will be overwritten by the next generation */
|
||||||
@Test
|
@Test
|
||||||
public void testSingleTokenDeletion() throws Exception {
|
public void testSingleTokenDeletion() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue