18 - the parse keeps each node's readable spelling, so the directive ask spells it once #105

Merged
lilleman merged 5 commits from directive-spelling-subtree into main 2026-09-19 13:50:09 +02:00
Showing only changes of commit 00e18d66b5 - Show all commits
+7 -7
View File
@@ -313,15 +313,15 @@ someone spells it or pins it.
scan may keep what it read for a later walk of the same text, and the fallback where it kept scan may keep what it read for a later walk of the same text, and the fallback where it kept
nothing must be the same reader over the same text at the same index, so the two cannot disagree nothing must be the same reader over the same text at the same index, so the two cannot disagree
— which is what makes the kept value a memo rather than a second spelling (4c). — which is what makes the kept value a memo rather than a second spelling (4c).
- The parse keeps each node's readable spelling in a memo, so the `commonMarkSpelling` ask spells a - The parse keeps each node's readable spelling in a memo, so the `commonMarkSpelling` ask stops
node once rather than once per level above it (18). The node reference is the key, which holds spelling a node once per level above it (18). The node reference is the key, which holds
because the parse builds one object per position; `adfToMarkdown` passes no memo, where a because the parse builds one object per position; `adfToMarkdown` passes no memo, where a
consumer's document may hold one node at two positions (4b). `text` and `spelling` carry no depth consumer's document may hold one node at two positions (4b). `text` and `spelling` carry no depth
and `headroom` is affine in it, so a read at or above the depth that filled the entry rebases; a read and `headroom` is affine in it, so a read at or above the depth that filled the entry rebases; a
below re-spells, because a hit skips the depth guards the walk it replaces runs and an ordered read below re-spells, because a hit skips the depth guards the walk it replaces runs and an
list past the marker cap gives way, spending two emitter levels where the parser spent one. A ordered list past the marker cap gives way, spending two emitter levels where the parser spent
give-way is kept too and serves any depth, reading the node's shape alone. Only what succeeded is one. A give-way is kept too and serves any depth, reading the node's shape alone. Only what
kept, so no path minted at another position is ever read. succeeded is kept, so no path minted at another position is ever read.
- No casts: `as`, `as unknown as`, non-null `!`. A boundary owes a type guard validating the - No casts: `as`, `as unknown as`, non-null `!`. A boundary owes a type guard validating the
fields it claims (`isAdfDocument`); past it everything is typed. Make invalid states fields it claims (`isAdfDocument`); past it everything is typed. Make invalid states
unrepresentable. unrepresentable.