pub enum IrEvent {
Text {
start: usize,
end: usize,
},
Construct {
start: usize,
end: usize,
kind: ConstructKind,
},
DelimRun {
ch: u8,
start: usize,
end: usize,
can_open: bool,
can_close: bool,
matches: Vec<DelimMatch>,
},
OpenBracket {
start: usize,
end: usize,
is_image: bool,
active: bool,
resolution: Option<BracketResolution>,
},
CloseBracket {
pos: usize,
matched: bool,
},
SoftBreak {
start: usize,
end: usize,
},
HardBreak {
start: usize,
end: usize,
},
}Expand description
One event in the inline IR.
Events partition the source byte range covered by the IR exactly: their
range() values are contiguous and non-overlapping, so concatenating
them reproduces the original input. This is the losslessness invariant
the emission pass relies on.
Variants§
Text
Plain text byte span. Emitted as a single TEXT token, possibly
merged with adjacent literal-disposition delim/bracket bytes.
Construct
An opaque higher-precedence construct (escape, code span, autolink,
raw HTML). The emission pass re-parses these from the source byte
range using the existing per-construct emitters; we don’t store a
pre-built GreenNode because rowan::GreenNodeBuilder doesn’t
support inserting subtrees directly. The byte range is what makes
emission well-defined — the construct kind is recovered by the
emitter dispatching on the leading byte.
DelimRun
A * or _ delimiter run. The matches vec is filled in by
process_emphasis; before that pass it is empty.
Fields
matches: Vec<DelimMatch>Matched fragments produced by process_emphasis. Each entry
is one (byte_offset_within_run, len, partner_event_idx, partner_byte_offset, kind, is_opener) tuple. Empty until the
pass runs; possibly multiple entries when a single run matches
at multiple positions (e.g. a 4-run that closes 2+2 pairs).
OpenBracket
[ or ![ bracket marker. Resolved by process_brackets.
Fields
resolution: Option<BracketResolution>Filled in when the matching CloseBracket resolves the pair
to a link / image.
CloseBracket
] bracket marker. Resolved by process_brackets.
Fields
SoftBreak
A soft line break (a \n or \r\n ending a paragraph-internal
line). Includes the line-ending bytes verbatim.
HardBreak
A hard line break ( \n / \\\n / \n etc.). Includes any
trailing-space bytes plus the line ending.