aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-09-14 19:17:09 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-09-14 19:17:16 -0700
commite22c35681f90740b4f5006c30b3f154ebd1f8ea2 (patch)
treec7f04d968bade120ebf75cfa0b9f073602917122 /nomsu_compiler.lua
parent7112af7cb6ee52f4ef9664db9c03db52d8c73ac9 (diff)
Auto-upgraded everything.
Diffstat (limited to 'nomsu_compiler.lua')
-rw-r--r--nomsu_compiler.lua40
1 files changed, 16 insertions, 24 deletions
diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua
index f01edf7..d5921cf 100644
--- a/nomsu_compiler.lua
+++ b/nomsu_compiler.lua
@@ -214,37 +214,29 @@ do
end
errs = _accum_0
end
- if #errs > 4 then
- local num_errs = #errs
- do
- local _accum_0 = { }
- local _len_0 = 1
- for i = 1, 3 do
- _accum_0[_len_0] = errs[i]
- _len_0 = _len_0 + 1
- end
- errs = _accum_0
- end
- table.insert(errs, "\027[31;1m +" .. tostring(num_errs - #errs) .. " additional errors...\027[0m\n")
- end
- if #errs > 0 then
+ local num_errs = #errs
+ if num_errs > 0 then
local err_strings
do
local _accum_0 = { }
local _len_0 = 1
- for _index_0 = 1, #errs do
- local t = errs[_index_0]
- _accum_0[_len_0] = pretty_error({
- error = t.error,
- hint = t.hint,
- source = t:get_source_code(),
- start = t.source.start,
- stop = t.source.stop
- })
- _len_0 = _len_0 + 1
+ for i, t in ipairs(errs) do
+ if i <= 3 then
+ _accum_0[_len_0] = pretty_error({
+ error = t.error,
+ hint = t.hint,
+ source = t:get_source_code(),
+ start = t.source.start,
+ stop = t.source.stop
+ })
+ _len_0 = _len_0 + 1
+ end
end
err_strings = _accum_0
end
+ if num_errs > 3 then
+ table.insert(err_strings, "\027[31;1m +" .. tostring(num_errs - #errs) .. " additional errors...\027[0m\n")
+ end
error(table.concat(err_strings, '\n\n'), 0)
end
return tree