1 unstable release
Uses new Rust 2024
| 0.1.0 | Feb 21, 2026 |
|---|
#6 in #jsonc
Used in 4 crates
(2 directly)
5KB
75 lines
Shared JSONC comment stripping utility.
Supports:
//line comments/* ... */block comments- string literal preservation (including escapes)
zpl_toolchain_jsonc_strip
Shared JSONC comment stripping utility used by multiple build-time tooling paths.
Purpose
Provides a single strip_jsonc() implementation to prevent drift between:
crates/spec-compilercrates/diagnosticsbuild script
Guarantees
- strips
//line comments - strips
/* ... */block comments - preserves string literals and escaped characters
- UTF-8 safe (operates on chars, not raw bytes)
Usage
use zpl_toolchain_jsonc_strip::strip_jsonc;
let stripped = strip_jsonc(r#"{ "a": 1, /* comment */ "b": 2 }"#);