aboutsummaryrefslogtreecommitdiff
path: root/core/metaprogramming.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-04-13 15:29:16 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-04-13 15:29:20 -0700
commit25e06d1fce660e7c8144425b440f7b1c698e2fb7 (patch)
tree3636abb32881a757ba907c2a8cf218090e6d28bd /core/metaprogramming.nom
parent8f6f941d897a5678ab09bb9b21e0274743857587 (diff)
Getting closer.
Diffstat (limited to 'core/metaprogramming.nom')
-rw-r--r--core/metaprogramming.nom9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index 0c7cada..8b1546b 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -82,7 +82,7 @@ immediately:
for i, a in ipairs(args) do replacements[i] = a.."="..a; end
replacements = "{"..table.concat(replacements, ", ").."}";
lua:append([[)
- local template = nomsu_parse(]]..template..[[, ]]..repr(tree.source.filename)..[[);
+ local template = nomsu:parse(]]..template..[[, ]]..repr(tree.source.filename)..[[);
local replacement = nomsu:tree_with_replaced_vars(template, ]]..replacements..[[);
return nomsu:tree_to_lua(replacement, nomsu.compilestack[#nomsu.compilestack].source.filename);
end);
@@ -190,6 +190,13 @@ immediately:
if not \(%condition as lua expr) then
error(\(repr %assumption), 0);
end
+
+ # TODO: factor this out and replace with "unless %condition: barf %message"
+ compile [assume %condition or barf %message] to:
+ Lua ".."
+ if not \(%condition as lua expr) then
+ error(\(%message as lua expr), 0);
+ end
# Literals
immediately: