Skip to main content

read_next_conditional

Function read_next_conditional 

Source
pub fn read_next_conditional() -> Result<Option<(Token, ConditionalType)>>
Expand description

reads and discards tokens, until it encounters a conditional, if any. Perl: skipConditionalBody inner loop (Conditional.pm L127-133) reads tokens directly from pushback/mouth (NOT through readToken) and manually tracks $LaTeXML::ALIGN_STATE for { and }. Critically, this bypasses the “alignment-template trigger” check that fires handleTemplate on &/\cr when align_group_count==0 — that check belongs to digestion, not to \else-skip. Rust’s read_token includes the trigger; calling it from here would let pmatrix’s & get treated as the OUTER alignment’s column-end during \ifx.#1.\else…\fi skip when #1 contains \begin{pmatrix}…&…\end{pmatrix}. (REG-2 / math-ph0501074: the 9-line \nonumber+\lefteqn+\pmatrix repro.) Use read_internal_token instead and track BEGIN/END manually, matching Perl byte-for-byte.