net.janino
Class Parser

java.lang.Object
  |
  +--net.janino.Parser

public class Parser
extends java.lang.Object

Implementation of a simplified compiler for the JavaTM programming language. The following elements of the Java programming language are implemented:

Elements of the Java programming language that are not (yet) implemented:


Inner Class Summary
static class Parser.ParseException
          An exception that reflects an error during parsing.
 
Field Summary
(package private) static java.lang.String cvs_header
           
 
Constructor Summary
Parser(Scanner scanner)
           
 
Method Summary
 Java.Atom parseAdditiveExpression(Java.Scope enclosingScope)
           AdditiveExpression := MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }
 Java.Atom parseAndExpression(Java.Scope enclosingScope)
           AndExpression := EqualityExpression { '&' EqualityExpression }
 Java.Rvalue[] parseArgumentList(Java.Scope enclosingScope)
           ArgumentList := Expression { ',' Expression }
 Java.Rvalue[] parseArguments(Java.Scope enclosingScope)
           Arguments := '(' [ ArgumentList ] ')'
 Java.Rvalue parseArrayInitializer(Java.Scope enclosingScope, Java.ArrayType arrayType)
           ArrayInitializer := '{' [ VariableInitializer { ',' VariableInitializer } [ ',' ] '}'
 Java.Atom parseAssignmentExpression(Java.Scope enclosingScope)
           AssignmentExpression := ConditionalExpression [ AssignmentOperator AssignmentExpression ] AssignmentOperator := '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '>>>=' | '&=' | '^=' | '|='
 Java.Block parseBlock(Java.Scope enclosingScope)
           '{' BlockStatements '}'
 Java.BlockStatement parseBlockStatement(Java.Block enclosingBlock)
           BlockStatement := { Identifier ':' } ( ( Modifiers Type | ModifiersOpt BasicType ) VariableDeclarators ';' | 'class' ...
 java.util.Vector parseBlockStatements(Java.Block enclosingBlock)
           BlockStatements := { BlockStatement }
(package private)  int parseBracketsOpt()
           BracketsOpt := { '[' ']' }
 Java.Statement parseBreakStatement(Java.Scope enclosingScope)
           BreakStatement := 'break' [ Identifier ] ';'
 void parseClassBody(Java.ClassDeclaration classDeclaration)
           ClassBody := '{' { ClassBodyDeclaration } '}'
 void parseClassBodyDeclaration(Java.ClassDeclaration classDeclaration)
           ClassBodyDeclaration := ';' | ModifiersOpt ( Block | 'void' Identifier MethodDeclaratorRest | 'class' ClassDeclarationRest | 'interface' InterfaceDeclarationRest | ConstructorDeclarator | Type Identifier ( MethodDeclaratorRest | VariableDeclaratorsRest ) )
 Java.ClassDeclaration parseClassDeclarationRest(Java.Scope enclosingScope, short modifiers)
           ClassDeclarationRest := Identifier [ 'extends' ReferenceType ] [ 'implements' ReferenceTypeList ] ClassBody
 Java.ClassOrInterfaceDeclaration parseClassOrInterfaceDeclaration(Java.Scope enclosingScope)
           ClassOrInterfaceDeclaration := ModifiersOpt 'class' ClassDeclarationRest | ModifiersOpt 'interface' InterfaceDeclarationRest
 Java.CompilationUnit parseCompilationUnit()
           CompilationUnit := [ 'package' QualifiedIdentifier ';' ] { ImportDeclaration } { TypeDeclaration }
 Java.Atom parseConditionalAndExpression(Java.Scope enclosingScope)
           ConditionalAndExpression := InclusiveOrExpression { '&&' InclusiveOrExpression }
 Java.Atom parseConditionalExpression(Java.Scope enclosingScope)
           ConditionalExpression := ConditionalOrExpression [ '?'
 Java.Atom parseConditionalOrExpression(Java.Scope enclosingScope)
           ConditionalOrExpression := ConditionalAndExpression { '||' ConditionalAndExpression ]
 Java.ConstructorDeclarator parseConstructorDeclarator(Java.ClassDeclaration declaringClass, short modifiers)
           ConstructorDeclarator := FormalParameters [ 'throws' ReferenceTypeList ] '{' [ 'this' Arguments ';' | 'super' Arguments ';' ] BlockStatements '}'
 Java.Statement parseContinueStatement(Java.Scope enclosingScope)
           ContinueStatement := 'continue' [ Identifier ] ';'
 Java.Rvalue[] parseDimExprs(Java.Scope enclosingScope)
           DimExprs := { '[' Expression ']' }
 Java.Statement parseDoStatement(Java.Scope enclosingScope)
           DoStatement := 'do' Statement 'while' '(' Expression ')' ';'
 Java.Atom parseEqualityExpression(Java.Scope enclosingScope)
           EqualityExpression := RelationalExpression { ( '==' | '!
 Java.Atom parseExclusiveOrExpression(Java.Scope enclosingScope)
           ExclusiveOrExpression := AndExpression { '^' AndExpression }
 Java.Atom parseExpression(Java.Scope enclosingScope)
           Expression := AssignmentExpression
 Java.Statement parseExpressionStatement(Java.Scope enclosingScope)
           ExpressionStatement := Expression
 Java.FormalParameter parseFormalParameter(Java.Scope enclosingScope)
           FormalParameter := [ 'final' ] Type Identifier BracketsOpt
 Java.FormalParameter[] parseFormalParameters(Java.Scope enclosingScope)
           FormalParameters := '(' [ FormalParameter { ',' FormalParameter } ] ')'
 Java.Statement parseForStatement(Java.Scope enclosingScope)
           ForStatement := 'for' '(' [ ForInit ] ';' [ Expression ] ';' [ StatementExpressionList ] ')' Statement
 Java.Statement parseIfStatement(Java.Scope enclosingScope)
           IfStatement := 'if' '(' Expression ')' Statement [ 'else' Statement ]
 void parseImportDeclaration(Java.CompilationUnit compilationUnit)
           ImportDeclaration := 'import' Identifier { '.'
 Java.Atom parseInclusiveOrExpression(Java.Scope enclosingScope)
           InclusiveOrExpression := ExclusiveOrExpression { '|' ExclusiveOrExpression }
 void parseInterfaceBody(Java.InterfaceDeclaration interfaceDeclaration)
           InterfaceBody := '{' { ';' | ModifiersOpt ( 'void' Identifier MethodDeclaratorRest | 'class' ClassDeclarationRest | 'interface' InterfaceDeclarationRest | Type Identifier ( MethodDeclaratorRest | VariableDeclaratorsRest ) ) } '}'
 Java.InterfaceDeclaration parseInterfaceDeclarationRest(Java.Scope enclosingScope, short modifiers)
           InterfaceDeclarationRest := Identifier [ 'extends' ReferenceTypeList ] InterfaceBody
 Java.Statement parseLabeledStatement(Java.Scope enclosingScope)
           LabeledStatement := Identifier ':' Statement
 Java.Atom parseLiteral()
           
 Java.Block parseMethodBody(Java.FunctionDeclarator declaringFunction)
           MethodBody := Block
 Java.MethodDeclarator parseMethodDeclaratorRest(Java.ClassOrInterfaceDeclaration declaringClassOrInterface, short modifiers, Java.Type type, java.lang.String name)
           MethodDeclaratorRest := FormalParameters | [ 'throws' ReferenceTypeList ] ( ';' | MethodBody )
 short parseModifiersOpt()
           ModifiersOpt := { 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native' | 'synchronized' | 'transient' | 'volatile' | 'strictfp'
 Java.Atom parseMultiplicativeExpression(Java.Scope enclosingScope)
           MultiplicativeExpression := UnaryExpression { ( '*' | '/' | '%' ) UnaryExpression }
 Java.Atom parsePrimary(Java.Scope enclosingScope)
           Primary := '(' PrimitiveType { '[]' } ')' UnaryExpression | // CastExpression 15.16 '(' Expression ')' UnaryExpression | // CastExpression 15.16 '(' Expression ')' | // ParenthesizedExpression 15.8.5 Literal | // Literal 15.8.1 Name | // AmbiguousName Name Arguments | // MethodInvocation Name '[]' { '[]' } | // ArrayType 10.1 Name '[]' { '[]' } '.'
 java.lang.String[] parseQualifiedIdentifier()
          QualifiedIdentifier := Identifier { '.'
 Java.ReferenceType parseReferenceType(Java.Scope scope)
           ReferenceType := QualifiedIdentifier
 Java.ReferenceType[] parseReferenceTypeList(Java.Scope scope)
           ReferenceTypeList := ReferenceType { ',' ReferenceType }
 Java.Atom parseRelationalExpression(Java.Scope enclosingScope)
           RelationalExpression := ShiftExpression { ( ( '<' | '>' | '<=' | '>=' ) ShiftExpression ) | ( 'instanceof' ReferenceType ) }
 Java.Statement parseReturnStatement(Java.Scope enclosingScope)
           ReturnStatement := 'return' [ Expression ] ';'
 Java.Atom parseSelector(Java.Scope enclosingScope, Java.Atom atom)
           Selector := '.'
 Java.Atom parseShiftExpression(Java.Scope enclosingScope)
           ShiftExpression := AdditiveExpression { ( '<<' | '>>' | '>>>' ) AdditiveExpression }
 Java.Statement parseStatement(Java.Scope enclosingScope)
           Statement := LabeledStatement | Block | IfStatement | ForStatement | WhileStatement | DoStatement | TryStatement | 'switch' ...
 Java.BlockStatement parseStatementExpressionList(Java.Scope enclosingScope)
           StatementExpressionList := ExpressionStatement { ',' ExpressionStatement }
 Java.Statement parseSwitchStatement(Java.Scope enclosingScope)
           SwitchStatement := 'switch' '(' Expression ')' '{' { SwitchLabels BlockStatements } '}' SwitchLabels := SwitchLabels { SwitchLabels } SwitchLabel := 'case' Expression ':' | 'default' ':'
 Java.Statement parseSynchronizedStatement(Java.Scope enclosingScope)
           SynchronizedStatement := 'synchronized' '(' expression ')' Block
 Java.Statement parseThrowStatement(Java.Scope enclosingScope)
           ThrowStatement := 'throw' Expression ';'
 Java.Statement parseTryStatement(Java.Scope enclosingScope)
           TryStatement := 'try' Block Catches [ Finally ] | 'try' Block Finally Catches := CatchClause { CatchClause } CatchClause := 'catch' '(' FormalParameter ')' Block Finally := 'finally' Block
 Java.Type parseType(Java.Scope scope)
           Type := ( 'byte' | 'short' | 'char' | 'int' | 'long' | 'float' | 'double' | 'boolean' | QualifiedIdentifier ) { '[' ']' }
 Java.ClassOrInterfaceDeclaration parseTypeDeclaration(Java.CompilationUnit compilationUnit)
           TypeDeclaration := ClassOrInterfaceDeclaration
 Java.Atom parseUnaryExpression(Java.Scope enclosingScope)
           UnaryExpression := { PrefixOperator } Primary { Selector } { PostfixOperator } PrefixOperator := '++' | '--' | '+' | '-' | '~' | '!'
 Java.VariableDeclarator parseVariableDeclarator(Java.Scope enclosingScope, Java.Type type)
           VariableDeclarator := Identifier VariableDeclaratorRest
 Java.VariableDeclarator parseVariableDeclaratorRest(Java.Scope enclosingScope, Java.Type type, java.lang.String name)
           VariableDeclaratorRest := { '[' ']' } [ '=' VariableInitializer ]
 Java.VariableDeclarator[] parseVariableDeclarators(Java.Scope enclosingScope, Java.Type type)
           VariableDeclarators := VariableDeclarator { ',' VariableDeclarator }
 Java.VariableDeclarator[] parseVariableDeclaratorsRest(Java.Scope enclosingScope, Java.Type type, java.lang.String name)
           VariableDeclaratorsRest := VariableDeclaratorRest { ',' VariableDeclarator }
 Java.Rvalue parseVariableInitializer(Java.Scope enclosingScope, Java.Type type)
           VariableInitializer := ArrayInitializer | Expression
 Java.Statement parseWhileStatement(Java.Scope enclosingScope)
           WhileStatement := 'while' '(' Expression ')' Statement
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvs_header

static final java.lang.String cvs_header
Constructor Detail

Parser

public Parser(Scanner scanner)
Method Detail

parseCompilationUnit

public Java.CompilationUnit parseCompilationUnit()
                                          throws Parser.ParseException,
                                                 Scanner.ScanException,
                                                 java.io.IOException
   CompilationUnit := [ 'package' QualifiedIdentifier ';' ]
                      { ImportDeclaration }
                      { TypeDeclaration }
 

parseImportDeclaration

public void parseImportDeclaration(Java.CompilationUnit compilationUnit)
                            throws Parser.ParseException,
                                   Scanner.ScanException,
                                   java.io.IOException
   ImportDeclaration := 'import' Identifier
                        { '.' Identifier }
                        [ '.' '*' ]
                        ';'
 

parseQualifiedIdentifier

public java.lang.String[] parseQualifiedIdentifier()
                                            throws Parser.ParseException,
                                                   Scanner.ScanException,
                                                   java.io.IOException
QualifiedIdentifier := Identifier { '.' Identifier }

parseTypeDeclaration

public Java.ClassOrInterfaceDeclaration parseTypeDeclaration(Java.CompilationUnit compilationUnit)
                                                      throws Parser.ParseException,
                                                             Scanner.ScanException,
                                                             java.io.IOException
   TypeDeclaration := ClassOrInterfaceDeclaration
 

parseClassOrInterfaceDeclaration

public Java.ClassOrInterfaceDeclaration parseClassOrInterfaceDeclaration(Java.Scope enclosingScope)
                                                                  throws Parser.ParseException,
                                                                         Scanner.ScanException,
                                                                         java.io.IOException
   ClassOrInterfaceDeclaration :=
             ModifiersOpt 'class' ClassDeclarationRest |
             ModifiersOpt 'interface' InterfaceDeclarationRest
 

parseModifiersOpt

public short parseModifiersOpt()
                        throws Parser.ParseException,
                               Scanner.ScanException,
                               java.io.IOException
   ModifiersOpt := { 'public' | 'protected' | 'private' | 'static' |
           'abstract' | 'final' | 'native' | 'synchronized' |
           'transient' | 'volatile' | 'strictfp'
 

parseClassDeclarationRest

public Java.ClassDeclaration parseClassDeclarationRest(Java.Scope enclosingScope,
                                                       short modifiers)
                                                throws Parser.ParseException,
                                                       Scanner.ScanException,
                                                       java.io.IOException
   ClassDeclarationRest :=
        Identifier
        [ 'extends' ReferenceType ]
        [ 'implements' ReferenceTypeList ]
        ClassBody
 

parseClassBody

public void parseClassBody(Java.ClassDeclaration classDeclaration)
                    throws Parser.ParseException,
                           Scanner.ScanException,
                           java.io.IOException
   ClassBody := '{' { ClassBodyDeclaration } '}'
 

parseClassBodyDeclaration

public void parseClassBodyDeclaration(Java.ClassDeclaration classDeclaration)
                               throws Parser.ParseException,
                                      Scanner.ScanException,
                                      java.io.IOException
   ClassBodyDeclaration :=
     ';' |
     ModifiersOpt (
       Block |
       'void' Identifier MethodDeclaratorRest |
       'class' ClassDeclarationRest |
       'interface' InterfaceDeclarationRest |
       ConstructorDeclarator |
       Type Identifier (
         MethodDeclaratorRest |
         VariableDeclaratorsRest
       )
     )

 

parseInterfaceDeclarationRest

public Java.InterfaceDeclaration parseInterfaceDeclarationRest(Java.Scope enclosingScope,
                                                               short modifiers)
                                                        throws Parser.ParseException,
                                                               Scanner.ScanException,
                                                               java.io.IOException
   InterfaceDeclarationRest :=
     Identifier
     [ 'extends' ReferenceTypeList ]
     InterfaceBody
 

parseInterfaceBody

public void parseInterfaceBody(Java.InterfaceDeclaration interfaceDeclaration)
                        throws Parser.ParseException,
                               Scanner.ScanException,
                               java.io.IOException
   InterfaceBody := '{' {
     ';' |
     ModifiersOpt (
       'void' Identifier MethodDeclaratorRest |
       'class' ClassDeclarationRest |
       'interface' InterfaceDeclarationRest |
       Type Identifier (
         MethodDeclaratorRest |
         VariableDeclaratorsRest
       )
     )
   } '}'
 

parseConstructorDeclarator

public Java.ConstructorDeclarator parseConstructorDeclarator(Java.ClassDeclaration declaringClass,
                                                             short modifiers)
                                                      throws Parser.ParseException,
                                                             Scanner.ScanException,
                                                             java.io.IOException
   ConstructorDeclarator :=
     FormalParameters
     [ 'throws' ReferenceTypeList ]
     '{'
       [ 'this' Arguments ';' | 'super' Arguments ';' ]
       BlockStatements
     '}'
 

parseMethodDeclaratorRest

public Java.MethodDeclarator parseMethodDeclaratorRest(Java.ClassOrInterfaceDeclaration declaringClassOrInterface,
                                                       short modifiers,
                                                       Java.Type type,
                                                       java.lang.String name)
                                                throws Parser.ParseException,
                                                       Scanner.ScanException,
                                                       java.io.IOException
   MethodDeclaratorRest :=
     FormalParameters |
     [ 'throws' ReferenceTypeList ]
     ( ';' | MethodBody )
 

parseVariableInitializer

public Java.Rvalue parseVariableInitializer(Java.Scope enclosingScope,
                                            Java.Type type)
                                     throws Parser.ParseException,
                                            Scanner.ScanException,
                                            java.io.IOException
   VariableInitializer :=
     ArrayInitializer |
     Expression
 

parseArrayInitializer

public Java.Rvalue parseArrayInitializer(Java.Scope enclosingScope,
                                         Java.ArrayType arrayType)
                                  throws Parser.ParseException,
                                         Scanner.ScanException,
                                         java.io.IOException
   ArrayInitializer :=
     '{' [ VariableInitializer { ',' VariableInitializer } [ ',' ] '}'
 

parseFormalParameters

public Java.FormalParameter[] parseFormalParameters(Java.Scope enclosingScope)
                                             throws Parser.ParseException,
                                                    Scanner.ScanException,
                                                    java.io.IOException
   FormalParameters := '(' [ FormalParameter { ',' FormalParameter } ] ')'
 

parseFormalParameter

public Java.FormalParameter parseFormalParameter(Java.Scope enclosingScope)
                                          throws Parser.ParseException,
                                                 Scanner.ScanException,
                                                 java.io.IOException
   FormalParameter := [ 'final' ] Type Identifier BracketsOpt
 

parseBracketsOpt

int parseBracketsOpt()
               throws Parser.ParseException,
                      Scanner.ScanException,
                      java.io.IOException
   BracketsOpt := { '[' ']' }
 

parseMethodBody

public Java.Block parseMethodBody(Java.FunctionDeclarator declaringFunction)
                           throws Parser.ParseException,
                                  Scanner.ScanException,
                                  java.io.IOException
   MethodBody := Block
 

parseBlock

public Java.Block parseBlock(Java.Scope enclosingScope)
                      throws Parser.ParseException,
                             Scanner.ScanException,
                             java.io.IOException
   '{' BlockStatements '}'
 

parseBlockStatements

public java.util.Vector parseBlockStatements(Java.Block enclosingBlock)
                                      throws Parser.ParseException,
                                             Scanner.ScanException,
                                             java.io.IOException
   BlockStatements := { BlockStatement }
 

parseBlockStatement

public Java.BlockStatement parseBlockStatement(Java.Block enclosingBlock)
                                        throws Parser.ParseException,
                                               Scanner.ScanException,
                                               java.io.IOException
   BlockStatement := { Identifier ':' } (
     ( Modifiers Type | ModifiersOpt BasicType ) VariableDeclarators ';' |
     'class' ... |
     Statement |
     Expression ';' |
     Expression [ Brackets ] VariableDeclarators ';'   (1)
   )
 
(1) "Expression" must pose a type.

parseVariableDeclarators

public Java.VariableDeclarator[] parseVariableDeclarators(Java.Scope enclosingScope,
                                                          Java.Type type)
                                                   throws Parser.ParseException,
                                                          Scanner.ScanException,
                                                          java.io.IOException
   VariableDeclarators := VariableDeclarator { ',' VariableDeclarator }
 

parseVariableDeclaratorsRest

public Java.VariableDeclarator[] parseVariableDeclaratorsRest(Java.Scope enclosingScope,
                                                              Java.Type type,
                                                              java.lang.String name)
                                                       throws Parser.ParseException,
                                                              Scanner.ScanException,
                                                              java.io.IOException
   VariableDeclaratorsRest :=
     VariableDeclaratorRest
     { ',' VariableDeclarator }
 

parseVariableDeclarator

public Java.VariableDeclarator parseVariableDeclarator(Java.Scope enclosingScope,
                                                       Java.Type type)
                                                throws Parser.ParseException,
                                                       Scanner.ScanException,
                                                       java.io.IOException
   VariableDeclarator := Identifier VariableDeclaratorRest
 

parseVariableDeclaratorRest

public Java.VariableDeclarator parseVariableDeclaratorRest(Java.Scope enclosingScope,
                                                           Java.Type type,
                                                           java.lang.String name)
                                                    throws Parser.ParseException,
                                                           Scanner.ScanException,
                                                           java.io.IOException
   VariableDeclaratorRest := { '[' ']' } [ '=' VariableInitializer ]
 

parseStatement

public Java.Statement parseStatement(Java.Scope enclosingScope)
                              throws Parser.ParseException,
                                     Scanner.ScanException,
                                     java.io.IOException
   Statement :=
     LabeledStatement |
     Block |
     IfStatement |
     ForStatement |
     WhileStatement |
     DoStatement |
     TryStatement |
     'switch' ... |
     'synchronized' ... |
     ReturnStatement |
     ThrowStatement |
     BreakStatement |
     ContinueStatement |
     ';' |
     ExpressionStatement
 

parseLabeledStatement

public Java.Statement parseLabeledStatement(Java.Scope enclosingScope)
                                     throws Parser.ParseException,
                                            Scanner.ScanException,
                                            java.io.IOException
   LabeledStatement := Identifier ':' Statement
 

parseIfStatement

public Java.Statement parseIfStatement(Java.Scope enclosingScope)
                                throws Parser.ParseException,
                                       Scanner.ScanException,
                                       java.io.IOException
   IfStatement := 'if' '(' Expression ')' Statement [ 'else' Statement ]
 

parseForStatement

public Java.Statement parseForStatement(Java.Scope enclosingScope)
                                 throws Parser.ParseException,
                                        Scanner.ScanException,
                                        java.io.IOException
   ForStatement :=
     'for' '('
       [ ForInit ] ';'
       [ Expression ] ';'
       [ StatementExpressionList ]
     ')' Statement
 

parseWhileStatement

public Java.Statement parseWhileStatement(Java.Scope enclosingScope)
                                   throws Parser.ParseException,
                                          Scanner.ScanException,
                                          java.io.IOException
   WhileStatement := 'while' '(' Expression ')' Statement
 

parseDoStatement

public Java.Statement parseDoStatement(Java.Scope enclosingScope)
                                throws Parser.ParseException,
                                       Scanner.ScanException,
                                       java.io.IOException
   DoStatement := 'do' Statement 'while' '(' Expression ')' ';'
 

parseTryStatement

public Java.Statement parseTryStatement(Java.Scope enclosingScope)
                                 throws Parser.ParseException,
                                        Scanner.ScanException,
                                        java.io.IOException
   TryStatement :=
     'try' Block Catches [ Finally ] |
     'try' Block Finally

   Catches := CatchClause { CatchClause }

   CatchClause := 'catch' '(' FormalParameter ')' Block

   Finally := 'finally' Block
 

parseSwitchStatement

public Java.Statement parseSwitchStatement(Java.Scope enclosingScope)
                                    throws Parser.ParseException,
                                           Scanner.ScanException,
                                           java.io.IOException
   SwitchStatement :=
     'switch' '(' Expression ')' '{' { SwitchLabels BlockStatements } '}'

   SwitchLabels := SwitchLabels { SwitchLabels }

   SwitchLabel := 'case' Expression ':' | 'default' ':'
 

parseSynchronizedStatement

public Java.Statement parseSynchronizedStatement(Java.Scope enclosingScope)
                                          throws Parser.ParseException,
                                                 Scanner.ScanException,
                                                 java.io.IOException
   SynchronizedStatement :=
     'synchronized' '(' expression ')' Block
 

parseReturnStatement

public Java.Statement parseReturnStatement(Java.Scope enclosingScope)
                                    throws Parser.ParseException,
                                           Scanner.ScanException,
                                           java.io.IOException
   ReturnStatement := 'return' [ Expression ] ';'
 

parseThrowStatement

public Java.Statement parseThrowStatement(Java.Scope enclosingScope)
                                   throws Parser.ParseException,
                                          Scanner.ScanException,
                                          java.io.IOException
   ThrowStatement := 'throw' Expression ';'
 

parseBreakStatement

public Java.Statement parseBreakStatement(Java.Scope enclosingScope)
                                   throws Parser.ParseException,
                                          Scanner.ScanException,
                                          java.io.IOException
   BreakStatement := 'break' [ Identifier ] ';'
 

parseContinueStatement

public Java.Statement parseContinueStatement(Java.Scope enclosingScope)
                                      throws Parser.ParseException,
                                             Scanner.ScanException,
                                             java.io.IOException
   ContinueStatement := 'continue' [ Identifier ] ';'
 

parseStatementExpressionList

public Java.BlockStatement parseStatementExpressionList(Java.Scope enclosingScope)
                                                 throws Parser.ParseException,
                                                        Scanner.ScanException,
                                                        java.io.IOException
   StatementExpressionList := ExpressionStatement { ',' ExpressionStatement }
 

parseType

public Java.Type parseType(Java.Scope scope)
                    throws Parser.ParseException,
                           Scanner.ScanException,
                           java.io.IOException
   Type := (
     'byte' | 'short' | 'char' | 'int' | 'long' |
     'float' | 'double' | 'boolean' |
     QualifiedIdentifier
   ) { '[' ']' }
 

parseReferenceType

public Java.ReferenceType parseReferenceType(Java.Scope scope)
                                      throws Parser.ParseException,
                                             Scanner.ScanException,
                                             java.io.IOException
   ReferenceType := QualifiedIdentifier
 

parseReferenceTypeList

public Java.ReferenceType[] parseReferenceTypeList(Java.Scope scope)
                                            throws Parser.ParseException,
                                                   Scanner.ScanException,
                                                   java.io.IOException
   ReferenceTypeList := ReferenceType { ',' ReferenceType }
 

parseExpression

public Java.Atom parseExpression(Java.Scope enclosingScope)
                          throws Parser.ParseException,
                                 Scanner.ScanException,
                                 java.io.IOException
   Expression := AssignmentExpression
 

parseAssignmentExpression

public Java.Atom parseAssignmentExpression(Java.Scope enclosingScope)
                                    throws Parser.ParseException,
                                           Scanner.ScanException,
                                           java.io.IOException
   AssignmentExpression :=
     ConditionalExpression [ AssignmentOperator AssignmentExpression ]

   AssignmentOperator :=
     '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' |
     '>>=' | '>>>=' | '&=' | '^=' | '|='
 

parseConditionalExpression

public Java.Atom parseConditionalExpression(Java.Scope enclosingScope)
                                     throws Parser.ParseException,
                                            Scanner.ScanException,
                                            java.io.IOException
   ConditionalExpression :=
     ConditionalOrExpression [ '?' Expression ':' ConditionalExpression ]
 

parseConditionalOrExpression

public Java.Atom parseConditionalOrExpression(Java.Scope enclosingScope)
                                       throws Parser.ParseException,
                                              Scanner.ScanException,
                                              java.io.IOException
   ConditionalOrExpression :=
     ConditionalAndExpression { '||' ConditionalAndExpression ]
 

parseConditionalAndExpression

public Java.Atom parseConditionalAndExpression(Java.Scope enclosingScope)
                                        throws Parser.ParseException,
                                               Scanner.ScanException,
                                               java.io.IOException
   ConditionalAndExpression :=
     InclusiveOrExpression { '&&' InclusiveOrExpression }
 

parseInclusiveOrExpression

public Java.Atom parseInclusiveOrExpression(Java.Scope enclosingScope)
                                     throws Parser.ParseException,
                                            Scanner.ScanException,
                                            java.io.IOException
   InclusiveOrExpression :=
     ExclusiveOrExpression { '|' ExclusiveOrExpression }
 

parseExclusiveOrExpression

public Java.Atom parseExclusiveOrExpression(Java.Scope enclosingScope)
                                     throws Parser.ParseException,
                                            Scanner.ScanException,
                                            java.io.IOException
   ExclusiveOrExpression :=
     AndExpression { '^' AndExpression }
 

parseAndExpression

public Java.Atom parseAndExpression(Java.Scope enclosingScope)
                             throws Parser.ParseException,
                                    Scanner.ScanException,
                                    java.io.IOException
   AndExpression :=
     EqualityExpression { '&' EqualityExpression }
 

parseEqualityExpression

public Java.Atom parseEqualityExpression(Java.Scope enclosingScope)
                                  throws Parser.ParseException,
                                         Scanner.ScanException,
                                         java.io.IOException
   EqualityExpression :=
     RelationalExpression { ( '==' | '!=' ) RelationalExpression }
 

parseRelationalExpression

public Java.Atom parseRelationalExpression(Java.Scope enclosingScope)
                                    throws Parser.ParseException,
                                           Scanner.ScanException,
                                           java.io.IOException
   RelationalExpression :=
     ShiftExpression {
       ( ( '<' | '>' | '<=' | '>=' ) ShiftExpression ) |
       ( 'instanceof' ReferenceType )
     }
 

parseShiftExpression

public Java.Atom parseShiftExpression(Java.Scope enclosingScope)
                               throws Parser.ParseException,
                                      Scanner.ScanException,
                                      java.io.IOException
   ShiftExpression :=
     AdditiveExpression { ( '<<' | '>>' | '>>>' ) AdditiveExpression }
 

parseAdditiveExpression

public Java.Atom parseAdditiveExpression(Java.Scope enclosingScope)
                                  throws Parser.ParseException,
                                         Scanner.ScanException,
                                         java.io.IOException
   AdditiveExpression :=
     MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }
 

parseMultiplicativeExpression

public Java.Atom parseMultiplicativeExpression(Java.Scope enclosingScope)
                                        throws Parser.ParseException,
                                               Scanner.ScanException,
                                               java.io.IOException
   MultiplicativeExpression :=
     UnaryExpression { ( '*' | '/' | '%' ) UnaryExpression }
 

parseUnaryExpression

public Java.Atom parseUnaryExpression(Java.Scope enclosingScope)
                               throws Parser.ParseException,
                                      Scanner.ScanException,
                                      java.io.IOException
   UnaryExpression :=
     { PrefixOperator } Primary { Selector } { PostfixOperator }

   PrefixOperator := '++' | '--' | '+' | '-' | '~' | '!'

   PostfixOperator := '++' | '--'
 

parsePrimary

public Java.Atom parsePrimary(Java.Scope enclosingScope)
                       throws Parser.ParseException,
                              Scanner.ScanException,
                              java.io.IOException
   Primary :=
     '(' PrimitiveType { '[]' } ')' UnaryExpression | // CastExpression 15.16
     '(' Expression ')' UnaryExpression |    // CastExpression 15.16
     '(' Expression ')' |                    // ParenthesizedExpression 15.8.5
     Literal |                               // Literal 15.8.1
     Name |                                  // AmbiguousName
     Name Arguments |                        // MethodInvocation
     Name '[]' { '[]' } |                    // ArrayType 10.1
     Name '[]' { '[]' } '.' 'class' |        // ClassLiteral 15.8.2
     'this' |                                // This 15.8.3
     'super' '.' Identifier |                // SuperclassFieldAccess 15.11.2
     'super' '.' Identifier Arguments |      // SuperclassMethodInvocation 15.12.4.9
     'new' ReferenceType Arguments [ ClassBody ] | // ClassInstanceCreationExpression 15.9
     'new' Type DimExprs { '[]' } |          // ArrayCreationExpression 15.10
     'new' ArrayType ArrayInitializer |      // ArrayInitializer 10.6
     BasicType { '[]' } |                    // Type
     BasicType { '[]' } '.' 'class' |        // ClassLiteral 15.8.2
     'void' '.' 'class'                      // ClassLiteral 15.8.2
 

parseSelector

public Java.Atom parseSelector(Java.Scope enclosingScope,
                               Java.Atom atom)
                        throws Parser.ParseException,
                               Scanner.ScanException,
                               java.io.IOException
   Selector :=
     '.' Identifier |                       // FieldAccess 15.11.1
     '.' Identifier Arguments |             // MethodInvocation
     '.' 'this'                             // QualifiedThis 15.8.4
     '.' 'super' '.' Identifier |           // SuperclassFieldReference
     '.' 'super' '.' Identifier Arguments | // SuperclassMethodInvocation 15.12.4.9
     '.' 'new' Identifier Arguments [ ClassBody ] | // QualifiedClassInstanceCreationExpression  15.9
     '.' 'class'
     '[' Expression ']'                     // ArrayAccessExpression 15.13
 

parseDimExprs

public Java.Rvalue[] parseDimExprs(Java.Scope enclosingScope)
                            throws Parser.ParseException,
                                   Scanner.ScanException,
                                   java.io.IOException
   DimExprs := { '[' Expression ']' }
 

parseArguments

public Java.Rvalue[] parseArguments(Java.Scope enclosingScope)
                             throws Parser.ParseException,
                                    Scanner.ScanException,
                                    java.io.IOException
   Arguments := '(' [ ArgumentList ] ')'
 

parseArgumentList

public Java.Rvalue[] parseArgumentList(Java.Scope enclosingScope)
                                throws Parser.ParseException,
                                       Scanner.ScanException,
                                       java.io.IOException
   ArgumentList := Expression { ',' Expression }
 

parseLiteral

public Java.Atom parseLiteral()
                       throws Parser.ParseException,
                              Scanner.ScanException,
                              java.io.IOException

parseExpressionStatement

public Java.Statement parseExpressionStatement(Java.Scope enclosingScope)
                                        throws Parser.ParseException,
                                               Scanner.ScanException,
                                               java.io.IOException
   ExpressionStatement := Expression