From dcd3391b36c7accc194cfdc8654db085c9bc820e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 2 Oct 2017 17:21:22 -0700 Subject: Updated to undo some of the block/thunk stuff. Thunks are thunks, and expressions can be grouped with parens, and they have a clear distinction. --- lib/moonscript.nom | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'lib/moonscript.nom') diff --git a/lib/moonscript.nom b/lib/moonscript.nom index f5a18b5..9aa9575 100644 --- a/lib/moonscript.nom +++ b/lib/moonscript.nom @@ -1,30 +1,30 @@ require "lib/metaprogramming.nom" # Moonscript! -macro block [moonscript block %moonscript_code] =: +parse [moonscript block %moonscript_code] as: lua block ".." - |local parse, compile = require('moonscript.parse'), require('moonscript.compile') - |local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars) - |local tree, err = parse.string(moon_code) - |if not tree then - | nomsu:error("Failed to parse moonscript: "..err) - |end - |local lua_code, err, pos = compile.tree(tree) - |if not lua_code then - | nomsu:error(compile.format_error(err, pos, moon_code)) - |end - |return "do\\n"..lua_code.."\\nend" + |local parse, compile = require('moonscript.parse'), require('moonscript.compile'); + |local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars); + |local tree, err = parse.string(moon_code); + |if not tree then; + | nomsu:error("Failed to parse moonscript: "..err); + |end; + |local lua_code, err, pos = compile.tree(tree); + |if not lua_code then; + | nomsu:error(compile.format_error(err, pos, moon_code)); + |end; + |return "do\\n"..lua_code.."\\nend"; -macro [moonscript %moonscript_code] =: +parse [moonscript %moonscript_code] as: lua block ".." - |local parse, compile = require('moonscript.parse'), require('moonscript.compile') - |local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars) - |local tree, err = parse.string(moon_code) - |if not tree then - | nomsu:error("Failed to parse moonscript: "..err) - |end - |local lua_code, err, pos = compile.tree(tree) - |if not lua_code then - | nomsu:error(compile.format_error(err, pos, moon_code)) - |end - |return "(function(nomsu, vars)\\n"..lua_code.."\\nend)(nomsu, vars)" + |local parse, compile = require('moonscript.parse'), require('moonscript.compile'); + |local moon_code = nomsu:tree_to_value(vars.moonscript_code, vars); + |local tree, err = parse.string(moon_code); + |if not tree then; + | nomsu:error("Failed to parse moonscript: "..err); + |end; + |local lua_code, err, pos = compile.tree(tree); + |if not lua_code then; + | nomsu:error(compile.format_error(err, pos, moon_code)); + |end; + |return "(function(nomsu, vars)\\n"..lua_code.."\\nend)(nomsu, vars)"; -- cgit v1.2.3