diff --git a/Cargo.toml b/Cargo.toml index 1ed12f8..5f2685d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,4 @@ [workspace] members = ["klang"] +resolver = "2" diff --git a/examples/clean_up_cans.k b/examples/clean_up_cans.k index c7fdefc..576630a 100644 --- a/examples/clean_up_cans.k +++ b/examples/clean_up_cans.k @@ -1,14 +1,5 @@ -# /usr/bin/env klang -# Defines a simple klang program. # This program is designed to get a robot to clean up soda cans. -action { - outcomes { - success [Success] - failure [Failure] - } -} - action { notes { prefer [Move quickly] @@ -20,6 +11,7 @@ action { outcomes { success [Found {item}] failure [Haven't moved in a while] + retry [Actively looking for {item}] } } diff --git a/klang/src/klang.pest b/klang/src/klang.pest index bf883e6..a7b7185 100644 --- a/klang/src/klang.pest +++ b/klang/src/klang.pest @@ -23,10 +23,11 @@ ACTIONS = { "actions" } UNTIL = { "until" } // Names +CHAR = { ASCII_ALPHANUMERIC | "." | "_" | "/" | "!" | "?" | " " | "," | "\"" | "\'" | "/" | "\\" } +VARIABLE = { LBRACE ~ CHAR+ ~ RBRACE } ACTION_NAME = { "<" ~ NAME ~ ">" } OUTCOME_NAME = { "[" ~ NAME ~ "]" } -CHAR = { ASCII_ALPHANUMERIC | "." | "_" | "/" | "!" | "?" | " " | "," | "\"" | "\'" | "/" | "\\" | "{" | "}" } -NAME = { CHAR+ } +NAME = { (CHAR | VARIABLE)+ } // Braces. LBRACE = { "{" }