Extract newline grammar rule

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

@ -3,16 +3,17 @@ operand = @{ "operand" } // TODO
instruction = { operator ~ (" "+ ~ operand)? }
loopBlockStart = { "[" ~ ("\n" | "\r\n") }
loopBlockStart = { "[" ~ newline }
loopBlockEnd = { "]" }
loopBlock = { loopBlockStart
~ statements
~ ("\n" | "\r\n")
~ newline
~ loopBlockEnd
}
statement = _{ instruction | loopBlock }
statements = _{ statement* }
newline = _{ "\n" | "\r\n" }
file = {SOI ~ (statement ~ ("\n" | "\r\n")+)* ~ EOI}
file = {SOI ~ (statement ~ newline+)* ~ EOI}

Loading…
Cancel
Save