@Override public int index() { return stream.index(); }
@Override public int index() { return stream.index(); }
@Override public int index() { return stream.index(); }
private boolean match(String delimiter) { for (int i = 0; i < delimiter.length(); i++) { if (_input.LA(i + 1) != delimiter.charAt(i)) { return false; } } _input.seek(_input.index() + delimiter.length()); return true; } }
public void skipCurrentTokenConsuming() { _input.seek(_input.index() - 1); }
protected void captureSimState(SimState settings, CharStream input, DFAState dfaState) { settings.index = input.index(); settings.line = line; settings.charPos = charPositionInLine; settings.dfaState = dfaState; }
/** What is the index of the current character of lookahead? */ public int getCharIndex() { return _input.index(); }
_tokenStartCharIndex = _input.index(); _tokenStartCharPositionInLine = getInterpreter().getCharPositionInLine(); _tokenStartLine = getInterpreter().getLine();
/** Get the text matched so far for the current token. */ public String getText(CharStream input) { // index is first lookahead char, don't include. return input.getText(Interval.of(startIndex, input.index()-1)); }
protected int failOrAccept(SimState prevAccept, CharStream input, ATNConfigSet reach, int t) { if (prevAccept.dfaState != null) { LexerActionExecutor lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor; accept(input, lexerActionExecutor, startIndex, prevAccept.index, prevAccept.line, prevAccept.charPos); return prevAccept.dfaState.prediction; } else { // if no accept and EOF is first char, return EOF if ( t==IntStream.EOF && input.index()==startIndex ) { return Token.EOF; } throw new LexerNoViableAltException(recog, input, startIndex, reach); } }
public void notifyListeners(LexerNoViableAltException e) { String text = _input.getText(Interval.of(_tokenStartCharIndex, _input.index())); String msg = "token recognition error at: '"+ getErrorDisplay(text) + "'"; ANTLRErrorListener listener = getErrorListenerDispatch(); listener.syntaxError(this, null, _tokenStartLine, _tokenStartCharPositionInLine, msg, e); }
public int match(CharStream input, int mode) { match_calls++; this.mode = mode; int mark = input.mark(); try { this.startIndex = input.index(); this.prevAccept.reset(); DFA dfa = decisionToDFA[mode]; if ( dfa.s0==null ) { return matchATN(input); } else { return execATN(input, dfa.s0); } } finally { input.release(mark); } }
LexerActionExecutor lexerActionExecutor = ((LexerATNConfig)c).getLexerActionExecutor(); if (lexerActionExecutor != null) { lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index() - startIndex);
int index = input.index(); int marker = input.mark(); try {
int stopIndex = input.index(); try { for (LexerAction lexerAction : lexerActions) {
_tokenStartCharIndex = _input.index(); _tokenStartCharPositionInLine = getInterpreter().getCharPositionInLine(); _tokenStartLine = getInterpreter().getLine();
@Override public Token nextToken() { _tokenStartCharIndex = _input.index(); CommonToken t = null; while ( t==null ) {