From 454bb76e2f889f13072445b57204d3e49c42e28c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 12 Oct 2017 14:39:03 -0700 Subject: Added chain and "with". --- lib/control_flow.nom | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/control_flow.nom') diff --git a/lib/control_flow.nom b/lib/control_flow.nom index 6287bfb..f0c0714 100644 --- a/lib/control_flow.nom +++ b/lib/control_flow.nom @@ -178,3 +178,12 @@ compile [when %branch-value == ? %body] to code: %result join= "\n::finished_when::;\nend;" %result + +# With statement +compile [with %thing = %value %action] to code: ".." + |do; + | local old_value = \(%thing as lua); + | \(%thing as lua) = \(%value as lua); + | \(%action as lua statements); + | \(%thing as lua) = old_value; + |end; -- cgit v1.2.3