aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lexer.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/lexer.go b/lexer.go
index 0c6f982..974831c 100644
--- a/lexer.go
+++ b/lexer.go
@@ -15,12 +15,6 @@ const (
char
)
-var typemap = map[int]int{
- number: NUMBER,
- word: WORD,
- char: eof,
-}
-
type item struct {
typ int
val string
@@ -49,14 +43,15 @@ func (y *yyLex) Lex(lval *yySymType) int {
y.Error(err.Error())
}
lval.fval = n
- return typemap[item.typ]
+ return NUMBER
case word:
lval.sval = item.val
- return typemap[item.typ]
+ return WORD
case char:
return int(item.val[0])
+ default:
+ return eof
}
- return eof
}
func lex(input string) *yyLex {