From 57f49576db1909bc47d558f825c10860898f17c3 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 4 Nov 2016 11:16:41 +0000 Subject: [PATCH] Serialize and deserialize Tokens as strings --- sql/token.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql/token.go b/sql/token.go index 46a39f5a..d2516d09 100644 --- a/sql/token.go +++ b/sql/token.go @@ -414,6 +414,13 @@ func (tok Token) String() string { return "" } +func newToken(str string) Token { + for k, v := range tokens { + if v == str { + return Token(k) + } + } + return ILLEGAL } func (tok Token) isLiteral() bool { return tok > literalsBeg && tok < literalsEnd }