diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-17 14:36:44 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-17 14:36:55 -0700 |
| commit | 26d0de8299c7568152f479320444833b4d30d0eb (patch) | |
| tree | 995feed96145619477a0b3547eb97e2f80521cdb /nomsu_tree.moon | |
| parent | 54fc7fc4404c02df2c38a7ae121e61e9b8bca78c (diff) | |
Partially working, at least for metaprogramming.nom
Diffstat (limited to 'nomsu_tree.moon')
| -rw-r--r-- | nomsu_tree.moon | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/nomsu_tree.moon b/nomsu_tree.moon index 3162bf8..9b00d85 100644 --- a/nomsu_tree.moon +++ b/nomsu_tree.moon @@ -65,7 +65,7 @@ Tree "Block", lua\append line_lua return lua -math_patt = re.compile [[ "%" (" " [*/^+-] " %")+ ]] +math_expression = re.compile [[ "%" (" " [*/^+-] " %")+ ]] Tree "Action", as_lua: (nomsu)=> stub = @get_stub! @@ -77,10 +77,12 @@ Tree "Action", if metadata.arg_orders new_args = [args[p-1] for p in *metadata.arg_orders[stub]] args = new_args - return action(Lua(@source), unpack(args)) + -- Force Lua to avoid tail call optimization for debugging purposes + ret = action(Lua(@source), unpack(args)) + return ret lua = Lua.Value(@source) - if not metadata and math_patt\match(stub) + if not metadata and math_expression\match(stub) -- This is a bit of a hack, but this code handles arbitrarily complex -- math expressions like 2*x + 3^2 without having to define a single -- action for every possibility. |
