Skip to main content

peek_upcoming_tokens

Function peek_upcoming_tokens 

Source
pub fn peek_upcoming_tokens(
    max_lines: usize,
    max_chars: usize,
    max_tokens: usize,
) -> impl Iterator<Item = Token>
Expand description

The tokens the current input holds next, without reading them: the pushback, next-read first, then the current mouth’s next max_lines source lines (at most max_chars characters of them, Mouth::peek_text) tokenized by a scratch mouth under the current catcodes as the iterator is drawn on, max_tokens in all. Nothing is read, expanded or moved, so a catcode change the look-ahead runs past still applies to the text when it is really read. Only the current mouth: the input levels outside it are not reached. The cost is bounded by the limits, not by the length of the line or of the pending expansion. A look-ahead for a decision about what follows (stomach.rs formula_continues_past_par, OXIDIZED_DESIGN #553).