Expand description
Internal parser support helpers.
Structsยง
- Parsed
Label ๐ - RawList
Line ๐ - One marker line captured during list collection. Not user-facing โ
the public AST uses
crate::ListItemafter nesting is resolved.
Functionsยง
- find_
byte ๐ - is_
escaped ๐ - Whether the byte at
posis escaped by an odd-length run of\immediately before it (bounded below bystart). Backslashes pair up (\\is a hard break, not an escape), so only an odd count escapes the following byte. The label scanners use this so a\<opens literal<text instead of a label. - list_
marker_ ๐at - If the line that starts at
posopens with a list marker, returnSome((indent, ordered, content_start)).indentcounts the leading ASCII spaces before the marker;orderedistruefor\d+\.andfalsefor-;content_startis the byte offset of the first byte after the marker plus its trailing whitespace run. Tabs are not recognised as either indent or post-marker whitespace in MVP 0. - locate_
label ๐ - Locate the first
<label>token insrc[start..end], returning the parsed label and the byte offset just past its>. Unlikestrip_trailing_labelthis finds a label anywhere in the range, so the heading parser can detect a label that is not the trailing element (e.g.= Title <id> trailing) and flag it (MOS0048) instead of silently swallowing it into the text. - next_
char_ ๐boundary - Return the byte offset of the next character boundary at or after
from + 1. Used to step over a single Unicode scalar value when accumulating string literal contents. - normalize_
raw_ ๐text - scan_
label_ ๐chars - Returns the byte offset just past the longest label-identifier run
that starts at
frominbytes. Empty (caller should detect viaid_end == from) if the first byte is not a valid identifier char. - skip_
set_ ๐ws - Skip ASCII whitespace (space, tab, CR, LF) inside a
#setbody. - skip_
to_ ๐comma - Advance to the next
,or end-of-body, used for error recovery inside directive argument parsing. - strip_
leading_ ๐label - If the substring
src[start..end]begins with optional ASCII whitespace followed by<label>, return(label_body_start, Some(id))wherelabel_body_startis the offset just past the closing>(with any trailing whitespace also consumed). Otherwise return(start, None). - strip_
trailing_ ๐label - If the substring
src[start..end]ends with<label>(after any trailing ASCII whitespace), return(text_end, Some(id))wheretext_endis the offset of the first byte to exclude from the preceding text โ trailing whitespace before the label is also trimmed. Otherwise return(end, None).