public class TokenTagToken extends CommonToken
Token object representing a token of a particular type; e.g.,
<ID>. These tokens are created for TagChunk chunks where the
tag corresponds to a lexer rule or token type.channel, charPositionInLine, EMPTY_SOURCE, index, line, source, start, stop, text, typeDEFAULT_CHANNEL, EOF, EPSILON, HIDDEN_CHANNEL, INVALID_TYPE, MIN_USER_CHANNEL_VALUE, MIN_USER_TOKEN_TYPE| Constructor and Description |
|---|
TokenTagToken(String tokenName,
int type)
Constructs a new instance of
TokenTagToken for an unlabeled tag
with the specified token name and type. |
TokenTagToken(String tokenName,
int type,
String label)
Constructs a new instance of
TokenTagToken with the specified
token name, type, and label. |
| Modifier and Type | Method and Description |
|---|---|
String |
getLabel()
Gets the label associated with the rule tag.
|
String |
getText()
Get the text of the token.
|
String |
getTokenName()
Gets the token name.
|
String |
toString() |
getChannel, getCharPositionInLine, getInputStream, getLine, getStartIndex, getStopIndex, getTokenIndex, getTokenSource, getType, setChannel, setCharPositionInLine, setLine, setStartIndex, setStopIndex, setText, setTokenIndex, setType, toStringpublic TokenTagToken(@NotNull
String tokenName,
int type)
TokenTagToken for an unlabeled tag
with the specified token name and type.tokenName - The token name.type - The token type.public TokenTagToken(@NotNull
String tokenName,
int type,
@Nullable
String label)
TokenTagToken with the specified
token name, type, and label.tokenName - The token name.type - The token type.label - The label associated with the token tag, or null if
the token tag is unlabeled.@NotNull public final String getTokenName()
@Nullable public final String getLabel()
null if this is an unlabeled rule tag.public String getText()
The implementation for TokenTagToken returns the token tag
formatted with < and > delimiters.
getText in interface TokengetText in class CommonTokenpublic String toString()
The implementation for TokenTagToken returns a string of the form
tokenName:type.
toString in class CommonTokenCopyright © 1992–2024 Daniel Sun. All rights reserved.