diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-30 16:40:05 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-30 16:40:23 -0800 |
| commit | 2dbf2d8810de19a2f06480798307b5bf781671a8 (patch) | |
| tree | e583af73fa99a56c92db874586f3dcfbcb38c033 /nomsu.lua | |
| parent | 78c15a5d5e9336f0164161c77c0441b41c226895 (diff) | |
Cleanup of REPL and detection of command-line running.
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1476,7 +1476,7 @@ do var_pattern = re.compile("{| %space ((('%' {%varname}) / %word) %space)+ |}", stub_defs) NomsuCompiler = _class_0 end -if arg then +if arg and debug.getinfo(2).func ~= require then colors = require('consolecolors') local parser = re.compile([[ args <- {| {:flags: flags? :} ({:input: input :} ";" ("-o;"{:output: output :} ";")?)? (";")? |} !. flags <- (({| ({flag} ";")* |}) -> set) @@ -1532,14 +1532,16 @@ if arg then if args.flags["-i"] then nomsu:run('use "lib/core.nom"', "stdin") while true do + io.write(colored.bright(colored.yellow(">> "))) local buff = "" while true do - io.write(">> ") local line = io.read("*L") if line == "\n" or not line then break end + line = line:gsub("\t", " ") buff = buff .. line + io.write(colored.dim(colored.yellow(".. "))) end if #buff == 0 then break |
