use of org.antlr.v4.runtime.atn.DecisionInfo in project antlr4 by antlr.
the class TestParserProfiler method testLL1.
@Test
public void testLL1() throws Exception {
Grammar g = new Grammar("parser grammar T;\n" + "s : ';'{}\n" + " | '.'\n" + " ;\n", lg);
DecisionInfo[] info = interpAndGetDecisionInfo(lg, g, "s", ";");
assertEquals(1, info.length);
String expecting = "{decision=0, contextSensitivities=0, errors=0, ambiguities=0, SLL_lookahead=1, " + "SLL_ATNTransitions=1, SLL_DFATransitions=0, LL_Fallback=0, LL_lookahead=0, LL_ATNTransitions=0}";
assertEquals(expecting, info[0].toString());
}
use of org.antlr.v4.runtime.atn.DecisionInfo in project antlr4 by antlr.
the class TestParserProfiler method test3xLL2.
@Test
public void test3xLL2() throws Exception {
Grammar g = new Grammar("parser grammar T;\n" + "s : ID ';'{}\n" + " | ID '.'\n" + " ;\n", lg);
// The '.' vs ';' causes another ATN transition
DecisionInfo[] info = interpAndGetDecisionInfo(lg, g, "s", "xyz;", "abc;", "z.");
assertEquals(1, info.length);
String expecting = "{decision=0, contextSensitivities=0, errors=0, ambiguities=0, SLL_lookahead=6, " + "SLL_ATNTransitions=3, SLL_DFATransitions=3, LL_Fallback=0, LL_lookahead=0, LL_ATNTransitions=0}";
assertEquals(expecting, info[0].toString());
}
Aggregations