aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-18 18:39:21 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-18 18:39:25 -0700
commit7f98262dfa92072fbfac785617a6dd364cc0146b (patch)
tree6e28eb365858deb7ee04b56fe8a608153004253b /core
parentf83cc3ad8afaa122867270a9b1255295e902c422 (diff)
Minor cleanups
Diffstat (limited to 'core')
-rw-r--r--core/control_flow.nom18
-rw-r--r--core/metaprogramming.nom2
2 files changed, 6 insertions, 14 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom
index 5a96d3e..4a007df 100644
--- a/core/control_flow.nom
+++ b/core/control_flow.nom
@@ -188,7 +188,7 @@ compile [for %var in %iterable %body] to
(%.type = "Action") and
(%.stub is "do next %") and
%.3.(1) = %var.(1)
- ..: to %lua write (Lua "\n ::continue_\(%var as lua identifier)::")
+ ..: to %lua write (Lua "\n::continue_\(%var as lua identifier)::")
to %lua write "\nend --foreach-loop"
if
%body has subtree % where
@@ -221,14 +221,14 @@ compile [..]
(%.type = "Action") and
(%.stub is "do next %") and
%.3.(1) = %key.(1)
- ..: to %lua write (Lua "\n ::continue_\(%key as lua identifier)::")
+ ..: to %lua write (Lua "\n::continue_\(%key as lua identifier)::")
if
%body has subtree % where
(%.type = "Action") and
(%.stub is "do next %") and
%.3.(1) = %value.(1)
- ..: to %lua write (Lua "\n ::continue_\(%value as lua identifier)::")
+ ..: to %lua write (Lua "\n::continue_\(%value as lua identifier)::")
to %lua write "\nend --foreach-loop"
%stop_labels <- (Lua "")
@@ -250,8 +250,7 @@ compile [..]
%lua <-
Lua ".."
do -- scope for stopping for % = % loop
- \%lua
- \%stop_labels
+ \%lua\%stop_labels
end
return %lua
@@ -378,11 +377,4 @@ compile [do %action then always %final_action] to
# Inline thunk:
compile [result of %body] to
- %body <- (%body as lua statements)
- declare locals in %body
- return
- Lua value ".."
- (function()
- \%body
- end)()
-
+ Lua value "(\(compile as: [] -> %body))()"
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index a7da3d8..8911b59 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -110,7 +110,7 @@ compile [parse %actions as %body] to
"\nreturn nomsu:compile(tree)")
return \(compile as: compile %actions to %new_body)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compile [remove action %action] to
Lua ".."