diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-12 14:39:03 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-12 14:39:03 -0700 |
| commit | 454bb76e2f889f13072445b57204d3e49c42e28c (patch) | |
| tree | d4f65f98b9c773df2b7c6850c0ff757593e693ad /lib/control_flow.nom | |
| parent | 4e5445e6bcd2007a6308942237523eef7c94953f (diff) | |
Added chain and "with".
Diffstat (limited to 'lib/control_flow.nom')
| -rw-r--r-- | lib/control_flow.nom | 9 |
1 files changed, 9 insertions, 0 deletions
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; |
