aboutsummaryrefslogtreecommitdiff
path: root/bootstrap.lua
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-16 16:31:49 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-16 16:32:02 -0800
commit8ca7749b5509a40256195563fa52d3ede4bd1a34 (patch)
treea3e597668b6a53048e440d9630b48f3a2efb3926 /bootstrap.lua
parent25e1ccc025e27d5ef7f1cc23e82e4836aa5a07f4 (diff)
Better error messaging (using pretty_error in more places)
Diffstat (limited to 'bootstrap.lua')
-rw-r--r--bootstrap.lua31
1 files changed, 3 insertions, 28 deletions
diff --git a/bootstrap.lua b/bootstrap.lua
index c257965..27a1953 100644
--- a/bootstrap.lua
+++ b/bootstrap.lua
@@ -10,33 +10,8 @@ do
end
local SyntaxTree = require("syntax_tree")
local Files = require("files")
-local pretty_error = require("pretty_errors")
-local compile_error
-compile_error = function(source, err_msg, hint)
- if hint == nil then
- hint = nil
- end
- local file
- if SyntaxTree:is_instance(source) then
- file = source:get_source_file()
- source = source.source
- elseif type(source) == 'string' then
- source = Source:from_string(source)
- end
- if source and not file then
- file = Files.read(source.filename)
- end
- local err_str = pretty_error({
- title = "Compile error",
- error = err_msg,
- hint = hint,
- source = file,
- start = source.start,
- stop = source.stop,
- filename = source.filename
- })
- return error(err_str, 0)
-end
+local fail_at
+fail_at = require('nomsu_compiler').fail_at
local MAX_LINE = 80
local compile_actions = {
[""] = function(self, fn, ...)
@@ -130,7 +105,7 @@ local compile_actions = {
end,
["test"] = function(self, body)
if not (body.type == 'Block') then
- compile_error(body, "This should be a Block")
+ fail_at(body, "Compile error: This should be a Block")
end
local test_nomsu = body:get_source_code():match(":[ ]*(.*)")
do