Class TokenTagToken

java.lang.Object
org.antlr.v4.runtime.CommonToken
org.antlr.v4.runtime.tree.pattern.TokenTagToken
All Implemented Interfaces:
Serializable, Token, WritableToken

public class TokenTagToken extends CommonToken
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.
See Also:
  • Constructor Details

    • TokenTagToken

      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 - The token name.
      type - The token type.
    • TokenTagToken

      public TokenTagToken(String tokenName, int type, String label)
      Constructs a new instance of TokenTagToken with the specified token name, type, and label.
      Parameters:
      tokenName - The token name.
      type - The token type.
      label - The label associated with the token tag, or null if the token tag is unlabeled.
  • Method Details

    • getTokenName

      public final String getTokenName()
      Gets the token name.
      Returns:
      The token name.
    • getLabel

      public final String getLabel()
      Gets the label associated with the rule tag.
      Returns:
      The name of the label associated with the rule tag, or null if this is an unlabeled rule tag.
    • getText

      public String getText()
      Get the text of the token.

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

      Specified by:
      getText in interface Token
      Overrides:
      getText in class CommonToken
    • toString

      public String toString()

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

      Overrides:
      toString in class CommonToken