Class TokenTool


  • public class TokenTool
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String LEXER_RULE_PREFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      TokenTool()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getLength​(org.antlr.runtime.Token t)  
      static java.lang.String getLexerRuleName​(java.lang.String antlrTokenDef)  
      static int getLine​(org.antlr.runtime.Token t)  
      static int getOffset​(org.antlr.runtime.Token t)  
      static java.lang.String getText​(org.antlr.runtime.Token t)  
      static boolean isLexerRule​(java.lang.String antlrTokenDef)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LEXER_RULE_PREFIX

        public static final java.lang.String LEXER_RULE_PREFIX
        See Also:
        Constant Field Values
    • Constructor Detail

      • TokenTool

        public TokenTool()
    • Method Detail

      • getText

        public static java.lang.String getText​(org.antlr.runtime.Token t)
        Parameters:
        t - the token
        Returns:
        the parsed text or null if the Token t was null or the token's text was null.
      • getLine

        public static int getLine​(org.antlr.runtime.Token t)
        Parameters:
        t - the token
        Returns:
        the line of the token or -1 if the Token t was null or the token did not provide line information.
      • getOffset

        public static int getOffset​(org.antlr.runtime.Token t)
        Parameters:
        t - the token
        Returns:
        the offset of the token or -1 if the Token t was null or the token did not provide offset information.
      • getLength

        public static int getLength​(org.antlr.runtime.Token t)
        Parameters:
        t - the token
        Returns:
        the length of the token or 0 if the Token t was null or the token did not provide line information.
      • isLexerRule

        public static boolean isLexerRule​(java.lang.String antlrTokenDef)
      • getLexerRuleName

        public static java.lang.String getLexerRuleName​(java.lang.String antlrTokenDef)