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:
@@ -1,14 +1,10 @@
|
||||
// Allow newlines in most places.
|
||||
// Allow after '[' and ',', and before ']'.
|
||||
var list = [
|
||||
|
||||
"a"
|
||||
, "b",
|
||||
|
||||
"c", "d"
|
||||
"a",
|
||||
"b"
|
||||
|
||||
]
|
||||
|
||||
IO.print(list[0]) // expect: a
|
||||
IO.print(list[1]) // expect: b
|
||||
IO.print(list[2]) // expect: c
|
||||
IO.print(list[3]) // expect: d
|
||||
|
||||
Reference in New Issue
Block a user