public final class Token extends Object
| Constructor and Description |
|---|
Token(int type,
Object value,
String token,
int line)
Creates a token with the given attributes.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Returns
true if o is a non-null
Token instance of the same type and raw token
text; false otherwise. |
int |
hashCode()
Returns the token hashcode based on the raw token string.
|
boolean |
isValue(Object value)
Returns
true if value equals the
token value and false otherwise. |
int |
lineNumber()
Returns the input line number where the token was found.
|
String |
token()
Returns the raw token string.
|
String |
toString()
Returns this token's textual representation.
|
int |
type()
Returns the token type.
|
Object |
value()
Returns the token value.
|
public Token(int type,
Object value,
String token,
int line)
type - The token type. See TokenLexer for the
token type list.value - The token value created from raw token
string.token - The raw token string.line - The input line where the token was found.public int type()
public Object value()
public String token()
public int lineNumber()
public boolean isValue(Object value)
true if value equals the
token value and false otherwise.value - Test equality between this object and the
token value.true if value equals the
token value and false otherwise.public boolean equals(Object o)
true if o is a non-null
Token instance of the same type and raw token
text; false otherwise.public int hashCode()
Copyright © 2019. All rights reserved.