Top Description Fields Constructors Methods
org.antlr.v4.runtime.tree.pattern

public Class TokenTagToken

extends CommonToken
Class Inheritance
Imports
org.antlr.v4.runtime.CommonToken, .Token, org.antlr.v4.runtime.misc.NotNull, .Nullable

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.

Field Summary

Modifier and TypeField and Description
private final String
label

This is the backing field for getLabel.

private final String
tokenName

This is the backing field for getTokenName.

Inherited from org.antlr.v4.runtime.CommonToken:
channelcharPositionInLineEMPTY_SOURCEindexlinesourcestartstoptexttype

Constructor Summary

AccessConstructor and Description
public
TokenTagToken(String
The token name.
tokenName
,
int
The token type.
type
)

Constructs a new instance of TokenTagToken for an unlabeled tag with the specified token name and type.

public
TokenTagToken(String
The token name.
tokenName
,
int
The token type.
type
,
String
The label associated with the token tag, or null if the token tag is unlabeled.
label
)

Constructs a new instance of TokenTagToken with the specified token name, type, and label.

Method Summary

Modifier and TypeMethod and Description
public final String

Returns:

The name of the label associated with the rule tag, or null if this is an unlabeled rule tag.
getLabel
()

Gets the label associated with the rule tag.

public String
getText()

Overrides org.antlr.v4.runtime.CommonToken.getText.

Implements org.antlr.v4.runtime.Token.getText.

Get the text of the token.
public final String

Returns:

The token name.
getTokenName
()

Gets the token name.

public String
toString()

Overrides org.antlr.v4.runtime.CommonToken.toString.

Returns a string representation of the object.
Inherited from org.antlr.v4.runtime.CommonToken:
getChannelgetCharPositionInLinegetInputStreamgetLinegetStartIndexgetStopIndexgetTokenIndexgetTokenSourcegetTypesetChannelsetCharPositionInLinesetLinesetStartIndexsetStopIndexsetTextsetTokenIndexsetTypetoString

Field Detail

labelback to summary
private final String label

This is the backing field for getLabel.

Annotations
@Nullable
tokenNameback to summary
private final String tokenName

This is the backing field for getTokenName.

Annotations
@NotNull

Constructor Detail

TokenTagTokenback to summary
public TokenTagToken(String tokenName, int type)

Constructs a new instance of TokenTagToken for an unlabeled tag with the specified token name and type.

Parameters
tokenName:String

The token name.

type:int

The token type.

TokenTagTokenback to summary
public TokenTagToken(String tokenName, int type, String label)

Constructs a new instance of TokenTagToken with the specified token name, type, and label.

Parameters
tokenName:String

The token name.

type:int

The token type.

label:String

The label associated with the token tag, or null if the token tag is unlabeled.

Method Detail

getLabelback to summary
public final String getLabel()

Gets the label associated with the rule tag.

Returns:String

The name of the label associated with the rule tag, or null if this is an unlabeled rule tag.

Annotations
@Nullable
getTextback to summary
public String getText()

Overrides org.antlr.v4.runtime.CommonToken.getText.

Implements org.antlr.v4.runtime.Token.getText.

Doc from org.antlr.v4.runtime.Token.getText.

Get the text of the token.

The implementation for TokenTagToken returns the token tag formatted with < and > delimiters.

Annotations
@Override
getTokenNameback to summary
public final String getTokenName()

Gets the token name.

Returns:String

The token name.

Annotations
@NotNull
toStringback to summary
public String toString()

Overrides org.antlr.v4.runtime.CommonToken.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

The implementation for TokenTagToken returns a string of the form tokenName:type.

Returns:String

a string representation of the object.

Annotations
@Override