Move newline handling down into parser.
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.
This commit is contained in:
+6
-12
@@ -1,20 +1,14 @@
|
||||
// Single-expression body.
|
||||
for (i in [1, 2, 3]) IO.print(i)
|
||||
for (i in [1]) IO.print(i)
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
|
||||
// Block body.
|
||||
for (i in [1, 2, 3]) {
|
||||
for (i in [1]) {
|
||||
IO.print(i)
|
||||
}
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
|
||||
// Newline after "for".
|
||||
for
|
||||
(i in [1, 2, 3]) IO.print(i)
|
||||
// expect: 1
|
||||
// expect: 2
|
||||
// expect: 3
|
||||
// Newline after "in".
|
||||
for (i in
|
||||
[1]) IO.print(i)
|
||||
// expect: 1
|
||||
Reference in New Issue
Block a user