3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 15:15:44 +01:00

Answer prose round 1: 0 🔴, 5 🟡; define the closer in place, and say the kept source is one per text

This commit is contained in:
2026-10-18 10:53:55 +02:00
committed by Lillem4n
parent 637fbc914c
commit 5e3f4c688c
5 changed files with 14 additions and 16 deletions
+2 -2
View File
@@ -18,10 +18,10 @@ export type InlineToken =
| { closes: boolean; kind: 'highlight'; opens: boolean; width: number }
| { construct: string; kind: 'html' }
// A text and what its openers look ahead for, read once, so a walk reading a token at every index stays linear in it.
// Build one per text and pass it to every `readInlineToken` call on that text, so a walk stays linear in the text's length.
export type InlineSource = {
readonly codeSpanCloser: (from: number, opener: number) => number | undefined
// Each HTML construct terminator's last start in the text, -1 for none, read the first time an opener asks.
// Where each HTML terminator last starts in the text, -1 for none; filled the first time an opener asks.
readonly terminators: Map<string, number>
readonly text: string
}