From 86a3219e7fc3244331595819f742b365172f96ad Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 21 Jun 2018 19:12:59 -0700 Subject: Cleanup of some metaprogramming stuff, as well as adding support for "package.nomsupath" to search for files in different locations, and prioritizing use of "luafilesystem" over system calls. --- parser.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'parser.lua') diff --git a/parser.lua b/parser.lua index a94418f..e685d56 100644 --- a/parser.lua +++ b/parser.lua @@ -127,7 +127,7 @@ do ident <- [a-zA-Z_][a-zA-Z0-9_]* comment <- "--" [^%nl]* ]]) - local nomsu_peg = peg_tidier:match(io.open("nomsu.peg"):read('*a')) + local nomsu_peg = peg_tidier:match(io.open((package.nomsupath or '.') .. "/nomsu.peg"):read('*a')) NOMSU_PATTERN = re.compile(nomsu_peg, NOMSU_DEFS) end local parse @@ -162,8 +162,7 @@ parse = function(nomsu_code, source) end errors = _accum_0 end - io.stderr:write("Errors occurred while parsing:\n\n", table.concat(errors, "\n\n"), '\n') - os.exit(1) + error("Errors occurred while parsing:\n\n" .. table.concat(errors, "\n\n"), 0) end return tree end -- cgit v1.2.3