Package org.codehaus.janino
Class Token
- java.lang.Object
-
- org.codehaus.janino.Token
-
public final class Token extends java.lang.ObjectImmutable representation of a Java token.
-
-
Field Summary
Fields Modifier and Type Field Description private intcolumnNumberprivate java.lang.StringfileNameprivate intlineNumberprivate LocationlocationTokenTypetypeThe type of this token.java.lang.StringvalueThe text of the token exactly as it appears in the source code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocationgetLocation()java.lang.StringtoString()
-
-
-
Field Detail
-
fileName
@Nullable private final java.lang.String fileName
-
lineNumber
private final int lineNumber
-
columnNumber
private final int columnNumber
-
type
public final TokenType type
The type of this token.Strictly speaking, this field is redundant, because the token type can always be deduced from the token value, e.g. iff the value begins with "'", then the type is
TokenType.CHARACTER_LITERAL.
-
value
public final java.lang.String value
The text of the token exactly as it appears in the source code.Iff this token represents a keyword,
true,false,nullor an operator, then this string isinterned, so that it can be reference-compared with other interned strings.
-
-
Method Detail
-
getLocation
public Location getLocation()
- Returns:
- The location of the first character of this token
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-