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

public Class RuleTagToken

extends Object
implements Token
Class Inheritance
All Implemented Interfaces
org.antlr.v4.runtime.Token
Imports
org.antlr.v4.runtime.CharStream, .Token, .TokenSource

A Token object representing an entire subtree matched by a parser rule; e.g., <expr>. These tokens are created for TagChunk chunks where the tag corresponds to a parser rule.

Field Summary

Modifier and TypeField and Description
private final int
bypassTokenType

The token type for the current token.

private final String
label

This is the backing field for getLabel.

private final String
ruleName

This is the backing field for getRuleName.

Constructor Summary

AccessConstructor and Description
public
RuleTagToken(String
The name of the parser rule this rule tag matches.
ruleName
,
int
The bypass token type assigned to the parser rule.
bypassTokenType
)

Constructs a new instance of RuleTagToken with the specified rule name and bypass token type and no label.

public
RuleTagToken(String
The name of the parser rule this rule tag matches.
ruleName
,
int
The bypass token type assigned to the parser rule.
bypassTokenType
,
String
The label associated with the rule tag, or null if the rule tag is unlabeled.
label
)

Constructs a new instance of RuleTagToken with the specified rule name, bypass token type, and label.

Method Summary

Modifier and TypeMethod and Description
public int
getChannel()

Implements org.antlr.v4.runtime.Token.getChannel.

Return the channel this token.
public int
getCharPositionInLine()

Implements org.antlr.v4.runtime.Token.getCharPositionInLine.

The index of the first character of this token relative to the beginning of the line at which it occurs, 0..n-1

The implementation for RuleTagToken always returns -1.

public CharStream
getInputStream()

Implements org.antlr.v4.runtime.Token.getInputStream.

Gets the CharStream from which this token was derived.
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 int
getLine()

Implements org.antlr.v4.runtime.Token.getLine.

The line number on which the 1st character of this token was matched, line=1..n

The implementation for RuleTagToken always returns 0.

public final String

Returns:

The name of the parser rule associated with this rule tag.
getRuleName
()

Gets the name of the rule associated with this rule tag.

public int
getStartIndex()

Implements org.antlr.v4.runtime.Token.getStartIndex.

The starting character index of the token This method is optional; return -1 if not implemented.
public int
getStopIndex()

Implements org.antlr.v4.runtime.Token.getStopIndex.

The last character index of the token.
public String
getText()

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

Get the text of the token.
public int
getTokenIndex()

Implements org.antlr.v4.runtime.Token.getTokenIndex.

An index from 0..n-1 of the token object in the input stream.
public TokenSource
getTokenSource()

Implements org.antlr.v4.runtime.Token.getTokenSource.

Gets the TokenSource which created this token.
public int
getType()

Implements org.antlr.v4.runtime.Token.getType.

Get the token type of the token

Rule tag tokens have types assigned according to the rule bypass transitions created during ATN deserialization.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bypassTokenTypeback to summary
private final int bypassTokenType

The token type for the current token. This is the token type assigned to the bypass alternative for the rule during ATN deserialization.

labelback to summary
private final String label

This is the backing field for getLabel.

ruleNameback to summary
private final String ruleName

This is the backing field for getRuleName.

Constructor Detail

RuleTagTokenback to summary
public RuleTagToken(String ruleName, int bypassTokenType)

Constructs a new instance of RuleTagToken with the specified rule name and bypass token type and no label.

Parameters
ruleName:String

The name of the parser rule this rule tag matches.

bypassTokenType:int

The bypass token type assigned to the parser rule.

Exceptions
IllegalArgumentException:
if ruleName is null or empty.
RuleTagTokenback to summary
public RuleTagToken(String ruleName, int bypassTokenType, String label)

Constructs a new instance of RuleTagToken with the specified rule name, bypass token type, and label.

Parameters
ruleName:String

The name of the parser rule this rule tag matches.

bypassTokenType:int

The bypass token type assigned to the parser rule.

label:String

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

Exceptions
IllegalArgumentException:
if ruleName is null or empty.

Method Detail

getChannelback to summary
public int getChannel()

Implements org.antlr.v4.runtime.Token.getChannel.

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

Return the channel this token. Each token can arrive at the parser on a different channel, but the parser only "tunes" to a single channel. The parser ignores everything not on DEFAULT_CHANNEL.

Rule tag tokens are always placed on the DEFAULT_CHANNEL.

Annotations
@Override
getCharPositionInLineback to summary
public int getCharPositionInLine()

Implements org.antlr.v4.runtime.Token.getCharPositionInLine.

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

The index of the first character of this token relative to the beginning of the line at which it occurs, 0..n-1

The implementation for RuleTagToken always returns -1.

Annotations
@Override
getInputStreamback to summary
public CharStream getInputStream()

Implements org.antlr.v4.runtime.Token.getInputStream.

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

Gets the CharStream from which this token was derived.

The implementation for RuleTagToken always returns null.

Annotations
@Override
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.

getLineback to summary
public int getLine()

Implements org.antlr.v4.runtime.Token.getLine.

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

The line number on which the 1st character of this token was matched, line=1..n

The implementation for RuleTagToken always returns 0.

Annotations
@Override
getRuleNameback to summary
public final String getRuleName()

Gets the name of the rule associated with this rule tag.

Returns:String

The name of the parser rule associated with this rule tag.

getStartIndexback to summary
public int getStartIndex()

Implements org.antlr.v4.runtime.Token.getStartIndex.

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

The starting character index of the token This method is optional; return -1 if not implemented.

The implementation for RuleTagToken always returns -1.

Annotations
@Override
getStopIndexback to summary
public int getStopIndex()

Implements org.antlr.v4.runtime.Token.getStopIndex.

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

The last character index of the token. This method is optional; return -1 if not implemented.

The implementation for RuleTagToken always returns -1.

Annotations
@Override
getTextback to summary
public String getText()

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

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

Get the text of the token.

This method returns the rule tag formatted with < and > delimiters.

Annotations
@Override
getTokenIndexback to summary
public int getTokenIndex()

Implements org.antlr.v4.runtime.Token.getTokenIndex.

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

An index from 0..n-1 of the token object in the input stream. This must be valid in order to print token streams and use TokenRewriteStream. Return -1 to indicate that this token was conjured up since it doesn't have a valid index.

The implementation for RuleTagToken always returns -1.

Annotations
@Override
getTokenSourceback to summary
public TokenSource getTokenSource()

Implements org.antlr.v4.runtime.Token.getTokenSource.

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

Gets the TokenSource which created this token.

The implementation for RuleTagToken always returns null.

Annotations
@Override
getTypeback to summary
public int getType()

Implements org.antlr.v4.runtime.Token.getType.

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

Get the token type of the token

Rule tag tokens have types assigned according to the rule bypass transitions created during ATN deserialization.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

The implementation for RuleTagToken returns a string of the form ruleName:bypassTokenType.

Returns:String

a string representation of the object

Annotations
@Override