aboutsummaryrefslogtreecommitdiff
path: root/parser.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-21 19:12:59 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-21 19:13:47 -0700
commit86a3219e7fc3244331595819f742b365172f96ad (patch)
tree948a3f308bd9c45b85efa2e130af8432bb1a97e2 /parser.lua
parent7761f715f7497e8b325a4f1134869f332848fd16 (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.lua')
-rw-r--r--parser.lua5
1 files changed, 2 insertions, 3 deletions
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