mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-12 06:38:45 +01:00
This lets us make it a grammar feature and not a lexer trick. Newlines are explicitly ignored in some parts of the grammar. This lets, for example, things like "|" ignore the newline when used as an operator, but not when used as a parameter delimiter in a block argument.
17 lines
219 B
Plaintext
17 lines
219 B
Plaintext
// Single-expression body.
|
|
var c = 0
|
|
while (c < 3) IO.print(c = c + 1)
|
|
// expect: 1
|
|
// expect: 2
|
|
// expect: 3
|
|
|
|
// Block body.
|
|
var a = 0
|
|
while (a < 3) {
|
|
IO.print(a)
|
|
a = a + 1
|
|
}
|
|
// expect: 0
|
|
// expect: 1
|
|
// expect: 2
|