Skip to main content

abandon_runaway_call

Function abandon_runaway_call 

Source
pub fn abandon_runaway_call(
    cs: Token,
    is_long: bool,
    checks_par: bool,
    runaway: Runaway,
) -> Result<()>
Expand description

Abandon the call of cs whose argument ran off the end of a file, given the runaway tokens it had read (ScannerStatusGuard::end_taking_runaway_argument).

TeX checks every token of a non-\long macro’s argument for \par (tex.web §392, §399) and at the first one abandons the call, “Paragraph ended before \cs was complete”, putting the \par back (§396 back_error): the call and its argument up to there are dropped, and the rest is read again. The readers make that check while they read for a macro whose long-ness is TeX’s (Runaway::Paragraph); for LaTeXML’s own macros (Perl’s isLong is stored, Expandable.pm:46, and never read) it is made here, on the runaway only: the argument ran to the file’s end, past the \par where TeX stopped, and without the check the call would drop everything after it too. The tokens from that \par on go back into the file, which then ends later, under the enclosing scan.

Otherwise (a \long macro, or no \par) it is the file’s end: “File ended while scanning use of \cs” (§338-339), and the file is closed now, as tex.web §362 closes it (end_file_reading) before recovering, so the next read is from the enclosing input (\expandafter\a\foo{… gives \a the next token after \input).