forked from jasder/antlr
added unit test
This commit is contained in:
parent
a9d4aeab71
commit
c8a9ed6d30
|
@ -73,6 +73,19 @@ public class TestLexerExec extends BaseTest {
|
|||
assertNull(stderrDuringParse);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonGreedyTermination2() throws Exception {
|
||||
String grammar =
|
||||
"lexer grammar L;\n"
|
||||
+ "STRING : '\"' ('\"\"' | .)+? '\"';";
|
||||
|
||||
String found = execLexer("L.g4", grammar, "L", "\"hi\"\"mom\"");
|
||||
assertEquals(
|
||||
"[@0,0:3='\"hi\"\"mom\"',<1>,1:0]\n" +
|
||||
"[@2,9:8='<EOF>',<-1>,1:9]\n", found);
|
||||
assertNull(stderrDuringParse);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGreedyOptional() throws Exception {
|
||||
String grammar =
|
||||
|
|
Loading…
Reference in New Issue