diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-11 13:53:40 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-05-11 13:54:24 -0700 |
| commit | 95ee15982bb021e94a4976741a0bcdfe5f5d6992 (patch) | |
| tree | d76886a98cf1b6655e591a98039a4044bdafbe08 | |
| parent | 113782ebd1c9b13284f6c418c90008734fec27ac (diff) | |
Switched to use inline nomsu generation for `Nomsu` tree lua
compilation and removed some dead code around Nomsu.debug
| -rw-r--r-- | core/metaprogramming.nom | 4 | ||||
| -rw-r--r-- | nomsu.lua | 5 | ||||
| -rwxr-xr-x | nomsu.moon | 4 | ||||
| -rw-r--r-- | nomsu_tree.lua | 2 | ||||
| -rw-r--r-- | nomsu_tree.moon | 2 |
5 files changed, 3 insertions, 14 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 47faefe..a63ec32 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -89,7 +89,7 @@ immediately lua:append(", "); lua:append(arg); end - local template = repr(tostring(\%longhand:as_nomsu())); + local template = repr(tostring(\%longhand:as_nomsu(true))); local replacements = {}; for i, a in ipairs(args) do replacements[i] = a.."="..a; end replacements = "{"..table.concat(replacements, ", ").."}"; @@ -166,8 +166,6 @@ immediately immediately compile [run %code] to Lua value "nomsu:run(Nomsu(\(=lua "tostring(tree.source)"), \(%code as lua expr)))" - parse [enable debugging] as: lua> "nomsu.debug = true;" - parse [disable debugging] as: lua> "nomsu.debug = false;" immediately compile [show lua %block] to @@ -815,7 +815,6 @@ if arg and debug_getinfo(2).func ~= require then local parser = re.compile([[ args <- {| (flag ";")* {:inputs: {| ({file} ";")* |} :} {:nomsu_args: {| ("--;" ({[^;]*} ";")*)? |} :} ";"? |} !. flag <- {:interactive: ("-i" -> true) :} - / {:verbose: ("-v" -> true) :} / {:optimized: ("-O" -> true) :} / {:format: ("-f" -> true) :} / {:syntax: ("-s" -> true) :} @@ -840,7 +839,6 @@ OPTIONS -O Run the compiler in optimized mode (use precompiled .lua versions of Nomsu files, when available) -f Auto-format the given Nomsu file and print the result. -s Check the program for syntax errors. - -v Verbose mode. -h/--help Print this message. -o <file> Output the compiled Lua file to the given file (use "-" to output to stdout; if outputting to stdout and -p is not specified, -p will default to /dev/null) -p <file> Print to the specified file instead of stdout. @@ -978,9 +976,6 @@ OPTIONS end local run run = function() - if args.verbose then - nomsu.debug = true - end for i, input in ipairs(args.inputs) do if input == "-" then args.inputs[i] = STDIN @@ -567,7 +567,6 @@ if arg and debug_getinfo(2).func != require args <- {| (flag ";")* {:inputs: {| ({file} ";")* |} :} {:nomsu_args: {| ("--;" ({[^;]*} ";")*)? |} :} ";"? |} !. flag <- {:interactive: ("-i" -> true) :} - / {:verbose: ("-v" -> true) :} / {:optimized: ("-O" -> true) :} / {:format: ("-f" -> true) :} / {:syntax: ("-s" -> true) :} @@ -589,7 +588,6 @@ OPTIONS -O Run the compiler in optimized mode (use precompiled .lua versions of Nomsu files, when available) -f Auto-format the given Nomsu file and print the result. -s Check the program for syntax errors. - -v Verbose mode. -h/--help Print this message. -o <file> Output the compiled Lua file to the given file (use "-" to output to stdout; if outputting to stdout and -p is not specified, -p will default to /dev/null) -p <file> Print to the specified file instead of stdout. @@ -691,8 +689,6 @@ OPTIONS io.stderr\flush! run = -> - if args.verbose - nomsu.debug = true for i,input in ipairs args.inputs if input == "-" then args.inputs[i] = STDIN diff --git a/nomsu_tree.lua b/nomsu_tree.lua index 5b9d12b..c800c65 100644 --- a/nomsu_tree.lua +++ b/nomsu_tree.lua @@ -54,7 +54,7 @@ Tree = function(name, methods) end Tree("Nomsu", { as_lua = function(self, nomsu) - return Lua.Value(self.source, "nomsu:parse(Nomsu(", repr(self.value.source), ", ", repr(tostring(self.value:as_nomsu())), "))") + return Lua.Value(self.source, "nomsu:parse(Nomsu(", repr(self.value.source), ", ", repr(tostring(self.value:as_nomsu(true))), "))") end, as_nomsu = function(self, inline) if inline == nil then diff --git a/nomsu_tree.moon b/nomsu_tree.moon index 6640030..fc71219 100644 --- a/nomsu_tree.moon +++ b/nomsu_tree.moon @@ -35,7 +35,7 @@ Tree = (name, methods)-> Tree "Nomsu", as_lua: (nomsu)=> - Lua.Value(@source, "nomsu:parse(Nomsu(",repr(@value.source),", ",repr(tostring(@value\as_nomsu!)),"))") + Lua.Value(@source, "nomsu:parse(Nomsu(",repr(@value.source),", ",repr(tostring(@value\as_nomsu(true))),"))") as_nomsu: (inline=false)=> nomsu = @value\as_nomsu(true) |
