Package org.antlr.v4.runtime.atn

Examples of org.antlr.v4.runtime.atn.PredictionContext


    ATNState right = newState(pred);

    AbstractPredicateTransition p;
    if (pred.getOptionString(LeftRecursiveRuleTransformer.PRECEDENCE_OPTION_NAME) != null) {
      int precedence = Integer.parseInt(pred.getOptionString(LeftRecursiveRuleTransformer.PRECEDENCE_OPTION_NAME));
      p = new PrecedencePredicateTransition(right, precedence);
    }
    else {
      boolean isCtxDependent = UseDefAnalyzer.actionIsContextDependent(pred);
      p = new PredicateTransition(right, currentRule.index, g.sempreds.get(pred), isCtxDependent);
    }
View Full Code Here


      int precedence = Integer.parseInt(pred.getOptionString(LeftRecursiveRuleTransformer.PRECEDENCE_OPTION_NAME));
      p = new PrecedencePredicateTransition(right, precedence);
    }
    else {
      boolean isCtxDependent = UseDefAnalyzer.actionIsContextDependent(pred);
      p = new PredicateTransition(right, currentRule.index, g.sempreds.get(pred), isCtxDependent);
    }

    left.addTransition(p);
    pred.atnState = left;
    return new Handle(left, right);
View Full Code Here

  public boolean rootIsWildcard() { return true; }
  public boolean fullCtx() { return false; }

  @Test public void test_$_$() {
    PredictionContext r = PredictionContext.merge(PredictionContext.EMPTY,
                            PredictionContext.EMPTY,
                            rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
      "digraph G {\n" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, rootIsWildcard()));
  }

  @Test public void test_$_$_fullctx() {
    PredictionContext r = PredictionContext.merge(PredictionContext.EMPTY,
                            PredictionContext.EMPTY,
                            fullCtx(), null);
    System.out.println(toDOTString(r, fullCtx()));
    String expecting =
      "digraph G {\n" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, fullCtx()));
  }

  @Test public void test_x_$() {
    PredictionContext r = PredictionContext.merge(x(), PredictionContext.EMPTY, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
      "digraph G {\n" +
      "rankdir=LR;\n" +
      "  s0[label=\"*\"];\n" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, rootIsWildcard()));
  }

  @Test public void test_x_$_fullctx() {
    PredictionContext r = PredictionContext.merge(x(), PredictionContext.EMPTY, fullCtx(), null);
    System.out.println(toDOTString(r, fullCtx()));
    String expecting =
      "digraph G {\n" +
      "rankdir=LR;\n" +
      "  s0[shape=record, label=\"<p0>|<p1>$\"];\n" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, fullCtx()));
  }

  @Test public void test_$_x() {
    PredictionContext r = PredictionContext.merge(PredictionContext.EMPTY, x(), rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
      "digraph G {\n" +
      "rankdir=LR;\n" +
      "  s0[label=\"*\"];\n" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, rootIsWildcard()));
  }

  @Test public void test_$_x_fullctx() {
    PredictionContext r = PredictionContext.merge(PredictionContext.EMPTY, x(), fullCtx(), null);
    System.out.println(toDOTString(r, fullCtx()));
    String expecting =
      "digraph G {\n" +
      "rankdir=LR;\n" +
      "  s0[shape=record, label=\"<p0>|<p1>$\"];\n" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, fullCtx()));
  }

  @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" +
View Full Code Here

      "}\n";
    assertEquals(expecting, toDOTString(r, rootIsWildcard()));
  }

  @Test public void test_a$_ax() {
    PredictionContext a1 = a();
    PredictionContext x = x();
    PredictionContext a2 = createSingleton(x, 1);
    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" +
View Full Code Here

TOP

Related Classes of org.antlr.v4.runtime.atn.PredictionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.