Files
kotlin-fork/grammar/src/control.grm
T
Denis Zharkov 9ff439e39e Change annotations parsing in bodies of operators
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
2016-10-12 11:39:04 +03:00

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 ")"
;