From acd9c2acd4688f2301b091daad910c04e402bd6a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 21 Sep 2018 00:26:36 -0700 Subject: Fixed breaking bug with compiler not finding the peg file when running the installed version because it wasn't looking in the full nomsupath. --- nomsu_compiler.moon | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'nomsu_compiler.moon') diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon index 19d4049..f5cc7d2 100644 --- a/nomsu_compiler.moon +++ b/nomsu_compiler.moon @@ -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"} -- cgit v1.2.3