private final Token jjFillToken() { Token t = Token.newToken(jjmatchedKind); t.kind = jjmatchedKind; String im = jjstrLiteralImages[jjmatchedKind]; t.image = (im == null) ? input_stream.GetImage() : im; t.beginLine = input_stream.getBeginLine(); t.beginColumn = input_stream.getBeginColumn(); t.endLine = input_stream.getEndLine(); t.endColumn = input_stream.getEndColumn(); return t; }
public static Token ERROR(String lexeme, int linePos, int charPos) { Token tok = new Token(lexeme, linePos, charPos); tok.kind = Kind.ERROR; return tok; }
// factory function public static Token EOF(int linePos, int charPos) { Token tok = new Token(linePos, charPos); tok.kind = Kind.EOF; return tok; }
public static Token Identifier(String name, int linePos, int charPos) { Token tok = new Token(linePos, charPos); tok.kind = Kind.IDENTIFIER; tok.lexeme = name; return tok; }
public static Token Error(String description, int linePos, int charPos) { Token tok = new Token(linePos, charPos); tok.kind = Kind.ERROR; tok.lexeme = description; return tok; }
public static Token Float(String value, int linePos, int charPos) { Token tok = new Token(linePos, charPos); tok.kind = Kind.FLOAT; tok.lexeme = value; return tok; }
public static Token Integer(String value, int linePos, int charPos) { Token tok = new Token(linePos, charPos); tok.kind = Kind.INTEGER; tok.lexeme = value; return tok; }