From be55821244bfa066e150d33490445a16d31d92b9 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 14 Sep 2017 05:14:28 -0700 Subject: Fixed invocation function to canonicalize better and play nice with "'" --- core.nom | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core.nom') diff --git a/core.nom b/core.nom index 6e0f2c5..0324a74 100644 --- a/core.nom +++ b/core.nom @@ -196,7 +196,7 @@ macro ["%item is in %list", "%list contains %item"]: ".."|(\%list as lua expr\[\%index as lua expr\] ~= nil) macro ["length of %list", "size of %list", "number of %list"]: - ".."|#(\list as lua expr\) + ".."|#(\%list as lua expr\) rule "dict %items": let "dict" = [] @@ -206,8 +206,8 @@ rule "dict %items": rule "restrict %fn to within %whitelist": lua block ".." - |local fns = (type(vars.fn) == 'string') and {vars.fn} or vars.fn - |local whitelist = (type(vars.whitelist) == 'string') and {vars.whitelist} or vars.whitelist + |local fns = compiler:get_invocations(vars.fn) + |local whitelist = compiler:get_invocations(vars.whitelist) |local whiteset = {} |for _,w in ipairs(whitelist) do | if not compiler.defs[w] then @@ -228,8 +228,8 @@ rule "restrict %fn to within %whitelist": rule "allow %whitelist to use %fn": lua block ".." - |local fns = (type(vars.fn) == 'string') and {vars.fn} or vars.fn - |local whitelist = (type(vars.whitelist) == 'string') and {vars.whitelist} or vars.whitelist + |local fns = compiler:get_invocations(vars.fn) + |local whitelist = compiler:get_invocations(vars.whitelist) |for _,w in ipairs(whitelist) do | if not compiler.defs[w] then | compiler:error("Undefined function: "..tostring(w)) @@ -252,8 +252,8 @@ rule "allow %whitelist to use %fn": rule "forbid %blacklist to use %fn": lua block ".." - |local fns = (type(vars.fn) == 'string') and {vars.fn} or vars.fn - |local blacklist = (type(vars.blacklist) == 'string') and {vars.blacklist} or vars.blacklist + |local fns = compiler:get_invocations(vars.fn) + |local blacklist = compiler:get_invocations(vars.blacklist) |for _,b in ipairs(blacklist) do | if not compiler.defs[b] then | compiler:error("Undefined function: "..tostring(b)) -- cgit v1.2.3