Package org.antlr.v4.runtime.misc

Examples of org.antlr.v4.runtime.misc.IntervalSet.addAll()


      Set<Integer> alts = s.getAltSet();
      if ( alts!=null ) {
        buf.append("\\n");
        // separate alts
        IntegerList altList = new IntegerList();
        altList.addAll(alts);
        altList.sort();
        Set<ATNConfig> configurations = s.configs;
        for (int altIndex = 0; altIndex < altList.size(); altIndex++) {
          int alt = altList.get(altIndex);
          if ( altIndex>0 ) {
View Full Code Here


        int a = CharSupport.getCharValueFromGrammarCharLiteral(t.getChild(0).getText());
        int b = CharSupport.getCharValueFromGrammarCharLiteral(t.getChild(1).getText());
        set.add(a, b);
      }
      else if ( t.getType()==ANTLRParser.LEXER_CHAR_SET ) {
        set.addAll(getSetFromCharSetLiteral(t));
      }
      else if ( t.getType()==ANTLRParser.STRING_LITERAL ) {
        int c = CharSupport.getCharValueFromGrammarCharLiteral(t.getText());
        if ( c != -1 ) {
          set.add(c);
View Full Code Here

      if ( look==null ) return false; // lookahead must've computation failed
      if ( !look.and(combined).isNil() ) {
        collision = true;
        break;
      }
      combined.addAll(look);
    }
    return !collision;
  }
}
View Full Code Here

        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.");
          } else {
            matchSet.addAll(matchTransition.label());
          }
        }

        Transition newTransition;
        if (matchSet.getIntervals().size() == 1) {
View Full Code Here

    if (!following.contains(Token.EPSILON)) {
      return following;
    }

    IntervalSet expected = new IntervalSet();
    expected.addAll(following);
    expected.remove(Token.EPSILON);
    while (ctx != null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
      ATNState invokingState = states.get(ctx.invokingState);
      RuleTransition rt = (RuleTransition)invokingState.transition(0);
      following = nextTokens(rt.followState);
View Full Code Here

    expected.remove(Token.EPSILON);
    while (ctx != null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
      ATNState invokingState = states.get(ctx.invokingState);
      RuleTransition rt = (RuleTransition)invokingState.transition(0);
      following = nextTokens(rt.followState);
      expected.addAll(following);
      expected.remove(Token.EPSILON);
      ctx = ctx.parent;
    }

    if (following.contains(Token.EPSILON)) {
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.