aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-03-29 16:35:54 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-03-29 16:35:54 +0200
commit5899aa90533584ffb81bec6b5073b203b58a22fb (patch)
tree06205148d28684a70f867f9f0efd88c89ded5c95
parent7c769b61459c01b164c475eca0f623362adb30f3 (diff)
Dequote
-rw-r--r--lexer.go6
1 files changed, 5 insertions, 1 deletions
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)