diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-09-17 15:29:48 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-09-17 15:30:24 -0700 |
| commit | c1cba45968b8d5e993fb12fcd7dae9192fbe6d79 (patch) | |
| tree | ffa1ba6e6eb9b544bd28ce08e653d7467df226e8 /core/metaprogramming.nom | |
| parent | e3bf10196ae42463db8d702fe90a222bb7cb4d54 (diff) | |
Added support for compile actions returning trees, and compiling blocks
into values.
Diffstat (limited to 'core/metaprogramming.nom')
| -rw-r--r-- | core/metaprogramming.nom | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 5d31c2b..c50f783 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -197,16 +197,14 @@ compile [parse %actions as %body] to (..) end local \%new_body = LuaCode(\%body.source, "local mangle = mangler()", - "\\nlocal tree = ", make_tree(\%body), - "\\nlocal lua = nomsu:compile(tree)", - "\\nreturn lua") + "\\nreturn ", make_tree(\%body)) local ret = \(compile as (compile %actions to %new_body)) return ret" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # TODO: add check for .is_value -compile [%tree as lua expr] to (Lua value "nomsu:compile(\(=lua "nomsu:compile(\%tree)"))") +compile [%tree as lua expr] to (Lua value "nomsu:compile(\(=lua "nomsu:compile(\%tree, nil, true)"), nil, true)") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
