state.tokenStartCharIndex = input.index(); state.tokenStartCharPositionInLine = input.getCharPositionInLine(); state.tokenStartLine = input.getLine(); state.text = null; try {
public void reportScanError(RecognitionException re) { CharStream cs = (CharStream)input; // print as good of a message as we can, given that we do not have // a Lexer object and, hence, cannot call the routine to get a // decent error message. System.err.println("problem matching token at "+ cs.getLine()+":"+cs.getCharPositionInLine()+" "+re); }
public void reportScanError(RecognitionException re) { CharStream cs = (CharStream)input; // print as good of a message as we can, given that we do not have // a Lexer object and, hence, cannot call the routine to get a // decent error message. System.err.println("problem matching token at "+ cs.getLine()+":"+cs.getCharPositionInLine()+" "+re); }
public void reportScanError(RecognitionException re) { CharStream cs = (CharStream)input; // print as good of a message as we can, given that we do not have // a Lexer object and, hence, cannot call the routine to get a // decent error message. System.err.println("problem matching token at "+ cs.getLine()+":"+cs.getCharPositionInLine()+" "+re); }
public void reportScanError(RecognitionException re) { CharStream cs = (CharStream)input; // print as good of a message as we can, given that we do not have // a Lexer object and, hence, cannot call the routine to get a // decent error message. System.err.println("problem matching token at "+ cs.getLine()+":"+cs.getCharPositionInLine()+" "+re); }
AntlrPosition(final int tokenType, CharStream stream) { this.index = stream.index(); this.linePosition = stream.getLine(); this.charPosition = stream.getCharPositionInLine(); this.tokenType = tokenType; }
@Override public void reportScanError(RecognitionException re) { CharStream cs = (CharStream)input; window.consoleTab.println("problem matching token at "+ cs.getLine()+":"+cs.getCharPositionInLine()+" "+re); } }
public Token _nextToken() { //System.out.println("nextToken: c="+(char)c+"@"+input.index()); while ( true ) { // lets us avoid recursion when skipping stuff startCharIndex = input.index(); startLine = input.getLine(); startCharPositionInLine = input.getCharPositionInLine(); if ( c==EOF ) return newToken(EOF_TYPE); Token t; if ( scanningInsideExpr ) t = inside(); else t = outside(); if ( t!=SKIP ) return t; } }
public Token _nextToken() { //System.out.println("nextToken: c="+(char)c+"@"+input.index()); while ( true ) { // lets us avoid recursion when skipping stuff startCharIndex = input.index(); startLine = input.getLine(); startCharPositionInLine = input.getCharPositionInLine(); if ( c==EOF ) return newToken(EOF_TYPE); Token t; if ( scanningInsideExpr ) t = inside(); else t = outside(); if ( t!=SKIP ) return t; } }
public Token newTokenFromPreviousChar(int ttype) { STToken t = new STToken(input, ttype, input.index()-1, input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(input.getCharPositionInLine()-1); return t; }
public Token newToken(int ttype, String text, int pos) { STToken t = new STToken(ttype, text); t.setStartIndex(startCharIndex); t.setStopIndex(input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(pos); return t; }
public Token newTokenFromPreviousChar(int ttype) { STToken t = new STToken(input, ttype, input.index()-1, input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(input.getCharPositionInLine()-1); return t; }
public Token newToken(int ttype, String text, int pos) { STToken t = new STToken(ttype, text); t.setStartIndex(startCharIndex); t.setStopIndex(input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(pos); return t; }
public Token newTokenFromPreviousChar(int ttype) { STToken t = new STToken(input, ttype, input.index()-1, input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(input.getCharPositionInLine()-1); return t; }
/** ID : ('a'..'z'|'A'..'Z'|'_'|'/') ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'/')* ; */ Token mID() { // called from subTemplate; so keep resetting position during speculation startCharIndex = input.index(); startLine = input.getLine(); startCharPositionInLine = input.getCharPositionInLine(); consume(); while ( isIDLetter(c) ) { consume(); } return newToken(ID); }
public Token newToken(int ttype, String text, int pos) { STToken t = new STToken(ttype, text); t.setStartIndex(startCharIndex); t.setStopIndex(input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(pos); return t; }
public Token newToken(int ttype, String text, int pos) { STToken t = new STToken(ttype, text); t.setStartIndex(startCharIndex); t.setStopIndex(input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(pos); return t; }
public Token newTokenFromPreviousChar(int ttype) { STToken t = new STToken(input, ttype, input.index()-1, input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(input.getCharPositionInLine()-1); return t; }
public Token newTokenFromPreviousChar(int ttype) { STToken t = new STToken(input, ttype, input.index()-1, input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(input.getCharPositionInLine()-1); return t; }
public Token newToken(int ttype, String text, int pos) { STToken t = new STToken(ttype, text); t.setStartIndex(startCharIndex); t.setStopIndex(input.index()-1); t.setLine(input.getLine()); t.setCharPositionInLine(pos); return t; }