Class RuleTagToken
java.lang.Object
org.graalvm.shadowed.org.antlr.v4.runtime.tree.pattern.RuleTagToken
-
Field Summary
Fields inherited from interface org.graalvm.shadowed.org.antlr.v4.runtime.Token
DEFAULT_CHANNEL, EOF, EPSILON, HIDDEN_CHANNEL, INVALID_TYPE, MIN_USER_CHANNEL_VALUE, MIN_USER_TOKEN_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionRuleTagToken(String ruleName, int bypassTokenType) Constructs a new instance ofRuleTagTokenwith the specified rule name and bypass token type and no label.RuleTagToken(String ruleName, int bypassTokenType, String label) Constructs a new instance ofRuleTagTokenwith the specified rule name, bypass token type, and label. -
Method Summary
Modifier and TypeMethodDescriptionintReturn the channel this token.intThe index of the first character of this token relative to the beginning of the line at which it occurs, 0..n-1Gets theCharStreamfrom which this token was derived.final StringgetLabel()Gets the label associated with the rule tag.intgetLine()The line number on which the 1st character of this token was matched, line=1..nfinal StringGets the name of the rule associated with this rule tag.intThe starting character index of the token This method is optional; return -1 if not implemented.intThe last character index of the token.getText()Get the text of the token.intAn index from 0..n-1 of the token object in the input stream.Gets theTokenSourcewhich created this token.intgetType()Get the token type of the tokentoString()
-
Constructor Details
-
RuleTagToken
Constructs a new instance ofRuleTagTokenwith the specified rule name and bypass token type and no label.- Parameters:
ruleName- The name of the parser rule this rule tag matches.bypassTokenType- The bypass token type assigned to the parser rule.- Throws:
IllegalArgumentException- ifruleNameisnullor empty.
-
RuleTagToken
Constructs a new instance ofRuleTagTokenwith the specified rule name, bypass token type, and label.- Parameters:
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, ornullif the rule tag is unlabeled.- Throws:
IllegalArgumentException- ifruleNameisnullor empty.
-
-
Method Details
-
getRuleName
Gets the name of the rule associated with this rule tag.- Returns:
- The name of the parser rule associated with this rule tag.
-
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.
-
getChannel
public int 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
Token.DEFAULT_CHANNEL.- Specified by:
getChannelin interfaceToken
-
getText
-
getType
-
getLine
public int getLine()The line number on which the 1st character of this token was matched, line=1..nThe implementation for
RuleTagTokenalways returns 0. -
getCharPositionInLine
public int getCharPositionInLine()The index of the first character of this token relative to the beginning of the line at which it occurs, 0..n-1The implementation for
RuleTagTokenalways returns -1.- Specified by:
getCharPositionInLinein interfaceToken
-
getTokenIndex
public int 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
RuleTagTokenalways returns -1.- Specified by:
getTokenIndexin interfaceToken
-
getStartIndex
public int getStartIndex()The starting character index of the token This method is optional; return -1 if not implemented.The implementation for
RuleTagTokenalways returns -1.- Specified by:
getStartIndexin interfaceToken
-
getStopIndex
public int getStopIndex()The last character index of the token. This method is optional; return -1 if not implemented.The implementation for
RuleTagTokenalways returns -1.- Specified by:
getStopIndexin interfaceToken
-
getTokenSource
Gets theTokenSourcewhich created this token.The implementation for
RuleTagTokenalways returnsnull.- Specified by:
getTokenSourcein interfaceToken
-
getInputStream
Gets theCharStreamfrom which this token was derived.The implementation for
RuleTagTokenalways returnsnull.- Specified by:
getInputStreamin interfaceToken
-
toString
The implementation for
RuleTagTokenreturns a string of the formruleName:bypassTokenType.
-