aboutsummaryrefslogtreecommitdiff
path: root/lexer.go
diff options
context:
space:
mode:
Diffstat (limited to 'lexer.go')
-rw-r--r--lexer.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/lexer.go b/lexer.go
index e5e025b..a52cc96 100644
--- a/lexer.go
+++ b/lexer.go
@@ -28,23 +28,24 @@ func (y *yyLex) Lex(lval *yySymType) int {
item := <-y.items
switch item.typ {
case STRING:
- lval.sval = item.val
+ lval.sval = S(item.val)
case QUOTED:
- lval.sval = strings.Replace(item.val, "''", "'", -1)
+ lval.sval = S(strings.Replace(item.val, "''", "'", -1))
case INTEGER:
item.val = strings.Replace(item.val, "¯", "-", -1)
- lval.ival, _ = strconv.ParseInt(item.val, 10, 64)
+ v, _ := strconv.ParseInt(item.val, 10, 64)
+ lval.ival = I(v)
case FLOAT:
item.val = strings.Replace(item.val, "¯", "-", -1)
- lval.fval, _ = strconv.ParseFloat(item.val, 64)
+ v, _ := strconv.ParseFloat(item.val, 64)
+ lval.fval = F(v)
case COMPLEX:
item.val = strings.Replace(item.val, "¯", "-", -1)
pos := strings.IndexAny(item.val, "jJ")
r, _ := strconv.ParseFloat(item.val[:pos], 64)
i, _ := strconv.ParseFloat(item.val[pos+1:], 64)
- lval.cval = complex(r, i)
+ lval.cval = C(complex(r, i))
}
- lval.sval = item.val
return item.typ
}