Class TokenTypes


  • public final class TokenTypes
    extends Object
    Contains the constants for all the tokens contained in the Abstract Syntax Tree.

    Implementation detail: This class has been introduced to break the circular dependency between packages.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ABSTRACT
      The abstract keyword.
      static int ANNOTATION
      An annotation of a package, type, field, parameter or variable.
      static int ANNOTATION_ARRAY_INIT
      An annotation array member initialization.
      static int ANNOTATION_DEF
      An annotation declaration.
      static int ANNOTATION_FIELD_DEF
      An annotation field declaration.
      static int ANNOTATION_MEMBER_VALUE_PAIR
      An initialization of an annotation member with a value.
      static int ANNOTATIONS
      A collection of annotations on a package or enum constant.
      static int ARRAY_DECLARATOR
      An array declaration.
      static int ARRAY_INIT
      An array initialization.
      static int ASSIGN
      The = (assignment) operator.
      static int AT
      An @ symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.
      static int BAND
      The & (bitwise AND) operator.
      static int BAND_ASSIGN
      The &= (bitwise AND assignment) operator.
      static int BLOCK_COMMENT_BEGIN
      Beginning of block comment: '/*'.
      static int BLOCK_COMMENT_END
      End of block comment: '*/'.
      static int BNOT
      The ~ (bitwise complement) operator.
      static int BOR
      The | (bitwise OR) operator.
      static int BOR_ASSIGN
      The |= (bitwise OR assignment) operator.
      static int BSR
      The >>> (unsigned shift right) operator.
      static int BSR_ASSIGN
      The >>>= (unsigned right shift assignment) operator.
      static int BXOR
      The ^ (bitwise exclusive OR) operator.
      static int BXOR_ASSIGN
      The ^= (bitwise exclusive OR assignment) operator.
      static int CASE_GROUP
      A group of case clauses.
      static int CHAR_LITERAL
      A character literal.
      static int CLASS_DEF
      A class declaration.
      static int COLON
      The : (colon) operator.
      static int COMMA
      The , (comma) operator.
      static int COMMENT_CONTENT
      Text of single-line or block comment.
      static int COMPACT_CTOR_DEF
      A compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.
      static int COMPILATION_UNIT
      This is the root node for the source file.
      static int CTOR_CALL
      A constructor call.
      static int CTOR_DEF
      A constructor declaration.
      static int DEC
      The -- (prefix decrement) operator.
      static int DIV
      The / (division) operator.
      static int DIV_ASSIGN
      The /= (division assignment) operator.
      static int DO_WHILE
      Literal while in do-while loop.
      static int DOT
      The . (dot) operator.
      static int DOUBLE_COLON
      The :: (double colon) separator.
      static int ELIST
      An expression list.
      static int ELLIPSIS
      A triple dot for variable-length parameters.
      static int EMPTY_STAT
      The empty statement.
      static int ENUM
      The enum keyword.
      static int ENUM_CONSTANT_DEF
      An enum constant declaration.
      static int ENUM_DEF
      An enum declaration.
      static int EQUAL
      The == (equal) operator.
      static int EXPR
      An expression.
      static int EXTENDS_CLAUSE
      An extends clause.
      static int FINAL
      The final keyword.
      static int FOR_CONDITION
      A for loop condition.
      static int FOR_EACH_CLAUSE
      A for-each clause.
      static int FOR_INIT
      A for loop initializer.
      static int FOR_ITERATOR
      A for loop iterator.
      static int GE
      The >= (greater than or equal) operator.
      static int GENERIC_END
      A > symbol signifying the end of type arguments or type parameters.
      static int GENERIC_START
      A < symbol signifying the start of type arguments or type parameters.
      static int GT
      The > (greater than) operator.
      static int IDENT
      An identifier.
      static int IMPLEMENTS_CLAUSE
      An implements clause.
      static int IMPORT
      An import declaration.
      static int INC
      The ++ (prefix increment) operator.
      static int INDEX_OP
      The array index operator.
      static int INSTANCE_INIT
      An instance initializer.
      static int INTERFACE_DEF
      An interface declaration.
      static int LABELED_STAT
      A labeled statement.
      static int LAMBDA
      Special lambda symbol ->.
      static int LAND
      The && (conditional AND) operator.
      static int LCURLY
      A left curly brace ({).
      static int LE
      The <= (less than or equal) operator.
      static int LITERAL_ASSERT
      The assert keyword.
      static int LITERAL_BOOLEAN
      The boolean keyword.
      static int LITERAL_BREAK
      The break keyword.
      static int LITERAL_BYTE
      The byte keyword.
      static int LITERAL_CASE
      The case keyword.
      static int LITERAL_CATCH
      The catch keyword.
      static int LITERAL_CHAR
      The char keyword.
      static int LITERAL_CLASS
      The class keyword.
      static int LITERAL_CONTINUE
      The continue keyword.
      static int LITERAL_DEFAULT
      The default keyword.
      static int LITERAL_DO
      The do keyword.
      static int LITERAL_DOUBLE
      The double keyword.
      static int LITERAL_ELSE
      The else keyword.
      static int LITERAL_FALSE
      The false keyword.
      static int LITERAL_FINALLY
      The finally keyword.
      static int LITERAL_FLOAT
      The float keyword.
      static int LITERAL_FOR
      The for keyword.
      static int LITERAL_IF
      The if keyword.
      static int LITERAL_INSTANCEOF
      The instanceof operator.
      static int LITERAL_INT
      The int keyword.
      static int LITERAL_INTERFACE
      The interface keyword.
      static int LITERAL_LONG
      The long keyword.
      static int LITERAL_NATIVE
      The native keyword.
      static int LITERAL_NEW
      The new keyword.
      static int LITERAL_NON_SEALED
      The non-sealed keyword.
      static int LITERAL_NULL
      The null keyword.
      static int LITERAL_PERMITS
      The permits restricted identifier.
      static int LITERAL_PRIVATE
      The private keyword.
      static int LITERAL_PROTECTED
      The protected keyword.
      static int LITERAL_PUBLIC
      The public keyword.
      static int LITERAL_RECORD
      The record keyword.
      static int LITERAL_RETURN
      The return keyword.
      static int LITERAL_SEALED
      The sealed restricted identifier.
      static int LITERAL_SHORT
      The short keyword.
      static int LITERAL_STATIC
      The static keyword.
      static int LITERAL_SUPER
      The super keyword.
      static int LITERAL_SWITCH
      The switch keyword.
      static int LITERAL_SYNCHRONIZED
      The synchronized keyword.
      static int LITERAL_THIS
      The this keyword use to refer the current object.
      static int LITERAL_THROW
      The throw keyword.
      static int LITERAL_THROWS
      The throws keyword.
      static int LITERAL_TRANSIENT
      The transient keyword.
      static int LITERAL_TRUE
      The true keyword.
      static int LITERAL_TRY
      The try keyword.
      static int LITERAL_VOID
      The void keyword.
      static int LITERAL_VOLATILE
      The volatile keyword.
      static int LITERAL_WHEN
      A when clause.
      static int LITERAL_WHILE
      The while keyword.
      static int LITERAL_YIELD
      The yield keyword.
      static int LNOT
      The ! (logical complement) operator.
      static int LOR
      The || (conditional OR) operator.
      static int LPAREN
      A left parenthesis (().
      static int LT
      The < (less than) operator.
      static int METHOD_CALL
      A method call.
      static int METHOD_DEF
      A method declaration.
      static int METHOD_REF
      A reference to a method or constructor without arguments.
      static int MINUS
      The - (subtraction) operator.
      static int MINUS_ASSIGN
      The -= (subtraction assignment) operator.
      static int MOD
      The % (remainder) operator.
      static int MOD_ASSIGN
      The %= (remainder assignment) operator.
      static int MODIFIERS
      Modifiers for type, method, and field declarations.
      static int NOT_EQUAL
      The != (not equal) operator.
      static int NUM_DOUBLE
      A double precision floating point literal.
      static int NUM_FLOAT
      A single precision floating point literal.
      static int NUM_INT
      An integer literal.
      static int NUM_LONG
      A long integer literal.
      static int OBJBLOCK
      An object block.
      static int PACKAGE_DEF
      The package declaration.
      static int PARAMETER_DEF
      A parameter declaration.
      static int PARAMETERS
      A list of parameters to a method or constructor.
      static int PATTERN_DEF
      A pattern definition, excluding simple type pattern (pattern variable) definition such as if (o instanceof Integer i){}.
      static int PATTERN_VARIABLE_DEF
      A pattern variable definition; when conditionally matched, this variable is assigned with the defined type.
      static int PERMITS_CLAUSE
      A permits clause.
      static int PLUS
      The + (addition) operator.
      static int PLUS_ASSIGN
      The += (addition assignment) operator.
      static int POST_DEC
      The -- (postfix decrement) operator.
      static int POST_INC
      The ++ (postfix increment) operator.
      static int QUESTION
      The ? (conditional) operator.
      static int RBRACK
      The ] symbol.
      static int RCURLY
      A right curly brace (}).
      static int RECORD_COMPONENT_DEF
      A record component is a variable that comprises the state of a record.
      static int RECORD_COMPONENTS
      Record components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.
      static int RECORD_DEF
      A declaration of a record specifies a name, a header, and a body.
      static int RECORD_PATTERN_COMPONENTS
      A (possibly empty) record component pattern list which is used to match against the corresponding record components.
      static int RECORD_PATTERN_DEF
      A record pattern definition.
      static int RESOURCE
      A resource in the Java 7 try-with-resources construct.
      static int RESOURCE_SPECIFICATION
      The Java 7 try-with-resources construct.
      static int RESOURCES
      A list of resources in the Java 7 try-with-resources construct.
      static int RPAREN
      A right parenthesis ()).
      static int SEMI
      The statement terminator (;).
      static int SINGLE_LINE_COMMENT
      Beginning of single-line comment: '//'.
      static int SL
      The << (shift left) operator.
      static int SL_ASSIGN
      The <<= (left shift assignment) operator.
      static int SLIST
      A list of statements.
      static int SR
      The >> (signed shift right) operator.
      static int SR_ASSIGN
      The >>= (signed right shift assignment) operator.
      static int STAR
      The * (multiplication or wildcard) operator.
      static int STAR_ASSIGN
      The *= (multiplication assignment) operator.
      static int STATIC_IMPORT
      A static import declaration.
      static int STATIC_INIT
      A static initialization block.
      static int STRICTFP
      The strictfp keyword.
      static int STRING_LITERAL
      A string literal.
      static int SUPER_CTOR_CALL
      A super constructor call.
      static int SWITCH_RULE
      Switch Expressions.
      static int TEXT_BLOCK_CONTENT
      Content of a Java 15 text block.
      static int TEXT_BLOCK_LITERAL_BEGIN
      Text blocks are a new feature added to to Java SE 15 and later that will make writing multi-line strings much easier and cleaner.
      static int TEXT_BLOCK_LITERAL_END
      End of a Java 15 text block literal, delimited by three double quotes.
      static int TYPE
      A type.
      static int TYPE_ARGUMENT
      A type arguments to a type reference or a method/ctor invocation.
      static int TYPE_ARGUMENTS
      A list of type arguments to a type reference or a method/ctor invocation.
      static int TYPE_EXTENSION_AND
      The & symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.
      static int TYPE_LOWER_BOUNDS
      A lower bounds on a wildcard type argument.
      static int TYPE_PARAMETER
      A type parameter to a class, interface or method definition.
      static int TYPE_PARAMETERS
      A list of type parameters to a class, interface or method definition.
      static int TYPE_UPPER_BOUNDS
      An upper bounds on a wildcard type argument or type parameter.
      static int TYPECAST
      A type-cast.
      static int UNARY_MINUS
      The - (unary minus) operator.
      static int UNARY_PLUS
      The + (unary plus) operator.
      static int UNNAMED_PATTERN_DEF
      An unnamed pattern variable definition.
      static int VARIABLE_DEF
      A field or local variable declaration.
      static int WILDCARD_TYPE
      The type that refers to all types.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TokenTypes()
      Prevent instantiation.
    • Field Detail

      • COMPILATION_UNIT

        public static final int COMPILATION_UNIT
        This is the root node for the source file. It's children are an optional package definition, zero or more import statements, and zero or more type declarations.

        For example:

         import java.util.List;
        
         class MyClass{}
         interface MyInterface{}
         ;
         

        parses as:

         COMPILATION_UNIT -> COMPILATION_UNIT
         |--IMPORT -> import
         |   |--DOT -> .
         |   |   |--DOT -> .
         |   |   |   |--IDENT -> java
         |   |   |   `--IDENT -> util
         |   |   `--IDENT -> List
         |   `--SEMI -> ;
         |--CLASS_DEF -> CLASS_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_CLASS -> class
         |   |--IDENT -> MyClass
         |   `--OBJBLOCK -> OBJBLOCK
         |       |--LCURLY -> {
         |       `--RCURLY -> }
         |--INTERFACE_DEF -> INTERFACE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_INTERFACE -> interface
         |   |--IDENT -> MyInterface
         |   `--OBJBLOCK -> OBJBLOCK
         |       |--LCURLY -> {
         |       `--RCURLY -> }
         `--SEMI -> ;
         
        See Also:
        PACKAGE_DEF, IMPORT, CLASS_DEF, INTERFACE_DEF, RECORD_DEF, ANNOTATION_DEF, ENUM_DEF, Constant Field Values
      • CTOR_DEF

        public static final int CTOR_DEF
        A constructor declaration.

        For example:

         public SpecialEntry(int value, String text)
         {
           this.value = value;
           this.text = text;
         }
         

        parses as:

         CTOR_DEF -> CTOR_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--IDENT -> SpecialEntry
          |--LPAREN -> (
          |--PARAMETERS -> PARAMETERS
          |   |--PARAMETER_DEF -> PARAMETER_DEF
          |   |   |--MODIFIERS -> MODIFIERS
          |   |   |--TYPE -> TYPE
          |   |   |   `--LITERAL_INT -> int
          |   |   `--IDENT -> value
          |   |--COMMA -> ,
          |   `--PARAMETER_DEF -> PARAMETER_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--IDENT -> String
          |       `--IDENT -> text
          |--RPAREN -> )
          `--SLIST -> {
              |--EXPR -> EXPR
              |   `--ASSIGN -> =
              |       |--DOT -> .
              |   |--LITERAL_THIS -> this
              |       |   `--IDENT -> value
              |       `--IDENT -> value
              |--SEMI -> ;
              |--EXPR -> EXPR
              |   `--ASSIGN -> =
              |       |--DOT -> .
              |       |   |--LITERAL_THIS -> this
              |       |   `--IDENT -> text
              |       `--IDENT -> text
              |--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        OBJBLOCK, CLASS_DEF, Constant Field Values
      • METHOD_DEF

        public static final int METHOD_DEF
        A method declaration. The children are modifiers, type parameters, return type, method name, parameter list, an optional throws list, and statement list. The statement list is omitted if the method declaration appears in an interface declaration. Method declarations may appear inside object blocks of class declarations, interface declarations, enum declarations, enum constant declarations or anonymous inner-class declarations.

        For example:

          public static int square(int x)
          {
            return x*x;
          }
         

        parses as:

         --METHOD_DEF -> METHOD_DEF
            |--MODIFIERS -> MODIFIERS
            |   |--LITERAL_PUBLIC -> public
            |   `--LITERAL_STATIC -> static
            |--TYPE -> TYPE
            |   `--LITERAL_INT -> int
            |--IDENT -> square
            |--LPAREN -> (
            |--PARAMETERS -> PARAMETERS
            |   `--PARAMETER_DEF -> PARAMETER_DEF
            |       |--MODIFIERS -> MODIFIERS
            |       |--TYPE -> TYPE
            |       |   `--LITERAL_INT -> int
            |       `--IDENT -> x
            |--RPAREN -> )
            `--SLIST -> {
                |--LITERAL_RETURN -> return
                |   |--EXPR -> EXPR
                |   |   `--STAR -> *
                |   |       |--IDENT -> x
                |   |       `--IDENT -> x
                |   `--SEMI -> ;
                `--RCURLY -> }
         
        See Also:
        MODIFIERS, TYPE_PARAMETERS, TYPE, IDENT, PARAMETERS, LITERAL_THROWS, SLIST, OBJBLOCK, Constant Field Values
      • VARIABLE_DEF

        public static final int VARIABLE_DEF
        A field or local variable declaration. The children are modifiers, type, the identifier name, and an optional assignment statement.

        For example:

         final double PI = 3.14;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--FINAL -> final
          |--TYPE -> TYPE
          |   `--LITERAL_DOUBLE -> int
          |--IDENT -> PI
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--NUM_FLOAT -> 3.14
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, TYPE, IDENT, ASSIGN, Constant Field Values
      • INSTANCE_INIT

        public static final int INSTANCE_INIT
        An instance initializer. Zero or more instance initializers may appear in class and enum definitions. This token will be a child of the object block of the declaring type.

        For example:

         public class MyClass {
             private int foo;
             {foo = 10;}
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--LITERAL_CLASS -> class
          |--IDENT -> MyClass
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              |--VARIABLE_DEF -> VARIABLE_DEF
              |   |--MODIFIERS -> MODIFIERS
              |   |   `--LITERAL_PRIVATE -> private
              |   |--TYPE -> TYPE
              |   |   `--LITERAL_INT -> int
              |   |--IDENT -> foo
              |   `--SEMI -> ;
              |--INSTANCE_INIT -> INSTANCE_INIT
              |   `--SLIST -> {
              |       |--EXPR -> EXPR
              |       |   `--ASSIGN -> =
              |       |       |--IDENT -> foo
              |       |       `--NUM_INT -> 10
              |       |--SEMI -> ;
              |       `--RCURLY -> }
              `--RCURLY -> }
         
        See Also:
        Java Language Specification§8.6, SLIST, OBJBLOCK, Constant Field Values
      • STATIC_INIT

        public static final int STATIC_INIT
        A static initialization block. Zero or more static initializers may be children of the object block of a class or enum declaration (interfaces cannot have static initializers). The first and only child is a statement list.

        For Example:

         static {
           num = 10;
         }
         

        parses as:

         STATIC_INIT -> STATIC_INIT
          `--SLIST -> {
              |--EXPR -> EXPR
              |   `--ASSIGN -> =
              |       |--IDENT -> num
              |       `--NUM_INT -> 10
              |--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        Java Language Specification, §8.7, SLIST, OBJBLOCK, Constant Field Values
      • PACKAGE_DEF

        public static final int PACKAGE_DEF
        The package declaration. This is optional, but if it is included, then there is only one package declaration per source file and it must be the first non-comment in the file. A package declaration may be annotated in which case the annotations comes before the rest of the declaration (and are the first children).

        For example:

           package com.puppycrawl.tools.checkstyle.api;
         

        parses as:

         PACKAGE_DEF -> package
         |--ANNOTATIONS -> ANNOTATIONS
         |--DOT -> .
         |   |--DOT -> .
         |   |   |--DOT -> .
         |   |   |   |--DOT -> .
         |   |   |   |   |--IDENT -> com
         |   |   |   |   `--IDENT -> puppycrawl
         |   |   |   `--IDENT -> tools
         |   |   `--IDENT -> checkstyle
         |   `--IDENT -> api
         `--SEMI -> ;
         
        See Also:
        Java Language Specification §7.4, DOT, IDENT, SEMI, ANNOTATIONS, FullIdent, Constant Field Values
      • ARRAY_DECLARATOR

        public static final int ARRAY_DECLARATOR
        An array declaration.

        If the array declaration represents a type, then the type of the array elements is the first child. Multidimensional arrays may be regarded as arrays of arrays. In other words, the first child of the array declaration is another array declaration.

        For example:

           int[] x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--LITERAL_INT -> int
          |   `--ARRAY_DECLARATOR -> [
          |       `--RBRACK -> ]
          |--IDENT -> x
          `--SEMI -> ;
         

        The array declaration may also represent an inline array definition. In this case, the first child will be either an expression specifying the length of the array or an array initialization block.

        See Also:
        Java Language Specification §10, TYPE, ARRAY_INIT, Constant Field Values
      • EXTENDS_CLAUSE

        public static final int EXTENDS_CLAUSE
        An extends clause. This appears as part of class and interface definitions. This element appears even if the extends keyword is not explicitly used. The child is an optional identifier.

        For example:

         public class Test extends ArrayList {
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_CLASS -> class
         |--IDENT -> Test
         |--EXTENDS_CLAUSE -> extends
         |   `--IDENT -> ArrayList
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        See Also:
        IDENT, DOT, CLASS_DEF, INTERFACE_DEF, FullIdent, Constant Field Values
      • IMPLEMENTS_CLAUSE

        public static final int IMPLEMENTS_CLAUSE
        An implements clause. This always appears in a class or enum declaration, even if there are no implemented interfaces. The children are a comma separated list of zero or more identifiers.

        For example:

         public class MyClass implements Collection {
        
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_CLASS -> class
         |--IDENT -> MyClass
         |--IMPLEMENTS_CLAUSE -> implements
         |   `--IDENT -> Collection
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        See Also:
        IDENT, DOT, COMMA, CLASS_DEF, ENUM_DEF, Constant Field Values
      • PARAMETERS

        public static final int PARAMETERS
        A list of parameters to a method or constructor. The children are zero or more parameter declarations separated by commas.

        For example

         int start, int end
         

        parses as:

         PARAMETERS -> PARAMETERS
          |--PARAMETER_DEF -> PARAMETER_DEF
          |   |--MODIFIERS -> MODIFIERS
          |   |--TYPE -> TYPE
          |   |   `--LITERAL_INT -> int
          |   `--IDENT -> start
          |--COMMA -> ,
          `--PARAMETER_DEF -> PARAMETER_DEF
              |--MODIFIERS -> MODIFIERS
              |--TYPE -> TYPE
              |   `--LITERAL_INT -> int
              `--IDENT -> end
         
        See Also:
        PARAMETER_DEF, COMMA, METHOD_DEF, CTOR_DEF, Constant Field Values
      • PARAMETER_DEF

        public static final int PARAMETER_DEF
        A parameter declaration. The last parameter in a list of parameters may be variable length (indicated by the ELLIPSIS child node immediately after the TYPE child).

        For example

              void foo(SomeType SomeType.this, int firstParameter, int... secondParameter) {}
         

        parses as:

         METHOD_DEF -> METHOD_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_VOID -> void
          |--IDENT -> foo
          |--LPAREN -> (
          |--PARAMETERS -> PARAMETERS
          |   |--PARAMETER_DEF -> PARAMETER_DEF
          |   |   |--MODIFIERS -> MODIFIERS
          |   |   |--TYPE -> TYPE
          |   |   |   `--IDENT -> SomeType
          |   |   `--DOT -> .
          |   |       |--IDENT -> SomeType
          |   |       `--LITERAL_THIS -> this
          |   |--COMMA -> ,
          |   |--PARAMETER_DEF -> PARAMETER_DEF
          |   |   |--MODIFIERS -> MODIFIERS
          |   |   |--TYPE -> TYPE
          |   |   |   `--LITERAL_INT -> int
          |   |   `--IDENT -> firstParameter
          |   |--COMMA -> ,
          |   `--PARAMETER_DEF -> PARAMETER_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--LITERAL_INT -> int
          |       |--ELLIPSIS -> ...
          |       `--IDENT -> secondParameter
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
        
         
        See Also:
        MODIFIERS, TYPE, IDENT, PARAMETERS, ELLIPSIS, Constant Field Values
      • LABELED_STAT

        public static final int LABELED_STAT
        A labeled statement.

        For example:

         outer:
         while (i < 10) {
             if (i == 5)
                 continue outer;
             i++;
         }
         

        parses as:

         LABELED_STAT -> :
          |--IDENT -> outer
          `--LITERAL_WHILE -> while
              |--LPAREN -> (
              |--EXPR -> EXPR
              |   `--LT -> <
              |       |--IDENT -> i
              |       `--NUM_INT -> 10
              |--RPAREN -> )
              `--SLIST -> {
                  |--LITERAL_IF -> if
                  |   |--LPAREN -> (
                  |   |--EXPR -> EXPR
                  |   |   `--EQUAL -> ==
                  |   |       |--IDENT -> i
                  |   |       `--NUM_INT -> 5
                  |   |--RPAREN -> )
                  |   `--LITERAL_CONTINUE -> continue
                  |       |--IDENT -> outer
                  |       `--SEMI -> ;
                  |--EXPR -> EXPR
                  |   `--POST_INC -> ++
                  |       `--IDENT -> i
                  |--SEMI -> ;
                  `--RCURLY -> }
         
        See Also:
        Java Language Specification, §14.7, SLIST, Constant Field Values
      • INDEX_OP

        public static final int INDEX_OP
        The array index operator.

        For example:

         arr[0] = 10;
         

        parses as:

         |--EXPR -> EXPR
         |   `--ASSIGN -> =
         |       |--INDEX_OP -> [
         |       |   |--IDENT -> arr
         |       |   |--EXPR -> EXPR
         |       |   |   `--NUM_INT -> 0
         |       |   `--RBRACK -> ]
         |       `--NUM_INT -> 10
         |--SEMI -> ;
         
        See Also:
        EXPR, Constant Field Values
      • METHOD_CALL

        public static final int METHOD_CALL
        A method call. A method call may have type arguments however these are attached to the appropriate node in the qualified method name.

        For example:

         Integer.parseInt("123");
         

        parses as:

         |--EXPR -> EXPR
         |   `--METHOD_CALL -> (
         |       |--DOT -> .
         |       |   |--IDENT -> Integer
         |       |   `--IDENT -> parseInt
         |       |--ELIST -> ELIST
         |       |   `--EXPR -> EXPR
         |       |       `--STRING_LITERAL -> "123"
         |       `--RPAREN -> )
         |--SEMI -> ;
         
        See Also:
        IDENT, TYPE_ARGUMENTS, DOT, ELIST, RPAREN, FullIdent, Constant Field Values
      • METHOD_REF

        public static final int METHOD_REF
        A reference to a method or constructor without arguments. Part of Java 8 syntax. The token should be used for subscribing for double colon literal. DOUBLE_COLON token does not appear in the tree.

        For example:

         Comparator<String> compare = String::compareToIgnoreCase;
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   |--IDENT -> Comparator
         |   |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
         |   |       |--GENERIC_START -> <
         |   |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
         |   |       |   `--IDENT -> String
         |   |       `--GENERIC_END -> >
         |   |--IDENT -> compare
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--METHOD_REF -> ::
         |               |--IDENT -> String
         |               `--IDENT -> compareToIgnoreCase
         |--SEMI -> ;
         
        See Also:
        IDENT, DOUBLE_COLON, Constant Field Values
      • EXPR

        public static final int EXPR
        An expression. Operators with lower precedence appear at a higher level in the tree than operators with higher precedence. Parentheses are siblings to the operator they enclose.

        For example:

         int x = 4 + 2 * (5 % 3) + (1 << 3) - 4 * 5;
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_INT -> int
         |   |--IDENT -> x
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--MINUS -> -
         |               |--PLUS -> +
         |               |   |--PLUS -> +
         |               |   |   |--NUM_INT -> 4
         |               |   |   `--STAR -> *
         |               |   |       |--NUM_INT -> 2
         |               |   |       |--LPAREN -> (
         |               |   |       |--MOD -> %
         |               |   |       |   |--NUM_INT -> 5
         |               |   |       |   `--NUM_INT -> 3
         |               |   |       `--RPAREN -> )
         |               |   |--LPAREN -> (
         |               |   |--SL -> <<
         |               |   |   |--NUM_INT -> 1
         |               |   |   `--NUM_INT -> 3
         |               |   `--RPAREN -> )
         |               `--STAR -> *
         |                   |--NUM_INT -> 4
         |                   `--NUM_INT -> 5
         |--SEMI -> ;
         
        See Also:
        ELIST, ASSIGN, LPAREN, RPAREN, Constant Field Values
      • ARRAY_INIT

        public static final int ARRAY_INIT
        An array initialization. This may occur as part of an array declaration or inline with new.

        For example:

           int[] y =
             {
               1,
               2,
             };
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--LITERAL_INT -> int
          |   `--ARRAY_DECLARATOR -> [
          |       `--RBRACK -> ]
          |--IDENT -> y
          |--ASSIGN -> =
          |   `--ARRAY_INIT -> {
          |       |--EXPR -> EXPR
          |       |   `--NUM_INT -> 1
          |       |--COMMA -> ,
          |       |--EXPR -> EXPR
          |       |   `--NUM_INT -> 2
          |       |--COMMA -> ,
          |       `--RCURLY -> }
          `--SEMI -> ;
         

        Also consider:

           int[] z = new int[]
             {
               1,
               2,
             };
         

        which parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE [2:4]
          |   |--LITERAL_INT -> int
          |   `--ARRAY_DECLARATOR -> [
          |       `--RBRACK -> ]
          |--IDENT -> z
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--LITERAL_NEW -> new
          |           |--LITERAL_INT -> int
          |           |--ARRAY_DECLARATOR -> [
          |           |   `--RBRACK -> ]
          |           `--ARRAY_INIT -> {
          |               |--EXPR -> EXPR
          |               |   `--NUM_INT -> 1
          |               |--COMMA -> ,
          |               |--EXPR -> EXPR
          |               |   `--NUM_INT -> 2
          |               |--COMMA -> ,
          |               `--RCURLY -> }
          `--SEMI -> ;
         
        See Also:
        ARRAY_DECLARATOR, TYPE, LITERAL_NEW, COMMA, Constant Field Values
      • IMPORT

        public static final int IMPORT
        An import declaration. Import declarations are option, but must appear after the package declaration and before the first type declaration.

        For example:

           import java.io.IOException;
         

        parses as:

         IMPORT -> import
         |--DOT -> .
         |   |--DOT -> .
         |   |   |--IDENT -> java
         |   |   `--IDENT -> io
         |   `--IDENT -> IOException
         `--SEMI -> ;
         
        See Also:
        Java Language Specification §7.5, DOT, IDENT, STAR, SEMI, FullIdent, Constant Field Values
      • CASE_GROUP

        public static final int CASE_GROUP
        A group of case clauses. Case clauses with no associated statements are grouped together into a case group. The last child is a statement list containing the statements to execute upon a match.

        For example:

         case 0:
         case 1:
         case 2:
           x = 3;
           break;
         

        parses as:

         CASE_GROUP -> CASE_GROUP
          |--LITERAL_CASE -> case
          |   |--EXPR -> EXPR
          |   |   `--NUM_INT -> 0
          |   `--COLON -> :
          |--LITERAL_CASE -> case
          |   |--EXPR -> EXPR
          |   |   `--NUM_INT -> 1
          |   `--COLON -> :
          |--LITERAL_CASE -> case
          |   |--EXPR -> EXPR
          |   |   `--NUM_INT -> 2
          |   `--COLON -> :
          `--SLIST -> SLIST
              |--EXPR -> EXPR
              |   `--ASSIGN -> =
              |       |--IDENT -> x
              |       `--NUM_INT -> 3
              |--SEMI -> ;
              `--LITERAL_BREAK -> break
                  `--SEMI -> ;
         
        See Also:
        LITERAL_CASE, LITERAL_DEFAULT, LITERAL_SWITCH, LITERAL_YIELD, Constant Field Values
      • ELIST

        public static final int ELIST
        An expression list. The children are a comma separated list of expressions.

        For example:

         new ArrayList(50);
         

        parses as:

         |--EXPR -> EXPR
         |   `--LITERAL_NEW -> new
         |       |--IDENT -> ArrayList
         |       |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
         |       |   |--GENERIC_START -> <
         |       |   `--GENERIC_END -> >
         |       |--LPAREN -> (
         |       |--ELIST -> ELIST
         |       |   `--EXPR -> EXPR
         |       |       `--NUM_INT -> 50
         |       `--RPAREN -> )
         |--SEMI -> ;
         
        See Also:
        LITERAL_NEW, FOR_INIT, FOR_ITERATOR, EXPR, METHOD_CALL, CTOR_CALL, SUPER_CTOR_CALL, Constant Field Values
      • FOR_INIT

        public static final int FOR_INIT
        A for loop initializer. This is a child of LITERAL_FOR. The children of this element may be a comma separated list of variable declarations, an expression list, or empty.

        For example:

         for (int i = 0; i < arr.length; i++) {}
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |   `--VARIABLE_DEF -> VARIABLE_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--LITERAL_INT -> int
          |       |--IDENT -> i
          |       `--ASSIGN -> =
          |           `--EXPR -> EXPR
          |               `--NUM_INT -> 0
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |   `--EXPR -> EXPR
          |       `--LT -> <
          |           |--IDENT -> i
          |           `--DOT -> .
          |               |--IDENT -> arr
          |               `--IDENT -> length
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |   `--ELIST -> ELIST
          |       `--EXPR -> EXPR
          |           `--POST_INC -> ++
          |               `--IDENT -> i
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        VARIABLE_DEF, ELIST, LITERAL_FOR, Constant Field Values
      • FOR_CONDITION

        public static final int FOR_CONDITION
        A for loop condition. This is a child of LITERAL_FOR. The child of this element is an optional expression.

        For example:

         for (int i = 0; i < arr.length; i++) {}
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |   `--VARIABLE_DEF -> VARIABLE_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--LITERAL_INT -> int
          |       |--IDENT -> i
          |       `--ASSIGN -> =
          |           `--EXPR -> EXPR
          |               `--NUM_INT -> 0
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |   `--EXPR -> EXPR
          |       `--LT -> <
          |           |--IDENT -> i
          |           `--DOT -> .
          |               |--IDENT -> arr
          |               `--IDENT -> length
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |   `--ELIST -> ELIST
          |       `--EXPR -> EXPR
          |           `--POST_INC -> ++
          |               `--IDENT -> i
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        EXPR, LITERAL_FOR, Constant Field Values
      • FOR_ITERATOR

        public static final int FOR_ITERATOR
        A for loop iterator. This is a child of LITERAL_FOR. The child of this element is an optional expression list.

        For example:

         for (int i = 0; i < arr.length; i++) {}
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |   `--VARIABLE_DEF -> VARIABLE_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--LITERAL_INT -> int
          |       |--IDENT -> i
          |       `--ASSIGN -> =
          |           `--EXPR -> EXPR
          |               `--NUM_INT -> 0
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |   `--EXPR -> EXPR
          |       `--LT -> <
          |           |--IDENT -> i
          |           `--DOT -> .
          |               |--IDENT -> arr
          |               `--IDENT -> length
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |   `--ELIST -> ELIST
          |       `--EXPR -> EXPR
          |           `--POST_INC -> ++
          |               `--IDENT -> i
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        ELIST, LITERAL_FOR, Constant Field Values
      • FINAL

        public static final int FINAL
        The final keyword.

        For example:

         public final int x = 0;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   |--LITERAL_PUBLIC -> public
          |   `--FINAL -> final
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> x
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--NUM_INT -> 0
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • ABSTRACT

        public static final int ABSTRACT
        The abstract keyword.

        For example:

          public abstract class MyClass
          {
          }
         

        parses as:

         --CLASS_DEF
            |--MODIFIERS
            |   |--LITERAL_PUBLIC (public)
            |   `--ABSTRACT (abstract)
            |--LITERAL_CLASS (class)
            |--IDENT (MyClass)
            `--OBJBLOCK
                |--LCURLY ({)
                `--RCURLY (})
         
        See Also:
        MODIFIERS, Constant Field Values
      • STRICTFP

        public static final int STRICTFP
        The strictfp keyword.

        For example:

        public strictfp class Test {}

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_PUBLIC -> public
         |   `--STRICTFP -> strictfp
         |--LITERAL_CLASS -> class
         |--IDENT -> Test
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        See Also:
        MODIFIERS, Constant Field Values
      • SUPER_CTOR_CALL

        public static final int SUPER_CTOR_CALL
        A super constructor call.

        For example:

         super(1);
         

        parses as:

         SUPER_CTOR_CALL -> super
          |--LPAREN -> (
          |--ELIST -> ELIST
          |   `--EXPR -> EXPR
          |       `--NUM_INT -> 1
          |--RPAREN -> )
          `--SEMI -> ;
         
        See Also:
        ELIST, RPAREN, SEMI, CTOR_CALL, Constant Field Values
      • SEMI

        public static final int SEMI
        The statement terminator (;). Depending on the context, this make occur as a sibling, a child, or not at all.

        For example:

         for(;;);
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |--RPAREN -> )
          `--EMPTY_STAT -> ;
         
        See Also:
        PACKAGE_DEF, IMPORT, SLIST, ARRAY_INIT, LITERAL_FOR, Constant Field Values
      • RBRACK

        public static final int RBRACK
        The ] symbol.

        For example:

         int a[];
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--LITERAL_INT -> int
          |   `--ARRAY_DECLARATOR -> [
          |       `--RBRACK -> ]
          |--IDENT -> a
          `--SEMI -> ;
         
        See Also:
        INDEX_OP, ARRAY_DECLARATOR, Constant Field Values
      • LITERAL_VOID

        public static final int LITERAL_VOID
        The void keyword.

        For example:

         void LITERAL_VOID(){}
         

        'void' parses as:

         METHOD_DEF -> METHOD_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_VOID -> void
          |--IDENT -> LITERAL_VOID
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_BOOLEAN

        public static final int LITERAL_BOOLEAN
        The boolean keyword.

        For example:

         public boolean flag;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_BOOLEAN -> boolean
          |--IDENT -> flag
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_BYTE

        public static final int LITERAL_BYTE
        The byte keyword.

        For example:

         public byte x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_BYTE -> byte
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_CHAR

        public static final int LITERAL_CHAR
        The char keyword.

        For example:

         char a = 'A';
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_CHAR -> char
          |--IDENT -> a
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--CHAR_LITERAL -> 'A'
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_SHORT

        public static final int LITERAL_SHORT
        The short keyword.

        For example:

         public short x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_SHORT -> short
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_INT

        public static final int LITERAL_INT
        The int keyword.

        For example:

         public int x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_FLOAT

        public static final int LITERAL_FLOAT
        The float keyword.

        For example:

         public float x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_FLOAT -> float
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_LONG

        public static final int LITERAL_LONG
        The long keyword.

        For example:

         public long x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_LONG -> long
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • LITERAL_DOUBLE

        public static final int LITERAL_DOUBLE
        The double keyword.

        For example:

         public double x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_DOUBLE -> double
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        TYPE, Constant Field Values
      • IDENT

        public static final int IDENT
        An identifier. These can be names of types, subpackages, fields, methods, parameters, and local variables.

        For example:

         int a = 10;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> a
          |   `--ASSIGN -> =
          |       `--EXPR -> EXPR
          |           `--NUM_INT -> 10
          `--SEMI -> ;
         
        See Also:
        Constant Field Values
      • DOT

        public static final int DOT
        The . (dot) operator.

        For example:

         return person.name;
         

        parses as:

         --LITERAL_RETURN -> return
            |--EXPR -> EXPR
            |   `--DOT -> .
            |       |--IDENT -> person
            |       `--IDENT -> name
            `--SEMI -> ;
         
        See Also:
        FullIdent, Constant Field Values
      • LITERAL_PRIVATE

        public static final int LITERAL_PRIVATE
        The private keyword.

        For example:

         private int x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PRIVATE -> private
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_PUBLIC

        public static final int LITERAL_PUBLIC
        The public keyword.

        For example:

         public int x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_PROTECTED

        public static final int LITERAL_PROTECTED
        The protected keyword.

        For example:

         protected int x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PROTECTED -> protected
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_STATIC

        public static final int LITERAL_STATIC
        The static keyword.

        For example:

         public static int x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   |--LITERAL_PUBLIC -> public
          |   `--LITERAL_STATIC -> static
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> x
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_TRANSIENT

        public static final int LITERAL_TRANSIENT
        The transient keyword.

        For example:

         transient int a;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_TRANSIENT -> transient
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> a
          `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_NATIVE

        public static final int LITERAL_NATIVE
        The native keyword.

        For example:

         native void foo(){}
         

        parses as:

         METHOD_DEF -> METHOD_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_NATIVE -> native
          |--TYPE -> TYPE
          |   `--LITERAL_VOID -> void
          |--IDENT -> foo
          |--LPAREN -> (
          |--PARAMETERS -> PARAMETERS
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_SYNCHRONIZED

        public static final int LITERAL_SYNCHRONIZED
        The synchronized keyword. This may be used as a modifier of a method or in the definition of a synchronized block.

        For example:

         synchronized(this)
         {
           x++;
         }
         

        parses as:

         |--LITERAL_SYNCHRONIZED -> synchronized
         |   |--LPAREN -> (
         |   |--EXPR -> EXPR
         |   |   `--LITERAL_THIS -> this
         |   |--RPAREN -> )
         |   `--SLIST -> {
         |       |--EXPR -> EXPR
         |       |   `--POST_INC -> ++
         |       |       `--IDENT -> x
         |       |--SEMI -> ;
         |       `--RCURLY -> }
         `--RCURLY -> }
         
        See Also:
        MODIFIERS, LPAREN, EXPR, RPAREN, SLIST, RCURLY, Constant Field Values
      • LITERAL_VOLATILE

        public static final int LITERAL_VOLATILE
        The volatile keyword. This may be used as a modifier of a field.

        For example:

         private volatile int x;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
         |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_PRIVATE -> private
         |   `--LITERAL_VOLATILE -> volatile
         |--TYPE -> TYPE
         |   `--LITERAL_INT -> int
         |--IDENT -> x
         `--SEMI -> ;
         
        See Also:
        MODIFIERS, Constant Field Values
      • LITERAL_CLASS

        public static final int LITERAL_CLASS
        The class keyword. This element appears both as part of a class declaration, and inline to reference a class object.

        For example:

         class Test {
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |--LITERAL_CLASS -> class
         |--IDENT -> Test
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         

        For example:

         int.class
         

        parses as:

         EXPR -> EXPR
          `--DOT -> .
              |--LITERAL_INT -> int
              `--LITERAL_CLASS -> class
         
        See Also:
        DOT, IDENT, CLASS_DEF, FullIdent, Constant Field Values
      • LITERAL_INTERFACE

        public static final int LITERAL_INTERFACE
        The interface keyword. This token appears in interface definition.

        For example:

         public interface MyInterface {
        
         }
         

        parses as:

         INTERFACE_DEF -> INTERFACE_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_INTERFACE -> interface
         |--IDENT -> MyInterface
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        See Also:
        INTERFACE_DEF, Constant Field Values
      • LCURLY

        public static final int LCURLY
        A left curly brace ({).

        For example:

         class App {
           int num;
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |--LITERAL_CLASS -> class
         |--IDENT -> App
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             |--VARIABLE_DEF -> VARIABLE_DEF
             |   |--MODIFIERS -> MODIFIERS
             |   |--TYPE -> TYPE
             |   |   `--LITERAL_INT -> int
             |   |--IDENT -> num
             |   `--SEMI -> ;
             `--RCURLY -> }
         
        See Also:
        OBJBLOCK, ARRAY_INIT, SLIST, Constant Field Values
      • RCURLY

        public static final int RCURLY
        A right curly brace (}).

        For example:

         
         void foo(){}
         
         

        parses as:

         METHOD_DEF -> METHOD_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_VOID -> void
          |--IDENT -> foo
          |--LPAREN -> (
          |--PARAMETERS -> PARAMETERS
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        OBJBLOCK, ARRAY_INIT, SLIST, Constant Field Values
      • COMMA

        public static final int COMMA
        The , (comma) operator.

        For example:

         int a, b;
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_INT -> int
         |   `--IDENT -> a
         |--COMMA -> ,
         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_INT -> int
         |   `--IDENT -> b
         |--SEMI -> ;
         
        See Also:
        ARRAY_INIT, FOR_INIT, FOR_ITERATOR, LITERAL_THROWS, IMPLEMENTS_CLAUSE, Constant Field Values
      • LPAREN

        public static final int LPAREN
        A left parenthesis (().

        For example:

         Integer val = new Integer();
         while (false) {
             val += (-3);
         }
         

        parses as:

          |--VARIABLE_DEF -> VARIABLE_DEF
          |   |--MODIFIERS -> MODIFIERS
          |   |--TYPE -> TYPE
          |   |   `--IDENT -> Integer
          |   |--IDENT -> val
          |   `--ASSIGN -> =
          |       `--EXPR -> EXPR
          |           `--LITERAL_NEW -> new
          |               |--IDENT -> Integer
          |               |--LPAREN -> (
          |               |--ELIST -> ELIST
          |               `--RPAREN -> )
          |--SEMI -> ;
          |--LITERAL_WHILE -> while
          |   |--LPAREN -> (
          |   |--EXPR -> EXPR
          |   |   `--LITERAL_FALSE -> false
          |   |--RPAREN -> )
          |   `--SLIST -> {
          |       |--EXPR -> EXPR
          |       |   `--PLUS_ASSIGN -> +=
          |       |       |--IDENT -> val
          |       |       |--LPAREN -> (
          |       |       |--UNARY_MINUS -> -
          |       |       |   `--NUM_INT -> 3
          |       |       `--RPAREN -> )
          |       |--SEMI -> ;
          |       `--RCURLY -> }
         
        See Also:
        LITERAL_FOR, LITERAL_NEW, EXPR, LITERAL_SWITCH, LITERAL_CATCH, Constant Field Values
      • LITERAL_THIS

        public static final int LITERAL_THIS
        The this keyword use to refer the current object. This can also be used to call the constructor.

        For example:

         this.name = name;
         

        parses as:

         EXPR -> EXPR
          `--ASSIGN -> =
              |--DOT -> .
              |   |--LITERAL_THIS -> this
              |   `--IDENT -> name
              `--IDENT -> name
         SEMI -> ;
         

        Also consider:

         this(1, "NULL");
         

        parses as:

         CTOR_CALL -> this
          |--LPAREN -> (
          |--ELIST -> ELIST
          |   |--EXPR -> EXPR
          |   |   `--NUM_INT -> 1
          |   |--COMMA -> ,
          |   `--EXPR -> EXPR
          |       `--STRING_LITERAL -> "NULL"
          |--RPAREN -> )
          `--SEMI -> ;
         
        See Also:
        EXPR, CTOR_CALL, Constant Field Values
      • LITERAL_SUPER

        public static final int LITERAL_SUPER
        The super keyword.

        For example:

         super.toString()ï¼›
         

        parses as:

         |--EXPR -> EXPR
         |   `--METHOD_CALL -> (
         |       |--DOT -> .
         |       |  |--LITERAL_SUPER -> super
         |       |  `--IDENT -> toString
         |       |--ELIST -> ELIST
         |       `--RPAREN -> )
         |--SEMI -> ;
         
        See Also:
        EXPR, SUPER_CTOR_CALL, Constant Field Values
      • LITERAL_THROWS

        public static final int LITERAL_THROWS
        The throws keyword. The children are a number of one or more identifiers separated by commas.

        For example:

         void test() throws FileNotFoundException, EOFException {
         }
         

        parses as:

         METHOD_DEF -> METHOD_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_VOID -> void
          |--IDENT -> test
          |--LPAREN -> (
          |--PARAMETERS -> PARAMETERS
          |--RPAREN -> )
          |--LITERAL_THROWS -> throws
          |   |--IDENT -> FileNotFoundException
          |   |--COMMA -> ,
          |   `--IDENT -> EOFException
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        Java Language Specification, §8.4.4, IDENT, DOT, COMMA, METHOD_DEF, CTOR_DEF, FullIdent, Constant Field Values
      • COLON

        public static final int COLON
        The : (colon) operator. This will appear as part of the conditional operator (? :).

        For example:

         num = isValid ? 1 : 0;
         

        parses as:

         |--EXPR -> EXPR
         |   `--ASSIGN -> =
         |       |--IDENT -> num
         |       `--QUESTION -> ?
         |           |--IDENT -> isValid
         |           |--NUM_INT -> 1
         |           |--COLON -> :
         |           `--NUM_INT -> 0
         |--SEMI -> ;
         
        See Also:
        QUESTION, LABELED_STAT, CASE_GROUP, Constant Field Values
      • DOUBLE_COLON

        public static final int DOUBLE_COLON
        The :: (double colon) separator. It is part of Java 8 syntax that is used for method reference. The token does not appear in tree, METHOD_REF should be used instead.

        For example:

         Function<Double, Double> square = MyClass::square;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--IDENT -> Function
          |   |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |   |       |--GENERIC_START -> <
          |   |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |   |       |   `--IDENT -> Double
          |   |       |--COMMA -> ,
          |   |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |   |       |   `--IDENT -> Double
          |   |       `--GENERIC_END -> >
          |   |--IDENT -> square
          |   |--ASSIGN -> =
          |   |   `--EXPR -> EXPR
          |   |       `--METHOD_REF -> ::
          |   |           |--IDENT -> MyClass
          |   |           `--IDENT -> square
          |   `--SEMI -> ;
         
        See Also:
        METHOD_REF, Constant Field Values
      • LITERAL_IF

        public static final int LITERAL_IF
        The if keyword.

        For example:

         if (optimistic)
         {
           message = "half full";
         }
         else
         {
           message = "half empty";
         }
         

        parses as:

         LITERAL_IF -> if
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--IDENT -> optimistic
          |--RPAREN -> )
          |--SLIST -> {
          |   |--EXPR -> EXPR
          |   |   `--ASSIGN -> =
          |   |       |--IDENT -> message
          |   |       `--STRING_LITERAL -> "half full"
          |   |--SEMI -> ;
          |   `--RCURLY -> }
          `--LITERAL_ELSE -> else
              `--SLIST -> {
                  |--EXPR -> EXPR
                  |   `--ASSIGN -> =
                  |       |--IDENT -> message
                  |       `--STRING_LITERAL -> "half empty"
                  |--SEMI -> ;
                  `--RCURLY -> }
         
        See Also:
        LPAREN, EXPR, RPAREN, SLIST, EMPTY_STAT, LITERAL_ELSE, Constant Field Values
      • LITERAL_FOR

        public static final int LITERAL_FOR
        The for keyword. The children are (, an initializer, a condition, an iterator, a ) and either a statement list, a single expression, or an empty statement.

        For example:

         for (int i = 0; i < arr.length; i++) {}
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |   `--VARIABLE_DEF -> VARIABLE_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--LITERAL_INT -> int
          |       |--IDENT -> i
          |       `--ASSIGN -> =
          |           `--EXPR -> EXPR
          |               `--NUM_INT -> 0
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |   `--EXPR -> EXPR
          |       `--LT -> <
          |           |--IDENT -> i
          |           `--DOT -> .
          |               |--IDENT -> arr
          |               `--IDENT -> length
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |   `--ELIST -> ELIST
          |       `--EXPR -> EXPR
          |           `--POST_INC -> ++
          |               `--IDENT -> i
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        LPAREN, FOR_INIT, SEMI, FOR_CONDITION, FOR_ITERATOR, RPAREN, SLIST, EMPTY_STAT, EXPR, Constant Field Values
      • LITERAL_WHILE

        public static final int LITERAL_WHILE
        The while keyword.

        For example:

         while (i < 5) {
             i++;
         }
         

        parses as:

         LITERAL_WHILE -> while
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--LT -> <
          |       |--IDENT -> i
          |       `--NUM_INT -> 5
          |--RPAREN -> )
          `--SLIST -> {
              |--EXPR -> EXPR
              |   `--POST_INC -> ++
              |       `--IDENT -> i
              |--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        Constant Field Values
      • LITERAL_DO

        public static final int LITERAL_DO
        The do keyword. Note that the while token does not appear as part of the do-while construct.

        For example:

         do {
           x = rand.nextInt();
         } while (x < 5);
         

        parses as:

         LITERAL_DO -> do
          |--SLIST -> {
          |   |--EXPR -> EXPR
          |   |   `--ASSIGN -> =
          |   |       |--IDENT -> x
          |   |       `--METHOD_CALL -> (
          |   |           |--DOT -> .
          |   |           |   |--IDENT -> rand
          |   |           |   `--IDENT -> nextInt
          |   |           |--ELIST -> ELIST
          |   |           `--RPAREN -> )
          |   |--SEMI -> ;
          |   `--RCURLY -> }
          |--DO_WHILE -> while
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--LT -> <
          |       |--IDENT -> x
          |       `--NUM_INT -> 5
          |--RPAREN -> )
          `--SEMI -> ;
         
        See Also:
        SLIST, EXPR, EMPTY_STAT, LPAREN, RPAREN, SEMI, Constant Field Values
      • DO_WHILE

        public static final int DO_WHILE
        Literal while in do-while loop.

        For example:

         do {
        
         } while (a > 0);
         

        parses as:

         --LITERAL_DO -> do
            |--SLIST -> {
            |   `--RCURLY -> }
            |--DO_WHILE -> while
            |--LPAREN -> (
            |--EXPR -> EXPR
            |   `--GT -> >
            |       |--IDENT -> a
            |       `--NUM_INT -> 0
            |--RPAREN -> )
            `--SEMI -> ;
         
        See Also:
        LITERAL_DO, Constant Field Values
      • LITERAL_BREAK

        public static final int LITERAL_BREAK
        The break keyword. The first child is an optional identifier and the last child is a semicolon.

        For example:

         for (;;) {
             break;
         }
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |--RPAREN -> )
          `--SLIST -> {
              |--LITERAL_BREAK -> break
              |   `--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        IDENT, SEMI, SLIST, Constant Field Values
      • LITERAL_CONTINUE

        public static final int LITERAL_CONTINUE
        The continue keyword. The first child is an optional identifier and the last child is a semicolon.

        For example:

         for (;;) {
             continue;
         }
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_INIT -> FOR_INIT
          |--SEMI -> ;
          |--FOR_CONDITION -> FOR_CONDITION
          |--SEMI -> ;
          |--FOR_ITERATOR -> FOR_ITERATOR
          |--RPAREN -> )
          `--SLIST -> {
              |--LITERAL_CONTINUE -> continue
              |   `--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        IDENT, SEMI, SLIST, Constant Field Values
      • LITERAL_RETURN

        public static final int LITERAL_RETURN
        The return keyword. The first child is an optional expression for the return value. The last child is a semicolon.

        For example:

         public int foo(int i) {
             return i+1;
         }
         

        parses as:

         METHOD_DEF -> METHOD_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   `--LITERAL_INT -> int
          |--IDENT -> foo
          |--LPAREN -> (
          |--PARAMETERS -> PARAMETERS
          |   `--PARAMETER_DEF -> PARAMETER_DEF
          |       |--MODIFIERS -> MODIFIERS
          |       |--TYPE -> TYPE
          |       |   `--LITERAL_INT -> int
          |       `--IDENT -> i
          |--RPAREN -> )
          `--SLIST -> {
              |--LITERAL_RETURN -> return
              |   |--EXPR -> EXPR
              |   |   `--PLUS -> +
              |   |       |--IDENT -> i
              |   |       `--NUM_INT -> 1
              |   `--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        EXPR, SEMI, SLIST, Constant Field Values
      • LITERAL_SWITCH

        public static final int LITERAL_SWITCH
        The switch keyword.

        For example:

         switch (type) {
              case 0:
                  background = Color.red;
                  break;
              case 1:
                  background = Color.blue;
                  break;
              default:
                  background = Color.green;
         }
         

        parses as:

         LITERAL_SWITCH -> switch
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--IDENT -> type
          |--RPAREN -> )
          |--LCURLY -> {
          |--CASE_GROUP -> CASE_GROUP
          |   |--LITERAL_CASE -> case
          |   |   |--EXPR -> EXPR
          |   |   |   `--NUM_INT -> 0
          |   |   `--COLON -> :
          |   `--SLIST -> SLIST
          |       |--EXPR -> EXPR
          |       |   `--ASSIGN -> =
          |       |       |--IDENT -> background
          |       |       `--DOT -> .
          |       |           |--IDENT -> Color
          |       |           `--IDENT -> red
          |       |--SEMI -> ;
          |       `--LITERAL_BREAK -> break
          |           `--SEMI -> ;
          |--CASE_GROUP -> CASE_GROUP
          |   |--LITERAL_CASE -> case
          |   |   |--EXPR -> EXPR
          |   |   |   `--NUM_INT -> 1
          |   |   `--COLON -> :
          |   `--SLIST -> SLIST
          |       |--EXPR -> EXPR
          |       |   `--ASSIGN -> =
          |       |       |--IDENT -> background
          |       |       `--DOT -> .
          |       |           |--IDENT -> Color
          |       |           `--IDENT -> blue
          |       |--SEMI -> ;
          |       `--LITERAL_BREAK -> break
          |           `--SEMI -> ;
          |--CASE_GROUP -> CASE_GROUP
          |   |--LITERAL_DEFAULT -> default
          |   |   `--COLON -> :
          |   `--SLIST -> SLIST
          |       |--EXPR -> EXPR
          |       |   `--ASSIGN -> =
          |       |       |--IDENT -> background
          |       |       `--DOT -> .
          |       |           |--IDENT -> Color
          |       |           `--IDENT -> green
          |       `--SEMI -> ;
          `--RCURLY -> }
         
        See Also:
        Java Language Specification, §14.10, LPAREN, EXPR, RPAREN, LCURLY, CASE_GROUP, RCURLY, SLIST, SWITCH_RULE, Constant Field Values
      • LITERAL_THROW

        public static final int LITERAL_THROW
        The throw keyword. The first child is an expression that evaluates to a Throwable instance.

        For example:

         throw new ArithmeticException("An exception occurred.");
         

        parses as:

         LITERAL_THROW -> throw
          |--EXPR -> EXPR
          |   `--LITERAL_NEW -> new
          |       |--IDENT -> ArithmeticException
          |       |--LPAREN -> (
          |       |--ELIST -> ELIST
          |       |   `--EXPR -> EXPR
          |       |       `--STRING_LITERAL -> "An exception occurred."
          |       `--RPAREN -> )
          `--SEMI -> ;
         
        See Also:
        Java Language Specification, §14.17, SLIST, EXPR, Constant Field Values
      • LITERAL_ELSE

        public static final int LITERAL_ELSE
        The else keyword. This appears as a child of an if statement.

        For example:

         if (flag) {
        
         } else {
        
         }
         

        parses as:

         LITERAL_IF -> if
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--IDENT -> flag
          |--RPAREN -> )
          |--SLIST -> {
          |   `--RCURLY -> }
          `--LITERAL_ELSE -> else
              `--SLIST -> {
                  `--RCURLY -> }
         
        See Also:
        SLIST, EXPR, EMPTY_STAT, LITERAL_IF, Constant Field Values
      • LITERAL_CASE

        public static final int LITERAL_CASE
        The case keyword. The first child is a constant expression that evaluates to an integer.

        For example:

         switch(num){
            case 0:
              num = 1;
         }
         

        parses as:

        
         CASE_GROUP -> CASE_GROUP
            |--LITERAL_CASE -> cas
            |   |--EXPR -> EXPR
            |   |   `--NUM_INT -> 0
            |   `--COLON -> :
            `--SLIST -> SLIST
                 |--EXPR -> EXPR
                 |   `--ASSIGN -> =
                 |       |--IDENT -> num
                 |       `--NUM_INT -> 1
                 `--SEMI -> ;
         

        For example:

         switch(num){
            case 1 -> num = -1
         }
         

        parses as:

         SWITCH_RULE -> SWITCH_RULE
           |--LITERAL_CASE -> case
           |   `--EXPR -> EXPR
           |       `--NUM_INT -> 1
           |--LAMBDA -> ->
           |--EXPR -> EXPR
           |   `--ASSIGN -> =
           |       |--IDENT -> num
           |       `--UNARY_MINUS -> -
           |           `--NUM_INT -> 1
           `--SEMI -> ;
         
        See Also:
        CASE_GROUP, EXPR, Constant Field Values
      • LITERAL_DEFAULT

        public static final int LITERAL_DEFAULT
        The default keyword. This element has no children.

        For example:

         switch (type) {
           case 1:
             x = 1;
             break;
           default:
             x = 3;
         }
         

        parses as:

         LITERAL_SWITCH -> switch
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--IDENT -> type
          |--RPAREN -> )
          |--LCURLY -> {
          |--CASE_GROUP -> CASE_GROUP
          |   |--LITERAL_CASE -> case
          |   |   |--EXPR -> EXPR
          |   |   |   `--NUM_INT -> 1
          |   |   `--COLON -> :
          |   `--SLIST -> SLIST
          |       |--EXPR -> EXPR
          |       |   `--ASSIGN -> =
          |       |       |--IDENT -> x
          |       |       `--NUM_INT -> 1
          |       |   |       |--SEMI -> ;
          |       `--LITERAL_BREAK -> break
          |           `--SEMI -> ;
          |--CASE_GROUP -> CASE_GROUP
          |   |--LITERAL_DEFAULT -> default
          |   |   `--COLON -> :
          |   `--SLIST -> SLIST
          |       |--EXPR -> EXPR
          |       |   `--ASSIGN -> =
          |       |       |--IDENT -> x
          |       |       `--NUM_INT -> 3
          |       `--SEMI -> ;
          `--RCURLY -> }
         
        See Also:
        CASE_GROUP, MODIFIERS, SWITCH_RULE, Constant Field Values
      • RESOURCE_SPECIFICATION

        public static final int RESOURCE_SPECIFICATION
        The Java 7 try-with-resources construct.

        For example:

         try (Foo foo = new Foo(); Bar bar = new Bar()) {
         }
         

        parses as:

         LITERAL_TRY -> try
          |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION
          |   |--LPAREN -> (
          |   |--RESOURCES -> RESOURCES
          |   |   |--RESOURCE -> RESOURCE
          |   |   |   |--MODIFIERS -> MODIFIERS
          |   |   |   |--TYPE -> TYPE
          |   |   |   |   `--IDENT -> Foo
          |   |   |   |--IDENT -> foo
          |   |   |   `--ASSIGN -> =
          |   |   |       `--EXPR -> EXPR
          |   |   |           `--LITERAL_NEW -> new
          |   |   |               |--IDENT -> Foo
          |   |   |               |--LPAREN -> (
          |   |   |               |--ELIST -> ELIST
          |   |   |               `--RPAREN -> )
          |   |   |--SEMI -> ;
          |   |   `--RESOURCE -> RESOURCE
          |   |       |--MODIFIERS -> MODIFIERS
          |   |       |--TYPE -> TYPE
          |   |       |   `--IDENT -> Bar
          |   |       |--IDENT -> bar
          |   |       `--ASSIGN -> =
          |   |           `--EXPR -> EXPR
          |   |               `--LITERAL_NEW -> new
          |   |                   |--IDENT -> Bar
          |   |                   |--LPAREN -> (
          |   |                   |--ELIST -> ELIST
          |   |                   `--RPAREN -> )
          |   `--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         

        Also consider:

         try (BufferedReader br = new BufferedReader(new FileReader(path))) {
         }
         

        which parses as:

         LITERAL_TRY -> try
          |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION
          |   |--LPAREN -> (
          |   |--RESOURCES -> RESOURCES
          |   |   `--RESOURCE -> RESOURCE
          |   |       |--MODIFIERS -> MODIFIERS
          |   |       |--TYPE -> TYPE
          |   |       |   `--IDENT -> BufferedReader
          |   |       |--IDENT -> br
          |   |       `--ASSIGN -> =
          |   |           `--EXPR -> EXPR
          |   |               `--LITERAL_NEW -> new
          |   |                   |--IDENT -> BufferedReader
          |   |                   |--LPAREN -> (
          |   |                   |--ELIST -> ELIST
          |   |                   |   `--EXPR -> EXPR
          |   |                   |       `--LITERAL_NEW -> new
          |   |                   |           |--IDENT -> FileReader
          |   |                   |           |--LPAREN -> (
          |   |                   |           |--ELIST -> ELIST
          |   |                   |           |   `--EXPR -> EXPR
          |   |                   |           |       `--IDENT -> path
          |   |                   |           `--RPAREN -> )
          |   |                   `--RPAREN -> )
          |   `--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        LPAREN, RESOURCES, RESOURCE, SEMI, RPAREN, LITERAL_TRY, Constant Field Values
      • RESOURCES

        public static final int RESOURCES
        A list of resources in the Java 7 try-with-resources construct. This is a child of RESOURCE_SPECIFICATION.

        For example:

             try (FileReader fr = new FileReader("config.xml")) {
             } finally {}
         

        parses as:

         LITERAL_TRY -> try
          |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION
          |   |--LPAREN -> (
          |   |--RESOURCES -> RESOURCES
          |   |   `--RESOURCE -> RESOURCE
          |   |       |--MODIFIERS -> MODIFIERS
          |   |       |--TYPE -> TYPE
          |   |       |   `--IDENT -> FileReader
          |   |       |--IDENT -> fr
          |   |       `--ASSIGN -> =
          |   |           `--EXPR -> EXPR
          |   |               `--LITERAL_NEW -> new
          |   |                   |--IDENT -> FileReader
          |   |                   |--LPAREN -> (
          |   |                   |--ELIST -> ELIST
          |   |                   |   `--EXPR -> EXPR
          |   |                   |       `--STRING_LITERAL -> "config.xml"
          |   |                   `--RPAREN -> )
          |   `--RPAREN -> )
          |--SLIST -> {
          |   `--RCURLY -> }
          `--LITERAL_FINALLY -> finally
              `--SLIST -> {
                  `--RCURLY -> }
         
        See Also:
        RESOURCE_SPECIFICATION, Constant Field Values
      • RESOURCE

        public static final int RESOURCE
        A resource in the Java 7 try-with-resources construct. This is a child of RESOURCES.

        For example:

         try (Foo foo = new Foo(); Bar bar = new Bar()) { }
         

        parses as:

         LITERAL_TRY -> try
          |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION
          |   |--LPAREN -> (
          |   |--RESOURCES -> RESOURCES
          |   |   |--RESOURCE -> RESOURCE
          |   |   |   |--MODIFIERS -> MODIFIERS
          |   |   |   |--TYPE -> TYPE
          |   |   |   |   `--IDENT -> Foo
          |   |   |   |--IDENT -> foo
          |   |   |   `--ASSIGN -> =
          |   |   |       `--EXPR -> EXPR
          |   |   |           `--LITERAL_NEW -> new
          |   |   |               |--IDENT -> Foo
          |   |   |               |--LPAREN -> (
          |   |   |               |--ELIST -> ELIST
          |   |   |               `--RPAREN -> )
          |   |   |--SEMI -> ;
          |   |   `--RESOURCE -> RESOURCE
          |   |       |--MODIFIERS -> MODIFIERS
          |   |       |--TYPE -> TYPE
          |   |       |   `--IDENT -> Bar
          |   |       |--IDENT -> bar
          |   |       `--ASSIGN -> =
          |   |           `--EXPR -> EXPR
          |   |               `--LITERAL_NEW -> new
          |   |                   |--IDENT -> Bar
          |   |                   |--LPAREN -> (
          |   |                   |--ELIST -> ELIST
          |   |                   `--RPAREN -> )
          |   `--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        See Also:
        RESOURCES, RESOURCE_SPECIFICATION, Constant Field Values
      • LITERAL_CATCH

        public static final int LITERAL_CATCH
        The catch keyword.

        For example:

         try {
             FileReader fr = new FileReader("Test.txt");
         } catch (FileNotFoundException e) {
        
         }
         

        parses as:

         LITERAL_TRY -> try
          |--SLIST -> {
          |   |--VARIABLE_DEF -> VARIABLE_DEF
          |   |   |--MODIFIERS -> MODIFIERS
          |   |   |--TYPE -> TYPE
          |   |   |   `--IDENT -> FileReader
          |   |   |--IDENT -> fr
          |   |   `--ASSIGN -> =
          |   |       `--EXPR -> EXPR
          |   |           `--LITERAL_NEW -> new
          |   |               |--IDENT -> FileReader
          |   |               |--LPAREN -> (
          |   |               |--ELIST -> ELIST
          |   |               |   `--EXPR -> EXPR
          |   |               |       `--STRING_LITERAL -> "Test.txt"
          |   |               `--RPAREN -> )
          |   |--SEMI -> ;
          |   `--RCURLY -> }
          `--LITERAL_CATCH -> catch
              |--LPAREN -> (
              |--PARAMETER_DEF -> PARAMETER_DEF
              |   |--MODIFIERS -> MODIFIERS
              |   |--TYPE -> TYPE
              |   |   `--IDENT -> FileNotFoundException
              |   `--IDENT -> e
              |--RPAREN -> )
              `--SLIST -> {
                  `--RCURLY -> }
         
        See Also:
        LPAREN, PARAMETER_DEF, RPAREN, SLIST, LITERAL_TRY, Constant Field Values
      • LITERAL_FINALLY

        public static final int LITERAL_FINALLY
        The finally keyword.

        For example:

         try {} finally {}
         

        parses as:

         LITERAL_TRY -> try
          |--SLIST -> {
          |   `--RCURLY -> }
          `--LITERAL_FINALLY -> finally
              `--SLIST -> {
                  `--RCURLY -> }
         
        See Also:
        SLIST, LITERAL_TRY, Constant Field Values
      • QUESTION

        public static final int QUESTION
        The ? (conditional) operator. Technically, the colon is also part of this operator, but it appears as a separate token.

        For example:

         String variable=(quantity==1)?"true":"false";
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--IDENT -> String
         |   |--IDENT -> variable
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--QUESTION -> ?
         |               |--LPAREN -> (
         |               |--EQUAL -> ==
         |               |   |--IDENT -> quantity
         |               |   `--NUM_INT -> 1
         |               |--RPAREN -> )
         |               |--STRING_LITERAL -> "true"
         |               |--COLON -> :
         |               `--STRING_LITERAL -> "false"
         |--SEMI -> ;
         
        See Also:
        Java Language Specification, §15.25, EXPR, COLON, Constant Field Values
      • LOR

        public static final int LOR
        The || (conditional OR) operator.

        For example:

         if (a || b) {
         }
         

        parses as:

         LITERAL_IF -> if
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--LOR -> ||
          |       |--IDENT -> a
          |       `--IDENT -> b
          |--RPAREN -> )
          |--SLIST -> {
          |   |--RCURLY -> }
         
        See Also:
        Java Language Specification, §15.24, EXPR, Constant Field Values
      • LAND

        public static final int LAND
        The && (conditional AND) operator.

        For example:

         if (a && b) {
         }
         

        parses as:

         LITERAL_IF -> if
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--LAND -> &&
          |       |--IDENT -> a
          |       `--IDENT -> b
          |--RPAREN -> )
          |--SLIST -> {
          |   |--RCURLY -> }
         
        See Also:
        Java Language Specification, §15.23, EXPR, Constant Field Values
      • NOT_EQUAL

        public static final int NOT_EQUAL
        The != (not equal) operator.

        For example:

         a != b;
         

        parses as:

         |--EXPR -> EXPR
         |   `--NOT_EQUAL -> !=
         |       |--IDENT -> a
         |       `--IDENT -> b
         `--SEMI -> ;
         
        See Also:
        EXPR, Constant Field Values
      • EQUAL

        public static final int EQUAL
        The == (equal) operator.

        For example:

         return a == b;
         

        parses as:

         |--EXPR -> EXPR
         |   `--EQUAL -> ==
         |       |--IDENT -> a
         |       `--IDENT -> b
         `--SEMI -> ;
         
        See Also:
        EXPR, Constant Field Values
      • LT

        public static final int LT
        The < (less than) operator.

        For example:

         c = a < b;
         

        parses as:

         |--EXPR -> EXPR
         |   `--ASSIGN -> =
         |       |--IDENT -> c
         |       `--LT -> <
         |           |--IDENT -> a
         |           `--IDENT -> b
         |--SEMI -> ;
         
        See Also:
        EXPR, Constant Field Values
      • GT

        public static final int GT
        The > (greater than) operator.

        For example:

         c = a > b;
         

        parses as:

         |--EXPR -> EXPR
         |   `--ASSIGN -> =
         |       |--IDENT -> c
         |       `--BAND -> >
         |           |--IDENT -> a
         |           `--IDENT -> b
         |--SEMI -> ;
         
        See Also:
        EXPR, Constant Field Values
      • LE

        public static final int LE
        The <= (less than or equal) operator.

        For example:

         c = a <= b;
         

        parses as:

         |--EXPR -> EXPR
         |   `--ASSIGN -> =
         |       |--IDENT -> c
         |       `--LE -> <=
         |           |--IDENT -> a
         |           `--IDENT -> b
         |--SEMI -> ;
         
        See Also:
        EXPR, Constant Field Values
      • GE

        public static final int GE
        The >= (greater than or equal) operator.

        For example:

           boolean b = a >= 3;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--LITERAL_BOOLEAN -> boolean
          |--IDENT -> b
          `--ASSIGN -> =
              `--EXPR -> EXPR
                  `--GE -> >=
                      |--IDENT -> a
                      `--NUM_INT -> 3
         
        See Also:
        EXPR, Constant Field Values
      • LITERAL_INSTANCEOF

        public static final int LITERAL_INSTANCEOF
        The instanceof operator. The first child is an object reference or something that evaluates to an object reference. The second child is a reference type or pattern.

        For example:

         boolean isBuilderReferenceType = text instanceof StringBuilder; // reference type
         boolean isBuilderPatternWithPattern =
                 text instanceof StringBuilder s; // type pattern, no `PATTERN_DEF`
         boolean isBuilderEmpty = text instanceof
                 (StringBuilder sb && sb.isEmpty());  // guarded pattern, `PATTERN_DEF`
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_BOOLEAN -> boolean
         |   |--IDENT -> isBuilderReferenceType
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--LITERAL_INSTANCEOF -> instanceof
         |               |--IDENT -> text
         |               `--TYPE -> TYPE
         |                   `--IDENT -> StringBuilder
         |--SEMI -> ;
         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_BOOLEAN -> boolean
         |   |--IDENT -> isBuilderPatternWithPattern
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--LITERAL_INSTANCEOF -> instanceof
         |               |--IDENT -> text
         |               `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |                   |--MODIFIERS -> MODIFIERS
         |                   |--TYPE -> TYPE
         |                   |   `--IDENT -> StringBuilder
         |                   `--IDENT -> s
         |--SEMI -> ;
         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_BOOLEAN -> boolean
         |   |--IDENT -> isBuilderEmpty
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--LITERAL_INSTANCEOF -> instanceof
         |               |--IDENT -> text
         |               `--PATTERN_DEF -> PATTERN_DEF
         |                   `--LPAREN -> (
         |                       |--LAND -> &&
         |                       |   |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |                       |   |   |--MODIFIERS -> MODIFIERS
         |                       |   |   |--TYPE -> TYPE
         |                       |   |   |   `--IDENT -> StringBuilder
         |                       |   |   `--IDENT -> sb
         |                       |   `--METHOD_CALL -> (
         |                       |       |--DOT -> .
         |                       |       |   |--IDENT -> sb
         |                       |       |   `--IDENT -> isEmpty
         |                       |       |--ELIST -> ELIST
         |                       |       `--RPAREN -> )
         |                       `--RPAREN -> )
         `--SEMI -> ;
         
        See Also:
        Java Language Specification, §15.20.2, EXPR, METHOD_CALL, IDENT, DOT, TYPE, PATTERN_VARIABLE_DEF, PATTERN_DEF, FullIdent, Constant Field Values
      • LITERAL_NEW

        public static final int LITERAL_NEW
        The new keyword. This element is used to define new instances of objects, new arrays, and new anonymous inner classes.

        For example:

         List<String> l = new ArrayList<String>();
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--IDENT -> List
          |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |       |--GENERIC_START -> <
          |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |       |   `--IDENT -> String
          |       `--GENERIC_END -> >
          |--IDENT -> l
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--LITERAL_NEW -> new
          |           |--IDENT -> ArrayList
          |           |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |           |   |--GENERIC_START -> <
          |           |   |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |           |   |   `--IDENT -> String
          |           |   `--GENERIC_END -> >
          |           |--LPAREN -> (
          |           |--ELIST -> ELIST
          |           `--RPAREN -> )
          `--SEMI -> ;
         

        For example:

         String[] strings = new String[3];
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--IDENT -> String
          |   `--ARRAY_DECLARATOR -> [
          |       `--RBRACK -> ]
          |--IDENT -> strings
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--LITERAL_NEW -> new
          |           |--IDENT -> String
          |           `--ARRAY_DECLARATOR -> [
          |               |--EXPR -> EXPR
          |               |   `--NUM_INT -> 3
          |               `--RBRACK -> ]
          `--SEMI -> ;
         

        For example:

         Supplier<Integer> s = new Supplier<>() {
             @Override
             public Integer get() {
                 return 42;
             }
         };
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--IDENT -> Supplier
          |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |       |--GENERIC_START -> <
          |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |       |   `--IDENT -> Integer
          |       `--GENERIC_END -> >
          |--IDENT -> s
          |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--LITERAL_NEW -> new
          |           |--IDENT -> Supplier
          |           |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |           |   |--GENERIC_START -> <
          |           |   `--GENERIC_END -> >
          |           |--LPAREN -> (
          |           |--ELIST -> ELIST
          |           |--RPAREN -> )
          |           `--OBJBLOCK -> OBJBLOCK
          |               |--LCURLY -> {
          |               |--METHOD_DEF -> METHOD_DEF
          |               |   |--MODIFIERS -> MODIFIERS
          |               |   |   |--ANNOTATION -> ANNOTATION
          |               |   |   |   |--AT -> @
          |               |   |   |   `--IDENT -> Override
          |               |   |   `--LITERAL_PUBLIC -> public
          |               |   |--TYPE -> TYPE
          |               |   |   `--IDENT -> Integer
          |               |   |--IDENT -> get
          |               |   |--LPAREN -> (
          |               |   |--PARAMETERS -> PARAMETERS
          |               |   |--RPAREN -> )
          |               |   `--SLIST -> {
          |               |       |--LITERAL_RETURN -> return
          |               |       |   |--EXPR -> EXPR
          |               |       |   |   `--NUM_INT -> 42
          |               |       |   `--SEMI -> ;
          |               |       `--RCURLY -> }
          |               `--RCURLY -> }
          `--SEMI -> ;
         
        See Also:
        IDENT, DOT, LPAREN, ELIST, RPAREN, OBJBLOCK, ARRAY_INIT, FullIdent, Constant Field Values
      • STRING_LITERAL

        public static final int STRING_LITERAL
        A string literal. This is a sequence of (possibly escaped) characters enclosed in double quotes.

        For example:

        String str = "StringLiteral";

        parses as:

          |--VARIABLE_DEF -> VARIABLE_DEF
          |   |--MODIFIERS -> MODIFIERS
          |   |--TYPE -> TYPE
          |   |   `--IDENT -> String
          |   |--IDENT -> str
          |   `--ASSIGN -> =
          |       `--EXPR -> EXPR
          |           `--STRING_LITERAL -> "StringLiteral"
          |--SEMI -> ;
         
        See Also:
        Java Language Specification, §3.10.5, EXPR, Constant Field Values
      • LITERAL_ASSERT

        public static final int LITERAL_ASSERT
        The assert keyword. This is only for Java 1.4 and later.

        For example:

         assert(x==4);
         

        parses as:

         LITERAL_ASSERT -> assert
          |--EXPR -> EXPR
          |   |--LPAREN -> (
          |   |--EQUAL -> ==
          |   |   |--IDENT -> x
          |   |   `--NUM_INT -> 4
          |   `--RPAREN -> )
          `--SEMI -> ;
         
        See Also:
        Constant Field Values
      • STATIC_IMPORT

        public static final int STATIC_IMPORT
        A static import declaration. Static import declarations are optional, but must appear after the package declaration and before the type declaration.

        For example:

         import static java.io.IOException;
         

        parses as:

         STATIC_IMPORT -> import
         |--LITERAL_STATIC -> static
         |--DOT -> .
         |   |--DOT -> .
         |   |   |--IDENT -> java
         |   |   `--IDENT -> io
         |   `--IDENT -> IOException
         `--SEMI -> ;
         
        See Also:
        JSR201, LITERAL_STATIC, DOT, IDENT, STAR, SEMI, FullIdent, Constant Field Values
      • ENUM_DEF

        public static final int ENUM_DEF
        An enum declaration. Its notable children are enum constant declarations followed by any construct that may be expected in a class body.

        For example:

         public enum MyEnum
           implements Serializable
         {
             FIRST_CONSTANT,
             SECOND_CONSTANT;
        
             public void someMethod()
             {
             }
         }
         

        parses as:

         ENUM_DEF -> ENUM_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--ENUM -> enum
          |--IDENT -> MyEnum
          |--IMPLEMENTS_CLAUSE -> implements
          |   `--IDENT -> Serializable
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              |--ENUM_CONSTANT_DEF -> ENUM_CONSTANT_DEF
              |   |--ANNOTATIONS -> ANNOTATIONS
              |   `--IDENT -> FIRST_CONSTANT
              |--COMMA -> ,
              |--ENUM_CONSTANT_DEF -> ENUM_CONSTANT_DEF
              |   |--ANNOTATIONS -> ANNOTATIONS
              |   `--IDENT -> SECOND_CONSTANT
              |--SEMI -> ;
              |--METHOD_DEF -> METHOD_DEF
              |   |--MODIFIERS -> MODIFIERS
              |   |   `--LITERAL_PUBLIC -> public
              |   |--TYPE -> TYPE
              |   |   `--LITERAL_VOID -> void
              |   |--IDENT -> someMethod
              |   |--LPAREN -> (
              |   |--PARAMETERS -> PARAMETERS
              |   |--RPAREN -> )
              |   `--SLIST -> {
              |       `--RCURLY -> }
              `--RCURLY -> }
         
        See Also:
        JSR201, MODIFIERS, ENUM, IDENT, EXTENDS_CLAUSE, IMPLEMENTS_CLAUSE, OBJBLOCK, LITERAL_NEW, ENUM_CONSTANT_DEF, Constant Field Values
      • ENUM

        public static final int ENUM
        The enum keyword. This element appears as part of an enum declaration.

        For example:

         public enum Count {}
         

        parses as:

         ENUM_DEF -> ENUM_DEF
          |--MODIFIERS -> MODIFIERS
          |  `--LITERAL_PUBLIC -> public
          |--ENUM -> enum
          |--IDENT -> Count
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              `--RCURLY -> }
         
        See Also:
        JSR201, MODIFIERS, ENUM_DEF, IDENT, OBJBLOCK, Constant Field Values
      • ENUM_CONSTANT_DEF

        public static final int ENUM_CONSTANT_DEF
        An enum constant declaration. Its notable children are annotations, arguments and object block akin to an anonymous inner class' body.

        For example:

         SOME_CONSTANT(1)
         {
             public void someMethodOverriddenFromMainBody()
             {
             }
         }
         

        parses as:

         ENUM_CONSTANT_DEF -> ENUM_CONSTANT_DEF
           |   |--ANNOTATIONS -> ANNOTATIONS
           |   |--IDENT -> SOME_CONSTANT
           |   |--LPAREN -> (
           |   |--ELIST -> ELIST
           |   |   `--EXPR -> EXPR
           |   |       `--NUM_INT -> 1
           |   |--RPAREN -> )
           |   `--OBJBLOCK -> OBJBLOCK
           |       |--LCURLY -> {
           |       |--METHOD_DEF -> METHOD_DEF
           |       |   |--MODIFIERS -> MODIFIERS
           |       |   |   `--LITERAL_PUBLIC -> public
           |       |   |--TYPE -> TYPE
           |       |   |   `--LITERAL_VOID -> void
           |       |   |--IDENT -> someMethodOverriddenFromMainBody
           |       |   |--LPAREN -> (
           |       |   |--PARAMETERS -> PARAMETERS
           |       |   |--RPAREN -> )
           |       |   `--SLIST -> {
           |       |       `--RCURLY -> }
           |       `--RCURLY -> }
         
        See Also:
        JSR201, ANNOTATIONS, MODIFIERS, IDENT, ELIST, OBJBLOCK, Constant Field Values
      • FOR_EACH_CLAUSE

        public static final int FOR_EACH_CLAUSE
        A for-each clause. This is a child of LITERAL_FOR. The children of this element may be a parameter definition, the colon literal and an expression.

        For example:

         for (int value : values) {
             doSmth();
         }
         

        parses as:

         LITERAL_FOR -> for
          |--LPAREN -> (
          |--FOR_EACH_CLAUSE -> FOR_EACH_CLAUSE
          |   |--VARIABLE_DEF -> VARIABLE_DEF
          |   |   |--MODIFIERS -> MODIFIERS
          |   |   |--TYPE -> TYPE
          |   |   |   `--LITERAL_INT -> int
          |   |   `--IDENT -> value
          |   |--COLON -> :
          |   `--EXPR -> EXPR
          |       `--IDENT -> values
          |--RPAREN -> )
          `--SLIST -> {
              |--EXPR -> EXPR
              |   `--METHOD_CALL -> (
              |       |--IDENT -> doSmth
              |       |--ELIST -> ELIST
              |       `--RPAREN -> )
              |--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        VARIABLE_DEF, ELIST, LITERAL_FOR, Constant Field Values
      • ANNOTATION_DEF

        public static final int ANNOTATION_DEF
        An annotation declaration. The notable children are the name of the annotation type, annotation field declarations and (constant) fields.

        For example:

         public @interface MyAnnotation
         {
             int someValue();
         }
         

        parses as:

         ANNOTATION_DEF -> ANNOTATION_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--AT -> @
          |--LITERAL_INTERFACE -> interface
          |--IDENT -> MyAnnotation
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              |--ANNOTATION_FIELD_DEF -> ANNOTATION_FIELD_DEF
              |   |--MODIFIERS -> MODIFIERS
              |   |--TYPE -> TYPE
              |   |   `--LITERAL_INT -> int
              |   |--IDENT -> someValue
              |   |--LPAREN -> (
              |   |--RPAREN -> )
              |   `--SEMI -> ;
              `--RCURLY -> }
         
        See Also:
        JSR201, MODIFIERS, LITERAL_INTERFACE, IDENT, OBJBLOCK, ANNOTATION_FIELD_DEF, Constant Field Values
      • ANNOTATION_FIELD_DEF

        public static final int ANNOTATION_FIELD_DEF
        An annotation field declaration. The notable children are modifiers, field type, field name and an optional default value (a conditional compile-time constant expression). Default values may also be annotations.

        For example:

             String someField() default "Hello world";
         

        parses as:

         ANNOTATION_FIELD_DEF -> ANNOTATION_FIELD_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   `--IDENT -> String
          |--IDENT -> someField
          |--LPAREN -> (
          |--RPAREN -> )
          |--LITERAL_DEFAULT -> default
          |   `--EXPR -> EXPR
          |       `--STRING_LITERAL -> "Hello world"
          `--SEMI -> ;
         
        See Also:
        JSR201, MODIFIERS, TYPE, LITERAL_DEFAULT, Constant Field Values
      • ANNOTATIONS

        public static final int ANNOTATIONS
        A collection of annotations on a package or enum constant. A collections of annotations will only occur on these nodes as all other nodes that may be qualified with an annotation can be qualified with any other modifier and hence these annotations would be contained in a MODIFIERS node.

        For example:

             @MyAnnotation package blah;
         

        parses as:

         PACKAGE_DEF -> package
          |--ANNOTATIONS -> ANNOTATIONS
          |   `--ANNOTATION -> ANNOTATION
          |       |--AT -> @
          |       `--IDENT -> MyAnnotation
          |--IDENT -> blah
          `--SEMI -> ;
         
        See Also:
        JSR201, ANNOTATION, AT, IDENT, Constant Field Values
      • ANNOTATION

        public static final int ANNOTATION
        An annotation of a package, type, field, parameter or variable. An annotation may occur anywhere modifiers occur (it is a type of modifier) and may also occur prior to a package definition. The notable children are: The annotation name and either a single default annotation value or a sequence of name value pairs. Annotation values may also be annotations themselves.

        For example:

             @MyAnnotation(someField1 = "Hello",
                            someField2 = @SomeOtherAnnotation)
         

        parses as:

         ANNOTATION -> ANNOTATION
          |--AT -> @
          |--IDENT -> MyAnnotation
          |--LPAREN -> (
          |--ANNOTATION_MEMBER_VALUE_PAIR -> ANNOTATION_MEMBER_VALUE_PAIR
          |   |--IDENT -> someField1
          |   |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--STRING_LITERAL -> "Hello"
          |--COMMA -> ,
          |--ANNOTATION_MEMBER_VALUE_PAIR -> ANNOTATION_MEMBER_VALUE_PAIR
          |   |--IDENT -> someField2
          |   |--ASSIGN -> =
          |   `--ANNOTATION -> ANNOTATION
          |       |--AT -> @
          |       `--IDENT -> SomeOtherAnnotation
          `--RPAREN -> )
         
        See Also:
        JSR201, MODIFIERS, IDENT, ANNOTATION_MEMBER_VALUE_PAIR, Constant Field Values
      • ANNOTATION_MEMBER_VALUE_PAIR

        public static final int ANNOTATION_MEMBER_VALUE_PAIR
        An initialization of an annotation member with a value. Its children are the name of the member, the assignment literal and the (compile-time constant conditional expression) value.

        For example:

         @Annotation(
             value="123"
         )
         

        parses as:

         ANNOTATION -> ANNOTATION
          |--AT -> @
          |--IDENT -> Annotation
          |--LPAREN -> (
          |--ANNOTATION_MEMBER_VALUE_PAIR -> ANNOTATION_MEMBER_VALUE_PAIR
          |   |--IDENT -> value
          |   |--ASSIGN -> =
          |   `--EXPR -> EXPR
          |       `--STRING_LITERAL -> "123"
          `--RPAREN -> )
         
        See Also:
        JSR201, ANNOTATION, IDENT, Constant Field Values
      • ANNOTATION_ARRAY_INIT

        public static final int ANNOTATION_ARRAY_INIT
        An annotation array member initialization. Initializers can not be nested. An initializer may be present as a default to an annotation member, as the single default value to an annotation (e.g. @Annotation({1,2})) or as the value of an annotation member value pair.

        For example:

         @Annotation({1, 2})
         

        parses as:

         ANNOTATION -> ANNOTATION
          |--AT -> @
          |--IDENT -> Annotation
          |--LPAREN -> (
          |--ANNOTATION_ARRAY_INIT -> {
          |   |--EXPR -> EXPR
          |   |   `--NUM_INT -> 1
          |   |--COMMA -> ,
          |   |--EXPR -> EXPR
          |   |   `--NUM_INT -> 2
          |   `--RCURLY -> }
          `--RPAREN -> )
         
        See Also:
        JSR201, ANNOTATION, IDENT, ANNOTATION_MEMBER_VALUE_PAIR, Constant Field Values
      • TYPE_PARAMETERS

        public static final int TYPE_PARAMETERS
        A list of type parameters to a class, interface or method definition. Children are LT, at least one TYPE_PARAMETER, zero or more of: a COMMAs followed by a single TYPE_PARAMETER and a final GT.

        For example:

         public class MyClass<A, B> {
        
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_CLASS -> class
         |--IDENT -> MyClass
         |--TYPE_PARAMETERS -> TYPE_PARAMETERS
         |   |--GENERIC_START -> <
         |   |--TYPE_PARAMETER -> TYPE_PARAMETER
         |   |   `--IDENT -> A
         |   |--COMMA -> ,
         |   |--TYPE_PARAMETER -> TYPE_PARAMETER
         |   |   `--IDENT -> B
         |   `--GENERIC_END -> >
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        See Also:
        Generic Classes and Type Parameters, GENERIC_START, GENERIC_END, TYPE_PARAMETER, COMMA, Constant Field Values
      • TYPE_PARAMETER

        public static final int TYPE_PARAMETER
        A type parameter to a class, interface or method definition. Children are the type name and an optional TYPE_UPPER_BOUNDS.

        For example:

         public class MyClass <A extends Collection> {
        
         }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_CLASS -> class
         |--IDENT -> MyClass
         |--TYPE_PARAMETERS -> TYPE_PARAMETERS
         |   |--GENERIC_START -> <
         |   |--TYPE_PARAMETER -> TYPE_PARAMETER
         |   |   |--IDENT -> A
         |   |   `--TYPE_UPPER_BOUNDS -> extends
         |   |       `--IDENT -> Collection
         |   `--GENERIC_END -> >
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        See Also:
        Generic Classes and Type Parameters, IDENT, WILDCARD_TYPE, TYPE_UPPER_BOUNDS, Constant Field Values
      • TYPE_ARGUMENTS

        public static final int TYPE_ARGUMENTS
        A list of type arguments to a type reference or a method/ctor invocation. Children are GENERIC_START, at least one TYPE_ARGUMENT, zero or more of a COMMAs followed by a single TYPE_ARGUMENT, and a final GENERIC_END.

        For example:

             public Collection<?> a;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--TYPE -> TYPE
          |   |--IDENT -> Collection
          |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |       |--GENERIC_START -> <
          |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |       |   `--WILDCARD_TYPE -> ?
          |       `--GENERIC_END -> >
          |--IDENT -> a
          `--SEMI -> ;
         
        See Also:
        GENERIC_START, GENERIC_END, TYPE_ARGUMENT, COMMA, Constant Field Values
      • TYPE_ARGUMENT

        public static final int TYPE_ARGUMENT
        A type arguments to a type reference or a method/ctor invocation. Children are either: type name or wildcard type with possible type upper or lower bounds.

        For example:

        List<? super List> list;

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--IDENT -> List
          |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |       |--GENERIC_START -> <
          |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |       |   |--WILDCARD_TYPE -> ?
          |       |   `--TYPE_LOWER_BOUNDS -> super
          |       |       `--IDENT -> List
          |       `--GENERIC_END -> >
          |--IDENT -> list
          `--SEMI -> ;
         
        See Also:
        Generic Classes and Type Parameters, WILDCARD_TYPE, TYPE_UPPER_BOUNDS, TYPE_LOWER_BOUNDS, Constant Field Values
      • TYPE_UPPER_BOUNDS

        public static final int TYPE_UPPER_BOUNDS
        An upper bounds on a wildcard type argument or type parameter. This node has one child - the type that is being used for the bounding.

        For example:

        List<? extends Number> list;

        parses as:

         --VARIABLE_DEF -> VARIABLE_DEF
          |--MODIFIERS -> MODIFIERS
          |--TYPE -> TYPE
          |   |--IDENT -> List
          |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
          |       |--GENERIC_START -> <
          |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
          |       |   |--WILDCARD_TYPE -> ?
          |       |   `--TYPE_UPPER_BOUNDS -> extends
          |       |       `--IDENT -> Number
          |       `--GENERIC_END -> >
          |--IDENT -> list
          `--SEMI -> ;
          
        See Also:
        Generic Classes and Type Parameters, TYPE_PARAMETER, TYPE_ARGUMENT, WILDCARD_TYPE, Constant Field Values
      • TYPE_LOWER_BOUNDS

        public static final int TYPE_LOWER_BOUNDS
        A lower bounds on a wildcard type argument. This node has one child - the type that is being used for the bounding.

        For example:

        List<? super Integer> list;

        parses as:

          --VARIABLE_DEF -> VARIABLE_DEF
             |--MODIFIERS -> MODIFIERS
             |--TYPE -> TYPE
             |   |--IDENT -> List
             |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
             |       |--GENERIC_START -> <
             |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
             |       |   |--WILDCARD_TYPE -> ?
             |       |   `--TYPE_LOWER_BOUNDS -> super
             |       |       `--IDENT -> Integer
             |       `--GENERIC_END -> >
             |--IDENT -> list
             `--SEMI -> ;
          
        See Also:
        Generic Classes and Type Parameters, TYPE_ARGUMENT, WILDCARD_TYPE, Constant Field Values
      • AT

        public static final int AT
        An @ symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.

        For example:

         @Deprecated
         private int value;
         

        parses as:

         VARIABLE_DEF -> VARIABLE_DEF
         |--MODIFIERS -> MODIFIERS
         |  |--ANNOTATION -> ANNOTATION
         |  |  |--AT -> @
         |  |  `--IDENT -> Deprecated
         |  `--LITERAL_PRIVATE -> private
         |--TYPE -> TYPE
         |  `--LITERAL_INT -> int
         |--IDENT -> value
         `--SEMI -> ;
         
        See Also:
        JSR201, Constant Field Values
      • ELLIPSIS

        public static final int ELLIPSIS
        A triple dot for variable-length parameters. This token only ever occurs in a parameter declaration immediately after the type of the parameter.

        For example:

          public void myShape(int... dimension) {
        
          }
         

        parses as:

         METHOD_DEF -> METHOD_DEF
           |--MODIFIERS -> MODIFIERS
           |   `--LITERAL_PUBLIC -> public
           |--TYPE -> TYPE
           |   `--LITERAL_VOID -> void
           |--IDENT -> myShape
           |--LPAREN -> (
           |--PARAMETERS -> PARAMETERS
           |   `--PARAMETER_DEF -> PARAMETER_DEF
           |       |--MODIFIERS -> MODIFIERS
           |       |--TYPE -> TYPE
           |       |   `--LITERAL_INT -> int
           |       |--ELLIPSIS -> ...
           |       `--IDENT -> dimension
           |--RPAREN -> )
           `--SLIST -> {
               `--RCURLY -> }
         
        See Also:
        JSR201, Constant Field Values
      • TYPE_EXTENSION_AND

        public static final int TYPE_EXTENSION_AND
        The & symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.

        Generic type bounds extension: class Comparable<T extends Serializable & CharSequence>

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |--LITERAL_CLASS -> class
         |--IDENT -> Comparable
         |--TYPE_PARAMETERS -> TYPE_PARAMETERS
             |--GENERIC_START -> <
             |--TYPE_PARAMETER -> TYPE_PARAMETER
             |   |--IDENT -> T
             |   `--TYPE_UPPER_BOUNDS -> extends
             |       |--IDENT -> Serializable
             |       |--TYPE_EXTENSION_AND -> &
             |       `--IDENT -> CharSequence
             `--GENERIC_END -> >
         

        Type cast extension: return (Serializable & CharSequence) null;

         --LITERAL_RETURN -> return
            |--EXPR -> EXPR
            |   `--TYPECAST -> (
            |       |--TYPE -> TYPE
            |       |   `--IDENT -> Serializable
            |       |--TYPE_EXTENSION_AND -> &
            |       |--TYPE -> TYPE
            |       |   `--IDENT -> CharSequence
            |       |--RPAREN -> )
            |       `--LITERAL_NULL -> null
            `--SEMI -> ;
         
        See Also:
        EXTENDS_CLAUSE, TYPECAST, Java Language Specification, §4.4, Java Language Specification, §15.16, Constant Field Values
      • GENERIC_START

        public static final int GENERIC_START
        A < symbol signifying the start of type arguments or type parameters.

        For example:

         class Test<T> {}
         

        parses as:

         CLASS_DEF -> CLASS_DEF
          |--MODIFIERS -> MODIFIERS
          |--LITERAL_CLASS -> class
          |--IDENT -> Test
          |--TYPE_PARAMETERS -> TYPE_PARAMETERS
          |   |--GENERIC_START -> <
          |   |--TYPE_PARAMETER -> TYPE_PARAMETER
          |   |   `--IDENT -> T
          |   `--GENERIC_END -> >
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              `--RCURLY -> }
         
        See Also:
        MODIFIERS, IDENT, OBJBLOCK, TYPE_PARAMETERS, GENERIC_END, Constant Field Values
      • GENERIC_END

        public static final int GENERIC_END
        A > symbol signifying the end of type arguments or type parameters.

        For example:

         class Test<T> {}
         

        parses as:

         CLASS_DEF -> CLASS_DEF
          |--MODIFIERS -> MODIFIERS
          |--LITERAL_CLASS -> class
          |--IDENT -> Test
          |--TYPE_PARAMETERS -> TYPE_PARAMETERS
          |   |--GENERIC_START -> <
          |   |--TYPE_PARAMETER -> TYPE_PARAMETER
          |   |   `--IDENT -> T
          |   `--GENERIC_END -> >
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              `--RCURLY -> }
         
        See Also:
        MODIFIERS, IDENT, OBJBLOCK, TYPE_PARAMETERS, GENERIC_START, Constant Field Values
      • LAMBDA

        public static final int LAMBDA
        Special lambda symbol ->.

        For example:

         numbers.forEach((n) -> System.out.println(n));
         

        parses as:

         METHOD_CALL -> (
          |--DOT -> .
          |   |--IDENT -> numbers
          |   `--IDENT -> forEach
          |--ELIST -> ELIST
          |   `--LAMBDA -> ->
          |       |--LPAREN -> (
          |       |--PARAMETERS -> PARAMETERS
          |       |   `--PARAMETER_DEF -> PARAMETER_DEF
          |       |       |--MODIFIERS -> MODIFIERS
          |       |       |--TYPE -> TYPE
          |       |       `--IDENT -> n
          |       |--RPAREN -> )
          |       `--EXPR -> EXPR
          |           `--METHOD_CALL -> (
          |               |--DOT -> .
          |               |   |--DOT -> .
          |               |   |   |--IDENT -> System
          |               |   |   `--IDENT -> out
          |               |   `--IDENT -> println
          |               |--ELIST -> ELIST
          |               |   `--EXPR -> EXPR
          |               |       `--IDENT -> n
          |               `--RPAREN -> )
          `--RPAREN -> )
         
        See Also:
        Constant Field Values
      • SINGLE_LINE_COMMENT

        public static final int SINGLE_LINE_COMMENT
        Beginning of single-line comment: '//'.
         SINGLE_LINE_COMMENT -> //
          `--COMMENT_CONTENT -> \r\n
         

        For example:

         // Comment content
         

        parses as:

         SINGLE_LINE_COMMENT -> //
          `--COMMENT_CONTENT ->  Comment Content\n
         
        See Also:
        Constant Field Values
      • BLOCK_COMMENT_BEGIN

        public static final int BLOCK_COMMENT_BEGIN
        Beginning of block comment: '/*'.

        For example:

         /* Comment content
         */
         

        parses as:

         --BLOCK_COMMENT_BEGIN -> /*
            |--COMMENT_CONTENT ->  Comment content\r\n
            `--BLOCK_COMMENT_END -> */
         
        See Also:
        Constant Field Values
      • BLOCK_COMMENT_END

        public static final int BLOCK_COMMENT_END
        End of block comment: '*/'.

        For example:

         /*comment*/
         

        parses as:

         BLOCK_COMMENT_BEGIN -> /*
          |--COMMENT_CONTENT -> comment
          `--BLOCK_COMMENT_END -> */
         
        See Also:
        Constant Field Values
      • COMMENT_CONTENT

        public static final int COMMENT_CONTENT
        Text of single-line or block comment.

        For example:

         //this is single-line comment
        
         /*
         this is multiline comment
         */
         

        parses as:

         |--SINGLE_LINE_COMMENT -> //
         |   `--COMMENT_CONTENT -> this is single-line comment\n
         |--BLOCK_COMMENT_BEGIN -> /*
         |   |--COMMENT_CONTENT -> \n\t\t\tthis is multiline comment\n\t\t
         |   `--BLOCK_COMMENT_END -> */
         
        See Also:
        Constant Field Values
      • PATTERN_VARIABLE_DEF

        public static final int PATTERN_VARIABLE_DEF
        A pattern variable definition; when conditionally matched, this variable is assigned with the defined type.

        For example:

         if (obj instanceof String str) { }
         

        parses as:

         LITERAL_IF -> if
          |--LPAREN -> (
          |--EXPR -> EXPR
          |   `--LITERAL_INSTANCEOF -> instanceof
          |       |--IDENT -> obj
          |       `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
          |           |--TYPE -> TYPE
          |           |   `--IDENT -> String
          |           `--IDENT -> str
          |--RPAREN -> )
          `--SLIST -> {
              `--RCURLY -> }
         
        Since:
        8.35
        See Also:
        LITERAL_INSTANCEOF, Constant Field Values
      • LITERAL_RECORD

        public static final int LITERAL_RECORD
        The record keyword. This element appears as part of a record declaration.

        For example:

         public record MyRecord () {
        
         }
         

        parses as:

         RECORD_DEF -> RECORD_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_RECORD -> record
         |--IDENT -> MyRecord
         |--LPAREN -> (
         |--RECORD_COMPONENTS -> RECORD_COMPONENTS
         |--RPAREN -> )
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.35
        See Also:
        Constant Field Values
      • RECORD_DEF

        public static final int RECORD_DEF
        A declaration of a record specifies a name, a header, and a body. The header lists the components of the record, which are the variables that make up its state.

        For example:

         public record MyRecord () {
        
         }
         

        parses as:

         RECORD_DEF -> RECORD_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_RECORD -> record
         |--IDENT -> MyRecord
         |--LPAREN -> (
         |--RECORD_COMPONENTS -> RECORD_COMPONENTS
         |--RPAREN -> )
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.35
        See Also:
        Constant Field Values
      • RECORD_COMPONENTS

        public static final int RECORD_COMPONENTS
        Record components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.

        For example:

         public record myRecord (Comp x, Comp y) { }
         

        parses as:

         RECORD_DEF -> RECORD_DEF
          |--MODIFIERS -> MODIFIERS
          |   `--LITERAL_PUBLIC -> public
          |--LITERAL_RECORD -> record
          |--IDENT -> myRecord
          |--LPAREN -> (
          |--RECORD_COMPONENTS -> RECORD_COMPONENTS
          |   |--RECORD_COMPONENT_DEF -> RECORD_COMPONENT_DEF
          |   |   |--ANNOTATIONS -> ANNOTATIONS
          |   |   |--TYPE -> TYPE
          |   |   |   `--IDENT -> Comp
          |   |   `--IDENT -> x
          |   |--COMMA -> ,
          |   `--RECORD_COMPONENT_DEF -> RECORD_COMPONENT_DEF
          |       |--ANNOTATIONS -> ANNOTATIONS
          |       |--TYPE -> TYPE
          |       |   `--IDENT -> Comp
          |       `--IDENT -> y
          |--RPAREN -> )
          `--OBJBLOCK -> OBJBLOCK
              |--LCURLY -> {
              `--RCURLY -> }
         
        Since:
        8.36
        See Also:
        Constant Field Values
      • RECORD_COMPONENT_DEF

        public static final int RECORD_COMPONENT_DEF
        A record component is a variable that comprises the state of a record. Record components have annotations (possibly), a type definition, and an identifier. They can also be of variable arity ('...').

        For example:

         public record MyRecord(Comp x, Comp... comps) {
        
         }
         

        parses as:

         RECORD_DEF -> RECORD_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_PUBLIC -> public
         |--LITERAL_RECORD -> record
         |--IDENT -> MyRecord
         |--LPAREN -> (
         |--RECORD_COMPONENTS -> RECORD_COMPONENTS
         |   |--RECORD_COMPONENT_DEF -> RECORD_COMPONENT_DEF
         |   |   |--ANNOTATIONS -> ANNOTATIONS
         |   |   |--TYPE -> TYPE
         |   |   |   `--IDENT -> Comp
         |   |   `--IDENT -> x
         |   |--COMMA -> ,
         |   `--RECORD_COMPONENT_DEF -> RECORD_COMPONENT_DEF
         |       |--ANNOTATIONS -> ANNOTATIONS
         |       |--TYPE -> TYPE
         |       |   `--IDENT -> Comp
         |       |--ELLIPSIS -> ...
         |       `--IDENT -> comps
         |--RPAREN -> )
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.36
        See Also:
        Constant Field Values
      • COMPACT_CTOR_DEF

        public static final int COMPACT_CTOR_DEF
        A compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.

        For example:

         public record myRecord () {
             public myRecord{}
         }
         

        parses as:

         RECORD_DEF
         |--MODIFIERS
         |   `--LITERAL_PUBLIC (public)
         |--LITERAL_RECORD (record)
         |--IDENT (myRecord)
         |--LPAREN (()
         |--RECORD_COMPONENTS
         |--RPAREN ())
         `--OBJBLOCK
             |--LCURLY ({)
             |--COMPACT_CTOR_DEF
             |   |--MODIFIERS
             |   |   `--LITERAL_PUBLIC (public)
             |   |--IDENT (myRecord)
             |   `--SLIST ({)
             |       `--RCURLY (})
             `--RCURLY (})
         
        Since:
        8.36
        See Also:
        Constant Field Values
      • TEXT_BLOCK_LITERAL_BEGIN

        public static final int TEXT_BLOCK_LITERAL_BEGIN
        Text blocks are a new feature added to to Java SE 15 and later that will make writing multi-line strings much easier and cleaner. Beginning of a Java 15 Text Block literal, delimited by three double quotes.

        For example:

                 String hello = """
                         Hello, world!
                         """;
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--IDENT -> String
         |   |--IDENT -> hello
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--TEXT_BLOCK_LITERAL_BEGIN -> """
         |               |--TEXT_BLOCK_CONTENT -> \n                Hello, world!\n
         |               `--TEXT_BLOCK_LITERAL_END -> """
         `--SEMI -> ;
         
        Since:
        8.36
        See Also:
        Constant Field Values
      • TEXT_BLOCK_CONTENT

        public static final int TEXT_BLOCK_CONTENT
        Content of a Java 15 text block. This is a sequence of characters, possibly escaped with '\'. Actual line terminators are represented by '\n'.

        For example:

                 String hello = """
                         Hello, world!
                         """;
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--IDENT -> String
         |   |--IDENT -> hello
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--TEXT_BLOCK_LITERAL_BEGIN -> """
         |               |--TEXT_BLOCK_CONTENT -> \n                Hello, world!\n
         |               `--TEXT_BLOCK_LITERAL_END -> """
         `--SEMI -> ;
         
        Since:
        8.36
        See Also:
        Constant Field Values
      • TEXT_BLOCK_LITERAL_END

        public static final int TEXT_BLOCK_LITERAL_END
        End of a Java 15 text block literal, delimited by three double quotes.

        For example:

                 String hello = """
                         Hello, world!
                         """;
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--IDENT -> String
         |   |--IDENT -> hello
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--TEXT_BLOCK_LITERAL_BEGIN -> """
         |               |--TEXT_BLOCK_CONTENT -> \n                Hello, world!\n
         |               `--TEXT_BLOCK_LITERAL_END -> """
         `--SEMI -> ;
         
        Since:
        8.36
        See Also:
        Constant Field Values
      • LITERAL_YIELD

        public static final int LITERAL_YIELD
        The yield keyword. This element appears as part of a yield statement.

        For example:

         int yield = 0; // not a keyword here
         return switch (mode) {
            case "a", "b":
                yield 1;
            default:
                yield - 1;
         };
         

        parses as:

         |--VARIABLE_DEF -> VARIABLE_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--TYPE -> TYPE
         |   |   `--LITERAL_INT -> int
         |   |--IDENT -> yield
         |   `--ASSIGN -> =
         |       `--EXPR -> EXPR
         |           `--NUM_INT -> 0
         |--SEMI -> ;
         |--LITERAL_RETURN -> return
         |   |--EXPR -> EXPR
         |   |   `--LITERAL_SWITCH -> switch
         |   |       |--LPAREN -> (
         |   |       |--EXPR -> EXPR
         |   |       |   `--IDENT -> mode
         |   |       |--RPAREN -> )
         |   |       |--LCURLY -> {
         |   |       |--CASE_GROUP -> CASE_GROUP
         |   |       |   |--LITERAL_CASE -> case
         |   |       |   |   |--EXPR -> EXPR
         |   |       |   |   |   `--STRING_LITERAL -> "a"
         |   |       |   |   |--COMMA -> ,
         |   |       |   |   |--EXPR -> EXPR
         |   |       |   |   |   `--STRING_LITERAL -> "b"
         |   |       |   |   `--COLON -> :
         |   |       |   `--SLIST -> SLIST
         |   |       |       `--LITERAL_YIELD -> yield
         |   |       |           |--EXPR -> EXPR
         |   |       |           |   `--NUM_INT -> 1
         |   |       |           `--SEMI -> ;
         |   |       |--CASE_GROUP -> CASE_GROUP
         |   |       |   |--LITERAL_DEFAULT -> default
         |   |       |   |   `--COLON -> :
         |   |       |   `--SLIST -> SLIST
         |   |       |       `--LITERAL_YIELD -> yield
         |   |       |           |--EXPR -> EXPR
         |   |       |           |   `--UNARY_MINUS -> -
         |   |       |           |       `--NUM_INT -> 1
         |   |       |           `--SEMI -> ;
         |   |       `--RCURLY -> }
         |   `--SEMI -> ;
         
        Since:
        8.36
        See Also:
        LITERAL_SWITCH, CASE_GROUP, SLIST, SWITCH_RULE, Java Language Specification, §14.21, Constant Field Values
      • SWITCH_RULE

        public static final int SWITCH_RULE
        Switch Expressions.

        For example:

         return switch (day) {
             case SAT, SUN -> "Weekend";
             default -> "Working day";
         };
         

        parses as:

         LITERAL_RETURN -> return
          |--EXPR -> EXPR
          |   `--LITERAL_SWITCH -> switch
          |       |--LPAREN -> (
          |       |--EXPR -> EXPR
          |       |   `--IDENT -> day
          |       |--RPAREN -> )
          |       |--LCURLY -> {
          |       |--SWITCH_RULE -> SWITCH_RULE
          |       |   |--LITERAL_CASE -> case
          |       |   |   |--EXPR -> EXPR
          |       |   |   |   `--IDENT -> SAT
          |       |   |   |--COMMA -> ,
          |       |   |   `--EXPR -> EXPR
          |       |   |       `--IDENT -> SUN
          |       |   |--LAMBDA -> ->
          |       |   |--EXPR -> EXPR
          |       |   |   `--STRING_LITERAL -> "Weekend"
          |       |   `--SEMI -> ;
          |       |--SWITCH_RULE -> SWITCH_RULE
          |       |   |--LITERAL_DEFAULT -> default
          |       |   |--LAMBDA -> ->
          |       |   |--EXPR -> EXPR
          |       |   |   `--STRING_LITERAL -> "Working day"
          |       |   `--SEMI -> ;
          |       `--RCURLY -> }
          `--SEMI -> ;
         
        Since:
        8.36
        See Also:
        LITERAL_CASE, LITERAL_DEFAULT, LITERAL_SWITCH, LITERAL_YIELD, Java Language Specification, §14.21, Constant Field Values
      • LITERAL_NON_SEALED

        public static final int LITERAL_NON_SEALED
        The non-sealed keyword. This element appears as part of a class or interface declaration.

        For example:

         non-sealed class Square extends Rectangle { }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   `--LITERAL_NON_SEALED -> non-sealed
         |--LITERAL_CLASS -> class
         |--IDENT -> Square
         |--EXTENDS_CLAUSE -> extends
         |   `--IDENT -> Rectangle
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.42
        See Also:
        Java Language Specification, §8.1.1.2, MODIFIERS, Constant Field Values
      • LITERAL_SEALED

        public static final int LITERAL_SEALED
        The sealed restricted identifier. This element appears as part of a class or interface declaration.

        For example:

         public sealed class Shape permits Circle, Square, Rectangle { }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_PUBLIC -> public
         |   `--LITERAL_SEALED -> sealed
         |--LITERAL_CLASS -> class
         |--IDENT -> Shape
         |--PERMITS_CLAUSE -> permits
         |   |--IDENT -> Circle
         |   |--COMMA -> ,
         |   |--IDENT -> Square
         |   |--COMMA -> ,
         |   `--IDENT -> Rectangle
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.42
        See Also:
        Java Language Specification, §8.1.1.2, MODIFIERS, Constant Field Values
      • LITERAL_PERMITS

        public static final int LITERAL_PERMITS
        The permits restricted identifier. This element appears as part of a class or interface declaration.

        For example:

         public sealed class Shape permits Circle, Square, Rectangle { }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_PUBLIC -> public
         |   `--LITERAL_SEALED -> sealed
         |--LITERAL_CLASS -> class
         |--IDENT -> Shape
         |--PERMITS_CLAUSE -> permits
         |   |--IDENT -> Circle
         |   |--COMMA -> ,
         |   |--IDENT -> Square
         |   |--COMMA -> ,
         |   `--IDENT -> Rectangle
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.42
        See Also:
        Java Language Specification, §9.1.4, MODIFIERS, Constant Field Values
      • PERMITS_CLAUSE

        public static final int PERMITS_CLAUSE
        A permits clause. A permits clause's children are a comma separated list of one or more identifiers.

        For example:

         public sealed class Shape permits Circle, Square, Rectangle { }
         

        parses as:

         CLASS_DEF -> CLASS_DEF
         |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_PUBLIC -> public
         |   `--LITERAL_SEALED -> sealed
         |--LITERAL_CLASS -> class
         |--IDENT -> Shape
         |--PERMITS_CLAUSE -> permits
         |   |--IDENT -> Circle
         |   |--COMMA -> ,
         |   |--IDENT -> Square
         |   |--COMMA -> ,
         |   `--IDENT -> Rectangle
         `--OBJBLOCK -> OBJBLOCK
             |--LCURLY -> {
             `--RCURLY -> }
         
        Since:
        8.42
        See Also:
        Java Language Specification, §9.1.4, MODIFIERS, CLASS_DEF, INTERFACE_DEF, COMMA, IDENT, Constant Field Values
      • PATTERN_DEF

        public static final int PATTERN_DEF
        A pattern definition, excluding simple type pattern (pattern variable) definition such as if (o instanceof Integer i){}. Pattern definitions appear as operands of statements and expressions.

        For example:

         switch(o) {
             case String s when s.length() > 4: // guarded pattern, `PATTERN_DEF`
                 break;
             case String s: // type pattern, no `PATTERN_DEF`
                 break;
         }
         

        parses as:

         LITERAL_SWITCH -> switch
         |   |--LPAREN -> (
         |   |--EXPR -> EXPR
         |   |   `--IDENT -> o
         |   |--RPAREN -> )
         |   |--LCURLY -> {
         |   |--CASE_GROUP -> CASE_GROUP
         |   |   |--LITERAL_CASE -> case
         |   |   |   |--PATTERN_DEF -> PATTERN_DEF
         |   |   |   |   `--LITERAL_WHEN -> when
         |   |   |   |       |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |   |   |   |       |   |--MODIFIERS -> MODIFIERS
         |   |   |   |       |   |--TYPE -> TYPE
         |   |   |   |       |   |   `--IDENT -> String
         |   |   |   |       |   `--IDENT -> s
         |   |   |   |       `--GT -> >
         |   |   |   |           |--METHOD_CALL -> (
         |   |   |   |           |   |--DOT -> .
         |   |   |   |           |   |   |--IDENT -> s
         |   |   |   |           |   |   `--IDENT -> length
         |   |   |   |           |   |--ELIST -> ELIST
         |   |   |   |           |   `--RPAREN -> )
         |   |   |   |           `--NUM_INT -> 4
         |   |   |   `--COLON -> :
         |   |   `--SLIST -> SLIST
         |   |       `--LITERAL_BREAK -> break
         |   |           `--SEMI -> ;
         |   |--CASE_GROUP -> CASE_GROUP
         |   |   |--LITERAL_CASE -> case
         |   |   |   |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |   |   |   |   |--MODIFIERS -> MODIFIERS
         |   |   |   |   |--TYPE -> TYPE
         |   |   |   |   |   `--IDENT -> String
         |   |   |   |   `--IDENT -> s
         |   |   |   `--COLON -> :
         |   |   `--SLIST -> SLIST
         |   |       `--LITERAL_BREAK -> break
         |   |           `--SEMI -> ;
         |   `--RCURLY -> }
         `--RCURLY -> }
         
        Since:
        9.3
        See Also:
        Java Language Specification, §14.30, LITERAL_SWITCH, PATTERN_VARIABLE_DEF, LITERAL_INSTANCEOF, Constant Field Values
      • LITERAL_WHEN

        public static final int LITERAL_WHEN
        A when clause. Appears as part of a switch label in a guarded pattern definition.

        For example:

         return switch (o) {
             case Integer i when i >= 0 -> i;
             default -> 2;
         };
         

        parses as:

         LITERAL_RETURN -> return
          `--EXPR -> EXPR
              `--LITERAL_SWITCH -> switch
                  |--LPAREN -> (
                  |--EXPR -> EXPR
                  |   `--IDENT -> o
                  |--RPAREN -> )
                  |--LCURLY -> {
                  |--SWITCH_RULE -> SWITCH_RULE
                  |   |--LITERAL_CASE -> case
                  |   |   `--PATTERN_DEF -> PATTERN_DEF
                  |   |       `--LITERAL_WHEN -> when
                  |   |           |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
                  |   |           |   |--MODIFIERS -> MODIFIERS
                  |   |           |   |--TYPE -> TYPE
                  |   |           |   |   `--IDENT -> Integer
                  |   |           |   `--IDENT -> i
                  |   |           `--GE -> >=
                  |   |               |--IDENT -> i
                  |   |               `--NUM_INT -> 0
                  |   |--LAMBDA -> ->
                  |   |--EXPR -> EXPR
                  |   |   `--IDENT -> i
                  |   `--SEMI -> ;
                  |--SWITCH_RULE -> SWITCH_RULE
                  |   |--LITERAL_DEFAULT -> default
                  |   |--LAMBDA -> ->
                  |   |--EXPR -> EXPR
                  |   |   `--NUM_INT -> 2
                  |   `--SEMI -> ;
                  `--RCURLY -> }
         
        Since:
        10.7.0
        See Also:
        Java Language Specification, §14.30, LITERAL_SWITCH, PATTERN_VARIABLE_DEF, LITERAL_INSTANCEOF, SWITCH_RULE, Constant Field Values
      • RECORD_PATTERN_DEF

        public static final int RECORD_PATTERN_DEF
        A record pattern definition. A record pattern consists of a type, a (possibly empty) record component pattern list which is used to match against the corresponding record components, and an optional identifier. Appears as part of an instanceof expression or a case label in a switch.

        For example:

         record R(Object o){}
         if (o instanceof R(String s) myRecord) {}
         switch (o) {
             case R(String s) myRecord -> {}
         }
         

        parses as:

         |--RECORD_DEF -> RECORD_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_RECORD -> record
         |   |--IDENT -> R
         |   |--LPAREN -> (
         |   |--RECORD_COMPONENTS -> RECORD_COMPONENTS
         |   |   `--RECORD_COMPONENT_DEF -> RECORD_COMPONENT_DEF
         |   |       |--ANNOTATIONS -> ANNOTATIONS
         |   |       |--TYPE -> TYPE
         |   |       |   `--IDENT -> Object
         |   |       `--IDENT -> o
         |   |--RPAREN -> )
         |   `--OBJBLOCK -> OBJBLOCK
         |       |--LCURLY -> {
         |       `--RCURLY -> }
         |--LITERAL_IF -> if
         |   |--LPAREN -> (
         |   |--EXPR -> EXPR
         |   |   `--LITERAL_INSTANCEOF -> instanceof
         |   |       |--IDENT -> o
         |   |       `--RECORD_PATTERN_DEF -> RECORD_PATTERN_DEF
         |   |           |--MODIFIERS -> MODIFIERS
         |   |           |--TYPE -> TYPE
         |   |           |   `--IDENT -> R
         |   |           |--LPAREN -> (
         |   |           |--RECORD_PATTERN_COMPONENTS -> RECORD_PATTERN_COMPONENTS
         |   |           |   `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |   |           |       |--MODIFIERS -> MODIFIERS
         |   |           |       |--TYPE -> TYPE
         |   |           |       |   `--IDENT -> String
         |   |           |       `--IDENT -> s
         |   |           |--RPAREN -> )
         |   |           `--IDENT -> myRecord
         |   |--RPAREN -> )
         |   `--SLIST -> {
         |       `--RCURLY -> }
         |--LITERAL_SWITCH -> switch
         |   |--LPAREN -> (
         |   |--EXPR -> EXPR
         |   |   `--IDENT -> o
         |   |--RPAREN -> )
         |   |--LCURLY -> {
         |   |--SWITCH_RULE -> SWITCH_RULE
         |   |   |--LITERAL_CASE -> case
         |   |   |   `--RECORD_PATTERN_DEF -> RECORD_PATTERN_DEF
         |   |   |       |--MODIFIERS -> MODIFIERS
         |   |   |       |--TYPE -> TYPE
         |   |   |       |   `--IDENT -> R
         |   |   |       |--LPAREN -> (
         |   |   |       |--RECORD_PATTERN_COMPONENTS -> RECORD_PATTERN_COMPONENTS
         |   |   |       |   `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |   |   |       |       |--MODIFIERS -> MODIFIERS
         |   |   |       |       |--TYPE -> TYPE
         |   |   |       |       |   `--IDENT -> String
         |   |   |       |       `--IDENT -> s
         |   |   |       |--RPAREN -> )
         |   |   |       `--IDENT -> myRecord
         |   |   |--LAMBDA -> ->
         |   |   `--SLIST -> {
         |   |       `--RCURLY -> }
         |   `--RCURLY -> }
         `--RCURLY -> }
         
        Since:
        10.12.0
        See Also:
        JEP 405: Record Patterns, LITERAL_WHEN, PATTERN_VARIABLE_DEF, LITERAL_INSTANCEOF, SWITCH_RULE, Constant Field Values
      • RECORD_PATTERN_COMPONENTS

        public static final int RECORD_PATTERN_COMPONENTS
        A (possibly empty) record component pattern list which is used to match against the corresponding record components. Appears as part of a record pattern definition.

        For example:

         record R(Object o){}
         if (o instanceof R(String myComponent)) {}
         switch (o) {
             case R(String myComponent) when "component".equalsIgnoreCase(myComponent) -> {}
         }
         

        parses as:

         |--RECORD_DEF -> RECORD_DEF
         |   |--MODIFIERS -> MODIFIERS
         |   |--LITERAL_RECORD -> record
         |   |--IDENT -> R
         |   |--LPAREN -> (
         |   |--RECORD_COMPONENTS -> RECORD_COMPONENTS
         |   |   `--RECORD_COMPONENT_DEF -> RECORD_COMPONENT_DEF
         |   |       |--ANNOTATIONS -> ANNOTATIONS
         |   |       |--TYPE -> TYPE
         |   |       |   `--IDENT -> Object
         |   |       `--IDENT -> o
         |   |--RPAREN -> )
         |   `--OBJBLOCK -> OBJBLOCK
         |       |--LCURLY -> {
         |       `--RCURLY -> }
         |--LITERAL_IF -> if
         |   |--LPAREN -> (
         |   |--EXPR -> EXPR
         |   |   `--LITERAL_INSTANCEOF -> instanceof
         |   |       |--IDENT -> o
         |   |       `--RECORD_PATTERN_DEF -> RECORD_PATTERN_DEF
         |   |           |--MODIFIERS -> MODIFIERS
         |   |           |--TYPE -> TYPE
         |   |           |   `--IDENT -> R
         |   |           |--LPAREN -> (
         |   |           |--RECORD_PATTERN_COMPONENTS -> RECORD_PATTERN_COMPONENTS
         |   |           |   `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |   |           |       |--MODIFIERS -> MODIFIERS
         |   |           |       |--TYPE -> TYPE
         |   |           |       |   `--IDENT -> String
         |   |           |       `--IDENT -> myComponent
         |   |           `--RPAREN -> )
         |   |--RPAREN -> )
         |   `--SLIST -> {
         |       `--RCURLY -> }
         |--LITERAL_SWITCH -> switch
         |   |--LPAREN -> (
         |   |--EXPR -> EXPR
         |   |   `--IDENT -> o
         |   |--RPAREN -> )
         |   |--LCURLY -> {
         |   |--SWITCH_RULE -> SWITCH_RULE
         |   |   |--LITERAL_CASE -> case
         |   |   |   `--PATTERN_DEF -> PATTERN_DEF
         |   |   |       `--LITERAL_WHEN -> when
         |   |   |           |--RECORD_PATTERN_DEF -> RECORD_PATTERN_DEF
         |   |   |           |   |--MODIFIERS -> MODIFIERS
         |   |   |           |   |--TYPE -> TYPE
         |   |   |           |   |   `--IDENT -> R
         |   |   |           |   |--LPAREN -> (
         |   |   |           |   |--RECORD_PATTERN_COMPONENTS -> RECORD_PATTERN_COMPONENTS
         |   |   |           |   |   `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF
         |   |   |           |   |       |--MODIFIERS -> MODIFIERS
         |   |   |           |   |       |--TYPE -> TYPE
         |   |   |           |   |       |   `--IDENT -> String
         |   |   |           |   |       `--IDENT -> myComponent
         |   |   |           |   `--RPAREN -> )
         |   |   |           `--METHOD_CALL -> (
         |   |   |               |--DOT -> .
         |   |   |               |   |--STRING_LITERAL -> "component"
         |   |   |               |   `--IDENT -> equalsIgnoreCase
         |   |   |               |--ELIST -> ELIST
         |   |   |               |   `--EXPR -> EXPR
         |   |   |               |       `--IDENT -> myComponent
         |   |   |               `--RPAREN -> )
         |   |   |--LAMBDA -> ->
         |   |   `--SLIST -> {
         |   |       `--RCURLY -> }
         |   `--RCURLY -> }
         `--RCURLY -> }
         
        Since:
        10.12.0
        See Also:
        JEP 405: Record Patterns, LITERAL_WHEN, PATTERN_VARIABLE_DEF, LITERAL_INSTANCEOF, SWITCH_RULE, Constant Field Values
    • Constructor Detail

      • TokenTypes

        private TokenTypes()
        Prevent instantiation.