aboutsummaryrefslogtreecommitdiff
path: root/lexer.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-06-06 02:33:41 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-06-06 02:33:41 +0200
commit798a774484d6703bc94d3cfd9103e4cc5165dfa8 (patch)
tree4679431d89553619c7a4241b84db29859114a89b /lexer.go
parent5ded4927cdd84f327a75ccdf17b32658d974b035 (diff)
....
Diffstat (limited to 'lexer.go')
-rw-r--r--lexer.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/lexer.go b/lexer.go
index e7223a4..704c32c 100644
--- a/lexer.go
+++ b/lexer.go
@@ -1,7 +1,7 @@
package main
import (
- "log"
+ "errors"
"strconv"
"strings"
"unicode"
@@ -34,10 +34,11 @@ type yyLex struct {
items chan item
result float64
ok bool
+ err error
}
func (y *yyLex) Error(s string) {
- log.Println(s)
+ y.err = errors.New(s)
}
func (y *yyLex) Lex(lval *yySymType) int {
@@ -45,7 +46,7 @@ func (y *yyLex) Lex(lval *yySymType) int {
case number:
n, err := strconv.ParseFloat(item.val, 64)
if err != nil {
- log.Println(err)
+ y.Error(err.Error())
}
lval.fval = n
return typemap[item.typ]