diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-21 19:12:59 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-06-21 19:13:47 -0700 |
| commit | 86a3219e7fc3244331595819f742b365172f96ad (patch) | |
| tree | 948a3f308bd9c45b85efa2e130af8432bb1a97e2 /parser.moon | |
| parent | 7761f715f7497e8b325a4f1134869f332848fd16 (diff) | |
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.
Diffstat (limited to 'parser.moon')
| -rw-r--r-- | parser.moon | 5 |
1 files changed, 2 insertions, 3 deletions
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 |
