Compare commits

...

1 Commits

Author SHA1 Message Date
Raymon Zutekouw 4a3ddc2717
Attempt grammar rewrite with implicit whitespace 3 years ago
  1. 38
      src/grammars/mblf.pest

@ -11,27 +11,27 @@ num =_{ hexNum | decNum }
constant = { char | num } constant = { char | num }
path = { "\"" ~ (!"\"" ~ ANY)+ ~ "\"" } path = { "\"" ~ (!"\"" ~ ANY)+ ~ "\"" }
include =@{ "#include" ~ spacing+ ~ path } include = { "#include" ~ path }
var =@{ "var" ~ spacing+ ~ variable } var = { "var" ~ variable }
delvar =@{ "delvar" ~ spacing+ ~ variable } delvar = { "delvar" ~ variable }
point =@{ "point" ~ spacing+ ~ variable } point = { "point" ~ variable }
pointm =@{ "pointm" ~ spacing+ ~ variable } pointm = { "pointm" ~ variable }
add =@{ "add" ~ spacing+ ~ constant } add = { "add" ~ constant }
addb =@{ "addb" ~ spacing+ ~ constant } addb = { "addb" ~ constant }
addv =@{ "addv" ~ spacing+ ~ variable } addv = { "addv" ~ variable }
sub =@{ "sub" ~ spacing+ ~ constant } sub = { "sub" ~ constant }
subb =@{ "subb" ~ spacing+ ~ constant } subb = { "subb" ~ constant }
subv =@{ "subv" ~ spacing+ ~ variable } subv = { "subv" ~ variable }
copy =@{ "copy" ~ spacing+ ~ variable } copy = { "copy" ~ variable }
setz =@{ "setz" } setz = { "setz" }
getchr =@{ "getchr" } getchr = { "getchr" }
print =@{ "print" } print = { "print" }
macaroo =_{ include } macaroo =_{ include }
instruction =_{ macaroo instruction =_{ macaroo
@ -61,16 +61,14 @@ loopBlockStart = { "[" ~ NEWLINE }
loopBlockEnd = { "]" } loopBlockEnd = { "]" }
loopBlock = { loopBlockStart loopBlock = { loopBlockStart
~ statements ~ statements
~ spacing* ~ loopBlockEnd ~ loopBlockEnd
} }
statement =_{ spacing* statement =_{ (instruction | loopBlock) }
~ (instruction | loopBlock)
}
statements =_{ (statement | NEWLINE)* } statements =_{ (statement | NEWLINE)* }
spacing =_{ " " | "\t" } WHITESPACE =_{ " " | "\t" }
COMMENT =_{ ";;" ~ (!NEWLINE ~ ANY)* ~ NEWLINE+ } COMMENT =_{ ";;" ~ (!NEWLINE ~ ANY)* ~ NEWLINE+ }
file = { SOI ~ (statement ~ NEWLINE+)* ~ EOI } file = { SOI ~ (statement ~ NEWLINE+)* ~ EOI }

Loading…
Cancel
Save