DEFAULT_CHANNEL, EOF, EPSILON, HIDDEN_CHANNEL, INVALID_TYPE, MIN_USER_CHANNEL_VALUE, MIN_USER_TOKEN_TYPE
Constructor and Description |
---|
RuleTagToken(String ruleName,
int bypassTokenType)
Constructs a new instance of
RuleTagToken with the specified rule
name and bypass token type and no label. |
RuleTagToken(String ruleName,
int bypassTokenType,
String label)
Constructs a new instance of
RuleTagToken with the specified rule
name, bypass token type, and label. |
Modifier and Type | Method and Description |
---|---|
int |
getChannel()
Return the channel this token.
|
int |
getCharPositionInLine()
The index of the first character of this token relative to the
beginning of the line at which it occurs, 0..n-1
|
CharStream |
getInputStream()
Gets the
CharStream from which this token was derived. |
String |
getLabel()
Gets the label associated with the rule tag.
|
int |
getLine()
The line number on which the 1st character of this token was matched,
line=1..n
|
String |
getRuleName()
Gets the name of the rule associated with this rule tag.
|
int |
getStartIndex()
The starting character index of the token
This method is optional; return -1 if not implemented.
|
int |
getStopIndex()
The last character index of the token.
|
String |
getText()
Get the text of the token.
|
int |
getTokenIndex()
An index from 0..n-1 of the token object in the input stream.
|
TokenSource |
getTokenSource()
Gets the
TokenSource which created this token. |
int |
getType()
Get the token type of the token
|
String |
toString() |
public RuleTagToken(String ruleName, int bypassTokenType)
RuleTagToken
with the specified rule
name and bypass token type and no label.ruleName
- The name of the parser rule this rule tag matches.bypassTokenType
- The bypass token type assigned to the parser rule.IllegalArgumentException
- if ruleName
is null
or empty.public RuleTagToken(String ruleName, int bypassTokenType, String label)
RuleTagToken
with the specified rule
name, bypass token type, and label.ruleName
- The name of the parser rule this rule tag matches.bypassTokenType
- The bypass token type assigned to the parser rule.label
- The label associated with the rule tag, or null
if
the rule tag is unlabeled.IllegalArgumentException
- if ruleName
is null
or empty.public final String getRuleName()
public final String getLabel()
null
if this is an unlabeled rule tag.public int getChannel()
Rule tag tokens are always placed on the Token.DEFAULT_CHANNEL
.
getChannel
in interface Token
public String getText()
This method returns the rule tag formatted with <
and >
delimiters.
public int getType()
Rule tag tokens have types assigned according to the rule bypass transitions created during ATN deserialization.
public int getLine()
The implementation for RuleTagToken
always returns 0.
public int getCharPositionInLine()
The implementation for RuleTagToken
always returns -1.
getCharPositionInLine
in interface Token
public int getTokenIndex()
The implementation for RuleTagToken
always returns -1.
getTokenIndex
in interface Token
public int getStartIndex()
The implementation for RuleTagToken
always returns -1.
getStartIndex
in interface Token
public int getStopIndex()
The implementation for RuleTagToken
always returns -1.
getStopIndex
in interface Token
public TokenSource getTokenSource()
TokenSource
which created this token.
The implementation for RuleTagToken
always returns null
.
getTokenSource
in interface Token
public CharStream getInputStream()
CharStream
from which this token was derived.
The implementation for RuleTagToken
always returns null
.
getInputStream
in interface Token
public String toString()
The implementation for RuleTagToken
returns a string of the form
ruleName:bypassTokenType
.
Copyright © 1992–2016 ANTLR. All rights reserved.