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;
 }
Exemple #2
0
 public static Token ERROR(String lexeme, int linePos, int charPos) {
   Token tok = new Token(lexeme, linePos, charPos);
   tok.kind = Kind.ERROR;
   return tok;
 }
Exemple #3
0
 // factory function
 public static Token EOF(int linePos, int charPos) {
   Token tok = new Token(linePos, charPos);
   tok.kind = Kind.EOF;
   return tok;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 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;
 }
Exemple #7
0
 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;
 }