Package iota

Enum Class TokenKind

All Implemented Interfaces:
Serializable, Comparable<TokenKind>, Constable

enum TokenKind extends Enum<TokenKind>
An enum of token kinds. Each entry in this enum represents the kind of a token along with its image (string representation).
  • Enum Constant Details

    • BOOLEAN

      public static final TokenKind BOOLEAN
      Reserved word, "boolean".
    • ELSE

      public static final TokenKind ELSE
      Reserved word, "else".
    • FALSE

      public static final TokenKind FALSE
      Reserved word, "false".
    • IF

      public static final TokenKind IF
      Reserved word, "if".
    • INT

      public static final TokenKind INT
      Reserved word, "int".
    • RETURN

      public static final TokenKind RETURN
      Reserved word, "return".
    • TRUE

      public static final TokenKind TRUE
      Reserved word, "true".
    • VOID

      public static final TokenKind VOID
      Reserved word, "void".
    • WHILE

      public static final TokenKind WHILE
      Reserved word, "while".
    • COMMA

      public static final TokenKind COMMA
      Separator, ",".
    • LCURLY

      public static final TokenKind LCURLY
      Separator, "{".
    • LPAREN

      public static final TokenKind LPAREN
      Separator, "(".
    • RCURLY

      public static final TokenKind RCURLY
      Separator, "}".
    • RPAREN

      public static final TokenKind RPAREN
      Separator, ")".
    • SEMI

      public static final TokenKind SEMI
      Separator, ";".
    • ASSIGN

      public static final TokenKind ASSIGN
      Operator, "=".
    • DIV

      public static final TokenKind DIV
      Operator, "/".
    • EQUAL

      public static final TokenKind EQUAL
      Operator, "==".
    • GE

      public static final TokenKind GE
      Operator, ">=".
    • GT

      public static final TokenKind GT
      Operator, ">".
    • LAND

      public static final TokenKind LAND
      Operator, "&&".
    • LE

      public static final TokenKind LE
      Operator, "<=".
    • LT

      public static final TokenKind LT
      Operator, "<".
    • LNOT

      public static final TokenKind LNOT
      Operator, "!".
    • LOR

      public static final TokenKind LOR
      Operator, "||".
    • MINUS

      public static final TokenKind MINUS
      Operator, "-".
    • NOT_EQUAL

      public static final TokenKind NOT_EQUAL
      Operator, "!=".
    • PLUS

      public static final TokenKind PLUS
      Operator, "+".
    • REM

      public static final TokenKind REM
      Operator, "%".
    • STAR

      public static final TokenKind STAR
      Operator, "*".
    • IDENTIFIER

      public static final TokenKind IDENTIFIER
      Identifier.
    • INT_LITERAL

      public static final TokenKind INT_LITERAL
      Integer literal.
    • EOF

      public static final TokenKind EOF
      End of file character.
  • Method Details

    • values

      public static TokenKind[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TokenKind valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • tokenRep

      public String tokenRep()
      Returns the token kind's string representation.
      Returns:
      the token kind's string representation.
    • image

      public String image()
      Returns the token kind's image.
      Returns:
      the token kind's image.