diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-08 15:06:05 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-08 15:06:05 -0700 |
| commit | 529afd465fbbfbf923831d8a33fc3ce349dc703f (patch) | |
| tree | b87f31c1e2e2832c80acd7baa60656c45420ac87 /lib/metaprogramming.nom | |
| parent | 6a429d79558f70578ba30565f5ae299f0fe42da1 (diff) | |
Fixed permissions to work better with aliases.
Diffstat (limited to 'lib/metaprogramming.nom')
| -rw-r--r-- | lib/metaprogramming.nom | 8 |
1 files changed, 5 insertions, 3 deletions
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 <unknown source code>")); + | local template = fn_def.is_macro and "compile %s to%s" or "rule %s =%s"; + | local src = fn_def.src or ":\\n <unknown source code>"; + | 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 |
