Skip to content

Commit 49e1c16

Browse files
authored
Merge pull request #23 from JackiebyChan/214-double-quote-supporting
fix_"12*"_parse
2 parents e631e1a + 1189f1f commit 49e1c16

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/parser/bison_parser.y

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,8 +1068,7 @@ column_name : IDENTIFIER { $$ = Expr::makeColumnRef($1); }
10681068

10691069
literal : identifier_literal | string_literal | bool_literal | num_literal | null_literal | date_literal | interval_literal | param_expr;
10701070

1071-
identifier_literal : IDENTIFIER { $$ = Expr::makeLiteral($1); }
1072-
| '"' IDENTIFIER '"' { $$ = Expr::makeLiteral($2); };
1071+
identifier_literal : IDENTIFIER { $$ = Expr::makeLiteral($1); };
10731072

10741073
string_literal : STRING { $$ = Expr::makeLiteral($1); };
10751074

src/parser/flex_lexer.l

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ CHARACTER[ \t\n]+VARYING TOKEN(CHARACTER_VARYING)
228228
">=" TOKEN(GREATEREQ)
229229
"||" TOKEN(CONCAT)
230230

231-
[-+*`"/(){},.;<>=^%:?[\]|] { return yytext[0]; }
231+
[-+*`/(){},.;<>=^%:?[\]|] { return yytext[0]; }
232232

233233
[0-9]+"."[0-9]* |
234234
"."[0-9]* {
@@ -256,6 +256,12 @@ CHARACTER[ \t\n]+VARYING TOKEN(CHARACTER_VARYING)
256256
return SQL_INTVAL;
257257
}
258258

259+
\"[^\"\n]+\" {
260+
// Crop the leading and trailing quote char
261+
yylval->sval = hsql::substr(yytext, 1, strlen(yytext)-1);
262+
return SQL_IDENTIFIER;
263+
}
264+
259265
[A-Za-z][A-Za-z0-9_]* {
260266
yylval->sval = strdup(yytext);
261267
return SQL_IDENTIFIER;

0 commit comments

Comments
 (0)