diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-12-13 16:29:15 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-12-13 16:29:15 -0800 |
| commit | 536a3ba64931946f81140e6a6d13f612a47a41d9 (patch) | |
| tree | fdf6975057207af248d5c345671e09be79498318 /lib/utils2.nom | |
| parent | 0c1c406ce0d1c19508653181d8cef75f976677a5 (diff) | |
Got it working.
Diffstat (limited to 'lib/utils2.nom')
| -rw-r--r-- | lib/utils2.nom | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/utils2.nom b/lib/utils2.nom index c31d5ab..def8854 100644 --- a/lib/utils2.nom +++ b/lib/utils2.nom @@ -25,7 +25,7 @@ compile [with %assignments %action] to code: %var = (%tokens -> 1) %eq = (%tokens -> 2) assert (=lua "vars.eq and vars.eq.type == 'Word' and vars.eq.value == '='") ".." - |Invalid format for 'with' statement. List entries must have the form %var = (value) + Invalid format for 'with' statement. List entries must have the form %var = (value) %value = (%tokens -> 3) add (d{i=%i; var=%var; value=%value}) to %data %foo = (..) @@ -34,18 +34,18 @@ compile [with %assignments %action] to code: ..for all %data ..with glue "\n " ".." - |do - | \(%foo) - | local fell_through = false; - | local ok, ret1, ret2 = pcall(function(nomsu, vars) - | \(%action as lua statements); - | fell_through = true; - | end, nomsu, vars); - | \(join ("\((%->"var") as lua) = old_value\(%->"i");" for all %data) with glue "\n ") - | if not ok then nomsu:error(ret1); end - | if not fell_through then - | return ret1, ret2; - | end - |end + do + \(%foo) + local fell_through = false; + local ok, ret1, ret2 = pcall(function(nomsu, vars) + \(%action as lua statements); + fell_through = true; + end, nomsu, vars); + \(join ("\((%->"var") as lua) = old_value\(%->"i");" for all %data) with glue "\n ") + if not ok then nomsu:error(ret1); end + if not fell_through then + return ret1, ret2; + end + end parse [with %thing = %value %action] as: with [%thing = %value] %action |
