Skip to main content

read_balanced_with_close

Function read_balanced_with_close 

Source
pub fn read_balanced_with_close(
    expansion_level: ExpansionLevel,
    pack_parameters: bool,
    require_open: bool,
) -> Result<(Tokens, Option<Token>)>
Expand description

read_balanced that also hands back the CLOSE token that ended the group (None when the read ran out or found no opening brace). A delimited reader stores a matched group verbatim (tex.web §392-398 macro_call’s store_new_token(cur_tok) — the argument keeps the braces it was scanned with; the single-group outer-brace strip is §399-400, by catcode). Diverges from Perl’s canonical T_END (Gullet.pm:661/674), OXIDIZED_DESIGN_DIVERGENCES #224. chemfig scans (…) submols with (/) given catcodes 1/2 (chemfig.tex:1315-1324) and a canonical } in their place re-tokenized as a real end-brace in the next \scantokens, unbalancing it (chemexec/chemnum, sweep 74).