Package eu.bandm.tools.lexic
Interface Token<D,T>
- Type Parameters:
D
- the type of source document identifiersT
- the type of token types; typically (but not necessarily) an enum type
- All Known Implementing Classes:
SimpleToken
public interface Token<D,T>
Abstract interface of parser tokens.
-
Method Details
-
getLocation
Returns the source location of this token.The default implementation returns
null
.- Returns:
- the source location of this token, or
null
if not available.
-
getType
T getType()Returns the type of this token.- Returns:
- the type of this token.
-
getText
Returns the text content of this token.The default implementation returns
null
.- Returns:
- the text content of this token, or
null
if not available.
-
withType
Returns a token that differs from this token only by a change of token type.- Parameters:
type
- the type of the new token- Returns:
- a token that differs from this token only by having the given token type instead
-