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