Class TokenTypes
Implementation detail: This class has been introduced to break the circular dependency between packages.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intTheabstractkeyword.static final intAn annotation of a package, type, field, parameter or variable.static final intAn annotation array member initialization.static final intAn annotation declaration.static final intAn annotation field declaration.static final intAn initialization of an annotation member with a value.static final intA collection of annotations on a package or enum constant.static final intAn array declaration.static final intAn array initialization.static final intThe=(assignment) operator.static final intAn@symbol - signifying an annotation instance or the prefix to the interface literal signifying the definition of an annotation declaration.static final intThe&(bitwise AND) operator.static final intThe&=(bitwise AND assignment) operator.static final intBeginning of block comment: '/*'.static final intEnd of block comment: '*/'.static final intThe~(bitwise complement) operator.static final intThe|(bitwise OR) operator.static final intThe|=(bitwise OR assignment) operator.static final intThe>>>(unsigned shift right) operator.static final intThe>>>=(unsigned right shift assignment) operator.static final intThe^(bitwise exclusive OR) operator.static final intThe^=(bitwise exclusive OR assignment) operator.static final intA group of case clauses.static final intA character literal.static final intA class declaration.static final intThe:(colon) operator.static final intThe,(comma) operator.static final intText of single-line or block comment.static final intA compact canonical constructor eliminates the list of formal parameters; they are declared implicitly.static final intThis is the root node for the source file.static final intA constructor call.static final intA constructor declaration.static final intThe--(prefix decrement) operator.static final intThe/(division) operator.static final intThe/=(division assignment) operator.static final intLiteralwhilein do-while loop.static final intThe.(dot) operator.static final intThe::(double colon) separator.static final intAn expression list.static final intA triple dot for variable-length parameters.static final intThe empty statement.static final intTheenumkeyword.static final intAn enum constant declaration.static final intAn enum declaration.static final intThe==(equal) operator.static final intAn expression.static final intAn extends clause.static final intThefinalkeyword.static final intA for loop condition.static final intA for-each clause.static final intA for loop initializer.static final intA for loop iterator.static final intThe>=(greater than or equal) operator.static final intA>symbol signifying the end of type arguments or type parameters.static final intA<symbol signifying the start of type arguments or type parameters.static final intThe>(greater than) operator.static final intAn identifier.static final intAn implements clause.static final intAn import declaration.static final intThe++(prefix increment) operator.static final intThe array index operator.static final intAn instance initializer.static final intAn interface declaration.static final intA labeled statement.static final intSpecial lambda symbol->.static final intThe&&(conditional AND) operator.static final intA left curly brace ({).static final intThe<=(less than or equal) operator.static final intTheassertkeyword.static final intThebooleankeyword.static final intThebreakkeyword.static final intThebytekeyword.static final intThecasekeyword.static final intThecatchkeyword.static final intThecharkeyword.static final intTheclasskeyword.static final intThecontinuekeyword.static final intThedefaultkeyword.static final intThedokeyword.static final intThedoublekeyword.static final intTheelsekeyword.static final intThefalsekeyword.static final intThefinallykeyword.static final intThefloatkeyword.static final intTheforkeyword.static final intTheifkeyword.static final intTheinstanceofoperator.static final intTheintkeyword.static final intTheinterfacekeyword.static final intThelongkeyword.static final intThenativekeyword.static final intThenewkeyword.static final intThenon-sealedkeyword.static final intThenullkeyword.static final intThepermitsrestricted identifier.static final intTheprivatekeyword.static final intTheprotectedkeyword.static final intThepublickeyword.static final intTherecordkeyword.static final intThereturnkeyword.static final intThesealedrestricted identifier.static final intTheshortkeyword.static final intThestatickeyword.static final intThesuperkeyword.static final intTheswitchkeyword.static final intThesynchronizedkeyword.static final intThethiskeyword use to refer the current object.static final intThethrowkeyword.static final intThethrowskeyword.static final intThetransientkeyword.static final intThetruekeyword.static final intThetrykeyword.static final intThevoidkeyword.static final intThevolatilekeyword.static final intThewhilekeyword.static final intTheyieldkeyword.static final intThe!(logical complement) operator.static final intThe||(conditional OR) operator.static final intA left parenthesis (().static final intThe<(less than) operator.static final intA method call.static final intA method declaration.static final intA reference to a method or constructor without arguments.static final intThe-(subtraction) operator.static final intThe-=(subtraction assignment) operator.static final intThe%(remainder) operator.static final intThe%=(remainder assignment) operator.static final intModifiers for type, method, and field declarations.static final intThe!=(not equal) operator.static final intA double precision floating point literal.static final intA single precision floating point literal.static final intAn integer literal.static final intA long integer literal.static final intAn object block.static final intThe package declaration.static final intA parameter declaration.static final intA list of parameters to a method or constructor.static final intA pattern definition, excluding simple type pattern (pattern variable) definition such asif (o instanceof Integer i){}.static final intA pattern variable definition; when conditionally matched, this variable is assigned with the defined type.static final intA permits clause.static final intThe+(addition) operator.static final intThe+=(addition assignment) operator.static final intThe--(postfix decrement) operator.static final intThe++(postfix increment) operator.static final intThe?(conditional) operator.static final intThe]symbol.static final intA right curly brace (}).static final intA record component is a variable that comprises the state of a record.static final intRecord components are a (possibly empty) list containing the components of a record, which are the variables that make up its state.static final intA declaration of a record specifies a name, a header, and a body.static final intA resource in the Java 7 try-with-resources construct.static final intThe Java 7 try-with-resources construct.static final intA list of resources in the Java 7 try-with-resources construct.static final intA right parenthesis ()).static final intThe statement terminator (;).static final intBeginning of single line comment: '//'.static final intThe<<(shift left) operator.static final intThe<<=(left shift assignment) operator.static final intA list of statements.static final intThe>>(signed shift right) operator.static final intThe>>=(signed right shift assignment) operator.static final intThe*(multiplication or wildcard) operator.static final intThe*=(multiplication assignment) operator.static final intA static import declaration.static final intA static initialization block.static final intThestrictfpkeyword.static final intA string literal.static final intA super constructor call.static final intSwitch Expressions.static final intContent of a Java 14 text block.static final intBeginning of a Java 14 Text Block literal, delimited by three double quotes.static final intEnd of a Java 14 text block literal, delimited by three double quotes.static final intA type.static final intA type arguments to a type reference or a method/ctor invocation.static final intA list of type arguments to a type reference or a method/ctor invocation.static final intThe&symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.static final intA lower bounds on a wildcard type argument.static final intA type parameter to a class, interface or method definition.static final intA list of type parameters to a class, interface or method definition.static final intAn upper bounds on a wildcard type argument or type parameter.static final intA type-cast.static final intThe-(unary minus) operator.static final intThe+(unary plus) operator.static final intA field or local variable declaration.static final intThe type that refers to all types. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
COMPILATION_UNIT
public static final int COMPILATION_UNITThis is the root node for the source file. It's children are an optional package definition, zero or more import statements, and zero or more type declarations.For example:
import java.util.List; class MyClass{} interface MyInterface{} ;parses as:
COMPILATION_UNIT -> COMPILATION_UNIT |--IMPORT -> import | |--DOT -> . | | |--DOT -> . | | | |--IDENT -> java | | | `--IDENT -> util | | `--IDENT -> List | `--SEMI -> ; |--CLASS_DEF -> CLASS_DEF | |--MODIFIERS -> MODIFIERS | |--LITERAL_CLASS -> class | |--IDENT -> MyClass | `--OBJBLOCK -> OBJBLOCK | |--LCURLY -> { | `--RCURLY -> } |--INTERFACE_DEF -> INTERFACE_DEF | |--MODIFIERS -> MODIFIERS | |--LITERAL_INTERFACE -> interface | |--IDENT -> MyInterface | `--OBJBLOCK -> OBJBLOCK | |--LCURLY -> { | `--RCURLY -> } `--SEMI -> ;- See Also:
-
MODIFIERS
public static final int MODIFIERSModifiers 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 -> ;
- See Also:
-
OBJBLOCK
public static final int OBJBLOCKAn 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 -> }- See Also:
-
SLIST
public static final int SLISTA 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 -> }- See Also:
-
CTOR_DEF
public static final int CTOR_DEFA 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
public static final int METHOD_DEFA method declaration. The children are modifiers, type parameters, return type, method name, parameter list, an optional throws list, and statement list. The statement list is omitted if the method declaration appears in an interface declaration. Method declarations may appear inside object blocks of class declarations, interface declarations, enum declarations, enum constant declarations or anonymous inner-class declarations.For example:
public static int square(int x) { return x*x; }parses as:
--METHOD_DEF -> METHOD_DEF |--MODIFIERS -> MODIFIERS | |--LITERAL_PUBLIC -> public | `--LITERAL_STATIC -> static |--TYPE -> TYPE | `--LITERAL_INT -> int |--IDENT -> square |--LPAREN -> ( |--PARAMETERS -> PARAMETERS | `--PARAMETER_DEF -> PARAMETER_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_INT -> int | `--IDENT -> x |--RPAREN -> ) `--SLIST -> { |--LITERAL_RETURN -> return | |--EXPR -> EXPR | | `--STAR -> * | | |--IDENT -> x | | `--IDENT -> x | `--SEMI -> ; `--RCURLY -> }- See Also:
-
VARIABLE_DEF
public static final int VARIABLE_DEFA field or local variable declaration. The children are modifiers, type, the identifier name, and an optional assignment statement.For example:
final int PI = 3.14;
parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS | `--FINAL -> final |--TYPE -> TYPE | `--LITERAL_INT -> int |--IDENT -> PI |--ASSIGN -> = | `--EXPR -> EXPR | `--NUM_FLOAT -> 3.14 `--SEMI -> ;
- See Also:
-
INSTANCE_INIT
public static final int INSTANCE_INITAn instance initializer. Zero or more instance initializers may appear in class and enum definitions. This token will be a child of the object block of the declaring type.For example:
public class MyClass { private int foo; {foo = 10;} }parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--LITERAL_CLASS -> class |--IDENT -> MyClass `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { |--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | | `--LITERAL_PRIVATE -> private | |--TYPE -> TYPE | | `--LITERAL_INT -> int | |--IDENT -> foo | `--SEMI -> ; |--INSTANCE_INIT -> INSTANCE_INIT | `--SLIST -> { | |--EXPR -> EXPR | | `--ASSIGN -> = | | |--IDENT -> foo | | `--NUM_INT -> 10 | |--SEMI -> ; | `--RCURLY -> } `--RCURLY -> }- See Also:
-
STATIC_INIT
public static final int STATIC_INITA static initialization block. Zero or more static initializers may be children of the object block of a class or enum declaration (interfaces cannot have static initializers). The first and only child is a statement list.For Example:
static { num = 10; }parses as:
STATIC_INIT -> STATIC_INIT `--SLIST -> { |--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> num | `--NUM_INT -> 10 |--SEMI -> ; `--RCURLY -> }- See Also:
-
TYPE
public static final int TYPEA 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 -> ;
- See Also:
-
CLASS_DEF
public static final int CLASS_DEFA 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 -> }- See Also:
-
INTERFACE_DEF
public static final int INTERFACE_DEFAn 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 -> }- See Also:
-
PACKAGE_DEF
public static final int PACKAGE_DEFThe package declaration. This is optional, but if it is included, then there is only one package declaration per source file and it must be the first non-comment in the file. A package declaration may be annotated in which case the annotations comes before the rest of the declaration (and are the first children).For example:
package com.puppycrawl.tools.checkstyle.api;
parses as:
PACKAGE_DEF -> package |--ANNOTATIONS -> ANNOTATIONS |--DOT -> . | |--DOT -> . | | |--DOT -> . | | | |--DOT -> . | | | | |--IDENT -> com | | | | `--IDENT -> puppycrawl | | | `--IDENT -> tools | | `--IDENT -> checkstyle | `--IDENT -> api `--SEMI -> ;
- See Also:
-
ARRAY_DECLARATOR
public static final int ARRAY_DECLARATORAn array declaration.If the array declaration represents a type, then the type of the array elements is the first child. Multidimensional arrays may be regarded as arrays of arrays. In other words, the first child of the array declaration is another array declaration.
For example:
int[] x;
parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | |--LITERAL_INT -> int | `--ARRAY_DECLARATOR -> [ | `--RBRACK -> ] |--IDENT -> x `--SEMI -> ;
The array declaration may also represent an inline array definition. In this case, the first child will be either an expression specifying the length of the array or an array initialization block.
- See Also:
-
EXTENDS_CLAUSE
public static final int EXTENDS_CLAUSEAn extends clause. This appear as part of class and interface definitions. This element appears even if theextendskeyword 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
public static final int IMPLEMENTS_CLAUSEAn implements clause. This always appears in a class or enum declaration, even if there are no implemented interfaces. The children are a comma separated list of zero or more identifiers.For example:
public class MyClass implements Collection { }parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--LITERAL_CLASS -> class |--IDENT -> MyClass |--IMPLEMENTS_CLAUSE -> implements | `--IDENT -> Collection `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }- See Also:
-
PARAMETERS
public static final int PARAMETERSA 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 | +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (start) +--COMMA (,) +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--LITERAL_INT (int) +--IDENT (end)- See Also:
-
PARAMETER_DEF
public static final int PARAMETER_DEFA 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(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 | | | `--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
public static final int LABELED_STATA labeled statement.For example:
outer: while (i < 10) { if (i == 5) continue outer; i++; }parses as:
LABELED_STAT -> : |--IDENT -> outer `--LITERAL_WHILE -> while |--LPAREN -> ( |--EXPR -> EXPR | `--LT -> < | |--IDENT -> i | `--NUM_INT -> 10 |--RPAREN -> ) `--SLIST -> { |--LITERAL_IF -> if | |--LPAREN -> ( | |--EXPR -> EXPR | | `--EQUAL -> == | | |--IDENT -> i | | `--NUM_INT -> 5 | |--RPAREN -> ) | `--LITERAL_CONTINUE -> continue | |--IDENT -> outer | `--SEMI -> ; |--EXPR -> EXPR | `--POST_INC -> ++ | `--IDENT -> i |--SEMI -> ; `--RCURLY -> }- See Also:
-
TYPECAST
public static final int TYPECASTA 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 -> )- See Also:
-
INDEX_OP
public static final int INDEX_OPThe 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
public static final int POST_INCThe++(postfix increment) operator.For example:
a++;
parses as:
|--EXPR -> EXPR | `--POST_INC -> ++ | `--IDENT -> a |--SEMI -> ;
- See Also:
-
POST_DEC
public static final int POST_DECThe--(postfix decrement) operator.For example:
a--;
parses as:
|--EXPR -> EXPR | `--POST_DEC -> -- | `--IDENT -> a |--SEMI -> ;
- See Also:
-
METHOD_CALL
public static final int METHOD_CALLA 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
public static final int METHOD_REFA 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_COLONtoken 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
public static final int EXPRAn 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
public static final int ARRAY_INITAn 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 -> ;- See Also:
-
IMPORT
public static final int IMPORTAn import declaration. Import declarations are option, but must appear after the package declaration and before the first type declaration.For example:
import java.io.IOException;
parses as:
IMPORT -> import |--DOT -> . | |--DOT -> . | | |--IDENT -> java | | `--IDENT -> io | `--IDENT -> IOException `--SEMI -> ;
- See Also:
-
UNARY_MINUS
public static final int UNARY_MINUSThe-(unary minus) operator.For example:
a = -b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--UNARY_MINUS -> - | `--IDENT -> b |--SEMI -> ;
- See Also:
-
UNARY_PLUS
public static final int UNARY_PLUSThe+(unary plus) operator.For example:
a = + b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--UNARY_PLUS -> + | `--IDENT -> b |--SEMI -> ;
- See Also:
-
CASE_GROUP
public static final int CASE_GROUPA group of case clauses. Case clauses with no associated statements are grouped together into a case group. The last child is a statement list containing the statements to execute upon a match.For example:
case 0: case 1: case 2: x = 3; break;
parses as:
CASE_GROUP -> CASE_GROUP |--LITERAL_CASE -> case | |--EXPR -> EXPR | | `--NUM_INT -> 0 | `--COLON -> : |--LITERAL_CASE -> case | |--EXPR -> EXPR | | `--NUM_INT -> 1 | `--COLON -> : |--LITERAL_CASE -> case | |--EXPR -> EXPR | | `--NUM_INT -> 2 | `--COLON -> : `--SLIST -> SLIST |--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> x | `--NUM_INT -> 3 |--SEMI -> ; `--LITERAL_BREAK -> break `--SEMI -> ;- See Also:
-
ELIST
public static final int ELISTAn expression list. The children are a comma separated list of expressions.For example:
new ArrayList(50);
parses as:
|--EXPR -> EXPR | `--LITERAL_NEW -> new | |--IDENT -> ArrayList | |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS | | |--GENERIC_START -> < | | `--GENERIC_END -> > | |--LPAREN -> ( | |--ELIST -> ELIST | | `--EXPR -> EXPR | | `--NUM_INT -> 50 | `--RPAREN -> ) |--SEMI -> ;
- See Also:
-
FOR_INIT
public static final int FOR_INITA 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
public static final int FOR_CONDITIONA 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
public static final int FOR_ITERATORA 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
public static final int EMPTY_STATThe empty statement. This goes in place of anSLISTfor afororwhileloop body.For example:
while(true);
parses as:
LITERAL_WHILE -> while |--LPAREN -> ( |--EXPR -> EXPR | `--LITERAL_TRUE -> true |--RPAREN -> ) `--EMPTY_STAT -> ;
- See Also:
-
FINAL
public static final int FINALThefinalkeyword.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
public static final int ABSTRACTTheabstractkeyword.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
public static final int STRICTFPThestrictfpkeyword.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
public static final int SUPER_CTOR_CALLA 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
public static final int CTOR_CALLA constructor call.For example:
this(1);
parses as:
CTOR_CALL -> this |--LPAREN -> ( |--ELIST -> ELIST | `--EXPR -> EXPR | `--NUM_INT -> 1 |--RPAREN -> ) `--SEMI -> ;
- See Also:
-
SEMI
public static final int SEMIThe statement terminator (;). Depending on the context, this make occur as a sibling, a child, or not at all.For example:
for(;;);
parses as:
LITERAL_FOR -> for |--LPAREN -> ( |--FOR_INIT -> FOR_INIT |--SEMI -> ; |--FOR_CONDITION -> FOR_CONDITION |--SEMI -> ; |--FOR_ITERATOR -> FOR_ITERATOR |--RPAREN -> ) `--EMPTY_STAT -> ;
- See Also:
-
RBRACK
public static final int RBRACKThe]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
public static final int LITERAL_VOIDThevoidkeyword.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
public static final int LITERAL_BOOLEANThebooleankeyword.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
public static final int LITERAL_BYTEThebytekeyword.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
public static final int LITERAL_CHARThecharkeyword.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
public static final int LITERAL_SHORTTheshortkeyword.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
public static final int LITERAL_INTTheintkeyword.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
public static final int LITERAL_FLOATThefloatkeyword.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
public static final int LITERAL_LONGThelongkeyword.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
public static final int LITERAL_DOUBLEThedoublekeyword.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
public static final int IDENTAn 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
public static final int DOTThe.(dot) operator.For example:
return person.name;
parses as:
--LITERAL_RETURN -> return |--EXPR -> EXPR | `--DOT -> . | |--IDENT -> person | `--IDENT -> name `--SEMI -> ;- See Also:
-
STAR
public static final int STARThe*(multiplication or wildcard) operator.For example:
f = m * a;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> f | `--STAR -> * | |--IDENT -> m | `--IDENT -> a |--SEMI -> ;
- See Also:
-
LITERAL_PRIVATE
public static final int LITERAL_PRIVATETheprivatekeyword.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
public static final int LITERAL_PUBLICThepublickeyword.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
public static final int LITERAL_PROTECTEDTheprotectedkeyword.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
public static final int LITERAL_STATICThestatickeyword.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
public static final int LITERAL_TRANSIENTThetransientkeyword.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
public static final int LITERAL_NATIVEThenativekeyword.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
public static final int LITERAL_SYNCHRONIZEDThesynchronizedkeyword. This may be used as a modifier of a method or in the definition of a synchronized block.For example:
synchronized(this) { x++; }parses as:
|--LITERAL_SYNCHRONIZED -> synchronized | |--LPAREN -> ( | |--EXPR -> EXPR | | `--LITERAL_THIS -> this | |--RPAREN -> ) | `--SLIST -> { | |--EXPR -> EXPR | | `--POST_INC -> ++ | | `--IDENT -> x | |--SEMI -> ; | `--RCURLY -> } `--RCURLY -> }- See Also:
-
LITERAL_VOLATILE
public static final int LITERAL_VOLATILEThevolatilekeyword. 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
public static final int LITERAL_CLASSTheclasskeyword. 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
public static final int LITERAL_INTERFACETheinterfacekeyword. 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
public static final int LCURLYA 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
public static final int RCURLYA 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
public static final int COMMAThe,(comma) operator.For example:
int a, b;
parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_INT -> int | `--IDENT -> a |--COMMA -> , |--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_INT -> int | `--IDENT -> b |--SEMI -> ;
- See Also:
-
LPAREN
public static final int LPARENA left parenthesis (().For example:
Integer val = new Integer(); while (false) { val += (-3); }parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--IDENT -> Integer | |--IDENT -> val | `--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_NEW -> new | |--IDENT -> Integer | |--LPAREN -> ( | |--ELIST -> ELIST | `--RPAREN -> ) |--SEMI -> ; |--LITERAL_WHILE -> while | |--LPAREN -> ( | |--EXPR -> EXPR | | `--LITERAL_FALSE -> false | |--RPAREN -> ) | `--SLIST -> { | |--EXPR -> EXPR | | `--PLUS_ASSIGN -> += | | |--IDENT -> val | | |--LPAREN -> ( | | |--UNARY_MINUS -> - | | | `--NUM_INT -> 3 | | `--RPAREN -> ) | |--SEMI -> ; | `--RCURLY -> }- See Also:
-
RPAREN
public static final int RPARENA 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 -> }- See Also:
-
LITERAL_THIS
public static final int LITERAL_THISThethiskeyword 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
public static final int LITERAL_SUPERThesuperkeyword.For example:
super.toString()ï¼›
parses as:
|--EXPR -> EXPR | `--METHOD_CALL -> ( | |--DOT -> . | | |--LITERAL_SUPER -> super | | `--IDENT -> toString | |--ELIST -> ELIST | `--RPAREN -> ) |--SEMI -> ;
- See Also:
-
ASSIGN
public static final int ASSIGNThe=(assignment) operator.For example:
a = b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
LITERAL_THROWS
public static final int LITERAL_THROWSThethrowskeyword. The children are a number of one or more identifiers separated by commas.For example:
void test() throws FileNotFoundException, EOFException { }parses as:
METHOD_DEF -> METHOD_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | `--LITERAL_VOID -> void |--IDENT -> test |--LPAREN -> ( |--PARAMETERS -> PARAMETERS |--RPAREN -> ) |--LITERAL_THROWS -> throws | |--IDENT -> FileNotFoundException | |--COMMA -> , | `--IDENT -> EOFException `--SLIST -> { `--RCURLY -> }- See Also:
-
COLON
public static final int COLONThe:(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
public static final int DOUBLE_COLONThe::(double colon) separator. It is part of Java 8 syntax that is used for method reference. The token does not appear in tree,METHOD_REFshould 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
public static final int LITERAL_IFTheifkeyword.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
public static final int LITERAL_FORTheforkeyword. The children are(, an initializer, a condition, an iterator, a)and either a statement list, a single expression, or an empty statement.For example:
for (int i = 0; i < arr.length; i++) {}parses as:
LITERAL_FOR -> for |--LPAREN -> ( |--FOR_INIT -> FOR_INIT | `--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_INT -> int | |--IDENT -> i | `--ASSIGN -> = | `--EXPR -> EXPR | `--NUM_INT -> 0 |--SEMI -> ; |--FOR_CONDITION -> FOR_CONDITION | `--EXPR -> EXPR | `--LT -> < | |--IDENT -> i | `--DOT -> . | |--IDENT -> arr | `--IDENT -> length |--SEMI -> ; |--FOR_ITERATOR -> FOR_ITERATOR | `--ELIST -> ELIST | `--EXPR -> EXPR | `--POST_INC -> ++ | `--IDENT -> i |--RPAREN -> ) `--SLIST -> { `--RCURLY -> }- See Also:
-
LITERAL_WHILE
public static final int LITERAL_WHILEThewhilekeyword.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
public static final int LITERAL_DOThedokeyword. Note the 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
public static final int DO_WHILELiteralwhilein 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
public static final int LITERAL_BREAKThebreakkeyword. 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
public static final int LITERAL_CONTINUEThecontinuekeyword. 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
public static final int LITERAL_RETURNThereturnkeyword. The first child is an optional expression for the return value. The last child is a semi colon.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
public static final int LITERAL_SWITCHTheswitchkeyword.For example:
switch (type) { case 0: background = Color.red; break; case 1: background = Color.blue; break; default: background = Color.green; }parses as:
LITERAL_SWITCH -> switch |--LPAREN -> ( |--EXPR -> EXPR | `--IDENT -> type |--RPAREN -> ) |--LCURLY -> { |--CASE_GROUP -> CASE_GROUP | |--LITERAL_CASE -> case | | |--EXPR -> EXPR | | | `--NUM_INT -> 0 | | `--COLON -> : | `--SLIST -> SLIST | |--EXPR -> EXPR | | `--ASSIGN -> = | | |--IDENT -> background | | `--DOT -> . | | |--IDENT -> Color | | `--IDENT -> red | |--SEMI -> ; | `--LITERAL_BREAK -> break | `--SEMI -> ; |--CASE_GROUP -> CASE_GROUP | |--LITERAL_CASE -> case | | |--EXPR -> EXPR | | | `--NUM_INT -> 1 | | `--COLON -> : | `--SLIST -> SLIST | |--EXPR -> EXPR | | `--ASSIGN -> = | | |--IDENT -> background | | `--DOT -> . | | |--IDENT -> Color | | `--IDENT -> blue | |--SEMI -> ; | `--LITERAL_BREAK -> break | `--SEMI -> ; |--CASE_GROUP -> CASE_GROUP | |--LITERAL_DEFAULT -> default | | `--COLON -> : | `--SLIST -> SLIST | |--EXPR -> EXPR | | `--ASSIGN -> = | | |--IDENT -> background | | `--DOT -> . | | |--IDENT -> Color | | `--IDENT -> green | `--SEMI -> ; `--RCURLY -> }- See Also:
-
LITERAL_THROW
public static final int LITERAL_THROWThethrowkeyword. The first child is an expression that evaluates to aThrowableinstance.For example:
throw new ArithmeticException("An exception occurred.");parses as:
LITERAL_THROW -> throw |--EXPR -> EXPR | `--LITERAL_NEW -> new | |--IDENT -> ArithmeticException | |--LPAREN -> ( | |--ELIST -> ELIST | | `--EXPR -> EXPR | | `--STRING_LITERAL -> "An exception occurred." | `--RPAREN -> ) `--SEMI -> ;
- See Also:
-
LITERAL_ELSE
public static final int LITERAL_ELSETheelsekeyword. This appears as a child of anifstatement.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
public static final int LITERAL_CASEThecasekeyword. 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
public static final int LITERAL_DEFAULTThedefaultkeyword. 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
public static final int LITERAL_TRYThetrykeyword. 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 -> }- See Also:
-
RESOURCE_SPECIFICATION
public static final int RESOURCE_SPECIFICATIONThe Java 7 try-with-resources construct.For example:
try (Foo foo = new Foo(); Bar bar = new Bar()) { }parses as:
LITERAL_TRY -> try |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION | |--LPAREN -> ( | |--RESOURCES -> RESOURCES | | |--RESOURCE -> RESOURCE | | | |--MODIFIERS -> MODIFIERS | | | |--TYPE -> TYPE | | | | `--IDENT -> Foo | | | |--IDENT -> foo | | | `--ASSIGN -> = | | | `--EXPR -> EXPR | | | `--LITERAL_NEW -> new | | | |--IDENT -> Foo | | | |--LPAREN -> ( | | | |--ELIST -> ELIST | | | `--RPAREN -> ) | | |--SEMI -> ; | | `--RESOURCE -> RESOURCE | | |--MODIFIERS -> MODIFIERS | | |--TYPE -> TYPE | | | `--IDENT -> Bar | | |--IDENT -> bar | | `--ASSIGN -> = | | `--EXPR -> EXPR | | `--LITERAL_NEW -> new | | |--IDENT -> Bar | | |--LPAREN -> ( | | |--ELIST -> ELIST | | `--RPAREN -> ) | `--RPAREN -> ) `--SLIST -> { `--RCURLY -> }Also consider:
try (BufferedReader br = new BufferedReader(new FileReader(path))) { }which parses as:
LITERAL_TRY -> try |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION | |--LPAREN -> ( | |--RESOURCES -> RESOURCES | | `--RESOURCE -> RESOURCE | | |--MODIFIERS -> MODIFIERS | | |--TYPE -> TYPE | | | `--IDENT -> BufferedReader | | |--IDENT -> br | | `--ASSIGN -> = | | `--EXPR -> EXPR | | `--LITERAL_NEW -> new | | |--IDENT -> BufferedReader | | |--LPAREN -> ( | | |--ELIST -> ELIST | | | `--EXPR -> EXPR | | | `--LITERAL_NEW -> new | | | |--IDENT -> FileReader | | | |--LPAREN -> ( | | | |--ELIST -> ELIST | | | | `--EXPR -> EXPR | | | | `--IDENT -> path | | | `--RPAREN -> ) | | `--RPAREN -> ) | `--RPAREN -> ) `--SLIST -> { `--RCURLY -> }- See Also:
-
RESOURCES
public static final int RESOURCESA 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
public static final int RESOURCEA resource in the Java 7 try-with-resources construct. This is a child of RESOURCES.For example:
try (Foo foo = new Foo(); Bar bar = new Bar()) { }parses as:
LITERAL_TRY -> try |--RESOURCE_SPECIFICATION -> RESOURCE_SPECIFICATION | |--LPAREN -> ( | |--RESOURCES -> RESOURCES | | |--RESOURCE -> RESOURCE | | | |--MODIFIERS -> MODIFIERS | | | |--TYPE -> TYPE | | | | `--IDENT -> Foo | | | |--IDENT -> foo | | | `--ASSIGN -> = | | | `--EXPR -> EXPR | | | `--LITERAL_NEW -> new | | | |--IDENT -> Foo | | | |--LPAREN -> ( | | | |--ELIST -> ELIST | | | `--RPAREN -> ) | | |--SEMI -> ; | | `--RESOURCE -> RESOURCE | | |--MODIFIERS -> MODIFIERS | | |--TYPE -> TYPE | | | `--IDENT -> Bar | | |--IDENT -> bar | | `--ASSIGN -> = | | `--EXPR -> EXPR | | `--LITERAL_NEW -> new | | |--IDENT -> Bar | | |--LPAREN -> ( | | |--ELIST -> ELIST | | `--RPAREN -> ) | `--RPAREN -> ) `--SLIST -> { `--RCURLY -> }- See Also:
-
LITERAL_CATCH
public static final int LITERAL_CATCHThecatchkeyword.For example:
try { FileReader fr = new FileReader("Test.txt"); } catch (FileNotFoundException e) { }parses as:
LITERAL_TRY -> try |--SLIST -> { | |--VARIABLE_DEF -> VARIABLE_DEF | | |--MODIFIERS -> MODIFIERS | | |--TYPE -> TYPE | | | `--IDENT -> FileReader | | |--IDENT -> fr | | `--ASSIGN -> = | | `--EXPR -> EXPR | | `--LITERAL_NEW -> new | | |--IDENT -> FileReader | | |--LPAREN -> ( | | |--ELIST -> ELIST | | | `--EXPR -> EXPR | | | `--STRING_LITERAL -> "Test.txt" | | `--RPAREN -> ) | |--SEMI -> ; | `--RCURLY -> } `--LITERAL_CATCH -> catch |--LPAREN -> ( |--PARAMETER_DEF -> PARAMETER_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--IDENT -> FileNotFoundException | `--IDENT -> e |--RPAREN -> ) `--SLIST -> { `--RCURLY -> }- See Also:
-
LITERAL_FINALLY
public static final int LITERAL_FINALLYThefinallykeyword.For example:
try {} finally {}parses as:
LITERAL_TRY -> try |--SLIST -> { | `--RCURLY -> } `--LITERAL_FINALLY -> finally `--SLIST -> { `--RCURLY -> }- See Also:
-
PLUS_ASSIGN
public static final int PLUS_ASSIGNThe+=(addition assignment) operator.For example:
a += b;
parses as:
|--EXPR -> EXPR | `--PLUS_ASSIGN -> += | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
MINUS_ASSIGN
public static final int MINUS_ASSIGNThe-=(subtraction assignment) operator.For example:
a -= b;
parses as:
|--EXPR -> EXPR | `--MINUS_ASSIGN -> -= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
STAR_ASSIGN
public static final int STAR_ASSIGNThe*=(multiplication assignment) operator.For example:
a *= b;
parses as:
|--EXPR -> EXPR | `--STAR_ASSIGN -> *= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
DIV_ASSIGN
public static final int DIV_ASSIGNThe/=(division assignment) operator.For example:
a /= b;
parses as:
|--EXPR -> EXPR | `--DIV_ASSIGN -> /= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
MOD_ASSIGN
public static final int MOD_ASSIGNThe%=(remainder assignment) operator.For example:
a %= 2;
parses as:
|--EXPR -> EXPR | `--MOD_ASSIGN -> %= | |--IDENT -> a | `--NUM_INT -> 2 |--SEMI -> ;
- See Also:
-
SR_ASSIGN
public static final int SR_ASSIGNThe>>=(signed right shift assignment) operator.For example:
a >>= b;
parses as:
|--EXPR -> EXPR | `--SR_ASSIGN -> >>= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
BSR_ASSIGN
public static final int BSR_ASSIGNThe>>>=(unsigned right shift assignment) operator.For example:
a >>>= b;
parses as:
|--EXPR -> EXPR | `--BSR_ASSIGN -> >>>= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
SL_ASSIGN
public static final int SL_ASSIGNThe<<=(left shift assignment) operator.- See Also:
-
BAND_ASSIGN
public static final int BAND_ASSIGNThe&=(bitwise AND assignment) operator.For example:
a &= b;
parses as:
|--EXPR -> EXPR | `--BAND_ASSIGN -> &= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
BXOR_ASSIGN
public static final int BXOR_ASSIGNThe^=(bitwise exclusive OR assignment) operator.- See Also:
-
BOR_ASSIGN
public static final int BOR_ASSIGNThe|=(bitwise OR assignment) operator.For example:
a |= b;
parses as:
|--EXPR -> EXPR | `--BOR_ASSIGN -> |= | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
QUESTION
public static final int QUESTIONThe?(conditional) operator. Technically, the colon is also part of this operator, but it appears as a separate token.For example:
String variable=(quantity==1)?"true":"false";
parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--IDENT -> String | |--IDENT -> variable | `--ASSIGN -> = | `--EXPR -> EXPR | `--QUESTION -> ? | |--LPAREN -> ( | |--EQUAL -> == | | |--IDENT -> quantity | | `--NUM_INT -> 1 | |--RPAREN -> ) | |--STRING_LITERAL -> "true" | |--COLON -> : | `--STRING_LITERAL -> "false" |--SEMI -> ;
- See Also:
-
LOR
public static final int LORThe||(conditional OR) operator.For example:
if (a || b) { }parses as:
LITERAL_IF -> if |--LPAREN -> ( |--EXPR -> EXPR | `--LOR -> || | |--IDENT -> a | `--IDENT -> b |--RPAREN -> ) |--SLIST -> { | |--RCURLY -> }- See Also:
-
LAND
public static final int LANDThe&&(conditional AND) operator.For example:
if (a && b) { }parses as:
LITERAL_IF -> if |--LPAREN -> ( |--EXPR -> EXPR | `--LAND -> && | |--IDENT -> a | `--IDENT -> b |--RPAREN -> ) |--SLIST -> { | |--RCURLY -> }- See Also:
-
BOR
public static final int BORThe|(bitwise OR) operator.For example:
a = a | b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--BOR -> | | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
BXOR
public static final int BXORThe^(bitwise exclusive OR) operator.- See Also:
-
BAND
public static final int BANDThe&(bitwise AND) operator.For example:
c = a & b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--BAND -> & | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
NOT_EQUAL
public static final int NOT_EQUALThe!=(not equal) operator.For example:
a != b;
parses as:
|--EXPR -> EXPR | `--NOT_EQUAL -> != | |--IDENT -> a | `--IDENT -> b `--SEMI -> ;
- See Also:
-
EQUAL
public static final int EQUALThe==(equal) operator.For example:
return a == b;
parses as:
|--EXPR -> EXPR | `--EQUAL -> == | |--IDENT -> a | `--IDENT -> b `--SEMI -> ;
- See Also:
-
LT
public static final int LTThe<(less than) operator.For example:
c = a < b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--LT -> < | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
GT
public static final int GTThe>(greater than) operator.For example:
c = a > b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--BAND -> > | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
LE
public static final int LEThe<=(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
public static final int GEThe>=(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
public static final int LITERAL_INSTANCEOFTheinstanceofoperator. The first child is an object reference or something that evaluates to an object reference. The second child is a reference type or pattern.For example:
boolean isBuilderReferenceType = text instanceof StringBuilder; // reference type boolean isBuilderPatternWithPattern = text instanceof StringBuilder s; // type pattern, no `PATTERN_DEF` boolean isBuilderEmpty = text instanceof (StringBuilder sb && sb.isEmpty()); // guarded pattern, `PATTERN_DEF`parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_BOOLEAN -> boolean | |--IDENT -> isBuilderReferenceType | `--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_INSTANCEOF -> instanceof | |--IDENT -> text | `--TYPE -> TYPE | `--IDENT -> StringBuilder |--SEMI -> ; |--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_BOOLEAN -> boolean | |--IDENT -> isBuilderPatternWithPattern | `--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_INSTANCEOF -> instanceof | |--IDENT -> text | `--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--IDENT -> StringBuilder | `--IDENT -> s |--SEMI -> ; |--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_BOOLEAN -> boolean | |--IDENT -> isBuilderEmpty | `--ASSIGN -> = | `--EXPR -> EXPR | `--LITERAL_INSTANCEOF -> instanceof | |--IDENT -> text | `--PATTERN_DEF -> PATTERN_DEF | `--LPAREN -> ( | |--LAND -> && | | |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF | | | |--MODIFIERS -> MODIFIERS | | | |--TYPE -> TYPE | | | | `--IDENT -> StringBuilder | | | `--IDENT -> sb | | `--METHOD_CALL -> ( | | |--DOT -> . | | | |--IDENT -> sb | | | `--IDENT -> isEmpty | | |--ELIST -> ELIST | | `--RPAREN -> ) | `--RPAREN -> ) `--SEMI -> ;
- See Also:
-
SL
public static final int SLThe<<(shift left) operator.For example:
a = a << b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--SR -> << | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
SR
public static final int SRThe>>(signed shift right) operator.For example:
a = a >> b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--SR -> >> | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
BSR
public static final int BSRThe>>>(unsigned shift right) operator.For example:
a >>> b;
parses as:
|--EXPR -> EXPR | `--BSR -> >>> | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
PLUS
public static final int PLUSThe+(addition) operator.For example:
c = a + b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--PLUS -> + | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
MINUS
public static final int MINUSThe-(subtraction) operator.For example:
c = a - b;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--MINUS -> - | |--IDENT -> a | `--IDENT -> b |--SEMI -> ;
- See Also:
-
DIV
public static final int DIVThe/(division) operator.For example:
a = 4 / 2;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--DIV -> / | |--NUM_INT -> 4 | `--NUM_INT -> 2 |--SEMI -> ;
- See Also:
-
MOD
public static final int MODThe%(remainder) operator.For example:
c = a % b;
parses as:
EXPR -> EXPR `--ASSIGN -> = |--IDENT -> c `--MOD -> % |--IDENT -> a `--IDENT -> b SEMI -> ;- See Also:
-
INC
public static final int INCThe++(prefix increment) operator.For example:
++a;
parses as:
|--EXPR -> EXPR | `--INC -> ++ | `--IDENT -> a |--SEMI -> ;
- See Also:
-
DEC
public static final int DECThe--(prefix decrement) operator.For example:
--a;
parses as:
|--EXPR -> EXPR | `--DEC -> -- | `--IDENT -> a |--SEMI -> ;
- See Also:
-
BNOT
public static final int BNOTThe~(bitwise complement) operator.For example:
a = ~ a;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--BNOT -> ~ | `--IDENT -> a |--SEMI -> ;
- See Also:
-
LNOT
public static final int LNOTThe!(logical complement) operator.For example:
c = ! a;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> c | `--LNOT -> ! | `--IDENT -> a |--SEMI -> ;
- See Also:
-
LITERAL_TRUE
public static final int LITERAL_TRUEThetruekeyword.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 -> ;
- See Also:
-
LITERAL_FALSE
public static final int LITERAL_FALSEThefalsekeyword.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 -> ;
- See Also:
-
LITERAL_NULL
public static final int LITERAL_NULLThenullkeyword.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 -> ;
- See Also:
-
LITERAL_NEW
public static final int LITERAL_NEWThenewkeyword. This element is used to define new instances of objects, new arrays, and new anonymous inner classes.For example:
new ArrayList(50)
parses as:
LITERAL_NEW -> new |--IDENT -> ArrayList |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS | |--GENERIC_START -> < | `--GENERIC_END -> > |--LPAREN -> ( |--ELIST -> ELIST | `--EXPR -> EXPR | `--NUM_INT -> 50 `--RPAREN -> )
For example:
new float[] { 3.0f, 4.0f };parses as:
+--LITERAL_NEW (new) | +--LITERAL_FLOAT (float) +--ARRAY_DECLARATOR ([) +--ARRAY_INIT ({) | +--EXPR | +--NUM_FLOAT (3.0f) +--COMMA (,) +--EXPR | +--NUM_FLOAT (4.0f) +--RCURLY (})For example:
new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".java"); } }parses as:
+--LITERAL_NEW (new) | +--IDENT (FilenameFilter) +--LPAREN (() +--ELIST +--RPAREN ()) +--OBJBLOCK | +--LCURLY ({) +--METHOD_DEF | +--MODIFIERS | +--LITERAL_PUBLIC (public) +--TYPE | +--LITERAL_BOOLEAN (boolean) +--IDENT (accept) +--PARAMETERS | +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--IDENT (File) +--IDENT (dir) +--COMMA (,) +--PARAMETER_DEF | +--MODIFIERS +--TYPE | +--IDENT (String) +--IDENT (name) +--SLIST ({) | +--LITERAL_RETURN (return) | +--EXPR | +--METHOD_CALL (() | +--DOT (.) | +--IDENT (name) +--IDENT (endsWith) +--ELIST | +--EXPR | +--STRING_LITERAL (".java") +--RPAREN ()) +--SEMI (;) +--RCURLY (}) +--RCURLY (})- See Also:
-
NUM_INT
public static final int NUM_INTAn 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 -> ;
- See Also:
-
CHAR_LITERAL
public static final int CHAR_LITERALA 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 -> ;- See Also:
-
STRING_LITERAL
public static final int STRING_LITERALA string literal. This is a sequence of (possibly escaped) characters enclosed in double quotes.For example:
String str = "StringLiteral";
parses as:
|--VARIABLE_DEF -> VARIABLE_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--IDENT -> String | |--IDENT -> str | `--ASSIGN -> = | `--EXPR -> EXPR | `--STRING_LITERAL -> "StringLiteral" |--SEMI -> ;
- See Also:
-
NUM_FLOAT
public static final int NUM_FLOATA single precision floating point literal. This is a floating point number with anForfsuffix.For example:
a = 3.14f;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_FLOAT -> 3.14f |--SEMI -> ;
- See Also:
-
NUM_LONG
public static final int NUM_LONGA long integer literal. These are almost the same as integer literals, but they have anLorl(ell) suffix.For example:
a = 3l;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_LONG -> 3l |--SEMI -> ;
- See Also:
-
NUM_DOUBLE
public static final int NUM_DOUBLEA double precision floating point literal. This is a floating point number with an optionalDordsuffix.For example:
a = 3.14d;
parses as:
|--EXPR -> EXPR | `--ASSIGN -> = | |--IDENT -> a | `--NUM_DOUBLE -> 3.14d |--SEMI -> ;
- See Also:
-
LITERAL_ASSERT
public static final int LITERAL_ASSERTTheassertkeyword. 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
public static final int STATIC_IMPORTA 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
public static final int ENUM_DEFAn enum declaration. Its notable children are enum constant declarations followed by any construct that may be expected in a class body.For example:
public enum MyEnum implements Serializable { FIRST_CONSTANT, SECOND_CONSTANT; public void someMethod() { } }parses as:
ENUM_DEF -> ENUM_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--ENUM -> enum |--IDENT -> MyEnum |--IMPLEMENTS_CLAUSE -> implements | `--IDENT -> Serializable `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { |--ENUM_CONSTANT_DEF -> ENUM_CONSTANT_DEF | |--ANNOTATIONS -> ANNOTATIONS | `--IDENT -> FIRST_CONSTANT |--COMMA -> , |--ENUM_CONSTANT_DEF -> ENUM_CONSTANT_DEF | |--ANNOTATIONS -> ANNOTATIONS | `--IDENT -> SECOND_CONSTANT |--SEMI -> ; |--METHOD_DEF -> METHOD_DEF | |--MODIFIERS -> MODIFIERS | | `--LITERAL_PUBLIC -> public | |--TYPE -> TYPE | | `--LITERAL_VOID -> void | |--IDENT -> someMethod | |--LPAREN -> ( | |--PARAMETERS -> PARAMETERS | |--RPAREN -> ) | `--SLIST -> { | `--RCURLY -> } `--RCURLY -> }- See Also:
-
ENUM
public static final int ENUMTheenumkeyword. This element appears as part of an enum declaration.For example:
public enum Count {}parses as:
ENUM_DEF -> ENUM_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--ENUM -> enum |--IDENT -> Count `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }- See Also:
-
ENUM_CONSTANT_DEF
public static final int ENUM_CONSTANT_DEFAn enum constant declaration. Its notable children are annotations, arguments and object block akin to an anonymous inner class' body.For example:
SOME_CONSTANT(1) { public void someMethodOverriddenFromMainBody() { } }parses as:
ENUM_CONSTANT_DEF -> ENUM_CONSTANT_DEF | |--ANNOTATIONS -> ANNOTATIONS | |--IDENT -> SOME_CONSTANT | |--LPAREN -> ( | |--ELIST -> ELIST | | `--EXPR -> EXPR | | `--NUM_INT -> 1 | |--RPAREN -> ) | `--OBJBLOCK -> OBJBLOCK | |--LCURLY -> { | |--METHOD_DEF -> METHOD_DEF | | |--MODIFIERS -> MODIFIERS | | | `--LITERAL_PUBLIC -> public | | |--TYPE -> TYPE | | | `--LITERAL_VOID -> void | | |--IDENT -> someMethodOverriddenFromMainBody | | |--LPAREN -> ( | | |--PARAMETERS -> PARAMETERS | | |--RPAREN -> ) | | `--SLIST -> { | | `--RCURLY -> } | `--RCURLY -> }- See Also:
-
FOR_EACH_CLAUSE
public static final int FOR_EACH_CLAUSEA 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
public static final int ANNOTATION_DEFAn annotation declaration. The notable children are the name of the annotation type, annotation field declarations and (constant) fields.For example:
public @interface MyAnnotation { int someValue(); }parses as:
ANNOTATION_DEF -> ANNOTATION_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--AT -> @ |--LITERAL_INTERFACE -> interface |--IDENT -> MyAnnotation `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { |--ANNOTATION_FIELD_DEF -> ANNOTATION_FIELD_DEF | |--MODIFIERS -> MODIFIERS | |--TYPE -> TYPE | | `--LITERAL_INT -> int | |--IDENT -> someValue | |--LPAREN -> ( | |--RPAREN -> ) | `--SEMI -> ; `--RCURLY -> }- See Also:
-
ANNOTATION_FIELD_DEF
public static final int ANNOTATION_FIELD_DEFAn 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 by 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
public static final int ANNOTATIONSA 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 aMODIFIERSnode.For example:
@MyAnnotation package blah;parses as:
PACKAGE_DEF -> package |--ANNOTATIONS -> ANNOTATIONS | `--ANNOTATION -> ANNOTATION | |--AT -> @ | `--IDENT -> MyAnnotation |--IDENT -> blah `--SEMI -> ;
- See Also:
-
ANNOTATION
public static final int ANNOTATIONAn annotation of a package, type, field, parameter or variable. An annotation may occur anywhere modifiers occur (it is a type of modifier) and may also occur prior to a package definition. The notable children are: The annotation name and either a single default annotation value or a sequence of name value pairs. Annotation values may also be annotations themselves.For example:
@MyAnnotation(someField1 = "Hello", someField2 = @SomeOtherAnnotation)parses as:
ANNOTATION -> ANNOTATION |--AT -> @ |--IDENT -> MyAnnotation |--LPAREN -> ( |--ANNOTATION_MEMBER_VALUE_PAIR -> ANNOTATION_MEMBER_VALUE_PAIR | |--IDENT -> someField1 | |--ASSIGN -> = | `--EXPR -> EXPR | `--STRING_LITERAL -> "Hello" |--COMMA -> , |--ANNOTATION_MEMBER_VALUE_PAIR -> ANNOTATION_MEMBER_VALUE_PAIR | |--IDENT -> someField2 | |--ASSIGN -> = | `--ANNOTATION -> ANNOTATION | |--AT -> @ | `--IDENT -> SomeOtherAnnotation `--RPAREN -> )
- See Also:
-
ANNOTATION_MEMBER_VALUE_PAIR
public static final int ANNOTATION_MEMBER_VALUE_PAIRAn 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
public static final int ANNOTATION_ARRAY_INITAn annotation array member initialization. Initializers can not be nested. An initializer may be present as a default to an annotation member, as the single default value to an annotation (e.g. @Annotation({1,2})) or as the value of an annotation member value pair.For example:
@Annotation({1, 2})parses as:
ANNOTATION -> ANNOTATION |--AT -> @ |--IDENT -> Annotation |--LPAREN -> ( |--ANNOTATION_ARRAY_INIT -> { | |--EXPR -> EXPR | | `--NUM_INT -> 1 | |--COMMA -> , | |--EXPR -> EXPR | | `--NUM_INT -> 2 | `--RCURLY -> } `--RPAREN -> )- See Also:
-
TYPE_PARAMETERS
public static final int TYPE_PARAMETERSA list of type parameters to a class, interface or method definition. Children are LT, at least one TYPE_PARAMETER, zero or more of: a COMMAs followed by a single TYPE_PARAMETER and a final GT.For example:
public class MyClass<A, B> { }parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--LITERAL_CLASS -> class |--IDENT -> MyClass |--TYPE_PARAMETERS -> TYPE_PARAMETERS | |--GENERIC_START -> < | |--TYPE_PARAMETER -> TYPE_PARAMETER | | `--IDENT -> A | |--COMMA -> , | |--TYPE_PARAMETER -> TYPE_PARAMETER | | `--IDENT -> B | `--GENERIC_END -> > `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }- See Also:
-
TYPE_PARAMETER
public static final int TYPE_PARAMETERA type parameter to a class, interface or method definition. Children are the type name and an optional TYPE_UPPER_BOUNDS.For example:
public class MyClass <A extends Collection> { }parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--LITERAL_CLASS -> class |--IDENT -> MyClass |--TYPE_PARAMETERS -> TYPE_PARAMETERS | |--GENERIC_START -> < | |--TYPE_PARAMETER -> TYPE_PARAMETER | | |--IDENT -> A | | `--TYPE_UPPER_BOUNDS -> extends | | `--IDENT -> Collection | `--GENERIC_END -> > `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }- See Also:
-
TYPE_ARGUMENTS
public static final int TYPE_ARGUMENTSA list of type arguments to a type reference or a method/ctor invocation. Children are GENERIC_START, at least one TYPE_ARGUMENT, zero or more of a COMMAs followed by a single TYPE_ARGUMENT, and a final GENERIC_END.For example:
public Collection<?> a;parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS | `--LITERAL_PUBLIC -> public |--TYPE -> TYPE | |--IDENT -> Collection | `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS | |--GENERIC_START -> < | |--TYPE_ARGUMENT -> TYPE_ARGUMENT | | `--WILDCARD_TYPE -> ? | `--GENERIC_END -> > |--IDENT -> a `--SEMI -> ;
- See Also:
-
TYPE_ARGUMENT
public static final int TYPE_ARGUMENTA type arguments to a type reference or a method/ctor invocation. Children are either: type name or wildcard type with possible type upper or lower bounds.For example:
List<? super List> list;
parses as:
VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | |--IDENT -> List | `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS | |--GENERIC_START -> < | |--TYPE_ARGUMENT -> TYPE_ARGUMENT | | |--WILDCARD_TYPE -> ? | | `--TYPE_LOWER_BOUNDS -> super | | `--IDENT -> List | `--GENERIC_END -> > |--IDENT -> list `--SEMI -> ;
- See Also:
-
WILDCARD_TYPE
public static final int WILDCARD_TYPEThe 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 -> ;
- See Also:
-
TYPE_UPPER_BOUNDS
public static final int TYPE_UPPER_BOUNDSAn upper bounds on a wildcard type argument or type parameter. This node has one child - the type that is being used for the bounding.For example:
List<? extends Number> list;
parses as:
--VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | |--IDENT -> List | `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS | |--GENERIC_START -> < | |--TYPE_ARGUMENT -> TYPE_ARGUMENT | | |--WILDCARD_TYPE -> ? | | `--TYPE_UPPER_BOUNDS -> extends | | `--IDENT -> Number | `--GENERIC_END -> > |--IDENT -> list `--SEMI -> ;
- See Also:
-
TYPE_LOWER_BOUNDS
public static final int TYPE_LOWER_BOUNDSA lower bounds on a wildcard type argument. This node has one child - the type that is being used for the bounding.For example:
List<? super Integer> list;
parses as:
--VARIABLE_DEF -> VARIABLE_DEF |--MODIFIERS -> MODIFIERS |--TYPE -> TYPE | |--IDENT -> List | `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS | |--GENERIC_START -> < | |--TYPE_ARGUMENT -> TYPE_ARGUMENT | | |--WILDCARD_TYPE -> ? | | `--TYPE_LOWER_BOUNDS -> super | | `--IDENT -> Integer | `--GENERIC_END -> > |--IDENT -> list `--SEMI -> ;- See Also:
-
AT
public static final int ATAn@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
public static final int ELLIPSISA 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
public static final int TYPE_EXTENSION_ANDThe&symbol when used to extend a generic upper or lower bounds constrain or a type cast expression with an additional interface.Generic type bounds extension:
class Comparable<T extends Serializable & CharSequence>CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS |--LITERAL_CLASS -> class |--IDENT -> Comparable |--TYPE_PARAMETERS -> TYPE_PARAMETERS |--GENERIC_START -> < |--TYPE_PARAMETER -> TYPE_PARAMETER | |--IDENT -> T | `--TYPE_UPPER_BOUNDS -> extends | |--IDENT -> Serializable | |--TYPE_EXTENSION_AND -> & | `--IDENT -> CharSequence `--GENERIC_END -> >Type cast extension:
return (Serializable & CharSequence) null;--LITERAL_RETURN -> return |--EXPR -> EXPR | `--TYPECAST -> ( | |--TYPE -> TYPE | | `--IDENT -> Serializable | |--TYPE_EXTENSION_AND -> & | |--TYPE -> TYPE | | `--IDENT -> CharSequence | |--RPAREN -> ) | `--LITERAL_NULL -> null `--SEMI -> ;- See Also:
-
GENERIC_START
public static final int GENERIC_STARTA<symbol signifying the start of type arguments or type parameters.For example:
class Test<T> {}parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS |--LITERAL_CLASS -> class |--IDENT -> Test |--TYPE_PARAMETERS -> TYPE_PARAMETERS | |--GENERIC_START -> < | |--TYPE_PARAMETER -> TYPE_PARAMETER | | `--IDENT -> T | `--GENERIC_END -> > `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }- See Also:
-
GENERIC_END
public static final int GENERIC_ENDA>symbol signifying the end of type arguments or type parameters.For example:
class Test<T> {}parses as:
CLASS_DEF -> CLASS_DEF |--MODIFIERS -> MODIFIERS |--LITERAL_CLASS -> class |--IDENT -> Test |--TYPE_PARAMETERS -> TYPE_PARAMETERS | |--GENERIC_START -> < | |--TYPE_PARAMETER -> TYPE_PARAMETER | | `--IDENT -> T | `--GENERIC_END -> > `--OBJBLOCK -> OBJBLOCK |--LCURLY -> { `--RCURLY -> }- See Also:
-
LAMBDA
public static final int LAMBDASpecial 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
public static final int SINGLE_LINE_COMMENTBeginning of single line comment: '//'.+--SINGLE_LINE_COMMENT | +--COMMENT_CONTENTFor example:
// Comment content
parses as:
SINGLE_LINE_COMMENT -> // `--COMMENT_CONTENT -> Comment Content\n
- See Also:
-
BLOCK_COMMENT_BEGIN
public static final int BLOCK_COMMENT_BEGINBeginning 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
public static final int BLOCK_COMMENT_ENDEnd of block comment: '*/'.For example:
/*comment*/
parses as:
BLOCK_COMMENT_BEGIN -> /* |--COMMENT_CONTENT -> comment `--BLOCK_COMMENT_END -> */
- See Also:
-
COMMENT_CONTENT
public static final int COMMENT_CONTENTText 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
public static final int PATTERN_VARIABLE_DEFA 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
public static final int LITERAL_RECORDTherecordkeyword. 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
public static final int RECORD_DEFA 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
public static final int RECORD_COMPONENTSRecord 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
public static final int RECORD_COMPONENT_DEFA 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
public static final int COMPACT_CTOR_DEFA 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
public static final int TEXT_BLOCK_LITERAL_BEGINBeginning of a Java 14 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 -> \r\n Hello, world!\r\n | `--TEXT_BLOCK_LITERAL_END -> """ |--SEMI -> ;
- Since:
- 8.36
- See Also:
-
TEXT_BLOCK_CONTENT
public static final int TEXT_BLOCK_CONTENTContent of a Java 14 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
public static final int TEXT_BLOCK_LITERAL_ENDEnd of a Java 14 text block literal, delimited by three double quotes.For example:
String hello = """ Hello, world! """;parses as:
|--VARIABLE_DEF | |--MODIFIERS | |--TYPE | | `--IDENT (String) | |--IDENT (hello) | |--ASSIGN (=) | | `--EXPR | | `--TEXT_BLOCK_LITERAL_BEGIN (""") | | |--TEXT_BLOCK_CONTENT (\n Hello, world!\n ) | | `--TEXT_BLOCK_LITERAL_END (""") | `--SEMI (;)- Since:
- 8.36
- See Also:
-
LITERAL_YIELD
public static final int LITERAL_YIELDTheyieldkeyword. 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
public static final int SWITCH_RULESwitch Expressions.For example:
return switch (day) { case SAT, SUN -> "Weekend"; default -> "Working day"; };parses as:
LITERAL_RETURN -> return |--EXPR -> EXPR | `--LITERAL_SWITCH -> switch | |--LPAREN -> ( | |--EXPR -> EXPR | | `--IDENT -> day | |--RPAREN -> ) | |--LCURLY -> { | |--SWITCH_RULE -> SWITCH_RULE | | |--LITERAL_CASE -> case | | | |--EXPR -> EXPR | | | | `--IDENT -> SAT | | | |--COMMA -> , | | | `--EXPR -> EXPR | | | `--IDENT -> SUN | | |--LAMBDA -> -> | | |--EXPR -> EXPR | | | `--STRING_LITERAL -> "Weekend" | | `--SEMI -> ; | |--SWITCH_RULE -> SWITCH_RULE | | |--LITERAL_DEFAULT -> default | | |--LAMBDA -> -> | | |--EXPR -> EXPR | | | `--STRING_LITERAL -> "Working day" | | `--SEMI -> ; | `--RCURLY -> } `--SEMI -> ;- Since:
- 8.36
- See Also:
-
LITERAL_NON_SEALED
public static final int LITERAL_NON_SEALEDThenon-sealedkeyword. 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
public static final int LITERAL_SEALEDThesealedrestricted 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
public static final int LITERAL_PERMITSThepermitsrestricted 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
public static final int PERMITS_CLAUSEA 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
public static final int PATTERN_DEFA 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 && 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 | | | | `--LAND -> && | | | | |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF | | | | | |--MODIFIERS -> MODIFIERS | | | | | |--TYPE -> TYPE | | | | | | `--IDENT -> String | | | | | `--IDENT -> s | | | | `--GT -> > | | | | |--METHOD_CALL -> ( | | | | | |--DOT -> . | | | | | | |--IDENT -> s | | | | | | `--IDENT -> length | | | | | |--ELIST -> ELIST | | | | | `--RPAREN -> ) | | | | `--NUM_INT -> 4 | | | `--COLON -> : | | `--SLIST -> SLIST | | `--LITERAL_BREAK -> break | | `--SEMI -> ; | |--CASE_GROUP -> CASE_GROUP | | |--LITERAL_CASE -> case | | | |--PATTERN_VARIABLE_DEF -> PATTERN_VARIABLE_DEF | | | | |--MODIFIERS -> MODIFIERS | | | | |--TYPE -> TYPE | | | | | `--IDENT -> String | | | | `--IDENT -> s | | | `--COLON -> : | | `--SLIST -> SLIST | | `--LITERAL_BREAK -> break | | `--SEMI -> ; | `--RCURLY -> } `--RCURLY -> }- Since:
- 9.3
- See Also:
-
-
Constructor Details
-
TokenTypes
private TokenTypes()Prevent instantiation.
-