From 529afd465fbbfbf923831d8a33fc3ce349dc703f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 8 Oct 2017 15:06:05 -0700 Subject: Fixed permissions to work better with aliases. --- lib/metaprogramming.nom | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/metaprogramming.nom') diff --git a/lib/metaprogramming.nom b/lib/metaprogramming.nom index 4924e78..a2cf4bf 100644 --- a/lib/metaprogramming.nom +++ b/lib/metaprogramming.nom @@ -80,12 +80,14 @@ compile [nomsu %method %args] to: "nomsu[\(%method as lua)](nomsu, unpack(\(%arg # Get the source code for a function rule [help %rule] =: lua block ".." - |local fn_def = nomsu:get_fn_def(vars.rule); + |local fn_def = nomsu.defs[nomsu:get_stub(vars.rule)] |if not fn_def then; | nomsu:writeln("Rule not found: "..nomsu:repr(vars.rule)); |else; - | nomsu:writeln("rule "..nomsu:repr(nomsu.utils.keys(fn_def.stub)) - | .." ="..(fn_def.src or ":\\n ")); + | local template = fn_def.is_macro and "compile %s to%s" or "rule %s =%s"; + | local src = fn_def.src or ":\\n "; + | if src:sub(1,1) ~= ":" and fn_def.is_macro then; template = "parse %s as: %s"; end; + | nomsu:writeln(template:format(nomsu:repr(fn_def.stub), src)); |end; # Compiler tools -- cgit v1.2.3