use of org.antlr.v4.runtime.atn.SingletonPredictionContext in project antlr4 by antlr.
the class TestGraphNodes method test_Aa_Aa.
@Test
public void test_Aa_Aa() {
SingletonPredictionContext a1 = a();
SingletonPredictionContext a2 = a();
ArrayPredictionContext A1 = array(a1);
ArrayPredictionContext A2 = array(a2);
PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
// System.out.println(toDOTString(r, rootIsWildcard()));
String expecting = "digraph G {\n" + "rankdir=LR;\n" + " s0[label=\"0\"];\n" + " s1[label=\"*\"];\n" + " s0->s1[label=\"1\"];\n" + "}\n";
assertEquals(expecting, toDOTString(r, rootIsWildcard()));
}
use of org.antlr.v4.runtime.atn.SingletonPredictionContext in project antlr4 by antlr.
the class TestGraphNodes method test_Aab_Ac.
@Test
public void test_Aab_Ac() {
// a,b + c
SingletonPredictionContext a = a();
SingletonPredictionContext b = b();
SingletonPredictionContext c = c();
ArrayPredictionContext A1 = array(a, b);
ArrayPredictionContext A2 = array(c);
PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
// System.out.println(toDOTString(r, rootIsWildcard()));
String expecting = "digraph G {\n" + "rankdir=LR;\n" + " s0[shape=record, label=\"<p0>|<p1>|<p2>\"];\n" + " s1[label=\"*\"];\n" + " s0:p0->s1[label=\"1\"];\n" + " s0:p1->s1[label=\"2\"];\n" + " s0:p2->s1[label=\"3\"];\n" + "}\n";
assertEquals(expecting, toDOTString(r, rootIsWildcard()));
}
Aggregations