Interface Token

  • All Superinterfaces:
    TokenTypes
    All Known Implementing Classes:
    TokenImpl

    public interface Token
    extends TokenTypes
    A lexical token in a Java file.
    Version:
    0.1
    • Method Detail

      • getColumn

        int getColumn()
        Returns the column (offset into the line) of this token.
        Returns:
        The column of the token.
        See Also:
        getLine()
      • getLexeme

        java.lang.String getLexeme()
        Returns the text of this token.
        Returns:
        This token's textual value.
      • getLength

        int getLength()
        Returns the length of this token.
        Returns:
        The token's length.
      • getLine

        int getLine()
        Returns the line this token is on.
        Returns:
        The token's line number.
        See Also:
        getColumn()
      • getOffset

        int getOffset()
        Returns the offset into the document of this token.
        Returns:
        The token's offset.
        See Also:
        getLine(), getColumn()
      • getType

        int getType()
        Returns the type of this token.
        Returns:
        The type of this token.
      • isBasicType

        boolean isBasicType()
        Returns whether this token is a primitive data type (int, float, string, etc.).
        Returns:
        Whether this token is a primitive data type.
      • isIdentifier

        boolean isIdentifier()
        Returns whether this token is an identifier.
        Returns:
        Whether this token is an identifier.
      • isInvalid

        boolean isInvalid()
        Returns whether this token is invalid.
        Returns:
        Whether this token is invalid.
      • isOperator

        boolean isOperator()
        Returns whether this token is an operator.
        Returns:
        Whether this token is an operator.
      • isType

        boolean isType​(int type)
        Returns whether this token is of the specified type.
        Parameters:
        type - The type to check.
        Returns:
        Whether this token is of the specified type.