Remove() public method

public Remove ( int el ) : void
el int
return void
Esempio n. 1
0
 protected internal virtual IntervalSet GetErrorRecoverySet(Parser recognizer)
 {
     ATN atn = recognizer.Interpreter.atn;
     RuleContext ctx = recognizer._ctx;
     IntervalSet recoverSet = new IntervalSet();
     while (ctx != null && ctx.invokingState >= 0)
     {
         // compute what follows who invoked us
         ATNState invokingState = atn.states[ctx.invokingState];
         RuleTransition rt = (RuleTransition)invokingState.Transition(0);
         IntervalSet follow = atn.NextTokens(rt.followState);
         recoverSet.AddAll(follow);
         ctx = ctx.parent;
     }
     recoverSet.Remove(TokenConstants.Epsilon);
     //		System.out.println("recover set "+recoverSet.toString(recognizer.getTokenNames()));
     return recoverSet;
 }
Esempio n. 2
0
 public virtual IntervalSet GetExpectedTokens(int stateNumber, RuleContext context)
 {
     if (stateNumber < 0 || stateNumber >= states.Count)
     {
         throw new ArgumentException("Invalid state number.");
     }
     RuleContext ctx = context;
     ATNState s = states[stateNumber];
     IntervalSet following = NextTokens(s);
     if (!following.Contains(TokenConstants.Epsilon))
     {
         return following;
     }
     IntervalSet expected = new IntervalSet();
     expected.AddAll(following);
     expected.Remove(TokenConstants.Epsilon);
     while (ctx != null && ctx.invokingState >= 0 && following.Contains(TokenConstants.Epsilon))
     {
         ATNState invokingState = states[ctx.invokingState];
         RuleTransition rt = (RuleTransition)invokingState.Transition(0);
         following = NextTokens(rt.followState);
         expected.AddAll(following);
         expected.Remove(TokenConstants.Epsilon);
         ctx = ctx.parent;
     }
     if (following.Contains(TokenConstants.Epsilon))
     {
         expected.Add(TokenConstants.Eof);
     }
     return expected;
 }