Examples of DFAState


Examples of org.antlr.v4.runtime.dfa.DFAState

    /* the lexer evaluates predicates on-the-fly; by this point configs
     * should not contain any configurations with unevaluated predicates.
     */
    assert !configs.hasSemanticContext;

    DFAState proposed = new DFAState(configs);
    ATNConfig firstConfigWithRuleStopState = null;
    for (ATNConfig c : configs) {
      if ( c.state instanceof RuleStopState )  {
        firstConfigWithRuleStopState = c;
        break;
      }
    }

    if ( firstConfigWithRuleStopState!=null ) {
      proposed.isAcceptState = true;
      proposed.lexerActionExecutor = ((LexerATNConfig)firstConfigWithRuleStopState).getLexerActionExecutor();
      proposed.prediction = atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
    }

    DFA dfa = decisionToDFA[mode];
    synchronized (dfa.states) {
      DFAState existing = dfa.states.get(proposed);
      if ( existing!=null ) return existing;

      DFAState newState = proposed;

      newState.stateNumber = dfa.states.size();
      configs.setReadonly(true);
      newState.configs = configs;
      dfa.states.put(newState, newState);
View Full Code Here

Examples of org.antlr.v4.runtime.dfa.DFAState

    }

    for (DFAState d : dfa.states.keySet()) {
      if ( d.edges!=null ) {
        for (int i = 0; i < d.edges.length; i++) {
          DFAState target = d.edges[i];
          if ( target==null) continue;
          if ( target.stateNumber == Integer.MAX_VALUE ) continue;
          int ttype = i-1; // we shift up for EOF as -1 for parser
          String label = String.valueOf(ttype);
          if ( isLexer ) label = "'"+getEdgeLabel(String.valueOf((char) i))+"'";
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.