Repository navigation
fix(splitter): agree with the parser on escapes, parentheses, GO and Oracle slash lines - #869
ajitpratap0 wants to merge 1 commit into
Conversation
…Oracle slash lines - SplitStatements follows each dialect's backslash-escape rule (MySQL, MariaDB, ClickHouse; PostgreSQL E-strings), so 'a\';b' is one string. - A ';' inside parentheses no longer ends a statement (CREATE RULE ... DO ALSO (a; b)); unbalanced nesting falls back to one linear semicolon pass. - GO [count] lines accept trailing line and block comments in both the splitter and the parser, through one shared helper (internal/batch). - Oracle: a line holding only '/' is a SQL*Plus execute command in the parser too, so the parser and the splitter see the same statements; a slash with a comment on its line stays division. - internal/dropcheck compares word counts, not word sets; backslash handling is per dialect. - scripts/dialect-audit and TestRealWorldCorpus share one pipeline (internal/dialectaudit); block-comment-only statements are empty; -dialect is validated; glob errors and empty dialect directories fail. - format_corpus_test maps /sqlserver/ paths to the SQL Server dialect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ajitpratap0's task in 40s —— View job Review of PR #869: splitter/parser boundary agreementI read the diff only and did not run the tests or the linter. The design is sound. Sharing Should fix or consider
Nits
Performance and security
Test coverage is strong. Gaps I'd add: item 1 above, |
Summary
Follow-ups from the pre-merge review of #866–#868:
SplitStatementsand the parser now agree on statement boundaries. The audit harness and drop detector are also tightened.E''strings.SELECT 'a\';b'; SELECT 3is now 2 statements in MySQL, not 3 fragments.;inside(...)no longer ends a statement, e.g. PostgreSQLCREATE RULE ... DO ALSO (a; b). Unbalanced nesting falls back to one extra linear pass, so a malformed fragment can't swallow the rest of a script.GO,GO 2,GO -- c,GO 2 /* c */and multi-line block comments after GO are handled by one helper (internal/batch.TextEnd), used by both the splitter and the parser./: a line holding only/is a SQL*Plus execute command in the parser as well as the splitter. A/that shares its line with SQL or a comment stays division.ANDamong several is caught. Backslash handling is per dialect.scripts/dialect-auditandTestRealWorldCorpusshare one pipeline (internal/dialectaudit). Statements holding only block comments count as empty.-dialectis validated. Glob errors and empty dialect directories now fail the test.format_corpus_testmaps/sqlserver/paths.Test Plan
gofmt,go vet,golangci-lint run(0 issues),task test:race,task test:cbindingsplitter_boundaries_test.go(escapes, parentheses, Oracle/cases, formatting OracleEND;+/scripts),splitter_batch_comments_test.go(every GO variant, including CRLF),internal/batch/text_test.go,internal/dialectaudit,scripts/dialect-audit/main_test.go, and the multiset dropcheck testsTestRealWorldCorpusgreen; known_failures stays empty with the multiset checkBreaking Changes
None to the Go API. Behaviour changes:
/line between expressions now parses as two statements, not a division.SplitStatementsoutput changes for the escape and parenthesis cases above.Known gap:
FormatASToutput drops the SQL*Plus/lines, as it did before. Keeping them, the way GO lines are kept, is a follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01DnbRnTFErhoMJdAjVEeCg2