From 5899aa90533584ffb81bec6b5073b203b58a22fb Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 29 Mar 2015 16:35:54 +0200 Subject: Dequote --- lexer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lexer.go b/lexer.go index fca7607..a9938c5 100644 --- a/lexer.go +++ b/lexer.go @@ -28,13 +28,17 @@ func deneg(s string) string { return strings.Replace(s, "¯", "-", -1) } +func dequote(s string) string { + return strings.Replace(s, "''", "'", -1) +} + func (y *yyLex) Lex(lval *yySymType) int { item := <-y.items switch item.typ { case STRING: lval.sval = S(item.val) case QUOTED: - lval.sval = S(strings.Replace(item.val, "''", "'", -1)) + lval.sval = S(dequote(item.val)) case INTEGER: item.val = deneg(item.val) v, err := strconv.ParseInt(item.val, 10, 64) -- cgit v1.2.3