ATNState state = recognizer.getInterpreter().atn.states.get(recognizer.getState()); IntervalSet nextTokens = recognizer.getATN().nextTokens(state); if (nextTokens.contains(token.getType())) { nextTokensContext = null; nextTokensState = ATNState.INVALID_STATE_NUMBER; return; if (nextTokens.contains(Token.EPSILON)) { if (null == nextTokensContext) { nextTokensContext = recognizer.getContext(); if (nextTokens.contains(identifierTokenIndex)) { ((CommonToken) token).setType(identifierTokenIndex);
if (labels.contains(currentToken)) { activeStates.add(new ParsingState(transition.target, tokenIndex + 1, caller));
@Override public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { return set.contains(symbol); }
/** Consume tokens until one matches the given token set. */ protected void consumeUntil(Parser recognizer, IntervalSet set) { // System.err.println("consumeUntil("+set.toString(recognizer.getTokenNames())+")"); int ttype = recognizer.getInputStream().LA(1); while (ttype != Token.EOF && !set.contains(ttype) ) { //System.out.println("consume during recover LA(1)="+getTokenNames()[input.LA(1)]); // recognizer.getInputStream().consume(); recognizer.consume(); ttype = recognizer.getInputStream().LA(1); } } }
ATNState s = atn.states.get(getState()); IntervalSet following = atn.nextTokens(s); if (following.contains(symbol)) { return true; if ( !following.contains(Token.EPSILON) ) return false; while ( ctx!=null && ctx.invokingState>=0 && following.contains(Token.EPSILON) ) { ATNState invokingState = atn.states.get(ctx.invokingState); RuleTransition rt = (RuleTransition)invokingState.transition(0); following = atn.nextTokens(rt.followState); if (following.contains(symbol)) { return true; if ( following.contains(Token.EPSILON) && symbol == Token.EOF ) { return true;
ATNState s = states.get(stateNumber); IntervalSet following = nextTokens(s); if (!following.contains(Token.EPSILON)) { return following; 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); if (following.contains(Token.EPSILON)) { expected.add(Token.EOF);
if ( look[alt].size()==0 || look[alt].contains(HIT_PRED) ) { look[alt] = null;
IntervalSet expectingAtLL2 = atn.nextTokens(next, recognizer._ctx); if ( expectingAtLL2.contains(currentSymbolType) ) { reportMissingToken(recognizer); return true;
boolean containsEof = set.contains(Token.EOF); if (containsEof && set.getIntervals().get(0).b == Token.EOF) { data.add(set.getIntervals().size() - 1);
int nextTokenType = recognizer.getInputStream().LA(2); IntervalSet expecting = getExpectedTokens(recognizer); if ( expecting.contains(nextTokenType) ) { reportUnwantedToken(recognizer);
@Override public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { return set.contains(symbol); }
@Override public boolean matches(int symbol, int minVocabSymbol, int maxVocabSymbol) { return set.contains(symbol); }
if (nextTokens.contains(Token.EPSILON)) { ATNState endOfRuleState = atn.ruleToStopState[config.state.ruleIndex]; result.add(new ATNConfig(config, endOfRuleState), mergeCache);
lastErrorStates.contains(recognizer.getState()) ) {
/** Consume tokens until one matches the given token set. */ protected void consumeUntil(Parser recognizer, IntervalSet set) { // System.err.println("consumeUntil("+set.toString(recognizer.getTokenNames())+")"); int ttype = recognizer.getInputStream().LA(1); while (ttype != Token.EOF && !set.contains(ttype) ) { //System.out.println("consume during recover LA(1)="+getTokenNames()[input.LA(1)]); // recognizer.getInputStream().consume(); recognizer.consume(); ttype = recognizer.getInputStream().LA(1); } } }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }
public void getNodesWithTypePreorderDFS_(List<GrammarAST> nodes, IntervalSet types) { if ( types.contains(this.getType()) ) nodes.add(this); // walk all children of root. for (int i= 0; i < getChildCount(); i++) { GrammarAST child = (GrammarAST)getChild(i); child.getNodesWithTypePreorderDFS_(nodes, types); } }
/** Consume tokens until one matches the given token set. */ protected void consumeUntil(@NotNull Parser recognizer, @NotNull IntervalSet set) { // System.err.println("consumeUntil("+set.toString(recognizer.getTokenNames())+")"); int ttype = recognizer.getInputStream().LA(1); while (ttype != Token.EOF && !set.contains(ttype) ) { //System.out.println("consume during recover LA(1)="+getTokenNames()[input.LA(1)]); // recognizer.getInputStream().consume(); recognizer.consume(); ttype = recognizer.getInputStream().LA(1); } } }