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.moon | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'parser.moon') diff --git a/parser.moon b/parser.moon index a713e85..51538cc 100644 --- a/parser.moon +++ b/parser.moon @@ -98,7 +98,7 @@ NOMSU_PATTERN = do ident <- [a-zA-Z_][a-zA-Z0-9_]* comment <- "--" [^%nl]* ]] - nomsu_peg = peg_tidier\match(io.open("nomsu.peg")\read('*a')) + nomsu_peg = peg_tidier\match(io.open((package.nomsupath or '.').."/nomsu.peg")\read('*a')) re.compile(nomsu_peg, NOMSU_DEFS) parse = (nomsu_code, source=nil)-> @@ -116,8 +116,7 @@ parse = (nomsu_code, source=nil)-> keys = utils.keys(userdata.errors) table.sort(keys) errors = [userdata.errors[k] for k in *keys] - 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) return tree -- cgit v1.2.3