Examples of ATNState


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

    throw new UnsupportedOperationException(message, cause);
  }

  @NotNull
  public ATNState newState(@Nullable GrammarAST node) {
    ATNState n = new BasicState();
    n.setRuleIndex(currentRule.index);
    atn.addState(n);
    return n;
  }
View Full Code Here

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

        Interval interval = setTransitions.getIntervals().get(i);
        if (interval.length() <= 1) {
          continue;
        }

        ATNState blockEndState = decision.transition(interval.a).target.transition(0).target;
        IntervalSet matchSet = new IntervalSet();
        for (int j = interval.a; j <= interval.b; j++) {
          Transition matchTransition = decision.transition(j).target.transition(0);
          if (matchTransition instanceof NotSetTransition) {
            throw new UnsupportedOperationException("Not yet implemented.");
View Full Code Here

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

      System.err.println("no such mode "+modeName);
      return;
    }
    ParserATNFactory f = new LexerATNFactory(g);
    ATN nfa = f.createATN();
    ATNState startState = nfa.modeNameToStartState.get(modeName);
    ATNPrinter serializer = new ATNPrinter(g, startState);
    String result = serializer.asString();
    //System.out.print(result);
    assertEquals(expecting, result);
  }
View Full Code Here

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

    ATN atn = f.createATN();

    IntTokenStream input = new IntTokenStream(types);
    System.out.println("input="+input.types);
    ParserInterpreterForTesting interp = new ParserInterpreterForTesting(g, input);
    ATNState startState = atn.ruleToStartState[g.getRule("a").index];
    if ( startState.transition(0).target instanceof BlockStartState ) {
      startState = startState.transition(0).target;
    }

    DOTGenerator dot = new DOTGenerator(g);
    System.out.println(dot.getDOT(atn.ruleToStartState[g.getRule("a").index]));
    Rule r = g.getRule("e");
View Full Code Here

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

        recognizer.getInputStream(), recognizer.getContext());
  }

  @Override
  public void sync(Parser recognizer) throws RecognitionException {
    ATNState s = recognizer.getInterpreter().atn.states.get(recognizer
        .getState());
    // System.err.println("sync @ "+s.stateNumber+"="+s.getClass().getSimpleName());
    // If already recovering, don't try to sync
    if (inErrorRecoveryMode(recognizer)) {
      return;
    }

    TokenStream tokens = recognizer.getInputStream();
    int la = tokens.LA(1);

    // try cheaper subset first; might get lucky. seems to shave a wee bit
    // off
    if (recognizer.getATN().nextTokens(s).contains(la) || la == Token.EOF)
      return;

    // Return but don't end recovery. only do that upon valid token match
    if (recognizer.isExpectedToken(la)) {
      return;
    }

    switch (s.getStateType()) {
    case ATNState.BLOCK_START:
    case ATNState.STAR_BLOCK_START:
    case ATNState.PLUS_BLOCK_START:
    case ATNState.STAR_LOOP_ENTRY:
      // report error and recover if possible
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.