Skip to main content

StatementMap

Struct StatementMap 

Source
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

Source

pub fn boundary_after(&self, idx: usize) -> bool

Whether a statement boundary sits in the gap after element idx.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.