Allow nested loopBlocks

- loopBlocks now contain statements i.o. instructions
rewrite/grammar-implicit-whitespace
Raymon Zutekouw 3 years ago
parent c949adeed9
commit 0c87557d39
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 22
      src/grammars/mblf.pest

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

Loading…
Cancel
Save