aboutsummaryrefslogtreecommitdiff
path: root/nomsu.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-30 14:25:02 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-30 14:25:35 -0700
commit54906c0553147f29807c945eace6724d06ff570c (patch)
tree9c138ac9c0bf03bee1799212604a1adb27aaa2f9 /nomsu.lua
parentfba035595df7ebd694fc33c804727c94a5ecb024 (diff)
Fix for REPL not getting launched when `nomsu -I lib` is run.
Diffstat (limited to 'nomsu.lua')
-rw-r--r--nomsu.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/nomsu.lua b/nomsu.lua
index ab04883..d8fee92 100644
--- a/nomsu.lua
+++ b/nomsu.lua
@@ -98,11 +98,12 @@ if not arg or debug.getinfo(2).func == require then
end
local file_queue = { }
local sep = "\0"
-local parser = re.compile([[ args <- {| (flag %sep)* (({~ file ~} -> add_file) %sep)? {:nomsu_args: {| ({(!%sep .)*} %sep)* |} :} %sep? |} !.
+local parser = re.compile([[ args <- {| (flag %sep)* (({~ file ~} -> add_file) {:primary_file: '' -> true :} %sep)?
+ {:nomsu_args: {| ({(!%sep .)*} %sep)* |} :} %sep? |} !.
flag <-
{:optimization: "-O" (%sep? (([0-9]+) -> tonumber))? :}
/ ("-I" %sep? ({~ file ~} -> add_file))
- / ("-e" %sep? (({} {~ file ~}) -> add_exec_string))
+ / ("-e" %sep? (({} {~ file ~}) -> add_exec_string) {:exec_strings: '' -> true :})
/ ({:check_syntax: ("-s" -> true):})
/ ({:compile: ("-c" -> true):})
/ ({:compile: ("-c" -> true):})
@@ -283,7 +284,7 @@ run = function()
end
end
end
- if #file_queue == 0 then
+ if not (args.primary_file or args.exec_strings) then
nomsu:run([[#!/usr/bin/env nomsu -V2
use "lib/consolecolor.nom"
action [quit, exit]: lua> "os.exit(0)"