diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:34:27 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-12-14 20:34:49 -0800 |
| commit | d30f6a397d274b0b942bdd2e2648b42538f1cbe2 (patch) | |
| tree | 56adafac78b01411b995ab5e41a8ceb777bcd5e6 /nomsu_environment.moon | |
| parent | 4fe63f253f58f87ab986fea38902d95f2a5ea338 (diff) | |
Fixed some bugs, including upgrade --upgrade-from=version not working.
Also updated the README.
Diffstat (limited to 'nomsu_environment.moon')
| -rw-r--r-- | nomsu_environment.moon | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/nomsu_environment.moon b/nomsu_environment.moon index 5d26701..cc059b5 100644 --- a/nomsu_environment.moon +++ b/nomsu_environment.moon @@ -60,18 +60,20 @@ nomsu_environment = Importer{ compile: compile, _1_as_lua: compile, compile_error_at:compile_error, :_1_forked, :import_to_1_from, - _1_parsed: (nomsu_code)-> + _1_parsed: (nomsu_code, syntax_version)-> if type(nomsu_code) == 'string' filename = Files.spoof(nomsu_code) nomsu_code = NomsuCode\from(Source(filename, 1, #nomsu_code), nomsu_code) source = nomsu_code.source nomsu_code = tostring(nomsu_code) version = nomsu_code\match("^#![^\n]*nomsu[ ]+-V[ ]*([0-9.]+)") - syntax_version = version and tonumber(version\match("^[0-9]+")) or max_parser_version + if syntax_version + syntax_version = tonumber(syntax_version\match("^[0-9]+")) + syntax_version or= version and tonumber(version\match("^[0-9]+")) or max_parser_version parse = Parsers[syntax_version] or Parsers[max_parser_version] tree = parse(nomsu_code, source.filename) if tree.shebang - tree.version = tree.shebang\match("nomsu %-V[ ]*([%d.]*)") + tree.version or= tree.shebang\match("nomsu %-V[ ]*([%d.]*)") errs = {} find_errors = (t)-> if t.type == "Error" |
