BNF for JavaParser.jj

NON-TERMINALS

CompilationUnit ::= OptPackageDeclaration ImportDeclarations ( TypeDeclaration )* <EOF>
OptPackageDeclaration ::= ( "package" Name ";" )?
ImportDeclarations ::= ( ImportDeclaration )*
ImportDeclaration ::= "import" Name ( "." "*" )? ";"
TypeDeclaration ::= ClassDeclaration
| InterfaceDeclaration
| ";"
ClassDeclaration ::= ( Static | Abstract | Final | Public | Protected | Private | Strictfp )* UnmodifiedClassDeclaration
UnmodifiedClassDeclaration ::= "class" SimpleName OptClassExtendsClause OptImplementsClause ClassBody
OptClassExtendsClause ::= ( "extends" Name )?
OptImplementsClause ::= ( "implements" NameList )?
ClassBody ::= "{" ( ClassBodyDeclaration )* "}"
ClassBodyDeclaration ::= Initializer
| ClassDeclaration
| InterfaceDeclaration
| ConstructorDeclaration
| MethodDeclaration
| FieldDeclaration
| ";"
MethodDeclarationLookahead ::= ( "public" | "protected" | "private" | "static" | "abstract" | "final" | "native" | "synchronized" | "strictfp" )* ResultType <IDENTIFIER> "("
InterfaceDeclaration ::= ( Static | Abstract | Public | Protected | Private | Strictfp )* UnmodifiedInterfaceDeclaration
UnmodifiedInterfaceDeclaration ::= "interface" SimpleName OptInterfaceExtendsClause InterfaceBody
InterfaceBody ::= "{" ( InterfaceMemberDeclaration )* "}"
OptInterfaceExtendsClause ::= ( "extends" NameList )?
InterfaceMemberDeclaration ::= ClassDeclaration
| InterfaceDeclaration
| MethodDeclaration
| FieldDeclaration
| ";"
FieldDeclaration ::= ( Public | Protected | Private | Static | Final | Transient | Volatile )* Type VariableDeclarator ( "," VariableDeclarator )* ";"
VariableDeclarator ::= SimpleName ( "[" "]" )* ( "=" VariableInitializer )?
VariableInitializer ::= ArrayInitializer
| Expression
ArrayInitializer ::= "{" ( VariableInitializer ( "," VariableInitializer )* )? ( "," )? "}"
ConstructorDeclaration ::= ( Public | Protected | Private )? ConstructorDeclarator OptThrowsClause ConstructorBody
ConstructorDeclarator ::= SimpleName FormalParameters
OptThrowsClause ::= ( "throws" NameList )?
MethodDeclaration ::= ( Public | Protected | Private | Static | Abstract | Final | Native | Synchronized | Strictfp )* ResultType MethodDeclarator OptThrowsClause ( MethodBody | ";" )
MethodDeclarator ::= SimpleName FormalParameters ( "[" "]" )*
FormalParameters ::= "(" ( FormalParameter ( "," FormalParameter )* )? ")"
FormalParameter ::= ( Final )? Type SimpleName ( "[" "]" )*
ConstructorBody ::= "{" ( ExplicitConstructorInvocation )? ( BlockStatement )* "}"
ExplicitConstructorInvocation ::= ThisExplicitConstructorInvocation
| SuperExplicitConstructorInvocation
ThisExplicitConstructorInvocation ::= "this" Arguments ";"
SuperExplicitConstructorInvocation ::= ( ExpressionNameOrPrimary "." )? "super" Arguments ";"
MethodBody ::= "{" ( BlockStatement )* "}"
Initializer ::= ( "static" )? Block
Type ::= ( PrimitiveType | Name ) ( "[" "]" )*
PrimitiveType ::= "boolean"
| "char"
| "byte"
| "short"
| "int"
| "long"
| "float"
| "double"
ResultType ::= "void"
| Type
Name ::= Identifier ( "." Identifier )*
NameList ::= NameNode ( "," NameNode )*
NameNode ::= Name
Expression ::= ConditionalExpression ( AssignmentOperator Expression )?
AssignmentOperator ::= ( "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" )
ConditionalExpression ::= ( ConditionalOrExpression ( "?" Expression ":" ConditionalExpression )? )
ConditionalOrExpression ::= ConditionalAndExpression ( "||" ConditionalAndExpression )*
ConditionalAndExpression ::= InclusiveOrExpression ( "&&" InclusiveOrExpression )*
InclusiveOrExpression ::= ExclusiveOrExpression ( "|" ExclusiveOrExpression )*
ExclusiveOrExpression ::= AndExpression ( "^" AndExpression )*
AndExpression ::= EqualityExpression ( "&" EqualityExpression )*
EqualityExpression ::= InstanceOfExpression ( ( "==" | "!=" ) InstanceOfExpression )*
InstanceOfExpression ::= ( RelationalExpression ( "instanceof" Type )? )
RelationalExpression ::= ShiftExpression ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression )*
ShiftExpression ::= AdditiveExpression ( ( "<<" | ">>" | ">>>" ) AdditiveExpression )*
AdditiveExpression ::= MultiplicativeExpression ( ( "+" | "-" ) MultiplicativeExpression )*
MultiplicativeExpression ::= UnaryExpression ( ( "*" | "/" | "%" ) UnaryExpression )*
UnaryExpression ::= ( "+" | "-" ) UnaryExpression
| PreIncDecExpression
| UnaryExpressionNotPlusMinus
PreIncDecExpression ::= IncDecOperator UnaryExpression
IncDecOperator ::= ( "++" | "--" )
UnaryExpressionNotPlusMinus ::= ( "~" | "!" ) UnaryExpression
| CastExpression
| PostfixExpression
CastLookahead ::= "(" PrimitiveType
| "(" Name "[" "]"
| "(" Name ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal )
CastExpression ::= ( "(" Type ")" UnaryExpression | "(" Type ")" UnaryExpressionNotPlusMinus )
PostfixExpression ::= ExpressionNameOrPrimary ( IncDecOperator )?
ExpressionNameOrPrimary ::= Primary
| ExpressionName
| Primary
ExpressionName ::= Name
Primary ::= PrimaryPrefix ( PrimarySuffix )*
PrimaryPrefix ::= Literal
| ThisExp
| AllocationExpression
| "(" Expression ")"
| SuperPrimaryPrefix
| ClassExp
| ( ExpressionName "[" Expression "]" )
| ( ExpressionName "." "new" Identifier Arguments ( ClassBody )? )
| NamePrimaryPrefix
ThisExp ::= "this"
SuperPrimaryPrefix ::= SuperMethodCall
| SuperExp
SuperMethodCall ::= "super" "." Identifier Arguments
SuperExp ::= "super" "." Identifier
ClassExp ::= ResultType "." "class"
NamePrimaryPrefix ::= Name ( ( Arguments ) | "." ( ( "this" ) | "super" "." Identifier ( ( Arguments ) | ( ) ) ) )
PrimarySuffixLookahead ::= "["
| "." ( <IDENTIFIER> | "new" )
PrimarySuffix ::= ( "[" Expression "]" )
| "." ( ( "new" Identifier Arguments ( ClassBody )? ) | Identifier ( ( Arguments ) | ( ) ) )
Literal ::= ( <DECIMAL_LITERAL> | <HEX_LITERAL> | <OCTAL_LITERAL> | <FLOATING_POINT_LITERAL> | <CHARACTER_LITERAL> | <STRING_LITERAL> | "true" | "false" | "null" )
Arguments ::= "(" ( Expression ( "," Expression )* )? ")"
AllocationExpression ::= ( "new" PrimitiveType ArrayDimsAndInits | "new" Name ( ArrayDimsAndInits | Arguments ( ClassBody )? ) )
ArrayDimsAndInits ::= ( ( "[" Expression "]" )+ ( "[" "]" )* | ( "[" "]" )+ ArrayInitializer )
Statement ::= LabeledStatement
| Block
| EmptyStatement
| ExpressionStatement
| SwitchStatement
| IfStatement
| WhileStatement
| DoStatement
| ForStatement
| BreakStatement
| ContinueStatement
| ReturnStatement
| ThrowStatement
| SynchronizedStatement
| TryStatement
LabeledStatement ::= SimpleName ":" Statement
Block ::= "{" ( BlockStatement )* "}"
BlockStatement ::= ClassDeclaration
| InterfaceDeclaration
| LocalVariableDeclaration ";"
| Statement
LocalVariableDeclaration ::= ( Final )? Type VariableDeclarator ( "," VariableDeclarator )*
EmptyStatement ::= ";"
ExpressionStatement ::= StatementExpression ";"
StatementExpression ::= Expression
SwitchStatement ::= "switch" "(" Expression ")" "{" ( Case )* "}"
Case ::= SwitchLabel ( BlockStatement )*
SwitchLabel ::= ( "case" Expression ":" | "default" ":" )
IfStatement ::= "if" "(" Expression ")" Statement ( "else" Statement )?
WhileStatement ::= "while" "(" Expression ")" Statement
DoStatement ::= "do" Statement "while" "(" Expression ")" ";"
ForStatement ::= "for" "(" OptForInit ";" OptExpression ";" OptForUpdate ")" Statement
OptForInit ::= ( ForInit )?
ForInit ::= ( LocalVariableDeclaration | StatementExpressionList )
StatementExpressionList ::= StatementExpression ( "," StatementExpression )*
OptExpression ::= ( Expression )?
OptForUpdate ::= ( StatementExpressionList )?
BreakStatement ::= "break" ( SimpleName )? ";"
ContinueStatement ::= "continue" ( SimpleName )? ";"
ReturnStatement ::= "return" ( Expression )? ";"
ThrowStatement ::= "throw" Expression ";"
SynchronizedStatement ::= "synchronized" "(" Expression ")" Block
TryStatement ::= "try" Block ( Catches ( "finally" Block )? | Catches "finally" Block )
Catches ::= ( Catch )*
Catch ::= "catch" "(" FormalParameter ")" Block
SimpleName ::= Identifier
Identifier ::= <IDENTIFIER>
Abstract ::= "abstract"
Final ::= "final"
Native ::= "native"
Public ::= "public"
Private ::= "private"
Protected ::= "protected"
Static ::= "static"
Strictfp ::= "strictfp"
Synchronized ::= "synchronized"
Transient ::= "transient"
Volatile ::= "volatile"