From 10bd72e858a8ffaacafa296dbbc429dc73b0111c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 18 Jan 2019 14:22:17 -0800 Subject: Added `tree` back as a parameter to compile actions, which helps with better error reporting, e.g. for (fail) (no arguments). Overall better error reporting now. Also added shorthand ("Action" tree with ...) for (SyntaxTree {.type = "Action", .1 = ...}). --- lib/consolecolor/init.nom | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/consolecolor/init.nom') diff --git a/lib/consolecolor/init.nom b/lib/consolecolor/init.nom index 19dc5ea..27823b8 100644 --- a/lib/consolecolor/init.nom +++ b/lib/consolecolor/init.nom @@ -18,9 +18,8 @@ $colors = { for $name = $colornum in $colors: $colornum = "\$colornum" - $(COMPILE RULES).$name = - for ($compile $text): - if $text: - return (Lua "('\\027[\($colornum)m'..\($text as lua expr)..'\\027[0m')") - ..else: - return (Lua "'\\027[\($colornum)m'") + \($name \$text) compiles to: + if $text: + return (Lua "('\\027[\($colornum)m'..\($text as lua expr)..'\\027[0m')") + ..else: + return (Lua "'\\027[\($colornum)m'") -- cgit v1.2.3