Update tea and lexer
This commit is contained in:
14
sql/lexer.go
14
sql/lexer.go
@@ -25,6 +25,10 @@ const (
|
||||
QUOTE
|
||||
SINGLE_QUOTE
|
||||
|
||||
// TYPES
|
||||
TYPE_NUMERIC
|
||||
TYPE_TEXT
|
||||
|
||||
// Keywords
|
||||
CREATE
|
||||
TABLE
|
||||
@@ -157,6 +161,12 @@ func (l *Lexer) Lex() (Position, Token, string) {
|
||||
}
|
||||
|
||||
return startPos, IDENT, lit
|
||||
} else if unicode.IsNumber(r) {
|
||||
startPos := l.pos
|
||||
l.backup()
|
||||
lit := l.lexIdent()
|
||||
|
||||
return startPos, TYPE_NUMERIC, lit
|
||||
} else {
|
||||
return l.pos, ILLEGAL, string(r)
|
||||
}
|
||||
@@ -176,7 +186,9 @@ func (l *Lexer) lexIdent() string {
|
||||
}
|
||||
|
||||
l.pos.column++
|
||||
if unicode.IsLetter(r) || unicode.IsNumber(r) || r == '_' {
|
||||
|
||||
// Dont allow dot, just for testing with numeric
|
||||
if unicode.IsLetter(r) || unicode.IsNumber(r) || r == '_' || r == '.' {
|
||||
// Change this to stringstream or something similar
|
||||
lit = lit + string(r)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user