Class TokenTagToken
- java.lang.Object
-
- org.antlr.v4.runtime.CommonToken
-
- org.antlr.v4.runtime.tree.pattern.TokenTagToken
-
- All Implemented Interfaces:
java.io.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 Modifier and Type Field Description private java.lang.StringlabelThis is the backing field forgetLabel().private java.lang.StringtokenNameThis 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
Constructors Constructor Description TokenTagToken(java.lang.String tokenName, int type)Constructs a new instance ofTokenTagTokenfor an unlabeled tag with the specified token name and type.TokenTagToken(java.lang.String tokenName, int type, java.lang.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 java.lang.StringgetLabel()Gets the label associated with the rule tag.java.lang.StringgetText()Get the text of the token.java.lang.StringgetTokenName()Gets the token name.java.lang.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
-
-
-
-
Field Detail
-
tokenName
private final java.lang.String tokenName
This is the backing field forgetTokenName().
-
label
private final java.lang.String label
This is the backing field forgetLabel().
-
-
Constructor Detail
-
TokenTagToken
public TokenTagToken(java.lang.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(java.lang.String tokenName, int type, java.lang.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 java.lang.String getTokenName()
Gets the token name.- Returns:
- The token name.
-
getLabel
public final java.lang.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 java.lang.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 java.lang.String toString()
The implementation for
TokenTagTokenreturns a string of the formtokenName:type.- Overrides:
toStringin classCommonToken
-
-