Skip to content

fix: support SQL-standard doubled quotes in string literals#65

Open
eaallen wants to merge 1 commit into
JavaScriptor:masterfrom
eaallen:fix/sql-standard-escaped-quotes
Open

fix: support SQL-standard doubled quotes in string literals#65
eaallen wants to merge 1 commit into
JavaScriptor:masterfrom
eaallen:fix/sql-standard-escaped-quotes

Conversation

@eaallen

@eaallen eaallen commented Jul 21, 2026

Copy link
Copy Markdown

Summary

  • The STRING lexer rules only accepted backslash escapes (\' / \"), so MySQL/SQL-standard doubled quotes like 'O''Hare' were tokenized as two strings and failed to parse.
  • Update the lexer to also accept '' / "" inside quoted literals, matching MySQL 5.7 string literals.
  • Add a regression test covering doubled single/double quotes, empty strings, and existing backslash escapes.

Test plan

  • npm test — all 37 tests pass locally
  • Maintainer: rebuild (npm run build) and cut a release so npm consumers pick up the fix

Made with Cursor

MySQL/SQL allow escaping a quote inside a string by doubling it
(e.g. 'O''Hare'). The lexer only recognized backslash escapes, so
these literals were split into multiple STRING tokens and failed to
parse.

Update the STRING lexer rules to accept '' and "" inside quoted
strings, matching https://dev.mysql.com/doc/refman/5.7/en/string-literals.html

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant