Enum Class TokenKind

java.lang.Object
java.lang.Enum<TokenKind>
org.clafer.frontend.TokenKind
All Implemented Interfaces:
Serializable, Comparable<TokenKind>, Constable

public enum TokenKind extends Enum<TokenKind>
The kinds of tokens.
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    A line or block comment.
    A decimal number with digits on both sides of the point, e.g., 19.99.
    The end of a block of indented lines, an empty span: the closing brace that Layout inserts.
    A double, a decimal number with an exponent, e.g., 1.2e2 or 1.0e-2, as the compiler prints a double literal.
    The end of the input, an empty span after the last character.
    Text that is not a token, e.g., an unexpected character or an unterminated string.
    An escape to a backend, [alloy| ... |] or [choco| ... |], set aside like a comment (ClaferLexer).
    The start of a block of indented lines, an empty span: the opening brace that Layout inserts.
    A natural number, e.g., 16.
    A reserved word of the full language, e.g., abstract, some or X (ClaferLexer): it cannot name a clafer.
    The separator that Layout inserts between two lines at the same indentation, an empty span, so that, e.g., a group cardinality at the start of a line is not the cardinality of the clafer on the line before.
    A string literal with its quotes and escapes as written, e.g., "a\"b"; see Lexer.unescape(String).
    An operator or punctuation, e.g., ->>, .. or a brace.
    A name or a keyword, e.g., c0_cost, abstract, int: keywords are recognized by the parser where they are expected, so a clafer may be named like one.
  • Method Summary

    Modifier and Type
    Method
    Description
    static TokenKind
    Returns the enum constant of this class with the specified name.
    static TokenKind[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • WORD

      public static final TokenKind WORD
      A name or a keyword, e.g., c0_cost, abstract, int: keywords are recognized by the parser where they are expected, so a clafer may be named like one.
    • INT

      public static final TokenKind INT
      A natural number, e.g., 16. A sign is a separate -.
    • DECIMAL

      public static final TokenKind DECIMAL
      A decimal number with digits on both sides of the point, e.g., 19.99.
    • DOUBLE

      public static final TokenKind DOUBLE
      A double, a decimal number with an exponent, e.g., 1.2e2 or 1.0e-2, as the compiler prints a double literal.
    • STRING

      public static final TokenKind STRING
      A string literal with its quotes and escapes as written, e.g., "a\"b"; see Lexer.unescape(String).
    • SYMBOL

      public static final TokenKind SYMBOL
      An operator or punctuation, e.g., ->>, .. or a brace.
    • COMMENT

      public static final TokenKind COMMENT
      A line or block comment. Comments are set aside, not passed to the parser.
    • ERROR

      public static final TokenKind ERROR
      Text that is not a token, e.g., an unexpected character or an unterminated string. The lexer reports a diagnostic for it and goes on.
    • KEYWORD

      public static final TokenKind KEYWORD
      A reserved word of the full language, e.g., abstract, some or X (ClaferLexer): it cannot name a clafer. The explicit languages have none (WORD).
    • ESCAPE

      public static final TokenKind ESCAPE
      An escape to a backend, [alloy| ... |] or [choco| ... |], set aside like a comment (ClaferLexer).
    • INDENT

      public static final TokenKind INDENT
      The start of a block of indented lines, an empty span: the opening brace that Layout inserts.
    • DEDENT

      public static final TokenKind DEDENT
      The end of a block of indented lines, an empty span: the closing brace that Layout inserts.
    • SEPARATOR

      public static final TokenKind SEPARATOR
      The separator that Layout inserts between two lines at the same indentation, an empty span, so that, e.g., a group cardinality at the start of a line is not the cardinality of the clafer on the line before.
    • EOF

      public static final TokenKind EOF
      The end of the input, an empty span after the last 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