From 3661754ed90e7b85bcfe61d6b44a65436c9c4c3f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 6 Feb 2018 22:06:39 -0800 Subject: Reverted to ACTIONS instead of ACTION and added 'show lua %' macro. --- core/metaprogramming.nom | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'core/metaprogramming.nom') diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 544ae59..b56f0e9 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -98,13 +98,13 @@ immediately: action [remove action %stub]: lua> ".." - local fn = ACTION[\%stub]; + local fn = ACTIONS[\%stub]; local metadata = ACTION_METADATA[fn]; for i=#metadata.aliases,1,-1 do metadata.arg_orders[metadata.aliases[i]] = nil; table.remove(metadata.aliases, i); end - ACTION[\%stub] = nil; + ACTIONS[\%stub] = nil; immediately: action [%tree as lua]: @@ -141,7 +141,7 @@ immediately: compile [%var as lua identifier] to {expr:"nomsu:var_to_lua_identifier(\(%var as lua expr))"} action [action %names metadata]: - =lua "ACTION_METADATA[ACTION[\%names]]" + =lua "ACTION_METADATA[ACTIONS[\%names]]" # Get the source code for a function action [help %action]: @@ -159,6 +159,12 @@ immediately: parse [enable debugging] as: lua> "nomsu.debug = true;" parse [disable debugging] as: lua> "nomsu.debug = false;" +immediately: + compile [show lua %block] to: + lua> ".." + local \%lua = nomsu:tree_to_lua(\%block); + return {statements = "print("..repr(\%lua.statements or \%lua.expr)..");"}; + immediately: compile [say %message] to: lua> ".." -- cgit v1.2.3