Composable pipeline stages for the lossless reader.
Pipeline: step-parse → step-read → (optionally) step-expand-syntax-quotes
Each stage is a ctx → ctx function operating on a shared context map:
| Key | Type | Written by | Read by |
|---|---|---|---|
| :source | String | caller | parse |
| :opts | Map or nil | caller | parse, read |
| :cst | Vector | parse | read, (tooling) |
| :forms | Vector | read | caller, expand |
The table above is mirrored as machine-readable data in stage-contracts.
Each stage calls check-contract! at entry, so miscomposed pipelines
(e.g. calling step-read before step-parse) throw a clear pipeline-error
with the missing key(s) and the actual ctx-keys present, instead of
surfacing deep-inside NPEs.
Stages are independent. Compose in any order respecting dependencies. Skip step-read for tooling that works with CST directly.
Composable pipeline stages for the lossless reader. Pipeline: step-parse → step-read → (optionally) step-expand-syntax-quotes Each stage is a ctx → ctx function operating on a shared context map: | Key | Type | Written by | Read by | |--------------|----------------|-------------|------------------| | :source | String | caller | parse | | :opts | Map or nil | caller | parse, read | | :cst | Vector | parse | read, (tooling) | | :forms | Vector | read | caller, expand | The table above is mirrored as machine-readable data in `stage-contracts`. Each stage calls `check-contract!` at entry, so miscomposed pipelines (e.g. calling step-read before step-parse) throw a clear pipeline-error with the missing key(s) and the actual ctx-keys present, instead of surfacing deep-inside NPEs. Stages are independent. Compose in any order respecting dependencies. Skip step-read for tooling that works with CST directly.
(expand-syntax-quotes forms opts)Expand syntax-quote AST nodes in a seq of forms. Convenience wrapper around step-expand-syntax-quotes for callers that don't need the full pipeline context map.
Expand syntax-quote AST nodes in a seq of forms. Convenience wrapper around step-expand-syntax-quotes for callers that don't need the full pipeline context map.
(run source)(run source opts)Run the full pipeline: source → CST → forms.
Run the full pipeline: source → CST → forms.
Machine-readable pipeline contract. Each entry is
{:requires #{ctx-keys} :produces #{ctx-keys}}.
:requires is enforced at runtime by check-contract!; :produces
is documentation — if a stage fails to produce what it claims, the
next stage's :requires check catches the mistake, so post-condition
runtime checks would be redundant.
Machine-readable pipeline contract. Each entry is
`{:requires #{ctx-keys} :produces #{ctx-keys}}`.
`:requires` is enforced at runtime by `check-contract!`; `:produces`
is documentation — if a stage fails to produce what it claims, the
next stage's `:requires` check catches the mistake, so post-condition
runtime checks would be redundant.(step-expand-syntax-quotes ctx)Expand syntax-quote AST nodes, unwrap MemeRaw values, and convert MemeAutoKeyword records to eval-able forms in :forms. Produces plain Clojure forms ready for eval.
Expand syntax-quote AST nodes, unwrap MemeRaw values, and convert MemeAutoKeyword records to eval-able forms in :forms. Produces plain Clojure forms ready for eval.
(step-parse ctx)Parse source string into CST using the unified Pratt parser. Uses meme grammar by default, or (:grammar opts) if provided. Reads :source, writes :cst.
Parse source string into CST using the unified Pratt parser. Uses meme grammar by default, or (:grammar opts) if provided. Reads :source, writes :cst.
(step-read ctx)Lower CST to Clojure forms via the CST reader. Reads :cst, writes :forms.
Lower CST to Clojure forms via the CST reader. Reads :cst, writes :forms.
(strip-shebang source)Strip a leading #! shebang line from source.
Strip a leading #! shebang line from source.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |