diff --git a/src/frontend/scanner.l b/src/frontend/scanner.l
index 5af85e047ec2913747f010638d884f9256cb1943..9d8e73d7d73cf01e8e80f552e8e90742cd345991 100644 (file)
--- a/src/frontend/scanner.l
+++ b/src/frontend/scanner.l
*/
identifier ([A-Za-z_][A-Za-z_0-9$]*)
/* TODO: fully support SQL strings */
-string ('[^']*')
+string ('([^']|'')*')
/*
* Numeric constants.
return IDENTIFIER;
}
{string} {
+ char *quot;
+ size_t len;
+
+ /* remove the leading and trailing quote */
yytext[yyleng - 1] = '\0';
yylval->str = strdup(yytext + 1);
+
+ quot = yylval->str;
+ len = yyleng - 2;
+ while ((quot = strstr(quot, "''")) != NULL) {
+ memmove(quot, quot + 1, len - (quot - yylval->str) - 1);
+ yylval->str[len - 1] = '\0';
+ --len;
+ ++quot;
+ }
return STRING;
}
{integer} {