aboutsummaryrefslogtreecommitdiff
path: root/core/scopes.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-05-30 17:20:22 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-05-30 17:21:19 -0700
commitb53516c47c0dd1f9325f9f721f561487510cca98 (patch)
tree92961e19bc94eec3ab8b0f19357c57399c205b7d /core/scopes.nom
parent5637676bc45ce9aa3015726485f63a2a5745a45a (diff)
Simplified and correctified lib/object (though the codegen still need
streamlining), added a .stub member to Action trees, and switched Source's repr to be @filename[start:stop] instead of "filename[start:stop]"
Diffstat (limited to 'core/scopes.nom')
-rw-r--r--core/scopes.nom41
1 files changed, 21 insertions, 20 deletions
diff --git a/core/scopes.nom b/core/scopes.nom
index e4e574a..72631c0 100644
--- a/core/scopes.nom
+++ b/core/scopes.nom
@@ -7,47 +7,48 @@ use "core/control_flow.nom"
compile [using %definitions %body, using %definitions do %body] to
%setup_lua <-
Lua ".."
- local fell_through = false;
+ local fell_through = false
local ok, ret = pcall(function()
\(%definitions as lua statements)
- fell_through = true;
- end);
+ fell_through = true
+ end)
%body_lua <-
Lua ".."
- local fell_through = false;
+ local fell_through = false
local ok, ret = pcall(function()
\(%body as lua statements)
- fell_through = true;
- end);
+ fell_through = true
+ end)
remove free vars (declare locals in %setup_lua) from %body_lua
%lua <-
Lua ".."
do
- local old_actions, old_compile_actions, old_arg_orders = ACTIONS, COMPILE_ACTIONS, ARG_ORDERS;
- ACTIONS = setmetatable({}, {__index=old_actions});
- COMPILE_ACTIONS = setmetatable({}, {__index=old_compile_actions});
- ARG_ORDERS = setmetatable({}, {__index=old_arg_orders});
+ local old_actions, old_compile_actions, old_arg_orders = ACTIONS, COMPILE_ACTIONS, ARG_ORDERS
+ ACTIONS = setmetatable({}, {__index=old_actions})
+ COMPILE_ACTIONS = setmetatable({}, {__index=old_compile_actions})
+ ARG_ORDERS = setmetatable({}, {__index=old_arg_orders})
\%setup_lua
if not ok then
- ACTIONS, COMPILE_ACTIONS, ARG_ORDERS = old_actions, old_compile_actions, old_arg_orders;
- error(ret);
+ ACTIONS, COMPILE_ACTIONS, ARG_ORDERS = old_actions, old_compile_actions, old_arg_orders
+ error(ret)
end
if not fell_through then
- ACTIONS, COMPILE_ACTIONS, ARG_ORDERS = old_actions, old_compile_actions, old_arg_orders;
- return ret;
+ ACTIONS, COMPILE_ACTIONS, ARG_ORDERS = old_actions, old_compile_actions, old_arg_orders
+ return ret
end
- getmetatable(ACTIONS).__newindex = old_actions;
- getmetatable(COMPILE_ACTIONS).__newindex = old_compile_actions;
- getmetatable(ARG_ORDERS).__newindex = old_arg_orders;
+ getmetatable(ACTIONS).__newindex = old_actions
+ getmetatable(COMPILE_ACTIONS).__newindex = old_compile_actions
+ getmetatable(ARG_ORDERS).__newindex = old_arg_orders
\%body_lua
- ACTIONS, COMPILE_ACTIONS, ARG_ORDERS = old_actions, old_compile_actions, old_arg_orders;
+ ACTIONS, COMPILE_ACTIONS, ARG_ORDERS = old_actions, old_compile_actions, old_arg_orders
if not ok then
- error(ret);
+ error(ret)
end
if not fell_through then
- return ret;
+ return ret
end
end
declare locals in %lua
return %lua
+parse [using %] as: using % (do nothing)