Class TokenTypes
Implementation detail: This class has been introduced to break the circular dependency between packages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Theabstract
keyword.static final int
An annotation of a package, type, field, parameter or variable.static final int
An annotation array member initialization.static final int
An annotation declaration.static final int
An annotation field declaration.static final int
An initialization of an annotation member with a value.static final int
A collection of annotations on a package or enum constant.static final int
An array declaration.static final int
An array initialization.static final int
The=
(assignment) operator.static final int
An@
symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.static final int
The&
(bitwise AND) operator.static final int
The&=
(bitwise AND assignment) operator.static final int
Beginning of block comment: '/*'.static final int
End of block comment: '*/'.static final int
The~
(bitwise complement) operator.static final int
The|
(bitwise OR) operator.static final int
The|=
(bitwise OR assignment) operator.static final int
The>>>
(unsigned shift right) operator.static final int
The>>>=
(unsigned right shift assignment) operator.static final int
The^
(bitwise exclusive OR) operator.static final int
The^=
(bitwise exclusive OR assignment) operator.static final int
A group of case clauses.static final int
A character literal.static final int
A class declaration.static final int
The:
(colon) operator.static final int
The,
(comma) operator.static final int
Text of single-line or block comment.static final int
A compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.static final int
This is the root node for the source file.static final int
A constructor call.static final int
A constructor declaration.static final int
The--
(prefix decrement) operator.static final int
The/
(division) operator.static final int
The/=
(division assignment) operator.static final int
Literalwhile
in do-while loop.static final int
The.
(dot) operator.static final int
The::
(double colon) separator.static final int
An expression list.static final int
A triple dot for variable-length parameters.static final int
The empty statement.static final int
Theenum
keyword.static final int
An enum constant declaration.static final int
An enum declaration.static final int
The==
(equal) operator.static final int
An expression.static final int
An extends clause.static final int
Thefinal
keyword.static final int
A for loop condition.static final int
A for-each clause.static final int
A for loop initializer.static final int
A for loop iterator.static final int
The>=
(greater than or equal) operator.static final int
A>
symbol signifying the end of type arguments or type parameters.static final int
A<
symbol signifying the start of type arguments or type parameters.static final int
The>
(greater than) operator.static final int
An identifier.static final int
An implements clause.static final int
An import declaration.static final int
The++
(prefix increment) operator.static final int
The array index operator.static final int
An instance initializer.static final int
An interface declaration.static final int
A labeled statement.static final int
Special lambda symbol->
.static final int
The&&
(conditional AND) operator.static final int
A left curly brace ({
).static final int
The<=
(less than or equal) operator.static final int
Theassert
keyword.static final int
Theboolean
keyword.static final int
Thebreak
keyword.static final int
Thebyte
keyword.static final int
Thecase
keyword.static final int
Thecatch
keyword.static final int
Thechar
keyword.static final int
Theclass
keyword.static final int
Thecontinue
keyword.static final int
Thedefault
keyword.static final int
Thedo
keyword.static final int
Thedouble
keyword.static final int
Theelse
keyword.static final int
Thefalse
keyword.static final int
Thefinally
keyword.static final int
Thefloat
keyword.static final int
Thefor
keyword.static final int
Theif
keyword.static final int
Theinstanceof
operator.static final int
Theint
keyword.static final int
Theinterface
keyword.static final int
Thelong
keyword.static final int
Thenative
keyword.static final int
Thenew
keyword.static final int
Thenon-sealed
keyword.static final int
Thenull
keyword.static final int
Thepermits
restricted identifier.static final int
Theprivate
keyword.static final int
Theprotected
keyword.static final int
Thepublic
keyword.static final int
Therecord
keyword.static final int
Thereturn
keyword.static final int
Thesealed
restricted identifier.static final int
Theshort
keyword.static final int
Thestatic
keyword.static final int
Thesuper
keyword.static final int
Theswitch
keyword.static final int
Thesynchronized
keyword.static final int
Thethis
keyword use to refer the current object.static final int
Thethrow
keyword.static final int
Thethrows
keyword.static final int
Thetransient
keyword.static final int
Thetrue
keyword.static final int
Thetry
keyword.static final int
Thevoid
keyword.static final int
Thevolatile
keyword.static final int
Awhen
clause.static final int
Thewhile
keyword.static final int
Theyield
keyword.static final int
The!
(logical complement) operator.static final int
The||
(conditional OR) operator.static final int
A left parenthesis ((
).static final int
The<
(less than) operator.static final int
A method call.static final int
A method declaration.static final int
A reference to a method or constructor without arguments.static final int
The-
(subtraction) operator.static final int
The-=
(subtraction assignment) operator.static final int
The%
(remainder) operator.static final int
The%=
(remainder assignment) operator.static final int
Modifiers for type, method, and field declarations.static final int
The!=
(not equal) operator.static final int
A double precision floating point literal.static final int
A single precision floating point literal.static final int
An integer literal.static final int
A long integer literal.static final int
An object block.static final int
The package declaration.static final int
A parameter declaration.static final int
A list of parameters to a method or constructor.static final int
A pattern definition, excluding simple type pattern (pattern variable) definition such asif (o instanceof Integer i){}
.static final int
A pattern variable definition; when conditionally matched, this variable is assigned with the defined type.static final int
A permits clause.static final int
The+
(addition) operator.static final int
The+=
(addition assignment) operator.static final int
The--
(postfix decrement) operator.static final int
The++
(postfix increment) operator.static final int
The?
(conditional) operator.static final int
The]
symbol.static final int
A right curly brace (}
).static final int
A record component is a variable that comprises the state of a record.static final int
Record components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.static final int
A declaration of a record specifies a name, a header, and a body.static final int
A (possibly empty) record component pattern list which is used to match against the corresponding record components.static final int
Arecord
pattern definition.static final int
A resource in the Java 7 try-with-resources construct.static final int
The Java 7 try-with-resources construct.static final int
A list of resources in the Java 7 try-with-resources construct.static final int
A right parenthesis ()
).static final int
The statement terminator (;
).static final int
Beginning of single-line comment: '//'.static final int
The<<
(shift left) operator.static final int
The<<=
(left shift assignment) operator.static final int
A list of statements.static final int
The>>
(signed shift right) operator.static final int
The>>=
(signed right shift assignment) operator.static final int
The*
(multiplication or wildcard) operator.static final int
The*=
(multiplication assignment) operator.static final int
A static import declaration.static final int
A static initialization block.static final int
Thestrictfp
keyword.static final int
A string literal.static final int
A super constructor call.static final int
Switch Expressions.static final int
Content of a Java 15 text block.static final int
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 final int
End of a Java 15 text block literal, delimited by three double quotes.static final int
A type.static final int
A type arguments to a type reference or a method/ctor invocation.static final int
A list of type arguments to a type reference or a method/ctor invocation.static final int
The&
symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.static final int
A lower bounds on a wildcard type argument.static final int
A type parameter to a class, interface or method definition.static final int
A list of type parameters to a class, interface or method definition.static final int
An upper bounds on a wildcard type argument or type parameter.static final int
A type-cast.static final int
The-
(unary minus) operator.static final int
The+
(unary plus) operator.static final int
An unnamed pattern variable definition.static final int
A field or local variable declaration.static final int
The type that refers to all types. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
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 -> ;
-
MODIFIERS
Modifiers for type, method, and field declarations. The modifiers element is always present even though it may have no children.For example:
public int x;
parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--TYPE -> TYPE | `--LITERAL_INT -> int |--IDENT -> x `--SEMI -> ;
-
OBJBLOCK
An object block. These are children of class, interface, enum, annotation and enum constant declarations. Also, object blocks are children of the new keyword when defining anonymous inner types.For example:
class Test {}
parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS |--LITERAL_CLASS -> class |--IDENT -> Test `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }
-
SLIST
A list of statements.For example:
if (c == 1) { c = 0; }
parses as:
LITERAL_IF -> if |--LPAREN -> ( |--EXPR -> EXPR | `--EQUAL -> == | |--IDENT -> c | `--NUM_INT -> 1 |--RPAREN -> ) `--SLIST -> { |--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--NUM_INT -> 0 |--SEMI -> ; `--RCURLY -> }
-
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:
-
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 -> }
-
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:
-
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 -> }
-
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 -> }
-
TYPE
A type. This is either a return type of a method or a type of a variable or field. The first child of this element is the actual type. This may be a primitive type, an identifier, a dot which is the root of a fully qualified type, or an array of any of these. The second child may be type arguments to the type.For example:
boolean var = true;
parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_BOOLEAN -> boolean | |--IDENT -> var | `--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_TRUE -> true |--SEMI -> ;
-
CLASS_DEF
A class declaration.For example:
public class Test { }
parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--LITERAL_CLASS -> class |--IDENT -> Test `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }
-
INTERFACE_DEF
An interface declaration.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 -> }
-
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 -> ;
-
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.
-
EXTENDS_CLAUSE
An extends clause. This appears as part of class and interface definitions. This element appears even if theextends
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:
-
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 -> }
-
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
-
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:
-
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 -> }
-
TYPECAST
A type-cast.For example:
(String)it.next()
parses as:
`--TYPECAST -> ( |--TYPE -> TYPE | `--IDENT -> String |--RPAREN -> ) `--METHOD_CALL -> ( |--DOT -> . | |--IDENT -> it | `--IDENT -> next |--ELIST -> ELIST `--RPAREN -> )
-
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:
-
POST_INC
The++
(postfix increment) operator.For example:
a++;
parses as:
|--EXPR -> EXPR | `--POST_INC -> ++ | `--IDENT -> a |--SEMI -> ;
-
POST_DEC
The--
(postfix decrement) operator.For example:
a--;
parses as:
|--EXPR -> EXPR | `--POST_DEC -> -- | `--IDENT -> a |--SEMI -> ;
-
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:
-
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:
-
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:
-
ARRAY_INIT
An array initialization. This may occur as part of an array declaration or inline withnew
.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 -> ;
-
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 -> ;
-
UNARY_MINUS
The-
(unary minus) operator.For example:
a = -b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--UNARY_MINUS -> - | `--IDENT -> b |--SEMI -> ;
-
UNARY_PLUS
The+
(unary plus) operator.For example:
a = + b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--UNARY_PLUS -> + | `--IDENT -> b |--SEMI -> ;
-
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 -> ;
-
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 -> ;
-
FOR_INIT
A for loop initializer. This is a child ofLITERAL_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:
-
FOR_CONDITION
A for loop condition. This is a child ofLITERAL_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:
-
FOR_ITERATOR
A for loop iterator. This is a child ofLITERAL_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:
-
EMPTY_STAT
The empty statement. This goes in place of anSLIST
for afor
orwhile
loop body.For example:
while(true);
parses as:
LITERAL_WHILE -> while |--LPAREN -> ( |--EXPR -> EXPR | `--LITERAL_TRUE -> true |--RPAREN -> ) `--EMPTY_STAT -> ;
-
FINAL
Thefinal
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:
-
ABSTRACT
Theabstract
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:
-
STRICTFP
Thestrictfp
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:
-
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:
-
CTOR_CALL
A constructor call.For example:
this(1);
parses as:
CTOR_CALL -> this |--LPAREN -> ( |--ELIST -> ELIST | `--EXPR -> EXPR | `--NUM_INT -> 1 |--RPAREN -> ) `--SEMI -> ;
- See Also:
-
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 -> ;
-
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:
-
LITERAL_VOID
Thevoid
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:
-
LITERAL_BOOLEAN
Theboolean
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:
-
LITERAL_BYTE
Thebyte
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:
-
LITERAL_CHAR
Thechar
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:
-
LITERAL_SHORT
Theshort
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:
-
LITERAL_INT
Theint
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:
-
LITERAL_FLOAT
Thefloat
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:
-
LITERAL_LONG
Thelong
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:
-
LITERAL_DOUBLE
Thedouble
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:
-
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:
-
DOT
The.
(dot) operator.For example:
return person.name;
parses as:
--LITERAL_RETURN -> return |--EXPR -> EXPR | `--DOT -> . | |--IDENT -> person | `--IDENT -> name `--SEMI -> ;
- See Also:
-
STAR
The*
(multiplication or wildcard) operator.For example:
f = m * a;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> f | `--STAR -> * | |--IDENT -> m | `--IDENT -> a |--SEMI -> ;
-
LITERAL_PRIVATE
Theprivate
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:
-
LITERAL_PUBLIC
Thepublic
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:
-
LITERAL_PROTECTED
Theprotected
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:
-
LITERAL_STATIC
Thestatic
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:
-
LITERAL_TRANSIENT
Thetransient
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:
-
LITERAL_NATIVE
Thenative
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:
-
LITERAL_SYNCHRONIZED
Thesynchronized
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 -> }
-
LITERAL_VOLATILE
Thevolatile
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:
-
LITERAL_CLASS
Theclass
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:
-
LITERAL_INTERFACE
Theinterface
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:
-
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:
-
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:
-
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 -> ;
-
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 -> }
-
RPAREN
A right parenthesis ()
).For example:
void check() { }
parses as:
METHOD_DEF -> METHOD_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | `--LITERAL_VOID -> void |--IDENT -> check |--LPAREN -> ( |--PARAMETERS -> PARAMETERS |--RPAREN -> ) `--SLIST -> { `--RCURLY -> }
-
LITERAL_THIS
Thethis
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:
-
LITERAL_SUPER
Thesuper
keyword.For example:
super.toString()ï¼›
parses as:
|--EXPR -> EXPR | `--METHOD_CALL -> ( | |--DOT -> . | | |--LITERAL_SUPER -> super | | `--IDENT -> toString | |--ELIST -> ELIST | `--RPAREN -> ) |--SEMI -> ;
- See Also:
-
ASSIGN
The=
(assignment) operator.For example:
a = b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
LITERAL_THROWS
Thethrows
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 -> }
-
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:
-
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:
-
LITERAL_IF
Theif
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:
-
LITERAL_FOR
Thefor
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 -> }
-
LITERAL_WHILE
Thewhile
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:
-
LITERAL_DO
Thedo
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:
-
DO_WHILE
Literalwhile
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_BREAK
Thebreak
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:
-
LITERAL_CONTINUE
Thecontinue
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:
-
LITERAL_RETURN
Thereturn
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:
-
LITERAL_SWITCH
Theswitch
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 -> }
-
LITERAL_THROW
Thethrow
keyword. The first child is an expression that evaluates to aThrowable
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 -> ;
-
LITERAL_ELSE
Theelse
keyword. This appears as a child of anif
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:
-
LITERAL_CASE
Thecase
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:
-
LITERAL_DEFAULT
Thedefault
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:
-
LITERAL_TRY
Thetry
keyword. The children are a statement list, zero or more catch blocks and then an optional finally block.For example:
try { } finally {}
parses as:
LITERAL_TRY -> try |--SLIST -> { | `--RCURLY -> } `--LITERAL_FINALLY -> finally `--SLIST -> { `--RCURLY -> }
-
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 -> }
-
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
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 -> }
-
LITERAL_CATCH
Thecatch
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 -> }
-
LITERAL_FINALLY
Thefinally
keyword.For example:
try {} finally {}
parses as:
LITERAL_TRY -> try |--SLIST -> { | `--RCURLY -> } `--LITERAL_FINALLY -> finally `--SLIST -> { `--RCURLY -> }
- See Also:
-
PLUS_ASSIGN
The+=
(addition assignment) operator.For example:
a += b;
parses as:
|--EXPR -> EXPR | `--PLUS_ASSIGN -> += | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
MINUS_ASSIGN
The-=
(subtraction assignment) operator.For example:
a -= b;
parses as:
|--EXPR -> EXPR | `--MINUS_ASSIGN -> -= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
STAR_ASSIGN
The*=
(multiplication assignment) operator.For example:
a *= b;
parses as:
|--EXPR -> EXPR | `--STAR_ASSIGN -> *= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
DIV_ASSIGN
The/=
(division assignment) operator.For example:
a /= b;
parses as:
|--EXPR -> EXPR | `--DIV_ASSIGN -> /= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
MOD_ASSIGN
The%=
(remainder assignment) operator.For example:
a %= 2;
parses as:
|--EXPR -> EXPR | `--MOD_ASSIGN -> %= | |--IDENT -> a | `--NUM_INT -> 2 |--SEMI -> ;
-
SR_ASSIGN
The>>=
(signed right shift assignment) operator.For example:
a >>= b;
parses as:
|--EXPR -> EXPR | `--SR_ASSIGN -> >>= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
BSR_ASSIGN
The>>>=
(unsigned right shift assignment) operator.For example:
a >>>= b;
parses as:
|--EXPR -> EXPR | `--BSR_ASSIGN -> >>>= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
SL_ASSIGN
The<<=
(left shift assignment) operator. -
BAND_ASSIGN
The&=
(bitwise AND assignment) operator.For example:
a &= b;
parses as:
|--EXPR -> EXPR | `--BAND_ASSIGN -> &= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
BXOR_ASSIGN
The^=
(bitwise exclusive OR assignment) operator. -
BOR_ASSIGN
The|=
(bitwise OR assignment) operator.For example:
a |= b;
parses as:
|--EXPR -> EXPR | `--BOR_ASSIGN -> |= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
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 -> ;
-
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 -> }
-
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 -> }
-
BOR
The|
(bitwise OR) operator.For example:
a = a | b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--BOR -> | | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
BXOR
The^
(bitwise exclusive OR) operator. -
BAND
The&
(bitwise AND) operator.For example:
c = a & b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--BAND -> & | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
NOT_EQUAL
The!=
(not equal) operator.For example:
a != b;
parses as:
|--EXPR -> EXPR | `--NOT_EQUAL -> != | |--IDENT -> a | `--IDENT -> b `--SEMI -> ;
- See Also:
-
EQUAL
The==
(equal) operator.For example:
return a == b;
parses as:
|--EXPR -> EXPR | `--EQUAL -> == | |--IDENT -> a | `--IDENT -> b `--SEMI -> ;
- See Also:
-
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:
-
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:
-
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:
-
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:
-
LITERAL_INSTANCEOF
Theinstanceof
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 -> ;
-
SL
The<<
(shift left) operator.For example:
a = a << b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--SR -> << | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
SR
The>>
(signed shift right) operator.For example:
a = a >> b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--SR -> >> | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
BSR
The>>>
(unsigned shift right) operator.For example:
a >>> b;
parses as:
|--EXPR -> EXPR | `--BSR -> >>> | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
PLUS
The+
(addition) operator.For example:
c = a + b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--PLUS -> + | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
MINUS
The-
(subtraction) operator.For example:
c = a - b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--MINUS -> - | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
-
DIV
The/
(division) operator.For example:
a = 4 / 2;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--DIV -> / | |--NUM_INT -> 4 | `--NUM_INT -> 2 |--SEMI -> ;
-
MOD
The%
(remainder) operator.For example:
c = a % b;
parses as:
EXPR -> EXPR `--ASSIGN -> = |--IDENT -> c `--MOD -> % |--IDENT -> a `--IDENT -> b SEMI -> ;
-
INC
The++
(prefix increment) operator.For example:
++a;
parses as:
|--EXPR -> EXPR | `--INC -> ++ | `--IDENT -> a |--SEMI -> ;
-
DEC
The--
(prefix decrement) operator.For example:
--a;
parses as:
|--EXPR -> EXPR | `--DEC -> -- | `--IDENT -> a |--SEMI -> ;
-
BNOT
The~
(bitwise complement) operator.For example:
a = ~ a;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--BNOT -> ~ | `--IDENT -> a |--SEMI -> ;
-
LNOT
The!
(logical complement) operator.For example:
c = ! a;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--LNOT -> ! | `--IDENT -> a |--SEMI -> ;
-
LITERAL_TRUE
Thetrue
keyword.For example:
boolean a = true;
parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_BOOLEAN -> boolean | |--IDENT -> a | `--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_TRUE -> true |--SEMI -> ;
-
LITERAL_FALSE
Thefalse
keyword.For example:
boolean a = false;
parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | `--LITERAL_BOOLEAN -> boolean |--IDENT -> a |--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_FALSE -> false `--SEMI -> ;
-
LITERAL_NULL
Thenull
keyword.For example:
String s = null;
parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | `--IDENT -> String |--IDENT -> s |--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_NULL -> null `--SEMI -> ;
-
LITERAL_NEW
Thenew
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 -> ;
-
NUM_INT
An integer literal. These may be specified in decimal, hexadecimal, or octal form.For example:
a = 3;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_INT -> 3 |--SEMI -> ;
-
CHAR_LITERAL
A character literal. This is a (possibly escaped) character enclosed in single quotes.For example:
return 'a';
parses as:
--LITERAL_RETURN -> return |--EXPR -> EXPR | `--CHAR_LITERAL -> 'a' `--SEMI -> ;
-
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 -> ;
-
NUM_FLOAT
A single precision floating point literal. This is a floating point number with anF
orf
suffix.For example:
a = 3.14f;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_FLOAT -> 3.14f |--SEMI -> ;
-
NUM_LONG
A long integer literal. These are almost the same as integer literals, but they have anL
orl
(ell) suffix.For example:
a = 3l;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_LONG -> 3l |--SEMI -> ;
-
NUM_DOUBLE
A double precision floating point literal. This is a floating point number with an optionalD
ord
suffix.For example:
a = 3.14d;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_DOUBLE -> 3.14d |--SEMI -> ;
-
LITERAL_ASSERT
Theassert
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:
-
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:
-
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 -> }
-
ENUM
Theenum
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 -> }
-
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 -> }
-
FOR_EACH_CLAUSE
A for-each clause. This is a child ofLITERAL_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:
-
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 -> }
-
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:
-
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 aMODIFIERS
node.For example:
@MyAnnotation package blah;
parses as:
PACKAGE_DEF -> package |--ANNOTATIONS -> ANNOTATIONS | `--ANNOTATION -> ANNOTATION | |--AT -> @ | `--IDENT -> MyAnnotation |--IDENT -> blah `--SEMI -> ;
- See Also:
-
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 -> )
-
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:
-
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 -> )
-
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 -> }
-
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 -> }
-
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 -> ;
-
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 -> ;
-
WILDCARD_TYPE
The type that refers to all types. This node has no children.For example:
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 -> ? | | `--GENERIC_END -> > | `--IDENT -> list |--SEMI -> ;
-
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 -> ;
-
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 -> ;
-
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:
-
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:
-
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 -> ;
-
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 -> }
-
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 -> }
-
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:
-
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:
-
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:
-
BLOCK_COMMENT_END
End of block comment: '*/'.For example:
/*comment*/
parses as:
BLOCK_COMMENT_BEGIN -> /* |--COMMENT_CONTENT -> comment `--BLOCK_COMMENT_END -> */
- See Also:
-
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:
-
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_RECORD
Therecord
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
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:
-
LITERAL_YIELD
Theyield
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:
-
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 -> ;
-
LITERAL_NON_SEALED
Thenon-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:
-
LITERAL_SEALED
Thesealed
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:
-
LITERAL_PERMITS
Thepermits
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:
-
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:
-
PATTERN_DEF
A pattern definition, excluding simple type pattern (pattern variable) definition such asif (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 -> }
-
LITERAL_WHEN
Awhen
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 -> }
-
RECORD_PATTERN_DEF
Arecord
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 aninstanceof
expression or acase
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:
-
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:
-
UNNAMED_PATTERN_DEF
An unnamed pattern variable definition. Appears as part of a pattern definition.For example:
if (r instanceof R(_)) {}
parses as:
LITERAL_IF -> if |--LPAREN -> ( |--EXPR -> EXPR | `--LITERAL_INSTANCEOF -> instanceof | |--IDENT -> r | `--RECORD_PATTERN_DEF -> RECORD_PATTERN_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--IDENT -> R | |--LPAREN -> ( | |--RECORD_PATTERN_COMPONENTS -> RECORD_PATTERN_COMPONENTS | | `--UNNAMED_PATTERN_DEF -> _ | `--RPAREN -> ) |--RPAREN -> ) `--SLIST -> { `--RCURLY -> }
-
-
Constructor Details
-
TokenTypes
private TokenTypes()Prevent instantiation.
-