Fixed breaking bug with compiler not finding the peg file when running the installed version because it

wasn't looking in the full nomsupath.
This commit is contained in:
Bruce Hill 2018-09-21 00:26:36 -07:00
parent d11f9bc5d3
commit acd9c2acd4
2 changed files with 19 additions and 11 deletions

View File

@ -131,15 +131,20 @@ end
local Parsers = { }
local max_parser_version = 0
for version = 1, 999 do
do
local peg_contents = Files.read("nomsu." .. tostring(version) .. ".peg")
if peg_contents then
max_parser_version = version
Parsers[version] = make_parser(peg_contents, make_tree)
else
break
local found_version = false
for _, full_path in Files.walk("nomsu." .. tostring(version) .. ".peg") do
do
local peg_contents = Files.read(full_path)
if peg_contents then
found_version = true
max_parser_version = version
Parsers[version] = make_parser(peg_contents, make_tree)
end
end
end
if not (found_version) then
break
end
end
local MAX_LINE = 80
local NomsuCompiler = setmetatable({ }, {

View File

@ -79,10 +79,13 @@ make_tree = (tree, userdata)->
Parsers = {}
max_parser_version = 0
for version=1,999
if peg_contents = Files.read("nomsu.#{version}.peg")
max_parser_version = version
Parsers[version] = make_parser(peg_contents, make_tree)
else break
found_version = false
for _, full_path in Files.walk("nomsu.#{version}.peg")
if peg_contents = Files.read(full_path)
found_version = true
max_parser_version = version
Parsers[version] = make_parser(peg_contents, make_tree)
break unless found_version
MAX_LINE = 80 -- For beautification purposes, try not to make lines much longer than this value
NomsuCompiler = setmetatable {}, {__tostring: => "Nomsu"}