9ff439e39e
This change only matters in cases of if/when/for/while having braceless blocks Annotations on them are parsed now as on block-level expressions, i.e. they're attached to the whole expression
45 lines
703 B
Plaintext
45 lines
703 B
Plaintext
/**
|
|
## Control structures
|
|
|
|
See [Control structures](control-flow.html)
|
|
*/
|
|
|
|
controlStructureBody
|
|
: block
|
|
: blockLevelExpression
|
|
;
|
|
|
|
if
|
|
: "if" "(" expression ")" controlStructureBody SEMI? ("else" controlStructureBody)?
|
|
;
|
|
|
|
try
|
|
: "try" block catchBlock* finallyBlock?
|
|
;
|
|
|
|
catchBlock
|
|
: "catch" "(" annotations SimpleName ":" userType ")" block
|
|
;
|
|
|
|
finallyBlock
|
|
: "finally" block
|
|
;
|
|
|
|
loop
|
|
: for
|
|
: while
|
|
: doWhile
|
|
;
|
|
|
|
for
|
|
: "for" "(" annotations (multipleVariableDeclarations | variableDeclarationEntry) "in" expression ")" controlStructureBody
|
|
;
|
|
|
|
while
|
|
: "while" "(" expression ")" controlStructureBody
|
|
;
|
|
|
|
doWhile
|
|
: "do" controlStructureBody "while" "(" expression ")"
|
|
;
|