aboutsummaryrefslogtreecommitdiff
path: root/parser.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-06-22 02:40:11 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-06-22 02:41:08 -0700
commit126678f737497d36126665b4661c17588c6d58d8 (patch)
tree0a2b877920ef23800e89b1906d061d314a8d3ca4 /parser.lua
parent86a3219e7fc3244331595819f742b365172f96ad (diff)
Adding fancy makefile that compiles all the moonscript files and
precompiles all the nomsu files and can build a nice executable file and install it wherever you like.
Diffstat (limited to 'parser.lua')
-rw-r--r--parser.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/parser.lua b/parser.lua
index e685d56..7b734c3 100644
--- a/parser.lua
+++ b/parser.lua
@@ -127,7 +127,10 @@ do
ident <- [a-zA-Z_][a-zA-Z0-9_]*
comment <- "--" [^%nl]*
]])
- local nomsu_peg = peg_tidier:match(io.open((package.nomsupath or '.') .. "/nomsu.peg"):read('*a'))
+ local peg_file = io.open("nomsu.peg") or (package.nomsupath and io.open(package.nomsupath .. "/nomsu.peg"))
+ assert(peg_file, "could not find nomsu.peg file")
+ local nomsu_peg = peg_tidier:match(peg_file:read('*a'))
+ peg_file:close()
NOMSU_PATTERN = re.compile(nomsu_peg, NOMSU_DEFS)
end
local parse