Expand description
DMS parser — full spec v0.14.
Modules§
- tier1
- Tier-1 module — decorators, dialects, and the t1 decoder/encoder.
- tier1_
stream - Tier-1 streaming decoder — separate from the batch path so the
main
decode_t1flow stays untouched. This module post-processes a fully-decodedDocumentT1into an iterator ofStreamEvents following TIER1.md §“Streaming / incremental decode” yield-point semantics.
Structs§
- Attached
Comment - A comment plus its attachment metadata.
- Comment
- One captured comment.
- Decode
Error - Document
- A parsed DMS document — body value plus optional front matter table.
- Heredoc
Modifier Call - Index
Map - A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.
Enums§
- Breadcrumb
Segment - One step in a comment-attachment breadcrumb path.
- Comment
Kind - Whether a comment was a
#///line comment or a### ###//* */block comment. - Comment
Position - How a comment attaches to its target node.
- Emit
Mode - Mirror of
ParseModefor the emitter side. - Encode
Error - Errors raised by the encode (emitter) path. Currently the only
failure mode is full-mode emit refusing a
Documentthat contains an unordered table — see SPEC §“Unordered tables”. Lite-mode emit (encode_lite) cannot fail and accepts unordered Documents. - Heredoc
Flavor - Original
Literal - Per-node literal-form record, captured during decoding so that
encodecan re-emit the value in the same source form (integer base, string flavor, heredoc modifiers). Keyed off the node’s path inDocument::original_forms. Spec §encode. - Parse
Mode - Parse mode — full preserves comments and original literal forms; lite skips that bookkeeping. See SPEC §Parsing modes — full and lite. Same grammar, same errors; only the round-trip metadata differs.
- String
Form - Value
Constants§
- SUPPORTS_
IGNORE_ ORDER - Capability advertisement — this port ships unordered-table decode
mode. See SPEC §Unordered tables. Unordered mode is optional to
ship; callers probe this before opting in via
decode_document_unordered/decode_lite_document_unordered. - SUPPORTS_
LITE_ MODE - Capability advertisement — this port ships lite-mode decode +
lite-mode
encode. See SPEC §Parsing modes — full and lite. Lite mode is optional to ship; callers can probe this constant before opting in viadecode_lite_document/encode_lite.
Functions§
- decode
- Decode a DMS source string and return only the body. Front matter,
if present, is decoded and validated (illegal declarations error),
then discarded. SPEC v0.14 canonical name (replaces
parse). - decode_
document - Decode a full DMS document, returning body + front-matter metadata
- decode_
document_ unordered - Full-mode decode with the unordered table backing — every
Value::Tableis replaced byValue::UnorderedTable(a plainHashMap, no insertion-order tracking). See SPEC §“Unordered tables”. Front matter remains ordered (per spec — meta is small and is consumed strictly). - decode_
document_ with_ mode - Decode with explicit mode selection.
- decode_
document_ with_ options - Decode with explicit mode and ordering selection. When
ignore_order=true, body tables are built asValue::UnorderedTable(HashMap-backed); when false, asValue::Table(IndexMap-backed, insertion-order preserved). See SPEC §“Unordered tables”. - decode_
front_ matter - Front-matter-only decode. Scans leading trivia, the opening
+++, the front-matter contents, and the closing+++, then stops — body bytes are NOT tokenized. Required at SPEC tier 0; see SPEC §“Front-matter-only decode” for the full contract. - decode_
lite - Lite-mode body-only decode. Equivalent to
decode_lite_document(src)?.body, but returns only the body. Use when you don’t need front matter either. - decode_
lite_ document - Lite-mode
Documentdecode. Body + front matter, no comment AST, nooriginal_forms. The returnedDocumentis not suitable forencoderound-trip — see SPEC §Parsing modes — full and lite. - decode_
lite_ document_ unordered - Lite-mode decode with the unordered table backing. The
(unordered, lite)combo is the fastest read-only path: hash-only table backing + no comment/original-form bookkeeping. See SPEC §“Unordered tables”. - encode
- Re-emit a decoded
Documentas DMS source. See SPEC §encode. - encode_
lite - Lite-mode
encode— emits the same data tree in canonical form: comments are dropped, integers are emitted in decimal regardless of source base, strings are emitted in basic-quoted form regardless of source flavour. Accepts both full-mode and lite-mode decodedDocuments — thecommentsandoriginal_formsfields are simply ignored. See SPEC §encode. - encode_
with_ mode - Mode-parameterised
encode.EmitMode::Fullmatchesencode()(and can fail withEncodeError::UnorderedInFullMode);EmitMode::Litematchesencode_lite()(alwaysOk). See SPEC §encode. - parse
Deprecated - Deprecated alias for
decode. Removed in v0.15. - parse_
document Deprecated - Deprecated alias for
decode_document. Removed in v0.15. - parse_
document_ unordered Deprecated - Deprecated alias for
decode_document_unordered. Removed in v0.15. - parse_
document_ with_ mode Deprecated - Deprecated alias for
decode_document_with_mode. Removed in v0.15. - parse_
document_ with_ options Deprecated - Deprecated alias for
decode_document_with_options. Removed in v0.15. - parse_
lite Deprecated - Deprecated alias for
decode_lite. Removed in v0.15. - parse_
lite_ document Deprecated - Deprecated alias for
decode_lite_document. Removed in v0.15. - parse_
lite_ document_ unordered Deprecated - Deprecated alias for
decode_lite_document_unordered. Removed in v0.15. - to_dms
Deprecated - Deprecated alias for
encode. Removed in v0.4. - to_
dms_ lite Deprecated - Deprecated alias for
encode_lite. Removed in v0.4. - to_
dms_ with_ mode Deprecated - Deprecated alias for
encode_with_mode. Removed in v0.4.
Type Aliases§
- DmsHash
Map HashMapspecialization used by unordered body tables, opt-in viadecode_document_unordered/decode_lite_document_unordered(or the--ignore-orderCLI flag). Iteration order is arbitrary — see SPEC §“Unordered tables”. ReusesDmsHasherso the hasher is the same as the ordered side; the only difference is the lack of theIndexMap’s entry-orderVec<usize>bookkeeping.- DmsMap
IndexMapspecialization used for body tables and front matter. Hasher is swappable via thefast_hashcargo feature.- Parse
Error Deprecated - Deprecated alias for
DecodeError. Removed in v0.4.