Support Java 7 "try with resources" and "multi-catch"
This commit is contained in:
parent
c8701a9434
commit
a670d7d2b0
|
@ -628,11 +628,8 @@ statement
|
|||
| 'for' '(' forControl ')' statement
|
||||
| 'while' parExpression statement
|
||||
| 'do' statement 'while' parExpression ';'
|
||||
| 'try' block
|
||||
( catches 'finally' block
|
||||
| catches
|
||||
| 'finally' block
|
||||
)
|
||||
| 'try' block (catches finallyBlock? | finallyBlock)
|
||||
| 'try' resourceSpecification block catches? finallyBlock?
|
||||
| 'switch' parExpression '{' switchBlockStatementGroups '}'
|
||||
| 'synchronized' parExpression block
|
||||
| 'return' expression? ';'
|
||||
|
@ -645,13 +642,33 @@ statement
|
|||
;
|
||||
|
||||
catches
|
||||
: catchClause (catchClause)*
|
||||
: catchClause+
|
||||
;
|
||||
|
||||
catchClause
|
||||
: 'catch' '(' formalParameter ')' block
|
||||
: 'catch' '(' variableModifiers catchType Identifier ')' block
|
||||
;
|
||||
|
||||
catchType
|
||||
: qualifiedName ('|' qualifiedName)*
|
||||
;
|
||||
|
||||
finallyBlock
|
||||
: 'finally' block
|
||||
;
|
||||
|
||||
resourceSpecification
|
||||
: '(' resources ';'? ')'
|
||||
;
|
||||
|
||||
resources
|
||||
: resource (';' resource)*
|
||||
;
|
||||
|
||||
resource
|
||||
: variableModifiers classOrInterfaceType variableDeclaratorId '=' expression
|
||||
;
|
||||
|
||||
formalParameter
|
||||
: variableModifiers type variableDeclaratorId
|
||||
;
|
||||
|
|
|
@ -625,11 +625,8 @@ statement
|
|||
| 'for' '(' forControl ')' statement
|
||||
| 'while' parExpression statement
|
||||
| 'do' statement 'while' parExpression ';'
|
||||
| 'try' block
|
||||
( catches 'finally' block
|
||||
| catches
|
||||
| 'finally' block
|
||||
)
|
||||
| 'try' block (catches finallyBlock? | finallyBlock)
|
||||
| 'try' resourceSpecification block catches? finallyBlock?
|
||||
| 'switch' parExpression '{' switchBlockStatementGroups '}'
|
||||
| 'synchronized' parExpression block
|
||||
| 'return' expression? ';'
|
||||
|
@ -642,13 +639,33 @@ statement
|
|||
;
|
||||
|
||||
catches
|
||||
: catchClause (catchClause)*
|
||||
: catchClause+
|
||||
;
|
||||
|
||||
catchClause
|
||||
: 'catch' '(' formalParameter ')' block
|
||||
: 'catch' '(' variableModifiers catchType Identifier ')' block
|
||||
;
|
||||
|
||||
catchType
|
||||
: qualifiedName ('|' qualifiedName)*
|
||||
;
|
||||
|
||||
finallyBlock
|
||||
: 'finally' block
|
||||
;
|
||||
|
||||
resourceSpecification
|
||||
: '(' resources ';'? ')'
|
||||
;
|
||||
|
||||
resources
|
||||
: resource (';' resource)*
|
||||
;
|
||||
|
||||
resource
|
||||
: variableModifiers classOrInterfaceType variableDeclaratorId '=' expression
|
||||
;
|
||||
|
||||
formalParameter
|
||||
: variableModifiers type variableDeclaratorId
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue