aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.moon
diff options
context:
space:
mode:
Diffstat (limited to 'nomsu_compiler.moon')
-rw-r--r--nomsu_compiler.moon11
1 files changed, 5 insertions, 6 deletions
diff --git a/nomsu_compiler.moon b/nomsu_compiler.moon
index b6faba3..432a195 100644
--- a/nomsu_compiler.moon
+++ b/nomsu_compiler.moon
@@ -112,15 +112,14 @@ with NomsuCompiler
find_errors(v)
errs = [err for err in coroutine.wrap(-> find_errors(tree))]
- if #errs > 4
- num_errs = #errs
- errs = [errs[i] for i=1,3]
- table.insert(errs, "\027[31;1m +#{num_errs-#errs} additional errors...\027[0m\n")
- if #errs > 0
+ num_errs = #errs
+ if num_errs > 0
err_strings = [pretty_error{
error:t.error, hint:t.hint, source:t\get_source_code!
start:t.source.start, stop:t.source.stop
- } for t in *errs]
+ } for i, t in ipairs(errs) when i <= 3]
+ if num_errs > 3
+ table.insert(err_strings, "\027[31;1m +#{num_errs-#errs} additional errors...\027[0m\n")
error(table.concat(err_strings, '\n\n'), 0)
return tree
.can_optimize = -> false