input.index(),input.index()); eof.setLine(getLine()); eof.setCharPositionInLine(getCharPositionInLine()); return eof;
public void setCharPositionInLine(int value){ token.setCharPositionInLine(value); }
public void setCharPositionInLine(int value){ token.setCharPositionInLine(value); }
public void offer(int ttype, String ttext) { Token t = new CommonToken(ttype, ttext); t.setLine(getLine()); t.setCharPositionInLine(getCharPositionInLine()); emit(t); }
public void offer(int ttype, String ttext) { Token t = new CommonToken(ttype, ttext); t.setLine(getLine()); t.setCharPositionInLine(getCharPositionInLine()); emit(t); }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. */ public Token emit() { Token t = new DroolsToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
/** Returns the EOF token (default), if you need * to return a custom token instead override this method. */ public Token getEOFToken() { Token eof = new CommonToken(input,Token.EOF, Token.DEFAULT_CHANNEL, input.index(),input.index()); eof.setLine(getLine()); eof.setCharPositionInLine(getCharPositionInLine()); return eof; }
/** Returns the EOF token (default), if you need * to return a custom token instead override this method. */ public Token getEOFToken() { Token eof = new CommonToken(input,Token.EOF, Token.DEFAULT_CHANNEL, input.index(),input.index()); eof.setLine(getLine()); eof.setCharPositionInLine(getCharPositionInLine()); return eof; }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. * * If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). */ public Token emit() { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
/** Returns the EOF token (default), if you need * to return a custom token instead override this method. */ public Token getEOFToken() { Token eof = new CommonToken(input,Token.EOF, Token.DEFAULT_CHANNEL, input.index(),input.index()); eof.setLine(getLine()); eof.setCharPositionInLine(getCharPositionInLine()); return eof; }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. * * If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). */ public Token emit() { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
/** Returns the EOF token (default), if you need * to return a custom token instead override this method. */ public Token getEOFToken() { Token eof = new CommonToken(input,Token.EOF, Token.DEFAULT_CHANNEL, input.index(),input.index()); eof.setLine(getLine()); eof.setCharPositionInLine(getCharPositionInLine()); return eof; }
/** Returns the EOF token (default), if you need * to return a custom token instead override this method. */ public Token getEOFToken() { Token eof = new CommonToken(input,Token.EOF, Token.DEFAULT_CHANNEL, input.index(),input.index()); eof.setLine(getLine()); eof.setCharPositionInLine(getCharPositionInLine()); return eof; }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. * * If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). */ public Token emit() { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. * * If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). */ public Token emit() { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. * * If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). */ public Token emit() { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
/** The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. * * If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). */ public Token emit() { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); emit(t); return t; }
public final void mSYNPRED() throws RecognitionException { try { int _type = SYNPRED; int _channel = DEFAULT_TOKEN_CHANNEL; // org/antlr/v4/parse/ANTLRLexer.g:491:14: ( '=>' ) // org/antlr/v4/parse/ANTLRLexer.g:491:16: '=>' { match("=>"); if (state.failed) return; if ( state.backtracking==0 ) { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); grammarError(ErrorType.V3_SYNPRED, t); _channel=HIDDEN; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "SYNPRED"
public final void mERRCHAR() throws RecognitionException { try { int _type = ERRCHAR; int _channel = DEFAULT_TOKEN_CHANNEL; // org/antlr/v4/parse/ANTLRLexer.g:787:5: ( . ) // org/antlr/v4/parse/ANTLRLexer.g:787:7: . { matchAny(); if (state.failed) return; if ( state.backtracking==0 ) { Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); t.setLine(state.tokenStartLine); t.setText(state.text); t.setCharPositionInLine(state.tokenStartCharPositionInLine); String msg = getTokenErrorDisplay(t) + " came as a complete surprise to me"; grammarError(ErrorType.SYNTAX_ERROR, t, msg); state.syntaxErrors++; skip(); } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } // $ANTLR end "ERRCHAR"
protected void updateASTLocations(AST ast) { ast.setColumn(preprocessor.getTrace().getEglColumnNumberFor(ast.getLine(), ast.getColumn())); ast.setLine(preprocessor.getTrace().getEglLineNumberFor(ast.getLine())); for (Token token : ast.getExtraTokens()) { if (token == null) continue; token.setCharPositionInLine(preprocessor.getTrace().getEglColumnNumberFor(token.getLine(), token.getCharPositionInLine())); token.setLine(preprocessor.getTrace().getEglLineNumberFor(token.getLine())); } boolean done = updateRegionsOfStaticTextASTs(ast); ast.setRegion(null); // Force ast to recompute its region if (!done) { for (AST child : ast.getChildren()) { updateASTLocations(child); } } }