Package org.antlr.v4.runtime.atn

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


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

  @Test public void test_Aaxc_Aayd() { // ax,c + ay,d -> merged a, array parent
    SingletonPredictionContext a1 = createSingleton(x(), 1);
    SingletonPredictionContext a2 = createSingleton(y(), 1);
    ArrayPredictionContext A1 = array(a1, c());
    ArrayPredictionContext A2 = array(a2, d());
    PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
View Full Code Here


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

  @Test public void test_Aaubv_Acwdx() { // au,bv + cw,dx -> [a,b,c,d]->[u,v,w,x]
    SingletonPredictionContext a = createSingleton(u(), 1);
    SingletonPredictionContext b = createSingleton(v(), 2);
    SingletonPredictionContext c = createSingleton(w(), 3);
    SingletonPredictionContext d = createSingleton(x(), 4);
    ArrayPredictionContext A1 = array(a, b);
    ArrayPredictionContext A2 = array(c, d);
    PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
View Full Code Here

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

  @Test public void test_Aaubv_Abvdx() { // au,bv + bv,dx -> [a,b,d]->[u,v,x]
    SingletonPredictionContext a = createSingleton(u(), 1);
    SingletonPredictionContext b1 = createSingleton(v(), 2);
    SingletonPredictionContext b2 = createSingleton(v(), 2);
    SingletonPredictionContext d = createSingleton(x(), 4);
    ArrayPredictionContext A1 = array(a, b1);
    ArrayPredictionContext A2 = array(b2, d);
    PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
View Full Code Here

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

  @Test public void test_Aaubv_Abwdx() { // au,bv + bw,dx -> [a,b,d]->[u,[v,w],x]
    SingletonPredictionContext a = createSingleton(u(), 1);
    SingletonPredictionContext b1 = createSingleton(v(), 2);
    SingletonPredictionContext b2 = createSingleton(w(), 2);
    SingletonPredictionContext d = createSingleton(x(), 4);
    ArrayPredictionContext A1 = array(a, b1);
    ArrayPredictionContext A2 = array(b2, d);
    PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
View Full Code Here

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

  @Test public void test_Aaubv_Abvdu() { // au,bv + bv,du -> [a,b,d]->[u,v,u]; u,v shared
    SingletonPredictionContext a = createSingleton(u(), 1);
    SingletonPredictionContext b1 = createSingleton(v(), 2);
    SingletonPredictionContext b2 = createSingleton(v(), 2);
    SingletonPredictionContext d = createSingleton(u(), 4);
    ArrayPredictionContext A1 = array(a, b1);
    ArrayPredictionContext A2 = array(b2, d);
    PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
View Full Code Here

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

  @Test public void test_Aaubu_Acudu() { // au,bu + cu,du -> [a,b,c,d]->[u,u,u,u]
    SingletonPredictionContext a = createSingleton(u(), 1);
    SingletonPredictionContext b = createSingleton(u(), 2);
    SingletonPredictionContext c = createSingleton(u(), 3);
    SingletonPredictionContext d = createSingleton(u(), 4);
    ArrayPredictionContext A1 = array(a, b);
    ArrayPredictionContext A2 = array(c, d);
    PredictionContext r = PredictionContext.merge(A1, A2, rootIsWildcard(), null);
    System.out.println(toDOTString(r, rootIsWildcard()));
    String expecting =
View Full Code Here

  private SingletonPredictionContext y() {
    return createSingleton(PredictionContext.EMPTY, 10);
  }

  public SingletonPredictionContext createSingleton(PredictionContext parent, int payload) {
    SingletonPredictionContext a = SingletonPredictionContext.create(parent, payload);
    return a;
  }
View Full Code Here

   * {@code (A|B)*} is not the same thing as {@code (A|B|)+}.
   */
  @NotNull
  @Override
  public Handle star(@NotNull GrammarAST starAST, @NotNull Handle elem) {
    StarBlockStartState blkStart = (StarBlockStartState)elem.left;
    BlockEndState blkEnd = (BlockEndState)elem.right;
    preventEpsilonClosureBlocks.add(new Triple<Rule, ATNState, ATNState>(currentRule, blkStart, blkEnd));

    StarLoopEntryState entry = newState(StarLoopEntryState.class, starAST);
    entry.nonGreedy = !((QuantifierAST)starAST).isGreedy();
View Full Code Here

  public Handle star(@NotNull GrammarAST starAST, @NotNull Handle elem) {
    StarBlockStartState blkStart = (StarBlockStartState)elem.left;
    BlockEndState blkEnd = (BlockEndState)elem.right;
    preventEpsilonClosureBlocks.add(new Triple<Rule, ATNState, ATNState>(currentRule, blkStart, blkEnd));

    StarLoopEntryState entry = newState(StarLoopEntryState.class, starAST);
    entry.nonGreedy = !((QuantifierAST)starAST).isGreedy();
    atn.defineDecisionState(entry);
    LoopEndState end = newState(LoopEndState.class, starAST);
    StarLoopbackState loop = newState(StarLoopbackState.class, starAST);
    entry.loopBackState = loop;
View Full Code Here

    StarLoopEntryState entry = newState(StarLoopEntryState.class, starAST);
    entry.nonGreedy = !((QuantifierAST)starAST).isGreedy();
    atn.defineDecisionState(entry);
    LoopEndState end = newState(LoopEndState.class, starAST);
    StarLoopbackState loop = newState(StarLoopbackState.class, starAST);
    entry.loopBackState = loop;
    end.loopBackState = loop;

    BlockAST blkAST = (BlockAST)starAST.getChild(0);
    if ( ((QuantifierAST)starAST).isGreedy() ) {
View Full Code Here

TOP

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

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.