diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-14 23:25:05 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-14 23:25:34 -0700 |
| commit | b12744d831c4158671fc22401590eaac00f7c141 (patch) | |
| tree | 203b80de68d89c7333172337f8def46ba11294d3 /core/metaprogramming.nom | |
| parent | 49f1eb3d08caf7605046373b7b3a001f28aa8aab (diff) | |
Some cleanup and fixes. Simplifying a lot of code, and extending the
flexibility of scoping. Redesigned Object system too.
Diffstat (limited to 'core/metaprogramming.nom')
| -rw-r--r-- | core/metaprogramming.nom | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 301c092..82447b3 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -117,8 +117,12 @@ immediately action [%tree as lua return] =lua "nomsu:tree_to_lua(\%tree):as_statements('return ')" - action [%var as lua identifier] - =lua "type(\%var) == 'string' and string.as_lua_id(\%var) or nomsu:tree_to_lua(\%var)" + action [%var as lua identifier, %var as lua id] + lua> ".." + if type(\%var) == 'string' then return string.as_lua_id(\%var) + elseif \%var.type == 'Var' then return string.as_lua_id(\%var[1]) + elseif \%var.type == 'Action' then return "A"..string.as_lua_id(\%var.stub) + end immediately compile [%tree with %t -> %replacement] to |
