Class TokenStream.CaseSensitiveToken

    • Field Detail

      • startIndex

        private final int startIndex
      • endIndex

        private final int endIndex
      • type

        private final int type
      • position

        private final Position position
    • Constructor Detail

      • CaseSensitiveToken

        public CaseSensitiveToken​(int startIndex,
                                  int endIndex,
                                  int type,
                                  Position position)
    • Method Detail

      • type

        public final int type()
        Description copied from interface: TokenStream.Token
        Get the type of the token.
        Specified by:
        type in interface TokenStream.Token
        Returns:
        the token's type
      • startIndex

        public final int startIndex()
        Description copied from interface: TokenStream.Token
        Get the index in the raw stream for the first character in the token.
        Specified by:
        startIndex in interface TokenStream.Token
        Returns:
        the starting index of the token
      • endIndex

        public final int endIndex()
        Description copied from interface: TokenStream.Token
        Get the index in the raw stream past the last character in the token.
        Specified by:
        endIndex in interface TokenStream.Token
        Returns:
        the ending index of the token, which is past the last character
      • length

        public final int length()
        Description copied from interface: TokenStream.Token
        Get the length of the token, which is equivalent to endIndex() - startIndex().
        Specified by:
        length in interface TokenStream.Token
        Returns:
        the length
      • matches

        public final boolean matches​(char expected)
        Description copied from interface: TokenStream.Token
        Determine if the token matches the supplied character.
        Specified by:
        matches in interface TokenStream.Token
        Parameters:
        expected - the expected character value
        Returns:
        true if the token's value matches the supplied character value, or false otherwise
      • matches

        public boolean matches​(String expected)
        Description copied from interface: TokenStream.Token
        Determine if the token matches the supplied string.
        Specified by:
        matches in interface TokenStream.Token
        Parameters:
        expected - the expected value
        Returns:
        true if the token's value matches the supplied value, or false otherwise
      • matches

        public final boolean matches​(int expectedType)
        Description copied from interface: TokenStream.Token
        Determine if the token matches the supplied type.
        Specified by:
        matches in interface TokenStream.Token
        Parameters:
        expectedType - the expected integer type
        Returns:
        true if the token's value matches the supplied integer type, or false otherwise
      • position

        public Position position()
        Description copied from interface: TokenStream.Token
        Get the position of this token, which includes the line number and column number of the first character in the token.
        Specified by:
        position in interface TokenStream.Token
        Returns:
        the position; never null
      • matchString

        protected String matchString()