Package org.codehaus.janino
Class Parser
java.lang.Object
org.codehaus.janino.Parser
A parser for the Java™ programming language.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final CompileExceptioncompileException(String message) Convenience method for throwing a CompileException.location()AdditiveExpression := MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }AndExpression := EqualityExpression { 'invalid input: '&'' EqualityExpression }ArgumentList := Expression { ',' Expression }Arguments := '(' [ ArgumentList ] ')'ArrayInitializer := '{' [ VariableInitializer { ',' VariableInitializer } [ ',' ] '}'AssertStatement := 'assert' Expression [ ':' Expression ] ';'AssignmentExpression := ConditionalExpression [ AssignmentOperator AssignmentExpression ] AssignmentOperator := '=' | '*=' | '/=' | '%=' | '+=' | '-=' | 'invalid input: '<'invalid input: '<'=' | '>>=' | '>>>=' | 'invalid input: '&'=' | '^=' | '|=''{' BlockStatements '}'BlockStatement := { Identifier ':' } ( ( Modifiers Type | ModifiersOpt BasicType ) LocalVariableDeclarators ';' | 'class' ...BlockStatements := { BlockStatement }BreakStatement := 'break' [ Identifier ] ';'voidparseClassBody(Java.ClassDeclaration classDeclaration) ClassBody := '{' { ClassBodyDeclaration } '}'voidparseClassBodyDeclaration(Java.ClassDeclaration classDeclaration) ClassBodyDeclaration := ';' | ModifiersOpt ( Block | // Instance (JLS2 8.6) or static initializer (JLS2 8.7) 'void' Identifier MethodDeclarationRest | 'class' ClassDeclarationRest | 'interface' InterfaceDeclarationRest | ConstructorDeclarator | Type Identifier ( MethodDeclarationRest | FieldDeclarationRest ';' ) )parseClassDeclarationRest(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations, Parser.ClassDeclarationContext context) ClassDeclarationRest := Identifier [ 'extends' ReferenceType ] [ 'implements' ReferenceTypeList ] ClassBodyCompilationUnit := [ PackageDeclaration ] { ImportDeclaration } { TypeDeclaration }ConditionalAndExpression := InclusiveOrExpression { 'invalid input: '&'invalid input: '&'' InclusiveOrExpression }ConditionalExpression := ConditionalOrExpression [ '?' Expression ':' ConditionalExpression ]ConditionalOrExpression := ConditionalAndExpression { '||' ConditionalAndExpression ]parseConstructorDeclarator(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations) ConstructorDeclarator := Identifier FormalParameters [ 'throws' ReferenceTypeList ] '{' [ 'this' Arguments ';' | 'super' Arguments ';' | Primary '.' 'super' Arguments ';' ] BlockStatements '}'ContinueStatement := 'continue' [ Identifier ] ';'DimExpr := '[' Expression ']'DimExprs := DimExpr { DimExpr }DoStatement := 'do' Statement 'while' '(' Expression ')' ';'EmptyStatement := ';'EqualityExpression := RelationalExpression { ( '==' | '!=' ) RelationalExpression }ExclusiveOrExpression := AndExpression { '^' AndExpression }Expression := AssignmentExpressionExpressionList := Expression { ',' Expression }ExpressionStatement := Expression ';'FieldDeclarationRest := VariableDeclaratorRest { ',' VariableDeclarator }FormalParameter := [ 'final' ] Type Identifier BracketsOptFormalParameters := '(' [ FormalParameter { ',' FormalParameter } ] ')'ForStatement := 'for' '(' [ ForInit ] ';' [ Expression ] ';' [ ExpressionList ] ')' StatementIfStatement := 'if' '(' Expression ')' Statement [ 'else' Statement ]ImportDeclaration := 'import' ImportDeclarationBody ';'ImportDeclarationBody := [ 'static' ] Identifier { '.' Identifier } [ '.' '*' ]InclusiveOrExpression := ExclusiveOrExpression { '|' ExclusiveOrExpression }voidparseInterfaceBody(Java.InterfaceDeclaration interfaceDeclaration) InterfaceBody := '{' { ';' | ModifiersOpt ( 'void' Identifier MethodDeclarationRest | 'class' ClassDeclarationRest | 'interface' InterfaceDeclarationRest | Type Identifier ( MethodDeclarationRest | FieldDeclarationRest ) ) } '}'parseInterfaceDeclarationRest(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations, Parser.InterfaceDeclarationContext context) InterfaceDeclarationRest := Identifier [ 'extends' ReferenceTypeList ] InterfaceBodyLabeledStatement := Identifier ':' StatementLocalVariableDeclarators := VariableDeclarator { ',' VariableDeclarator }MethodBody := BlockparseMethodDeclarationRest(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations, Java.Type type, String name) MethodDeclarationRest := FormalParameters { '[' ']' } [ 'throws' ReferenceTypeList ] ( ';' | MethodBody )ModifiersAndAnnotations := { 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native' | 'synchronized' | 'transient' | 'volatile' | 'strictfp' | Annotation }MultiplicativeExpression := UnaryExpression { ( '*' | '/' | '%' ) UnaryExpression }PackageDeclaration := 'package' QualifiedIdentifier ';'PackageMemberTypeDeclaration := ModifiersOpt 'class' ClassDeclarationRest | ModifiersOpt 'interface' InterfaceDeclarationRestPrimary := CastExpression | // 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 'this' Arguments | // Alternate constructor invocation 8.8.5.1 'super' Arguments | // Unqualified superclass constructor invocation 8.8.5.1 'super' '.' Identifier | // SuperclassFieldAccess 15.11.2 'super' '.' Identifier Arguments | // SuperclassMethodInvocation 15.12.4.9 NewClassInstance | NewAnonymousClassInstance | // ClassInstanceCreationExpression 15.9 NewArray | // ArrayCreationExpression 15.10 NewInitializedArray | // ArrayInitializer 10.6 BasicType { '[]' } | // Type BasicType { '[]' } '.' 'class' | // ClassLiteral 15.8.2 'void' '.' 'class' // ClassLiteral 15.8.2 CastExpression := '(' PrimitiveType { '[]' } ')' UnaryExpression | '(' Expression ')' UnaryExpression NewClassInstance := 'new' ReferenceType Arguments NewAnonymousClassInstance := 'new' ReferenceType Arguments [ ClassBody ] NewArray := 'new' Type DimExprs { '[]' } NewInitializedArray := 'new' ArrayType ArrayInitializerString[]QualifiedIdentifier := Identifier { '.' Identifier }ReferenceType := QualifiedIdentifierReferenceTypeList := ReferenceType { ',' ReferenceType }RelationalExpression := ShiftExpression { ( ( 'invalid input: '<'' | '>' | 'invalid input: '<'=' | '>=' ) ShiftExpression ) | ( 'instanceof' ReferenceType ) }ReturnStatement := 'return' [ Expression ] ';'parseSelector(Java.Atom atom) Selector := '.' Identifier | // FieldAccess 15.11.1 '.' Identifier Arguments | // MethodInvocation '.' 'this' // QualifiedThis 15.8.4 '.' 'super' Arguments // Qualified superclass constructor invocation (JLS 8.8.5.1) '.' 'super' '.' Identifier | // SuperclassFieldReference (JLS 15.11.2) '.' 'super' '.' Identifier Arguments | // SuperclassMethodInvocation (JLS 15.12.4.9) '.' 'new' Identifier Arguments [ ClassBody ] | // QualifiedClassInstanceCreationExpression 15.9 '.' 'class' '[' Expression ']' // ArrayAccessExpression 15.13ShiftExpression := AdditiveExpression { ( 'invalid input: '<'invalid input: '<'' | '>>' | '>>>' ) AdditiveExpression }Statement := LabeledStatement | Block | IfStatement | ForStatement | WhileStatement | DoStatement | TryStatement | 'switch' ...SwitchStatement := 'switch' '(' Expression ')' '{' { SwitchLabels BlockStatements } '}' SwitchLabels := SwitchLabels { SwitchLabels } SwitchLabel := 'case' Expression ':' | 'default' ':'SynchronizedStatement := 'synchronized' '(' expression ')' BlockThrowStatement := 'throw' Expression ';'TryStatement := 'try' Block Catches [ Finally ] | 'try' Block Finally Catches := CatchClause { CatchClause } CatchClause := 'catch' '(' FormalParameter ')' Block Finally := 'finally' BlockType := ( 'byte' | 'short' | 'char' | 'int' | 'long' | 'float' | 'double' | 'boolean' | ReferenceType ) { '[' ']' }UnaryExpression := { PrefixOperator } Primary { Selector } { PostfixOperator } PrefixOperator := '++' | '--' | '+' | '-' | '~' | '!' PostfixOperator := '++' | '--'VariableDeclarator := Identifier VariableDeclaratorRestVariableDeclaratorRest := { '[' ']' } [ '=' VariableInitializer ]VariableInitializer := ArrayInitializer | ExpressionWhileStatement := 'while' '(' Expression ')' Statementpeek()intpeek(int[] types) booleanintbooleanpeekEof()booleanbooleanpeekNextButOne(String value) booleanintread()voidintvoidsetWarningHandler(WarningHandler optionalWarningHandler) By default, warnings are discarded, but an application my install aWarningHandler.
-
Constructor Details
-
Parser
-
-
Method Details
-
getScanner
-
parseCompilationUnit
CompilationUnit := [ PackageDeclaration ] { ImportDeclaration } { TypeDeclaration }- Throws:
CompileExceptionIOException
-
parsePackageDeclaration
PackageDeclaration := 'package' QualifiedIdentifier ';'
- Throws:
CompileExceptionIOException
-
parseImportDeclaration
public Java.CompilationUnit.ImportDeclaration parseImportDeclaration() throws CompileException, IOExceptionImportDeclaration := 'import' ImportDeclarationBody ';'
- Throws:
CompileExceptionIOException
-
parseImportDeclarationBody
public Java.CompilationUnit.ImportDeclaration parseImportDeclarationBody() throws CompileException, IOExceptionImportDeclarationBody := [ 'static' ] Identifier { '.' Identifier } [ '.' '*' ]- Throws:
CompileExceptionIOException
-
parseQualifiedIdentifier
QualifiedIdentifier := Identifier { '.' Identifier }- Throws:
CompileExceptionIOException
-
parsePackageMemberTypeDeclaration
public Java.PackageMemberTypeDeclaration parsePackageMemberTypeDeclaration() throws CompileException, IOExceptionPackageMemberTypeDeclaration := ModifiersOpt 'class' ClassDeclarationRest | ModifiersOpt 'interface' InterfaceDeclarationRest- Throws:
CompileExceptionIOException
-
parseModifiersAndAnnotations
public Java.ModifiersAndAnnotations parseModifiersAndAnnotations() throws CompileException, IOExceptionModifiersAndAnnotations := { 'public' | 'protected' | 'private' | 'static' | 'abstract' | 'final' | 'native' | 'synchronized' | 'transient' | 'volatile' | 'strictfp' | Annotation }- Throws:
CompileExceptionIOException
-
parseClassDeclarationRest
public Java.NamedClassDeclaration parseClassDeclarationRest(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations, Parser.ClassDeclarationContext context) throws CompileException, IOException ClassDeclarationRest := Identifier [ 'extends' ReferenceType ] [ 'implements' ReferenceTypeList ] ClassBody- Throws:
CompileExceptionIOException
-
parseClassBody
public void parseClassBody(Java.ClassDeclaration classDeclaration) throws CompileException, IOException ClassBody := '{' { ClassBodyDeclaration } '}'- Throws:
CompileExceptionIOException
-
parseClassBodyDeclaration
public void parseClassBodyDeclaration(Java.ClassDeclaration classDeclaration) throws CompileException, IOException ClassBodyDeclaration := ';' | ModifiersOpt ( Block | // Instance (JLS2 8.6) or static initializer (JLS2 8.7) 'void' Identifier MethodDeclarationRest | 'class' ClassDeclarationRest | 'interface' InterfaceDeclarationRest | ConstructorDeclarator | Type Identifier ( MethodDeclarationRest | FieldDeclarationRest ';' ) )- Throws:
CompileExceptionIOException
-
parseInterfaceDeclarationRest
public Java.InterfaceDeclaration parseInterfaceDeclarationRest(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations, Parser.InterfaceDeclarationContext context) throws CompileException, IOException InterfaceDeclarationRest := Identifier [ 'extends' ReferenceTypeList ] InterfaceBody- Throws:
CompileExceptionIOException
-
parseInterfaceBody
public void parseInterfaceBody(Java.InterfaceDeclaration interfaceDeclaration) throws CompileException, IOException InterfaceBody := '{' { ';' | ModifiersOpt ( 'void' Identifier MethodDeclarationRest | 'class' ClassDeclarationRest | 'interface' InterfaceDeclarationRest | Type Identifier ( MethodDeclarationRest | FieldDeclarationRest ) ) } '}'- Throws:
CompileExceptionIOException
-
parseConstructorDeclarator
public Java.ConstructorDeclarator parseConstructorDeclarator(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations) throws CompileException, IOException ConstructorDeclarator := Identifier FormalParameters [ 'throws' ReferenceTypeList ] '{' [ 'this' Arguments ';' | 'super' Arguments ';' | Primary '.' 'super' Arguments ';' ] BlockStatements '}'- Throws:
CompileExceptionIOException
-
parseMethodDeclarationRest
public Java.MethodDeclarator parseMethodDeclarationRest(String optionalDocComment, Java.ModifiersAndAnnotations modifiersAndAnnotations, Java.Type type, String name) throws CompileException, IOException MethodDeclarationRest := FormalParameters { '[' ']' } [ 'throws' ReferenceTypeList ] ( ';' | MethodBody )- Throws:
CompileExceptionIOException
-
parseVariableInitializer
public Java.ArrayInitializerOrRvalue parseVariableInitializer() throws CompileException, IOExceptionVariableInitializer := ArrayInitializer | Expression- Throws:
CompileExceptionIOException
-
parseArrayInitializer
ArrayInitializer := '{' [ VariableInitializer { ',' VariableInitializer } [ ',' ] '}'- Throws:
CompileExceptionIOException
-
parseFormalParameters
public Java.FunctionDeclarator.FormalParameter[] parseFormalParameters() throws CompileException, IOExceptionFormalParameters := '(' [ FormalParameter { ',' FormalParameter } ] ')'- Throws:
CompileExceptionIOException
-
parseFormalParameter
public Java.FunctionDeclarator.FormalParameter parseFormalParameter() throws CompileException, IOExceptionFormalParameter := [ 'final' ] Type Identifier BracketsOpt
- Throws:
CompileExceptionIOException
-
parseMethodBody
MethodBody := Block
- Throws:
CompileExceptionIOException
-
parseBlock
'{' BlockStatements '}'- Throws:
CompileExceptionIOException
-
parseBlockStatements
BlockStatements := { BlockStatement }- Throws:
CompileExceptionIOException
-
parseBlockStatement
BlockStatement := { Identifier ':' } ( ( Modifiers Type | ModifiersOpt BasicType ) LocalVariableDeclarators ';' | 'class' ... | Statement | 'final' Type LocalVariableDeclarators ';' | Expression ';' | Expression LocalVariableDeclarators ';' (1) )(1) "Expression" must pose a type, and has optional trailing brackets.- Throws:
CompileExceptionIOException
-
parseLocalVariableDeclarators
public Java.VariableDeclarator[] parseLocalVariableDeclarators() throws CompileException, IOExceptionLocalVariableDeclarators := VariableDeclarator { ',' VariableDeclarator }- Throws:
CompileExceptionIOException
-
parseFieldDeclarationRest
public Java.VariableDeclarator[] parseFieldDeclarationRest(String name) throws CompileException, IOException FieldDeclarationRest := VariableDeclaratorRest { ',' VariableDeclarator }- Throws:
CompileExceptionIOException
-
parseVariableDeclarator
VariableDeclarator := Identifier VariableDeclaratorRest
- Throws:
CompileExceptionIOException
-
parseVariableDeclaratorRest
public Java.VariableDeclarator parseVariableDeclaratorRest(String name) throws CompileException, IOException VariableDeclaratorRest := { '[' ']' } [ '=' VariableInitializer ]Used by field declarations and local variable declarations.- Throws:
CompileExceptionIOException
-
parseStatement
Statement := LabeledStatement | Block | IfStatement | ForStatement | WhileStatement | DoStatement | TryStatement | 'switch' ... | 'synchronized' ... | ReturnStatement | ThrowStatement | BreakStatement | ContinueStatement | EmptyStatement | ExpressionStatement- Throws:
CompileExceptionIOException
-
parseLabeledStatement
LabeledStatement := Identifier ':' Statement
- Throws:
CompileExceptionIOException
-
parseIfStatement
IfStatement := 'if' '(' Expression ')' Statement [ 'else' Statement ]- Throws:
CompileExceptionIOException
-
parseForStatement
ForStatement := 'for' '(' [ ForInit ] ';' [ Expression ] ';' [ ExpressionList ] ')' Statement- Throws:
CompileExceptionIOException
-
parseWhileStatement
WhileStatement := 'while' '(' Expression ')' Statement- Throws:
CompileExceptionIOException
-
parseDoStatement
DoStatement := 'do' Statement 'while' '(' Expression ')' ';'- Throws:
CompileExceptionIOException
-
parseTryStatement
TryStatement := 'try' Block Catches [ Finally ] | 'try' Block Finally Catches := CatchClause { CatchClause } CatchClause := 'catch' '(' FormalParameter ')' Block Finally := 'finally' Block- Throws:
CompileExceptionIOException
-
parseSwitchStatement
SwitchStatement := 'switch' '(' Expression ')' '{' { SwitchLabels BlockStatements } '}' SwitchLabels := SwitchLabels { SwitchLabels } SwitchLabel := 'case' Expression ':' | 'default' ':'- Throws:
CompileExceptionIOException
-
parseSynchronizedStatement
SynchronizedStatement := 'synchronized' '(' expression ')' Block- Throws:
CompileExceptionIOException
-
parseReturnStatement
ReturnStatement := 'return' [ Expression ] ';'
- Throws:
CompileExceptionIOException
-
parseThrowStatement
ThrowStatement := 'throw' Expression ';'
- Throws:
CompileExceptionIOException
-
parseBreakStatement
BreakStatement := 'break' [ Identifier ] ';'
- Throws:
CompileExceptionIOException
-
parseContinueStatement
ContinueStatement := 'continue' [ Identifier ] ';'
- Throws:
CompileExceptionIOException
-
parseAssertStatement
AssertStatement := 'assert' Expression [ ':' Expression ] ';'
- Throws:
CompileExceptionIOException
-
parseEmptyStatement
EmptyStatement := ';'
- Throws:
CompileExceptionIOException
-
parseExpressionList
ExpressionList := Expression { ',' Expression }- Throws:
CompileExceptionIOException
-
parseType
Type := ( 'byte' | 'short' | 'char' | 'int' | 'long' | 'float' | 'double' | 'boolean' | ReferenceType ) { '[' ']' }- Throws:
CompileExceptionIOException
-
parseReferenceType
ReferenceType := QualifiedIdentifier
- Throws:
CompileExceptionIOException
-
parseReferenceTypeList
ReferenceTypeList := ReferenceType { ',' ReferenceType }- Throws:
CompileExceptionIOException
-
parseExpression
Expression := AssignmentExpression
- Throws:
CompileExceptionIOException
-
parseAssignmentExpression
AssignmentExpression := ConditionalExpression [ AssignmentOperator AssignmentExpression ] AssignmentOperator := '=' | '*=' | '/=' | '%=' | '+=' | '-=' | 'invalid input: '<'invalid input: '<'=' | '>>=' | '>>>=' | 'invalid input: '&'=' | '^=' | '|='- Throws:
CompileExceptionIOException
-
parseConditionalExpression
ConditionalExpression := ConditionalOrExpression [ '?' Expression ':' ConditionalExpression ]- Throws:
CompileExceptionIOException
-
parseConditionalOrExpression
ConditionalOrExpression := ConditionalAndExpression { '||' ConditionalAndExpression ]- Throws:
CompileExceptionIOException
-
parseConditionalAndExpression
ConditionalAndExpression := InclusiveOrExpression { 'invalid input: '&'invalid input: '&'' InclusiveOrExpression }- Throws:
CompileExceptionIOException
-
parseInclusiveOrExpression
InclusiveOrExpression := ExclusiveOrExpression { '|' ExclusiveOrExpression }- Throws:
CompileExceptionIOException
-
parseExclusiveOrExpression
ExclusiveOrExpression := AndExpression { '^' AndExpression }- Throws:
CompileExceptionIOException
-
parseAndExpression
AndExpression := EqualityExpression { 'invalid input: '&'' EqualityExpression }- Throws:
CompileExceptionIOException
-
parseEqualityExpression
EqualityExpression := RelationalExpression { ( '==' | '!=' ) RelationalExpression }- Throws:
CompileExceptionIOException
-
parseRelationalExpression
RelationalExpression := ShiftExpression { ( ( 'invalid input: '<'' | '>' | 'invalid input: '<'=' | '>=' ) ShiftExpression ) | ( 'instanceof' ReferenceType ) }- Throws:
CompileExceptionIOException
-
parseShiftExpression
ShiftExpression := AdditiveExpression { ( 'invalid input: '<'invalid input: '<'' | '>>' | '>>>' ) AdditiveExpression }- Throws:
CompileExceptionIOException
-
parseAdditiveExpression
AdditiveExpression := MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }- Throws:
CompileExceptionIOException
-
parseMultiplicativeExpression
MultiplicativeExpression := UnaryExpression { ( '*' | '/' | '%' ) UnaryExpression }- Throws:
CompileExceptionIOException
-
parseUnaryExpression
UnaryExpression := { PrefixOperator } Primary { Selector } { PostfixOperator } PrefixOperator := '++' | '--' | '+' | '-' | '~' | '!' PostfixOperator := '++' | '--'- Throws:
CompileExceptionIOException
-
parsePrimary
Primary := CastExpression | // 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 'this' Arguments | // Alternate constructor invocation 8.8.5.1 'super' Arguments | // Unqualified superclass constructor invocation 8.8.5.1 'super' '.' Identifier | // SuperclassFieldAccess 15.11.2 'super' '.' Identifier Arguments | // SuperclassMethodInvocation 15.12.4.9 NewClassInstance | NewAnonymousClassInstance | // ClassInstanceCreationExpression 15.9 NewArray | // ArrayCreationExpression 15.10 NewInitializedArray | // ArrayInitializer 10.6 BasicType { '[]' } | // Type BasicType { '[]' } '.' 'class' | // ClassLiteral 15.8.2 'void' '.' 'class' // ClassLiteral 15.8.2 CastExpression := '(' PrimitiveType { '[]' } ')' UnaryExpression | '(' Expression ')' UnaryExpression NewClassInstance := 'new' ReferenceType Arguments NewAnonymousClassInstance := 'new' ReferenceType Arguments [ ClassBody ] NewArray := 'new' Type DimExprs { '[]' } NewInitializedArray := 'new' ArrayType ArrayInitializer- Throws:
CompileExceptionIOException
-
parseSelector
Selector := '.' Identifier | // FieldAccess 15.11.1 '.' Identifier Arguments | // MethodInvocation '.' 'this' // QualifiedThis 15.8.4 '.' 'super' Arguments // Qualified superclass constructor invocation (JLS 8.8.5.1) '.' 'super' '.' Identifier | // SuperclassFieldReference (JLS 15.11.2) '.' 'super' '.' Identifier Arguments | // SuperclassMethodInvocation (JLS 15.12.4.9) '.' 'new' Identifier Arguments [ ClassBody ] | // QualifiedClassInstanceCreationExpression 15.9 '.' 'class' '[' Expression ']' // ArrayAccessExpression 15.13- Throws:
CompileExceptionIOException
-
parseDimExprs
DimExprs := DimExpr { DimExpr }- Throws:
CompileExceptionIOException
-
parseDimExpr
DimExpr := '[' Expression ']'
- Throws:
CompileExceptionIOException
-
parseArguments
Arguments := '(' [ ArgumentList ] ')'- Throws:
CompileExceptionIOException
-
parseArgumentList
ArgumentList := Expression { ',' Expression }- Throws:
CompileExceptionIOException
-
parseLiteral
- Throws:
CompileExceptionIOException
-
parseExpressionStatement
ExpressionStatement := Expression ';'
- Throws:
CompileExceptionIOException
-
location
-
peek
- Throws:
CompileExceptionIOException
-
peekNextButOne
- Throws:
CompileExceptionIOException
-
read
- Throws:
CompileExceptionIOException
-
peek
- Throws:
CompileExceptionIOException
-
peek
- Throws:
CompileExceptionIOException
-
peek
- Throws:
CompileExceptionIOException
-
peekNextButOne
- Throws:
CompileExceptionIOException
-
read
- Throws:
CompileExceptionIOException
-
read
- Throws:
CompileExceptionIOException
-
peekRead
- Throws:
CompileExceptionIOException
-
peekRead
- Returns:
- -1 iff the next token is none of
values - Throws:
CompileExceptionIOException
-
peekEof
- Throws:
CompileExceptionIOException
-
peekIdentifier
- Throws:
CompileExceptionIOException
-
peekLiteral
- Throws:
CompileExceptionIOException
-
readIdentifier
- Throws:
CompileExceptionIOException
-
readOperator
- Throws:
CompileExceptionIOException
-
setWarningHandler
By default, warnings are discarded, but an application my install aWarningHandler.Notice that there is no
Parser.setErrorHandler()method, but parse errors always throw aCompileException. The reason being is that there is no reasonable way to recover from parse errors and continue parsing, so there is no need to install a custom parse error handler.- Parameters:
optionalWarningHandler-nullto indicate that no warnings be issued
-
compileException
Convenience method for throwing a CompileException.
-