Skip to main content

Module document

Module document 

Source
Expand description

A ledger as the text somebody wrote, edited where it must change and copied everywhere else.

The structure comes from a real YAML parser: yamlpath gives the byte span of any row and yamlpatch performs the key-level edits, so nothing here guesses at indentation or decides how to quote a value.

Two things are ours, because the format leaves them open. A row moves by byte range, since no patch operation offers a move. And a comment written directly above a row — no blank line between — belongs to that row: the parser hands a comment to the row above it, which would strand a comment on one move and steal it on the next.

That same attribution is why a row is edited while it is out of the file. A removal span for the last key of a row reaches past it, so removing acceptance from a row would take the following row’s comment with it. A row on its own has no neighbour to rob.

Structs§

Document
A ledger’s text, with the parser’s view of it available on demand.

Functions§

must_still_parse
Fail rather than write something the next verb cannot read.