Files
kotlin-fork/grammar/src/when.grm
T
Alexander Udalov 3ad4f18e1a Update grammar to Kotlin 1.1
Also drop obsolete comments and inline some trivial rules
2017-03-01 14:50:36 +03:00

23 lines
359 B
Plaintext

/**
#### When-expression
See [When-expression](control-flow.html#when-expression)
*/
when
: "when" ("(" expression ")")? "{"
whenEntry*
"}"
;
whenEntry
: whenCondition{","} "->" controlStructureBody SEMI
: "else" "->" controlStructureBody SEMI
;
whenCondition
: expression
: ("in" | "!in") expression
: ("is" | "!is") type
;