From 54906c0553147f29807c945eace6724d06ff570c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 30 Jul 2018 14:25:02 -0700 Subject: Fix for REPL not getting launched when `nomsu -I lib` is run. --- nomsu.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nomsu.lua') 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)" -- cgit v1.2.3