Class Scanner.Token

  • Enclosing class:
    Scanner

    public final class Scanner.Token
    extends Object
    Representation of a Java™ token.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BOOLEAN_LITERAL
      The token represents a boolean literal; its value is either 'true' or 'false'.
      static int CHARACTER_LITERAL
      The token represents a character literal; its value is the text of the character literal exactly as it appears in the source code (including the single quotes around it).
      static int EOF
      Indication of the 'end-of-input' condition.
      static int FLOATING_POINT_LITERAL
      The token represents a floating-point literal; its value is the text of the floating-point literal exactly as it appears in the source code.
      static int IDENTIFIER
      The token represents an identifier.
      static int INTEGER_LITERAL
      The token represents an integer literal; its value is the text of the integer literal exactly as it appears in the source code.
      static int KEYWORD
      The token represents a keyword.
      static int NULL_LITERAL
      The token represents the null literal; its value is 'null'.
      static int OPERATOR
      The token represents an operator; its value is exactly the particular operator (e.g.
      static int STRING_LITERAL
      The token represents a string literal; its value is the text of the string literal exactly as it appears in the source code (including the double quotes around it).
      int type
      The type of this token; legal values are the various public constant declared in this class.
      String value
      The text of the token exactly as it appears in the source code.
    • Field Detail

      • type

        public final int type
        The type of this token; legal values are the various public constant declared in this class.
      • EOF

        public static final int EOF
        Indication of the 'end-of-input' condition.
        See Also:
        Constant Field Values
      • IDENTIFIER

        public static final int IDENTIFIER
        The token represents an identifier.
        See Also:
        Constant Field Values
      • KEYWORD

        public static final int KEYWORD
        The token represents a keyword.
        See Also:
        Constant Field Values
      • INTEGER_LITERAL

        public static final int INTEGER_LITERAL
        The token represents an integer literal; its value is the text of the integer literal exactly as it appears in the source code.
        See Also:
        Constant Field Values
      • FLOATING_POINT_LITERAL

        public static final int FLOATING_POINT_LITERAL
        The token represents a floating-point literal; its value is the text of the floating-point literal exactly as it appears in the source code.
        See Also:
        Constant Field Values
      • BOOLEAN_LITERAL

        public static final int BOOLEAN_LITERAL
        The token represents a boolean literal; its value is either 'true' or 'false'.
        See Also:
        Constant Field Values
      • CHARACTER_LITERAL

        public static final int CHARACTER_LITERAL
        The token represents a character literal; its value is the text of the character literal exactly as it appears in the source code (including the single quotes around it).
        See Also:
        Constant Field Values
      • STRING_LITERAL

        public static final int STRING_LITERAL
        The token represents a string literal; its value is the text of the string literal exactly as it appears in the source code (including the double quotes around it).
        See Also:
        Constant Field Values
      • NULL_LITERAL

        public static final int NULL_LITERAL
        The token represents the null literal; its value is 'null'.
        See Also:
        Constant Field Values
      • OPERATOR

        public static final int OPERATOR
        The token represents an operator; its value is exactly the particular operator (e.g. "<<<=").
        See Also:
        Constant Field Values
      • value

        public final String value
        The text of the token exactly as it appears in the source code.
    • Method Detail

      • getLocation

        public Location getLocation()
        Returns:
        The location of the first character of this token