Expand description
Code-block minifiers used by the LLM emit pass.
v0.2 shipped JSON/JSONL. v0.3 adds Rust, Go, JavaScript/TypeScript, Java,
C/C++, and SQL via hand-rolled tokenizers. Each minifier is fail-closed:
any parse error returns Err, and the caller falls back to verbatim
emission with a B0701 warning.
Minification is required to be semantically lossless — the broad rule is
parse → minify → re-parse produces structurally equal data. Where we
lack a real parser we settle for tokenizer-equivalence and a hand-curated
corpus of edge-case fixtures.
Modules§
- c_
common - Shared building blocks for the C-family minifiers (Rust, Go, JS/TS,
Java, C/C++, SQL). Each language module produces a
Vec<Token>with its own lexer; a shared emitter consumes the stream to produce a minified string with minimal-but-safe whitespace. - c_cpp
- C and C++ minifier.
- go
- Go minifier.
- java
- Java minifier.
- javascript
- JavaScript / TypeScript minifier.
- json
- JSON / JSONL minifiers (v0.2). Comment-free formats: the
MinifyOptions::keep_commentsflag is a no-op here. - rust
- Rust minifier.
- sql
- SQL minifier (Postgres-flavored, the canonical dialect per spec §4.5).
Structs§
- Minify
Error - Minify
Options - Minify
Output - A successful minification produces a body plus zero-or-more per-conversion warnings (e.g. B0703 line-comment-converted notices).
Enums§
- Minify
Warning - Per-block warnings the minifier may produce. The LLM emit pass is
responsible for translating these into stderr
warning[Bxxxx]: …lines.
Functions§
- is_
supported - Returns true if
lang, lowercased, is one of the minifiers shipped in this build. v0.3: json, jsonl, rust/rs, c/h, cpp/c++/cc/cxx/hpp/hxx, java, go, js/javascript, ts/typescript, sql. - minify
- Dispatch to the appropriate minifier by language tag. Caller must check
is_supportedfirst; an unsupported language returns Err. - refusal_
reason - If
langis a permanently-refused language (significant whitespace), return a one-line reason. Languages: python/py, yaml/yml, makefile/make/mk.