Commit ef47c7f
authored
refactor(vnext): share bounded SQL lexical primitives
## Summary
- extract dialect lexical profiles and shared UTF-16 identifier, quote,
block-comment, and dollar-quote scanners from the statement index
- preserve statement-index behavior while adding explicit upper bounds
needed by the parser-independent query-site recognizer
- make bounded dollar-quote opener/closer classification
prefix-deterministic and keep partial close search bounded
- add direct boundary regressions for quotes, block comments, dollar
quotes, UTF-16 identifiers, and SQL whitespace
This is a private prerequisite for ADR 0005 step 3; it adds no public
package export.
## Validation
- `pnpm run typecheck` (strict and loose optional-property modes)
- `pnpm exec oxlint`
- `pnpm run test:integrity`
- 1,272 Node tests passed + 1 expected failure
- 7 Chromium tests passed
- packed-package smoke passed
- worker-placement/runtime evidence passed
- demo build passed
- changed coverage: 98.51% statements, 96.75% branches, 100% functions,
98.50% lines
- three independent exact-head adversarial approvals at `652b108`
## Review history
Adversarial review found a dollar-opener read beyond an explicit scan
limit. The final head guards the opener before inspecting a suffix and
includes bounded-prefix equivalence coverage. No additional Copilot
request will be made after the one request for this PR.
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Shares SQL lexical primitives and adds explicit scan limits to prevent
over-reads while keeping statement-index behavior. Also preserves fast,
bounded ASCII word scans and fixes dollar-quote opener detection.
- **Refactors**
- Moved scanners for quotes, block comments, dollar quotes, UTF‑16
identifiers, and SQL whitespace into `src/vnext/lexical.ts` with
explicit `limit` handling; preserved fast ASCII word scanning in
`statement-index.ts` for performance.
- Centralized dialect profiles and helpers; `statement-index.ts` now
imports these and drops duplicate logic.
- **Bug Fixes**
- Dollar-quote opener classification is now prefix-bounded; no suffix
reads beyond the scan limit.
- Quote and block comment scanners respect limits, including line-break
and backslash cases.
- Dollar-quote tags over 256 chars return `delimiterTooLong` instead of
scanning unbounded.
<sup>Written for commit 3600269.
Summary will update on new commits.</sup>
<a
href="https://cubic.dev/pr/marimo-team/codemirror-sql/pull/185?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->1 parent 1ca5751 commit ef47c7f
3 files changed
Lines changed: 474 additions & 330 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments