more tests
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6808]
This commit is contained in:
parent
47a3f66fea
commit
f6eaa737a4
|
@ -84,10 +84,7 @@ public class NFAConfig {
|
||||||
|
|
||||||
/** An NFA configuration is equal to another if both have
|
/** An NFA configuration is equal to another if both have
|
||||||
* the same state, they predict the same alternative, and
|
* the same state, they predict the same alternative, and
|
||||||
* syntactic/semantic contexts are the same. I don't think
|
* syntactic/semantic contexts are the same.
|
||||||
* the state|alt|ctx could be the same and have two different
|
|
||||||
* semantic contexts, but might as well define equals to be
|
|
||||||
* everything.
|
|
||||||
*/
|
*/
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( o==null ) return false;
|
if ( o==null ) return false;
|
||||||
|
|
|
@ -62,6 +62,25 @@ public class TestPredicatedDFAConstruction extends BaseTest {
|
||||||
System.err.println(msgs);
|
System.err.println(msgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSemanticContextPreventsEarlyTerminationOfClosure() throws Exception {
|
||||||
|
String g =
|
||||||
|
"parser grammar T;\n" +
|
||||||
|
"a : loop SEMI | ID SEMI\n" +
|
||||||
|
" ;\n" +
|
||||||
|
"loop\n" +
|
||||||
|
" : {while}? ID\n" +
|
||||||
|
" | {do}? ID\n" +
|
||||||
|
" | {for}? ID\n" +
|
||||||
|
" ;";
|
||||||
|
String expecting =
|
||||||
|
"s0-ID->s1\n" +
|
||||||
|
"s1-SEMI->s2\n" +
|
||||||
|
"s2-({while}?||{for}?||{do}?)->:s3=>1\n" +
|
||||||
|
"s2-true->:s4=>2\n";
|
||||||
|
checkRuleDFA(g, "a", expecting);
|
||||||
|
}
|
||||||
|
|
||||||
@Test public void _template() throws Exception {
|
@Test public void _template() throws Exception {
|
||||||
String g =
|
String g =
|
||||||
"";
|
"";
|
||||||
|
|
Loading…
Reference in New Issue