Skip to content

Commit

Permalink
update grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
dhilipsiva committed Apr 12, 2023
1 parent 8aa7471 commit 355435d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions examples/01-basics.oduraja
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
for |i| in |a+b| {
log |6|
}
Log |5|
8 changes: 4 additions & 4 deletions src/main.pest
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ stmt_catch = { CATCH ~ "{" ~ statements* ~ "}" }
stmt_define = { !reserved_parts ~ part ~ (param_define | part)* ~ "{" ~ statements* ~ "}" }
stmt_invoke = { !reserved_parts ~ part ~ (param_invoke | part)* }
stmt_break = { BREAK }
stmt_continue = { BREAK }
stmt_continue = { CONTINUE }
stmt_return = { RETURN ~ (param_invoke)? }
param_invoke = { "|" ~ expression ~ "|" }
param_define = { "|" ~ ident ~ "|" }
param_invoke = _{ "|" ~ expression ~ "|" }
param_define = _{ "|" ~ ident ~ "|" }

expression = _{ infix | expression_inner }
infix = { expression_inner ~ (binary_operator ~ expression_inner)+ }
Expand All @@ -48,7 +48,7 @@ literal = _{ map | array | string | float | integer | boolean }
array = { "[" ~ (expression ~ ("," ~ expression)*)? ~ "]" }
ident = @{ !reserved ~ LETTER ~ (LETTER | NUMBER | "_")* }

map = { "{" ~ (map_pair ~ ("," ~ map_pair)*)? ~ "}" }
map = { "{" ~ (map_pair ~ ("," ~ map_pair)*)? ~ "}" }
map_pair = { keyword ~ expression }
keyword = @{ ident ~ ":" }

Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ fn oduraja(pair: Pair<Rule>) {
match pair.as_rule() {
Rule::EOI => todo!(),
Rule::WHITESPACE => todo!(),
//Rule::NEWLINE => todo!(),
Rule::oduraja => todo!(),
Rule::reserved => todo!(),
Rule::part => todo!(),
Expand Down

0 comments on commit 355435d

Please sign in to comment.