-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdef.pest
More file actions
19 lines (12 loc) · 751 Bytes
/
def.pest
File metadata and controls
19 lines (12 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
WHITESPACE = _{ " " | "\t" | "\n" | "\r" }
all = { SOI ~ process ~ EOI }
process = { (if_branch | while_loop | step | WHITESPACE)+ }
if_branch = ${ "if" ~ WHITESPACE+ ~ condition ~ WHITESPACE* ~ "{" ~ WHITESPACE* ~ process ~ WHITESPACE* ~ "}" ~ else_branch? }
else_branch = { WHITESPACE* ~ "else" ~ WHITESPACE* ~ "{" ~ WHITESPACE* ~ process ~ WHITESPACE* ~ "}" }
while_loop = ${ "while" ~ WHITESPACE+ ~ condition ~ WHITESPACE* ~ "{" ~ WHITESPACE* ~ process ~ WHITESPACE* ~ "}" }
condition = { expression }
step = { exit ~ terminator | expression ~ terminator }
exit = { "exit" }
expression = ${ nw_char ~ (nw_char | WHITESPACE)* }
nw_char = _{ (ASCII_ALPHANUMERIC | "\"" | "'" | "." | "_" | "-" | "/" | "(" | ")" | "=") }
terminator = _{ ";" }