From b12744d831c4158671fc22401590eaac00f7c141 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 14 Jun 2018 23:25:05 -0700 Subject: Some cleanup and fixes. Simplifying a lot of code, and extending the flexibility of scoping. Redesigned Object system too. --- core/metaprogramming.nom | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/metaprogramming.nom') 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 -- cgit v1.2.3