|
115 | 115 | * \xE1\xA0\x8E
|
116 | 116 | * U+180E MONGOLIAN VOWEL SEPARATOR -- not a whitespace anymore
|
117 | 117 | */
|
| 118 | +%x xb |
| 119 | +%x xc |
| 120 | +%x xd |
| 121 | +%x xh |
| 122 | +%x xq |
| 123 | +%x xqs |
| 124 | +%x xe |
| 125 | +%x xdolq |
| 126 | +%x xui |
| 127 | +%x xus |
| 128 | +%x xeu |
| 129 | + |
| 130 | + |
118 | 131 | whitespace [\t\n\v\f\r ]+
|
119 | 132 |
|
120 | 133 | /*
|
@@ -202,17 +215,22 @@ decimalscifail2 ({digitseq}|{decimal})[Ee][+-]
|
202 | 215 | dquote \"
|
203 | 216 | dqchars [^"\\]+
|
204 | 217 | squote '
|
| 218 | + |
205 | 219 | sqchars [^'\\]+
|
206 | 220 | esascii \\["'/\\bfnrt]
|
207 | 221 | esasciifail \\[^Uu]?
|
208 | 222 | esunicode \\(U{hexdigit}{8}|u{hexdigit}{4})
|
209 | 223 | esunicodefail \\(U{hexdigit}{0,7}|u{hexdigit}{0,3})
|
| 224 | +doublequote {squote}{squote} |
210 | 225 | escapecode \\{digit}{3}
|
211 | 226 | escapecodefail \\{digit}{0,2}
|
212 | 227 | hexcode \\(x{hexdigit}+|X{hexdigit}+)
|
213 | 228 | hexcodefail \\(X|x)
|
214 | 229 | any (?s:.)
|
215 | 230 |
|
| 231 | + |
| 232 | + |
| 233 | + |
216 | 234 | /* id pattern is for UnescapedSymbolicName rule in Cypher. */
|
217 | 235 | id {idstart}{idcont}*
|
218 | 236 | idstart [A-Z_a-z\x80-\xFF]
|
@@ -454,6 +472,23 @@ ag_token token;
|
454 | 472 | BEGIN(sqstr);
|
455 | 473 | }
|
456 | 474 |
|
| 475 | +{squote} { |
| 476 | + update_location(); |
| 477 | + strbuf_reset(&yyextra.literal_buf); |
| 478 | + BEGIN(sqstr); |
| 479 | + |
| 480 | + /* |
| 481 | + * In quoted strings, only Unicode escape sequences need to be verified, |
| 482 | + * and the actions for <dqstr,sqstr>{esunicode} and <qstru>{esunicode} |
| 483 | + * rules verify the code point values. So, quoted strings are always valid. |
| 484 | + */ |
| 485 | + |
| 486 | + token.type = AG_TOKEN_STRING; |
| 487 | + token.value.s = strbuf_get_str(&yyextra.literal_buf); |
| 488 | + token.location = get_location(); |
| 489 | + return token; |
| 490 | +} |
| 491 | + |
457 | 492 | <dqstr>{dqchars} |
|
458 | 493 | <sqstr>{sqchars} {
|
459 | 494 | strbuf_append_buf(&yyextra.literal_buf, yytext, yyleng);
|
@@ -507,6 +542,9 @@ ag_token token;
|
507 | 542 | scan_errposition()));
|
508 | 543 | }
|
509 | 544 | }
|
| 545 | +<dqstr,sqstr>{doublequote} { |
| 546 | + strbuf_append_char(&yyextra.literal_buf, '\''); |
| 547 | +} |
510 | 548 |
|
511 | 549 | <dqstr,sqstr>{esunicode} {
|
512 | 550 | pg_wchar c;
|
|
0 commit comments