Use built-in NEWLINE Rule

rewrite/grammar-implicit-whitespace
Raymon Zutekouw 3 years ago
parent 535f362910
commit b4d7130c8c
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 9
      src/grammars/mblf.pest

@ -3,7 +3,7 @@ operand = @{ "operand" } // TODO
instruction = { operator ~ (spacing+ ~ operand)? } instruction = { operator ~ (spacing+ ~ operand)? }
loopBlockStart = { "[" ~ newline } loopBlockStart = { "[" ~ NEWLINE }
loopBlockEnd = { "]" } loopBlockEnd = { "]" }
loopBlock = { loopBlockStart loopBlock = { loopBlockStart
~ statements ~ statements
@ -14,10 +14,9 @@ statement = _{ spacing*
~ (instruction | loopBlock) ~ (instruction | loopBlock)
} }
statements = _{ (statement | newline)* } statements = _{ (statement | NEWLINE)* }
newline = _{ "\n" | "\r\n" }
spacing = _{ " " | "\t" } spacing = _{ " " | "\t" }
COMMENT = _{ ";;" ~ (!newline ~ ANY)* ~ newline} COMMENT = _{ ";;" ~ (!NEWLINE ~ ANY)* ~ NEWLINE}
file = {SOI ~ (statement ~ newline+)* ~ EOI} file = {SOI ~ (statement ~ NEWLINE+)* ~ EOI}

Loading…
Cancel
Save