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 +1 @@
|
||||
true ? 1 : // expect error
|
||||
(true ? 1 :) // expect error
|
||||
|
||||
@@ -1 +1 @@
|
||||
true ? : 2 // expect error
|
||||
(true ? : 2) // expect error
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// Newline after '?'.
|
||||
IO.print(true ?
|
||||
"yes" : "no") // expect: yes
|
||||
|
||||
// Newline after ':'.
|
||||
IO.print(false ? "yes" :
|
||||
"no") // expect: no
|
||||
Reference in New Issue
Block a user