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)? } instruction = { operator ~ (" "+ ~ operand)? }
loopBlockStart = { "[" ~ ("\n" | "\r\n") } loopBlockStart = { "[" ~ newline }
loopBlockEnd = { "]" } loopBlockEnd = { "]" }
loopBlock = { loopBlockStart loopBlock = { loopBlockStart
~ statements ~ statements
~ ("\n" | "\r\n") ~ newline
~ loopBlockEnd ~ loopBlockEnd
} }
statement = _{ instruction | loopBlock } statement = _{ instruction | loopBlock }
statements = _{ statement* } statements = _{ statement* }
newline = _{ "\n" | "\r\n" }
file = {SOI ~ (statement ~ ("\n" | "\r\n")+)* ~ EOI} file = {SOI ~ (statement ~ newline+)* ~ EOI}

Loading…
Cancel
Save