Commit 9ced4e8
committed
feat!: add support for noop string escapes
This commit let dialects (like MySQL) allow escaping quotes that are not the current string delimiter, effectively treating the escape character as a no-op regarding the character's literal value but consuming the backslash. Previously, tokenize("""'\"a'""", "mysql") resulted in "a. With this change, it correctly results in "a.
Example:
In MySQL:
'"' -> " (Backslash is consumed)
'\"' -> " (Backslash is escaped, quote remains)1 parent 9454a18 commit 9ced4e8
File tree
3 files changed
+25
-1
lines changed- sqlglot
- dialects
- tests/dialects
3 files changed
+25
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| 551 | + | |
551 | 552 | | |
552 | 553 | | |
553 | 554 | | |
| |||
668 | 669 | | |
669 | 670 | | |
670 | 671 | | |
| 672 | + | |
671 | 673 | | |
672 | 674 | | |
673 | 675 | | |
| |||
698 | 700 | | |
699 | 701 | | |
700 | 702 | | |
| 703 | + | |
701 | 704 | | |
702 | 705 | | |
703 | 706 | | |
| |||
1509 | 1512 | | |
1510 | 1513 | | |
1511 | 1514 | | |
| 1515 | + | |
1512 | 1516 | | |
1513 | 1517 | | |
1514 | 1518 | | |
1515 | | - | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
1516 | 1524 | | |
1517 | 1525 | | |
1518 | 1526 | | |
1519 | 1527 | | |
| 1528 | + | |
| 1529 | + | |
1520 | 1530 | | |
1521 | 1531 | | |
1522 | 1532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
435 | 448 | | |
436 | 449 | | |
437 | 450 | | |
| |||
0 commit comments