Examples of AtomTransition


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

    ATNState left = newState(stringLiteralAST);
    ATNState prev = left;
    ATNState right = null;
    for (int i=0; i<n; i++) {
      right = newState(stringLiteralAST);
      prev.addTransition(new AtomTransition(right, chars.charAt(i)));
      prev = right;
    }
    stringLiteralAST.atnState = left;
    return new Handle(left, right);
  }
View Full Code Here

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

  public Handle tokenRef(TerminalAST node) {
    // Ref to EOF in lexer yields char transition on -1
    if ( node.getText().equals("EOF") ) {
      ATNState left = newState(node);
      ATNState right = newState(node);
      left.addTransition(new AtomTransition(right, IntStream.EOF));
      return new Handle(left, right);
    }
    return _ruleRef(node);
  }
View Full Code Here

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

          else {
            buf.append("-").append(not?"~":"").append(st.label().toString(g.getVocabulary())).append("->").append(getStateString(t.target)).append('\n');
          }
        }
        else if ( t instanceof AtomTransition ) {
          AtomTransition a = (AtomTransition)t;
          String label = g.getTokenDisplayName(a.label);
          buf.append("-").append(label).append("->").append(getStateString(t.target)).append('\n');
        }
        else {
          buf.append("-").append(t.toString()).append("->").append(getStateString(t.target)).append('\n');
View Full Code Here

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

          }
          edgeST.add("loopback", loopback);
        }
        else if ( edge instanceof AtomTransition ) {
          edgeST = stlib.getInstanceOf("edge");
          AtomTransition atom = (AtomTransition)edge;
          String label = String.valueOf(atom.label);
          if ( isLexer ) label = "'"+getEdgeLabel(String.valueOf((char)atom.label))+"'";
          else if ( grammar!=null ) label = grammar.getTokenDisplayName(atom.label);
          edgeST.add("label", getEdgeLabel(label));
        }
View Full Code Here

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

  @Override
  public Handle tokenRef(@NotNull TerminalAST node) {
    ATNState left = newState(node);
    ATNState right = newState(node);
    int ttype = g.getTokenType(node.getText());
    left.addTransition(new AtomTransition(right, ttype));
    node.atnState = left;
    return new Handle(left, right);
  }
View Full Code Here

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

    ATNState eofTarget = newState(null); // one unique EOF target for all rules
    for (Rule r : g.rules.values()) {
      ATNState stop = atn.ruleToStopState[r.index];
      if ( stop.getNumberOfTransitions()>0 ) continue;
      n++;
      Transition t = new AtomTransition(eofTarget, Token.EOF);
      stop.addTransition(t);
    }
    return n;
  }
View Full Code Here

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

        }

        Transition newTransition;
        if (matchSet.getIntervals().size() == 1) {
          if (matchSet.size() == 1) {
            newTransition = new AtomTransition(blockEndState, matchSet.getMinElement());
          } else {
            Interval matchInterval = matchSet.getIntervals().get(0);
            newTransition = new RangeTransition(blockEndState, matchInterval.a, matchInterval.b);
          }
        } else {
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.