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, type
DEFAULT_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, toString
public TokenTagToken(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(String tokenName, int type, 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.public final String getTokenName()
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 Token
getText
in class CommonToken
public String toString()
The implementation for TokenTagToken
returns a string of the form
tokenName:type
.
toString
in class CommonToken
Copyright © 1992–2020 ANTLR. All rights reserved.