Skip to content

fix(syntax): skip shebangs, treat unused brackets as constituents, extend Scheme's # table - #140

Merged
takeokunn merged 2 commits into
mainfrom
fix/reader-shebang-and-bracket-constituents
Aug 5, 2026
Merged

fix(syntax): skip shebangs, treat unused brackets as constituents, extend Scheme's # table#140
takeokunn merged 2 commits into
mainfrom
fix/reader-shebang-and-bracket-constituents

Conversation

@takeokunn

Copy link
Copy Markdown
Collaborator

Three independent reader-classification gaps, in the same style as prior audits in this series:

Test plan

  • cargo build -p paredit-core-syntax
  • cargo test -p paredit-core-syntax (778 passed)
  • cargo check --workspace --all-targets

…tend Scheme's # table

Three independent reader-classification gaps, found by the same style of
corpus audit as prior PRs in this series:

- `#!/usr/bin/env sbcl --script` and other shebang lines are now skipped at
  offset 0 for Common Lisp, matching the existing Emacs Lisp and Hy arms.
  Without it, files starting with a shebang failed to parse at all,
  including ASDF's own tools/cl-source-registry-cache.lisp.

- `[`, `]`, `{`, `}` are CLHS-reserved constituent characters in Common
  Lisp, not delimiters. `is_atom_boundary` was splitting symbols like
  `whitespace[2]p` and `print-mov[dq]-opcode` at the bracket, which broke
  parsing outright on files including SBCL's own src/code/reader.lisp.
  Scheme and Emacs Lisp are deliberately left alone: their own readers
  either already handle it or reserve the character without assigning it
  constituent status.

- classify_scheme's `#` dispatch table gains the R6RS lexical syntax for
  `syntax`/`quasisyntax`/`unsyntax`/`unsyntax-splicing` (`#'`, `` #` ``,
  `#,`, `#,@`) and Guile's `#nil`, alongside the `##name` (Gambit
  namespace-qualified identifier) handling already shipped in #132. `#'`
  keeps its child visible via ReaderPrefix::Function; the other three
  become opaque MultiDatum forms rather than new ReaderPrefix variants,
  which is the same suppressing-direction tradeoff #132 made for the rest
  of this table.

The vector-width and `#:keyword` dispatch logic in this area already
shipped in #132; this only adds coverage #132 did not have, reusing its
existing scheme_uniform_vector_width and Racket-guard fix rather than
reimplementing them.
…racket bug

unused_brackets_are_constituents (this branch) makes `[`, `]`, `{` and `}`
ordinary constituent characters in Common Lisp instead of raw delimiters.
Five existing tests across three packages had pinned the *old*, buggy
behavior — a bracket-containing string failing to parse as Common Lisp —
as if it were a dialect-semantics guarantee, when it was really this bug.
`cargo test --workspace` caught all five; each is updated to assert the
CLHS-correct `.is_ok()` and, where the test's own point was rule silence
or dialect-scoped reading rather than the parse result itself, extended to
check that directly instead of relying on a parse failure as a shortcut.
@takeokunn
takeokunn merged commit 2420bfa into main Aug 5, 2026
10 checks passed
@takeokunn
takeokunn deleted the fix/reader-shebang-and-bracket-constituents branch August 5, 2026 03:43
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