From 652c29bdef1f0991cc13bef59d6dc78b657ae9a4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 8 Nov 2018 15:23:22 -0800 Subject: Major overhaul, splitting nomsu_compiler into nomsu_environment, nomsu_compiler, and nomsu_decompiler. Also added comprehensions. --- core/errors.nom | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/errors.nom') diff --git a/core/errors.nom b/core/errors.nom index 0b0a6a3..74c0a54 100644 --- a/core/errors.nom +++ b/core/errors.nom @@ -4,6 +4,8 @@ use "core/metaprogramming.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + (barf %msg) compiles to (Lua "error(\(=lua "\%msg and \(%msg as lua expr) or 'nil'"), 0);") (compile error at %tree %msg) compiles to (..) Lua "nomsu:compile_error(\(%tree as lua expr), \(%msg as lua expr))" @@ -12,7 +14,7 @@ use "core/metaprogramming.nom" (assume %condition) compiles to: lua> "\ - ..local \%assumption = 'Assumption failed: '..tostring(nomsu:tree_to_nomsu(\%condition))" + ..local \%assumption = 'Assumption failed: '..tostring((\%condition):get_source_code())" return (..) Lua "\ ..if not \(%condition as lua expr) then @@ -21,7 +23,7 @@ use "core/metaprogramming.nom" (assume %a == %b) compiles to: lua> "\ - ..local \%assumption = 'Assumption failed: '..tostring(nomsu:tree_to_nomsu(\(\(%a == %b))))" + ..local \%assumption = 'Assumption failed: '..tostring(\(\(%a == %b) as nomsu))" define mangler return (..) Lua "\ -- cgit v1.2.3