mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-16 20:28:04 +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.
14 lines
194 B
Plaintext
14 lines
194 B
Plaintext
// Single-expression body.
|
|
for (i in [1]) IO.print(i)
|
|
// expect: 1
|
|
|
|
// Block body.
|
|
for (i in [1]) {
|
|
IO.print(i)
|
|
}
|
|
// expect: 1
|
|
|
|
// Newline after "in".
|
|
for (i in
|
|
[1]) IO.print(i)
|
|
// expect: 1 |