diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-02 17:21:22 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-10-02 17:21:22 -0700 |
| commit | dcd3391b36c7accc194cfdc8654db085c9bc820e (patch) | |
| tree | d55e932ed8b4ba17dd5729803e27c1a543fb672a /lib/moonscript.nom | |
| parent | e2bbbfe1611f12b33692af175d661fa25b2cc616 (diff) | |
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.
Diffstat (limited to 'lib/moonscript.nom')
| -rw-r--r-- | lib/moonscript.nom | 48 |
1 files changed, 24 insertions, 24 deletions
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)"; |
