类 ClassicToken

  • 所有已实现的接口:
    Token

    public class ClassicToken
    extends java.lang.Object
    implements Token
    A Token object like we'd use in ANTLR 2.x; has an actual string created and associated with this object. These objects are needed for imaginary tree nodes that have payload objects. We need to create a Token object that has a string; the tree node will point at this token. CommonToken has indexes into a char stream and hence cannot be used to introduce new strings.
    • 字段详细资料

      • text

        protected java.lang.String text
      • type

        protected int type
      • line

        protected int line
      • charPositionInLine

        protected int charPositionInLine
      • channel

        protected int channel
      • index

        protected int index
        What token number is this from 0..n-1 tokens
    • 构造器详细资料

      • ClassicToken

        public ClassicToken​(int type)
      • ClassicToken

        public ClassicToken​(Token oldToken)
      • ClassicToken

        public ClassicToken​(int type,
                            java.lang.String text)
      • ClassicToken

        public ClassicToken​(int type,
                            java.lang.String text,
                            int channel)
    • 方法详细资料

      • getType

        public int getType()
        指定者:
        getType 在接口中 Token
      • setLine

        public void setLine​(int line)
        指定者:
        setLine 在接口中 Token
      • getText

        public java.lang.String getText()
        从接口复制的说明: Token
        Get the text of the token
        指定者:
        getText 在接口中 Token
      • setText

        public void setText​(java.lang.String text)
        指定者:
        setText 在接口中 Token
      • getLine

        public int getLine()
        从接口复制的说明: Token
        The line number on which this token was matched; line=1..n
        指定者:
        getLine 在接口中 Token
      • getCharPositionInLine

        public int getCharPositionInLine()
        从接口复制的说明: Token
        The index of the first character relative to the beginning of the line 0..n-1
        指定者:
        getCharPositionInLine 在接口中 Token
      • setCharPositionInLine

        public void setCharPositionInLine​(int charPositionInLine)
        指定者:
        setCharPositionInLine 在接口中 Token
      • getChannel

        public int getChannel()
        指定者:
        getChannel 在接口中 Token
      • setChannel

        public void setChannel​(int channel)
        指定者:
        setChannel 在接口中 Token
      • setType

        public void setType​(int type)
        指定者:
        setType 在接口中 Token
      • getTokenIndex

        public int getTokenIndex()
        从接口复制的说明: Token
        An index from 0..n-1 of the token object in the input stream. This must be valid in order to use the ANTLRWorks debugger.
        指定者:
        getTokenIndex 在接口中 Token
      • setTokenIndex

        public void setTokenIndex​(int index)
        指定者:
        setTokenIndex 在接口中 Token
      • getInputStream

        public CharStream getInputStream()
        从接口复制的说明: Token
        From what character stream was this token created? You don't have to implement but it's nice to know where a Token comes from if you have include files etc... on the input.
        指定者:
        getInputStream 在接口中 Token
      • toString

        public java.lang.String toString()
        覆盖:
        toString 在类中 java.lang.Object