Class TokenTagToken
java.lang.Object
org.antlr.v4.runtime.CommonToken
org.antlr.v4.runtime.tree.pattern.TokenTagToken
- All Implemented Interfaces:
Serializable
,Token
,WritableToken
A
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.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
This is the backing field forgetLabel()
.private final String
This is the backing field forgetTokenName()
.Fields inherited from class org.antlr.v4.runtime.CommonToken
channel, charPositionInLine, EMPTY_SOURCE, index, line, source, start, stop, text, type
Fields inherited from interface org.antlr.v4.runtime.Token
DEFAULT_CHANNEL, EOF, EPSILON, HIDDEN_CHANNEL, INVALID_TYPE, MIN_USER_CHANNEL_VALUE, MIN_USER_TOKEN_TYPE
-
Constructor Summary
ConstructorsConstructorDescriptionTokenTagToken
(String tokenName, int type) Constructs a new instance ofTokenTagToken
for an unlabeled tag with the specified token name and type.TokenTagToken
(String tokenName, int type, String label) Constructs a new instance ofTokenTagToken
with the specified token name, type, and label. -
Method Summary
Methods inherited from class org.antlr.v4.runtime.CommonToken
getChannel, getCharPositionInLine, getInputStream, getLine, getStartIndex, getStopIndex, getTokenIndex, getTokenSource, getType, setChannel, setCharPositionInLine, setLine, setStartIndex, setStopIndex, setText, setTokenIndex, setType, toString
-
Field Details
-
tokenName
This is the backing field forgetTokenName()
. -
label
This is the backing field forgetLabel()
.
-
-
Constructor Details
-
TokenTagToken
Constructs a new instance ofTokenTagToken
for an unlabeled tag with the specified token name and type.- Parameters:
tokenName
- The token name.type
- The token type.
-
TokenTagToken
Constructs a new instance ofTokenTagToken
with the specified token name, type, and label.- Parameters:
tokenName
- The token name.type
- The token type.label
- The label associated with the token tag, ornull
if the token tag is unlabeled.
-
-
Method Details
-
getTokenName
Gets the token name.- Returns:
- The token name.
-
getLabel
Gets the label associated with the rule tag.- Returns:
- The name of the label associated with the rule tag, or
null
if this is an unlabeled rule tag.
-
getText
Get the text of the token.The implementation for
TokenTagToken
returns the token tag formatted with<
and>
delimiters.- Specified by:
getText
in interfaceToken
- Overrides:
getText
in classCommonToken
-
toString
The implementation for
TokenTagToken
returns a string of the formtokenName:type
.- Overrides:
toString
in classCommonToken
-