pub struct StatementMap { /* private fields */ }Expand description
The statement-boundary map for one element stream: boundary_after(i) says
a statement ends in the gap after element i. Boundaries sit on whole
top-level siblings — a boundary never splits a CST node, so anything the
greedy parser over-attached to a consumed sibling rides along in its
statement.
Implementations§
Source§impl StatementMap
impl StatementMap
Sourcepub fn boundary_after(&self, idx: usize) -> bool
pub fn boundary_after(&self, idx: usize) -> bool
Whether a statement boundary sits in the gap after element idx.
Sourcepub fn glue_before(&self, idx: usize) -> bool
pub fn glue_before(&self, idx: usize) -> bool
Whether the gap before element idx must render unbreakable. Set for
a recognized-head COMMAND sitting mid-way through a fallback
statement: a width wrap at that gap would start a printed line with the
recognized head, which the next pass segments as its own statement
mid-way through this one and the passes disagree (l3fp-trig.dtx’s
\@@_sep:-delimited protocols, xo-or.dtx’s =~ \exp_not:c {…}\space
trace lines). Every other fallback gap stays breakable: a printed
continuation line starting with anything unrecognized re-segments to
exactly that line and renders to itself, the fallback’s fixed point.
Sourcepub fn is_glued(&self, idx: usize) -> bool
pub fn is_glued(&self, idx: usize) -> bool
Whether element idx belongs to a recognized statement that absorbed
trailing same-line material ([absorb_trailing_junk]) — a call unit
followed by unrecognized tokens or a comment on its authored line
(xparse’s \bool_if:NTF … { \cs_set:cpn } … ##1 \q_@@ … definition
trickery). Such a statement renders with every top-level gap
unbreakable: its junk extent is newline-keyed (the fallback’s Tier-2
residue), so a width wrap moving material across a line boundary would
change the extent — and with it the trailing-command glue decision —
on the next pass. All-hard gaps preserve the authored line shape
(node-internal layout still breaks freely and re-reads node-internal),
which is a fixed point by construction.
Sourcepub fn is_fallback(&self, idx: usize) -> bool
pub fn is_fallback(&self, idx: usize) -> bool
Whether element idx belongs to a fallback statement. A fallback line
commits as a plain greedy fill, never the sticky fill structural
statements use: greedy packing is self-fulfilling (each printed line
re-segments to a fallback statement that re-fills to exactly itself),
while a sticky cascade forces atoms that would fit onto their own
broken lines — a shape the next pass’s shorter per-line statements
do not reproduce.