Class TokenTagToken
- java.lang.Object
-
- org.antlr.v4.runtime.CommonToken
-
- org.antlr.v4.runtime.tree.pattern.TokenTagToken
-
- All Implemented Interfaces:
Serializable,Token,WritableToken
public class TokenTagToken extends CommonToken
ATokenobject representing a token of a particular type; e.g.,<ID>. These tokens are created forTagChunkchunks where the tag corresponds to a lexer rule or token type.- See Also:
- Serialized Form
-
-
Field Summary
-
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
Constructors Constructor Description TokenTagToken(String tokenName, int type)Constructs a new instance ofTokenTagTokenfor an unlabeled tag with the specified token name and type.TokenTagToken(String tokenName, int type, String label)Constructs a new instance ofTokenTagTokenwith the specified token name, type, and label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetLabel()Gets the label associated with the rule tag.StringgetText()Get the text of the token.StringgetTokenName()Gets the token name.StringtoString()-
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
-
-
-
-
Constructor Detail
-
TokenTagToken
public TokenTagToken(String tokenName, int type)
Constructs a new instance ofTokenTagTokenfor an unlabeled tag with the specified token name and type.- Parameters:
tokenName- The token name.type- The token type.
-
TokenTagToken
public TokenTagToken(String tokenName, int type, String label)
Constructs a new instance ofTokenTagTokenwith the specified token name, type, and label.- Parameters:
tokenName- The token name.type- The token type.label- The label associated with the token tag, ornullif the token tag is unlabeled.
-
-
Method Detail
-
getTokenName
public final String getTokenName()
Gets the token name.- Returns:
- The token name.
-
getLabel
public final String getLabel()
Gets the label associated with the rule tag.- Returns:
- The name of the label associated with the rule tag, or
nullif this is an unlabeled rule tag.
-
getText
public String getText()
Get the text of the token.The implementation for
TokenTagTokenreturns the token tag formatted with<and>delimiters.- Specified by:
getTextin interfaceToken- Overrides:
getTextin classCommonToken
-
toString
public String toString()
The implementation for
TokenTagTokenreturns a string of the formtokenName:type.- Overrides:
toStringin classCommonToken
-
-