Skip to content

Replace sjacket/parsley with clojure.tools.reader - #216

Merged
bbatsov merged 1 commit into
mainfrom
replace-sjacket-with-tools-reader
Jun 15, 2026
Merged

bbatsov merged 1 commit into
mainfrom
replace-sjacket-with-tools-reader

Conversation

@bbatsov

@bbatsov bbatsov commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

sjacket and parsley have been unmaintained since ~2013 and don't handle modern Clojure reader syntax — namespaced maps (#::{}), tagged literals, reader conditionals, etc. This causes #172 and #200.

This replaces both with org.clojure/tools.reader, which is actively maintained and tracks the language by definition. The internal parsing in reply.parsing is rewritten but the public API (parsed-forms) is unchanged, so no callers need updating.

The key change is a custom position-tracking reader (make-tracking-reader) that implements the tools.reader protocols directly, avoiding the indexing reader's unreliable position reporting at EOF boundaries. Incomplete forms are detected via :eof exceptions from r/read, and syntax errors are passed through as form strings so the REPL displays them as before.

All existing tests pass on Clojure 1.8 through 1.12.

Fixes #172, fixes #200

sjacket and parsley have been unmaintained since ~2013 and don't support
modern Clojure syntax like namespaced maps (#::{}) and tagged literals,
causing issues #172 and #200.

Replace them with clojure.tools.reader which is actively maintained and
tracks the language by definition. The public API (parsed-forms) is
unchanged — only the internal parsing mechanism is rewritten.
@bbatsov

bbatsov commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator Author

I forgot to mention that probably using https://github.com/borkdude/edamame would have made the code a bit simpler, but I felt that tools.reader was more in line with the spirit of REPLy of being a more foundational library.

@bbatsov
bbatsov merged commit b50296b into main Jun 15, 2026
11 checks passed
@bbatsov
bbatsov deleted the replace-sjacket-with-tools-reader branch June 15, 2026 20:11
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.

No support for auto-resolved namepaced maps EOF exception with keywords with % character

1 participant