Skip to content

fix: honor configured lexer rules for delimited tokens - #943

Open
Sarbajit-Sengupta wants to merge 1 commit into
andialbrecht:masterfrom
Sarbajit-Sengupta:fix/configurable-delimited-lexer
Open

Sarbajit-Sengupta wants to merge 1 commit into
andialbrecht:masterfrom
Sarbajit-Sengupta:fix/configurable-delimited-lexer

Conversation

@Sarbajit-Sengupta

Copy link
Copy Markdown

Lexer.clear() and set_SQL_REGEX() no longer control block comments and dollar-quoted literals because delimiter handling runs before the configured rules. A lexer configured with only (r".+", tokens.Name) still returns Comment.Multiline for /* comment */ and Literal for $$body$$.

Move delimiter resolution into a marker rule in the default SQL_REGEX sequence. Custom rules can then override or omit it, while default lexing keeps the indexed delimiter scanner. Add six regression cases and document the rule's behavior.

Validation: 512 passed, 2 xfailed, 1 xpassed; Ruff and git diff --check passed. Both delimiter benchmark vectors remained linear at sizes 1,000/2,000/4,000 (exponents 1.02 and 1.16).

  • ran the tests (pytest)
  • all style issues addressed (ruff)
  • your changes are covered by tests
  • your changes are documented, if needed

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