ABSTRACT
public static final int ABSTRACT
The abstract
keyword.
- 40
MODIFIERS
ARRAY_DECLARATOR
public static final int ARRAY_DECLARATOR
An array declaration.
If the array declaration represents a type, then the type of
the array elements is the first child. Multidimensional arrays
may be regarded as arrays of arrays. In other words, the first
child of the array declaration is another array
declaration.
For example:
int[] x;
parses as:
+--VARIABLE_DEF
|
+--MODIFIERS
+--TYPE
|
+--ARRAY_DECLARATOR ([)
|
+--LITERAL_INT (int)
+--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.
- 17
Java
Language Specification Chapter 10
, TYPE
, ARRAY_INIT
ARRAY_INIT
public static final int ARRAY_INIT
An array initialization. This may occur as part of an array
declaration or inline with
new
.
For example:
int[] y =
{
1,
2,
};
parses as:
+--VARIABLE_DEF
|
+--MODIFIERS
+--TYPE
|
+--ARRAY_DECLARATOR ([)
|
+--LITERAL_INT (int)
+--IDENT (y)
+--ASSIGN (=)
|
+--ARRAY_INIT ({)
|
+--EXPR
|
+--NUM_INT (1)
+--COMMA (,)
+--EXPR
|
+--NUM_INT (2)
+--COMMA (,)
+--RCURLY (})
+--SEMI (;)
Also consider:
int[] z = new int[]
{
1,
2,
};
which parses as:
+--VARIABLE_DEF
|
+--MODIFIERS
+--TYPE
|
+--ARRAY_DECLARATOR ([)
|
+--LITERAL_INT (int)
+--IDENT (z)
+--ASSIGN (=)
|
+--EXPR
|
+--LITERAL_NEW (new)
|
+--LITERAL_INT (int)
+--ARRAY_DECLARATOR ([)
+--ARRAY_INIT ({)
|
+--EXPR
|
+--NUM_INT (1)
+--COMMA (,)
+--EXPR
|
+--NUM_INT (2)
+--COMMA (,)
+--RCURLY (})
- 29
ARRAY_DECLARATOR
, TYPE
, LITERAL_NEW
, COMMA
CASE_GROUP
public static final int CASE_GROUP
A group of case clauses. Case clauses with no associated
statements are grouped together into a case group. The last
child is a statement list containing the statements to execute
upon a match.
For example:
case 0:
case 1:
case 2:
x = 3;
break;
parses as:
+--CASE_GROUP
|
+--LITERAL_CASE (case)
|
+--EXPR
|
+--NUM_INT (0)
+--LITERAL_CASE (case)
|
+--EXPR
|
+--NUM_INT (1)
+--LITERAL_CASE (case)
|
+--EXPR
|
+--NUM_INT (2)
+--SLIST
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (x)
+--NUM_INT (3)
+--SEMI (;)
+--LITERAL_BREAK (break)
|
+--SEMI (;)
- 33
LITERAL_CASE
, LITERAL_DEFAULT
, LITERAL_SWITCH
COLON
public static final int COLON
The :
(colon) operator. This will appear as part
of the conditional operator (? :
).
- 82
QUESTION
, LABELED_STAT
, CASE_GROUP
CTOR_CALL
public static final int CTOR_CALL
A constructor call.
For example:
this(1);
parses as:
+--CTOR_CALL (()
|
+--ELIST
|
+--EXPR
|
+--NUM_INT (1)
+--RPAREN ())
+--SEMI (;)
- 43
ELIST
, RPAREN
, SEMI
, SUPER_CTOR_CALL
CTOR_DEF
public static final int CTOR_DEF
A constructor declaration.
For example:
public SpecialEntry(int value, String text)
{
this.value = value;
this.text = text;
}
parses as:
+--CTOR_DEF
|
+--MODIFIERS
|
+--LITERAL_PUBLIC (public)
+--IDENT (SpecialEntry)
+--LPAREN (()
+--PARAMETERS
|
+--PARAMETER_DEF
|
+--MODIFIERS
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (value)
+--COMMA (,)
+--PARAMETER_DEF
|
+--MODIFIERS
+--TYPE
|
+--IDENT (String)
+--IDENT (text)
+--RPAREN ())
+--SLIST ({)
|
+--EXPR
|
+--ASSIGN (=)
|
+--DOT (.)
|
+--LITERAL_THIS (this)
+--IDENT (value)
+--IDENT (value)
+--SEMI (;)
+--EXPR
|
+--ASSIGN (=)
|
+--DOT (.)
|
+--LITERAL_THIS (this)
+--IDENT (text)
+--IDENT (text)
+--SEMI (;)
+--RCURLY (})
- 8
OBJBLOCK
, CLASS_DEF
DOT
public static final int DOT
The .
(dot) operator.
- 59
FullIdent
EOF
public static final int EOF
The end of file token. This is the root node for the source
file. It's children are an optional package definition, zero
or more import statements, and one or more class or interface
definitions.
- 1
PACKAGE_DEF
, IMPORT
, CLASS_DEF
, INTERFACE_DEF
EQUAL
public static final int EQUAL
The ==
(equal) operator.
- 116
EXPR
EXPR
public static final int EXPR
An expression. Operators with lower precedence appear at a
higher level in the tree than operators with higher precedence.
Parentheses are siblings to the operator they enclose.
For example:
x = 4 + 3 * 5 + (30 + 26) / 4 + 5 % 4 + (1<<3);
parses as:
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (x)
+--PLUS (+)
|
+--PLUS (+)
|
+--PLUS (+)
|
+--PLUS (+)
|
+--NUM_INT (4)
+--STAR (*)
|
+--NUM_INT (3)
+--NUM_INT (5)
+--DIV (/)
|
+--LPAREN (()
+--PLUS (+)
|
+--NUM_INT (30)
+--NUM_INT (26)
+--RPAREN ())
+--NUM_INT (4)
+--MOD (%)
|
+--NUM_INT (5)
+--NUM_INT (4)
+--LPAREN (()
+--SL (<<)
|
+--NUM_INT (1)
+--NUM_INT (3)
+--RPAREN ())
+--SEMI (;)
- 28
ELIST
, ASSIGN
, LPAREN
, RPAREN
EXTENDS_CLAUSE
public static final int EXTENDS_CLAUSE
An extends clause. This appear as part of class and interface
definitions. This element appears even if the
extends
keyword is not explicitly used. The child
is an optional identifier.
For example:
parses as:
+--EXTENDS_CLAUSE
|
+--DOT (.)
|
+--DOT (.)
|
+--IDENT (java)
+--IDENT (util)
+--IDENT (LinkedList)
- 18
IDENT
, DOT
, CLASS_DEF
, INTERFACE_DEF
, FullIdent
FINAL
public static final int FINAL
The final
keyword.
- 39
MODIFIERS
FOR_CONDITION
public static final int FOR_CONDITION
A for loop condition. This is a child of
LITERAL_FOR
. The child of this element is an
optional expression.
- 36
EXPR
, LITERAL_FOR
FOR_INIT
public static final int FOR_INIT
A for loop initializer. This is a child of
LITERAL_FOR
. The children of this element may be
a comma separated list of variable declarations, an expression
list, or empty.
- 35
VARIABLE_DEF
, ELIST
, LITERAL_FOR
FOR_ITERATOR
public static final int FOR_ITERATOR
A for loop iterator. This is a child of
LITERAL_FOR
. The child of this element is an
optional expression list.
- 37
ELIST
, LITERAL_FOR
GE
public static final int GE
The >=
(greater than or equal) operator.
- 120
EXPR
GT
public static final int GT
The >
(greater than) operator.
- 118
EXPR
IDENT
public static final int IDENT
An identifier. These can be names of types, subpackages,
fields, methods, parameters, and local variables.
- 58
IMPLEMENTS_CLAUSE
public static final int IMPLEMENTS_CLAUSE
An implements clause. This always appears in a class
declaration, even if there are no implemented interfaces. The
children are a comma separated list of zero or more
identifiers.
For example:
implements Serializable, Comparable
parses as:
+--IMPLEMENTS_CLAUSE
|
+--IDENT (Serializable)
+--COMMA (,)
+--IDENT (Comparable)
- 19
IDENT
, DOT
, COMMA
, CLASS_DEF
IMPORT
public static final int IMPORT
An import declaration. Import declarations are option, but
must appear after the package declaration and before the type
declaration.
For example:
import java.io.IOException;
parses as:
+--IMPORT (import)
|
+--DOT (.)
|
+--DOT (.)
|
+--IDENT (java)
+--IDENT (io)
+--IDENT (IOException)
+--SEMI (;)
- 30
Java
Language Specification §7.5
, DOT
, IDENT
, STAR
, SEMI
, FullIdent
INDEX_OP
public static final int INDEX_OP
The array index operator.
For example:
ar[2] = 5;
parses as:
+--EXPR
|
+--ASSIGN (=)
|
+--INDEX_OP ([)
|
+--IDENT (ar)
+--EXPR
|
+--NUM_INT (2)
+--NUM_INT (5)
+--SEMI (;)
- 24
EXPR
INSTANCE_INIT
public static final int INSTANCE_INIT
An instance initializer. Zero or more instance initializers
may appear in class definitions. This token will be a child of
the object block in either a normal or anonymous inner class.
- 11
Java
Language Specification§8.6
, SLIST
, OBJBLOCK
INTERFACE_DEF
public static final int INTERFACE_DEF
An interface declaration.
For example:
public interface MyInterface
{
}
parses as:
+--INTERFACE_DEF
|
+--MODIFIERS
|
+--LITERAL_PUBLIC (public)
+--LITERAL_INTERFACE (interface)
+--IDENT (MyInterface)
+--EXTENDS_CLAUSE
+--OBJBLOCK
|
+--LCURLY ({)
+--RCURLY (})
- 15
Java
Language Specification, Chapter 9
, MODIFIERS
, IDENT
, EXTENDS_CLAUSE
, OBJBLOCK
LABELED_STAT
public static final int LABELED_STAT
A labeled statement.
For example:
outside: ;
parses as:
+--LABELED_STAT (:)
|
+--IDENT (outside)
+--EMPTY_STAT (;)
- 22
Java
Language Specification, §14.7
, SLIST
LE
public static final int LE
The <=
(less than or equal) operator.
- 119
EXPR
LITERAL_ASSERT
public static final int LITERAL_ASSERT
The
assert
keyword. This is only for Java 1.4 and
later.
For example:
assert(x==4);
parses as:
+--LITERAL_ASSERT (assert)
|
+--EXPR
|
+--LPAREN (()
+--EQUAL (==)
|
+--IDENT (x)
+--NUM_INT (4)
+--RPAREN ())
+--SEMI (;)
- 151
LITERAL_BOOLEAN
public static final int LITERAL_BOOLEAN
The boolean
keyword.
- 50
TYPE
LITERAL_BREAK
public static final int LITERAL_BREAK
The break
keyword. The first child is an optional
identifier and the last child is a semicolon.
- 87
IDENT
, SEMI
, SLIST
LITERAL_BYTE
public static final int LITERAL_BYTE
The byte
keyword.
- 51
TYPE
LITERAL_CASE
public static final int LITERAL_CASE
The case
keyword. The first child is a constant
expression that evaluates to a integer.
- 93
CASE_GROUP
, EXPR
LITERAL_CHAR
public static final int LITERAL_CHAR
The char
keyword.
- 52
TYPE
LITERAL_CLASS
public static final int LITERAL_CLASS
The
class
keyword. This element appears both
as part of a class declaration, and inline to reference a
class object.
For example:
int.class
parses as:
+--EXPR
|
+--DOT (.)
|
+--LITERAL_INT (int)
+--LITERAL_CLASS (class)
- 69
DOT
, IDENT
, CLASS_DEF
, FullIdent
LITERAL_CONTINUE
public static final int LITERAL_CONTINUE
The continue
keyword. The first child is an
optional identifier and the last child is a semicolon.
- 88
IDENT
, SEMI
, SLIST
LITERAL_DEFAULT
public static final int LITERAL_DEFAULT
The default
keyword. This element has no
children.
- 94
CASE_GROUP
LITERAL_DO
public static final int LITERAL_DO
The
do
keyword. Note the the while token does not
appear as part of the do-while construct.
For example:
do
{
x = rand.nextInt(10);
}
while(x <325);
parses as:
+--LITERAL_DO (do)
|
+--SLIST ({)
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (x)
+--METHOD_CALL (()
|
+--DOT (.)
|
+--IDENT (rand)
+--IDENT (nextInt)
+--ELIST
|
+--EXPR
|
+--NUM_INT (10)
+--RPAREN ())
+--SEMI (;)
+--RCURLY (})
+--LPAREN (()
+--EXPR
|
+--LT (<)
|
+--IDENT (x)
+--NUM_INT (5)
+--RPAREN ())
+--SEMI (;)
- 86
SLIST
, EXPR
, EMPTY_STAT
, LPAREN
, RPAREN
, SEMI
LITERAL_DOUBLE
public static final int LITERAL_DOUBLE
The double
keyword.
- 57
TYPE
LITERAL_ELSE
public static final int LITERAL_ELSE
The else
keyword. This appears as a child of an
if
statement.
- 92
SLIST
, EXPR
, EMPTY_STAT
, LITERAL_IF
LITERAL_FINALLY
public static final int LITERAL_FINALLY
The finally
keyword.
- 97
SLIST
, LITERAL_TRY
LITERAL_FLOAT
public static final int LITERAL_FLOAT
The float
keyword.
- 55
TYPE
LITERAL_FOR
public static final int LITERAL_FOR
The
for
keyword. The children are
(
,
an initializer, a condition, an iterator, a
)
and
either a statement list, a single expression, or an empty
statement.
For example:
for(int i = 0, n = myArray.length; i < n; i++)
{
}
parses as:
+--LITERAL_FOR (for)
|
+--LPAREN (()
+--FOR_INIT
|
+--VARIABLE_DEF
|
+--MODIFIERS
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (i)
+--ASSIGN (=)
|
+--EXPR
|
+--NUM_INT (0)
+--COMMA (,)
+--VARIABLE_DEF
|
+--MODIFIERS
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (n)
+--ASSIGN (=)
|
+--EXPR
|
+--DOT (.)
|
+--IDENT (myArray)
+--IDENT (length)
+--SEMI (;)
+--FOR_CONDITION
|
+--EXPR
|
+--LT (<)
|
+--IDENT (i)
+--IDENT (n)
+--SEMI (;)
+--FOR_ITERATOR
|
+--ELIST
|
+--EXPR
|
+--POST_INC (++)
|
+--IDENT (i)
+--RPAREN ())
+--SLIST ({)
|
+--RCURLY (})
- 84
LPAREN
, FOR_INIT
, SEMI
, FOR_CONDITION
, FOR_ITERATOR
, RPAREN
, SLIST
, EMPTY_STAT
, EXPR
LITERAL_IF
public static final int LITERAL_IF
The
if
keyword.
For example:
if(optimistic)
{
message = "half full";
}
else
{
message = "half empty";
}
parses as:
+--LITERAL_IF (if)
|
+--LPAREN (()
+--EXPR
|
+--IDENT (optimistic)
+--RPAREN ())
+--SLIST ({)
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (message)
+--STRING_LITERAL ("half full")
+--SEMI (;)
+--RCURLY (})
+--LITERAL_ELSE (else)
|
+--SLIST ({)
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (message)
+--STRING_LITERAL ("half empty")
+--SEMI (;)
+--RCURLY (})
- 83
LPAREN
, EXPR
, RPAREN
, SLIST
, EMPTY_STAT
, LITERAL_ELSE
LITERAL_INT
public static final int LITERAL_INT
The int
keyword.
- 54
TYPE
LITERAL_INTERFACE
public static final int LITERAL_INTERFACE
The interface
keyword. This token appears in
interface definition.
- 71
INTERFACE_DEF
LITERAL_LONG
public static final int LITERAL_LONG
The long
keyword.
- 56
TYPE
LITERAL_NATIVE
public static final int LITERAL_NATIVE
The native
keyword.
- 66
MODIFIERS
LITERAL_NEW
public static final int LITERAL_NEW
The
new
keyword. This element is used to define
new instances of objects, new arrays, and new anonymous inner
classes.
For example:
new ArrayList(50)
parses as:
+--LITERAL_NEW (new)
|
+--IDENT (ArrayList)
+--LPAREN (()
+--ELIST
|
+--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 (})
- 136
IDENT
, DOT
, LPAREN
, ELIST
, RPAREN
, OBJBLOCK
, ARRAY_INIT
, FullIdent
LITERAL_PRIVATE
public static final int LITERAL_PRIVATE
The private
keyword.
- 61
MODIFIERS
LITERAL_PROTECTED
public static final int LITERAL_PROTECTED
The protected
keyword.
- 63
MODIFIERS
LITERAL_PUBLIC
public static final int LITERAL_PUBLIC
The public
keyword.
- 62
MODIFIERS
LITERAL_RETURN
public static final int LITERAL_RETURN
The return
keyword. The first child is an
optional expression for the return value. The last child is a
semi colon.
- 89
EXPR
, SEMI
, SLIST
LITERAL_SHORT
public static final int LITERAL_SHORT
The short
keyword.
- 53
TYPE
LITERAL_STATIC
public static final int LITERAL_STATIC
The static
keyword.
- 64
MODIFIERS
LITERAL_SWITCH
public static final int LITERAL_SWITCH
The
switch
keyword.
For example:
switch(type)
{
case 0:
background = Color.blue;
break;
case 1:
background = Color.red;
break;
default:
background = Color.green;
break;
}
parses as:
+--LITERAL_SWITCH (switch)
|
+--LPAREN (()
+--EXPR
|
+--IDENT (type)
+--RPAREN ())
+--LCURLY ({)
+--CASE_GROUP
|
+--LITERAL_CASE (case)
|
+--EXPR
|
+--NUM_INT (0)
+--SLIST
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (background)
+--DOT (.)
|
+--IDENT (Color)
+--IDENT (blue)
+--SEMI (;)
+--LITERAL_BREAK (break)
|
+--SEMI (;)
+--CASE_GROUP
|
+--LITERAL_CASE (case)
|
+--EXPR
|
+--NUM_INT (1)
+--SLIST
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (background)
+--DOT (.)
|
+--IDENT (Color)
+--IDENT (red)
+--SEMI (;)
+--LITERAL_BREAK (break)
|
+--SEMI (;)
+--CASE_GROUP
|
+--LITERAL_DEFAULT (default)
+--SLIST
|
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (background)
+--DOT (.)
|
+--IDENT (Color)
+--IDENT (green)
+--SEMI (;)
+--LITERAL_BREAK (break)
|
+--SEMI (;)
+--RCURLY (})
- 90
Java
Language Specification, §14.10
, LPAREN
, EXPR
, RPAREN
, LCURLY
, CASE_GROUP
, RCURLY
, SLIST
LITERAL_SYNCHRONIZED
public static final int LITERAL_SYNCHRONIZED
The
synchronized
keyword. This may be used as a
modifier of a method or in the definition of a synchronized
block.
For example:
synchronized(this)
{
x++;
}
parses as:
+--LITERAL_SYNCHRONIZED (synchronized)
|
+--LPAREN (()
+--EXPR
|
+--LITERAL_THIS (this)
+--RPAREN ())
+--SLIST ({)
|
+--EXPR
|
+--POST_INC (++)
|
+--IDENT (x)
+--SEMI (;)
+--RCURLY (})
+--RCURLY (})
- 67
MODIFIERS
, LPAREN
, EXPR
, RPAREN
, SLIST
, RCURLY
LITERAL_THIS
public static final int LITERAL_THIS
The this
keyword.
- 78
EXPR
, CTOR_CALL
LITERAL_TRANSIENT
public static final int LITERAL_TRANSIENT
The transient
keyword.
- 65
MODIFIERS
LITERAL_TRY
public static final int LITERAL_TRY
The
try
keyword. The children are a statement
list, zero or more catch blocks and then an optional finally
block.
For example:
try
{
FileReader in = new FileReader("abc.txt");
}
catch(IOException ioe)
{
}
finally
{
}
parses as:
+--LITERAL_TRY (try)
|
+--SLIST ({)
|
+--VARIABLE_DEF
|
+--MODIFIERS
+--TYPE
|
+--IDENT (FileReader)
+--IDENT (in)
+--ASSIGN (=)
|
+--EXPR
|
+--LITERAL_NEW (new)
|
+--IDENT (FileReader)
+--LPAREN (()
+--ELIST
|
+--EXPR
|
+--STRING_LITERAL ("abc.txt")
+--RPAREN ())
+--SEMI (;)
+--RCURLY (})
+--LITERAL_CATCH (catch)
|
+--LPAREN (()
+--PARAMETER_DEF
|
+--MODIFIERS
+--TYPE
|
+--IDENT (IOException)
+--IDENT (ioe)
+--RPAREN ())
+--SLIST ({)
|
+--RCURLY (})
+--LITERAL_FINALLY (finally)
|
+--SLIST ({)
|
+--RCURLY (})
+--RCURLY (})
- 95
Java
Language Specification, §14.19
, SLIST
, LITERAL_CATCH
, LITERAL_FINALLY
LITERAL_VOID
public static final int LITERAL_VOID
The void
keyword.
- 49
TYPE
LITERAL_VOLATILE
public static final int LITERAL_VOLATILE
The volatile
keyword.
- 68
MODIFIERS
LITERAL_WHILE
public static final int LITERAL_WHILE
The
while
keyword.
For example:
while(line != null)
{
process(line);
line = in.readLine();
}
parses as:
+--LITERAL_WHILE (while)
|
+--LPAREN (()
+--EXPR
|
+--NOT_EQUAL (!=)
|
+--IDENT (line)
+--LITERAL_NULL (null)
+--RPAREN ())
+--SLIST ({)
|
+--EXPR
|
+--METHOD_CALL (()
|
+--IDENT (process)
+--ELIST
|
+--EXPR
|
+--IDENT (line)
+--RPAREN ())
+--SEMI (;)
+--EXPR
|
+--ASSIGN (=)
|
+--IDENT (line)
+--METHOD_CALL (()
|
+--DOT (.)
|
+--IDENT (in)
+--IDENT (readLine)
+--ELIST
+--RPAREN ())
+--SEMI (;)
+--RCURLY (})
- 85
LT
public static final int LT
The <
(less than) operator.
- 117
EXPR
METHOD_CALL
public static final int METHOD_CALL
A method call.
For example:
Math.random()
parses as:
+--METHOD_CALL (()
|
+--DOT (.)
|
+--IDENT (Math)
+--IDENT (random)
+--ELIST
+--RPAREN ())
- 27
IDENT
, DOT
, ELIST
, RPAREN
, FullIdent
METHOD_DEF
public static final int METHOD_DEF
A method declaration. The children are modifiers, 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, or anonymous inner-class
declarations.
For example:
public static int square(int x)
{
return x*x;
}
parses as:
+--METHOD_DEF
|
+--MODIFIERS
|
+--LITERAL_PUBLIC (public)
+--LITERAL_STATIC (static)
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (square)
+--PARAMETERS
|
+--PARAMETER_DEF
|
+--MODIFIERS
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (x)
+--SLIST ({)
|
+--LITERAL_RETURN (return)
|
+--EXPR
|
+--STAR (*)
|
+--IDENT (x)
+--IDENT (x)
+--SEMI (;)
+--RCURLY (})
- 9
MODIFIERS
, TYPE
, IDENT
, PARAMETERS
, LITERAL_THROWS
, SLIST
, OBJBLOCK
MODIFIERS
public static final int MODIFIERS
Modifiers for type, method, and field declarations. The
modifiers element is always present even though it may have no
children.
- 5
Java
Language Specification, Chapter 8
, LITERAL_PUBLIC
, LITERAL_PROTECTED
, LITERAL_PRIVATE
, ABSTRACT
, LITERAL_STATIC
, FINAL
, LITERAL_TRANSIENT
, LITERAL_VOLATILE
, LITERAL_SYNCHRONIZED
, LITERAL_NATIVE
, STRICTFP
NOT_EQUAL
public static final int NOT_EQUAL
The !=
(not equal) operator.
- 115
EXPR
OBJBLOCK
public static final int OBJBLOCK
An object block. These are children of class and interface
declarations. Also, object blocks are children of the new
keyword when defining anonymous inner classes.
- 6
LCURLY
, INSTANCE_INIT
, STATIC_INIT
, CLASS_DEF
, CTOR_DEF
, METHOD_DEF
, VARIABLE_DEF
, RCURLY
, INTERFACE_DEF
, LITERAL_NEW
PACKAGE_DEF
public static final int PACKAGE_DEF
The package declaration. This is optional, but if it is
included, then there is only one package declaration per source
file and it must be the first non-comment in the file.
For example:
package com.puppycrawl.tools.checkstyle.api;
parses as:
+--PACKAGE_DEF (package)
|
+--DOT (.)
|
+--DOT (.)
|
+--DOT (.)
|
+--DOT (.)
|
+--IDENT (com)
+--IDENT (puppycrawl)
+--IDENT (tools)
+--IDENT (checkstyle)
+--IDENT (api)
+--SEMI (;)
- 16
Java
Language Specification §7.4
, DOT
, IDENT
, SEMI
, FullIdent
PARAMETERS
public static final int PARAMETERS
A list of parameters to a method or constructor. The children
are zero or more parameter declarations separated by commas.
For example
int start, int end
parses as:
+--PARAMETERS
|
+--PARAMETER_DEF
|
+--MODIFIERS
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (start)
+--COMMA (,)
+--PARAMETER_DEF
|
+--MODIFIERS
+--TYPE
|
+--LITERAL_INT (int)
+--IDENT (end)
- 20
PARAMETER_DEF
, COMMA
, METHOD_DEF
, CTOR_DEF
QUESTION
public static final int QUESTION
The
?
(conditional) operator. Technically,
the colon is also part of this operator, but it appears as a
separate token.
For example:
(quantity == 1) ? "": "s"
parses as:
+--QUESTION (?)
|
+--LPAREN (()
+--EQUAL (==)
|
+--IDENT (quantity)
+--NUM_INT (1)
+--RPAREN ())
+--STRING_LITERAL ("")
+--COLON (:)
+--STRING_LITERAL ("s")
- 109
Java
Language Specification, §15.25
, EXPR
, COLON
SLIST
public static final int SLIST
A list of statements.
- 7
RCURLY
, EXPR
, LABELED_STAT
, LITERAL_THROWS
, LITERAL_RETURN
, SEMI
, METHOD_DEF
, CTOR_DEF
, LITERAL_FOR
, LITERAL_WHILE
, LITERAL_IF
, LITERAL_ELSE
, CASE_GROUP
STATIC_INIT
public static final int STATIC_INIT
A static initialization block. Zero or more static
initializers may be children of the object block of a class
declaration (interfaces cannot have static initializers). The
first and only child is a statement list.
- 12
Java
Language Specification, §8.7
, SLIST
, OBJBLOCK
STRICTFP
public static final int STRICTFP
The strictfp
keyword.
- 41
MODIFIERS
TYPE
public static final int TYPE
A type. This is either a return type of a method or a type of
a variable or field. The first child of this element is the
actual type. This may be a primitive type, an identifier, a
dot which is the root of a fully qualified type, or an array of
any of these.
- 13
VARIABLE_DEF
, METHOD_DEF
, PARAMETER_DEF
, IDENT
, DOT
, LITERAL_VOID
, LITERAL_BOOLEAN
, LITERAL_BYTE
, LITERAL_CHAR
, LITERAL_SHORT
, LITERAL_INT
, LITERAL_FLOAT
, LITERAL_LONG
, LITERAL_DOUBLE
, ARRAY_DECLARATOR
TYPECAST
public static final int TYPECAST
A type-cast.
For example:
(String)it.next()
parses as:
+--TYPECAST (()
|
+--TYPE
|
+--IDENT (String)
+--RPAREN ())
+--METHOD_CALL (()
|
+--DOT (.)
|
+--IDENT (it)
+--IDENT (next)
+--ELIST
+--RPAREN ())
- 23
Java
Language Specification, §15.16
, EXPR
, TYPE
, RPAREN
VARIABLE_DEF
public static final int VARIABLE_DEF
A field or local variable declaration. The children are
modifiers, type, the identifier name, and an optional
assignment statement.
- 10
MODIFIERS
, TYPE
, IDENT
, ASSIGN