From b86ff2eb060de15b27cedd0d5559f1338fd8e951 Mon Sep 17 00:00:00 2001 From: Qi Xiao Date: Tue, 16 Feb 2016 14:32:35 +0100 Subject: [PATCH] Show parser errors as well. --- edit/editor.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/edit/editor.go b/edit/editor.go index cb21057e..d2ca2353 100644 --- a/edit/editor.go +++ b/edit/editor.go @@ -123,15 +123,18 @@ func (ed *Editor) refresh(fullRefresh bool) error { name := "[interacitve]" src := ed.line if ed.mode != modeCompletion { - n, _ /*err*/ := parse.Parse(src) + n, err := parse.Parse(src) + if err != nil { + ed.addTip("parser error: %s", err) + } if n == nil { ed.tokens = []Token{{ParserError, src, nil, ""}} } else { ed.tokens = tokenize(src, n) _, err := ed.evaler.Compile(name, src, n) if err != nil { + ed.addTip("compiler error: %s", err) if err, ok := err.(*errutil.ContextualError); ok { - ed.addTip("compiler error: %s", err) p := err.Pos() for i, token := range ed.tokens { if token.Node.Begin() <= p && p < token.Node.End() {