forked from jasder/antlr
tweak tests
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9109]
This commit is contained in:
parent
6179d7586b
commit
c99ce6d26e
|
@ -104,4 +104,19 @@ public class TestParseTrees extends BaseTest {
|
||||||
String expecting = "(a <ERROR:z>)\n";
|
String expecting = "(a <ERROR:z>)\n";
|
||||||
assertEquals(expecting, result);
|
assertEquals(expecting, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test public void testSync() throws Exception {
|
||||||
|
String grammar =
|
||||||
|
"grammar T;\n" +
|
||||||
|
"s\n" +
|
||||||
|
"@init {setBuildParseTrees(true);}\n" +
|
||||||
|
"@after {System.out.println($r.toStringTree(this));}\n" +
|
||||||
|
" : r=a ;\n" +
|
||||||
|
"a : 'x' 'y'* '!'\n" +
|
||||||
|
" ;\n" +
|
||||||
|
"Z : 'z'; \n";
|
||||||
|
String result = execParser("T.g", grammar, "TParser", "TLexer", "s", "xzyy!", false);
|
||||||
|
String expecting = "(a x <ERROR:z> y y !)\n";
|
||||||
|
assertEquals(expecting, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue