pub fn read_primitive_token() -> Result<Option<Token>>Expand description
Read a token as a primitive reads one: tex.web §365 get_token under the
current ScannerStatus (\let, \futurelet, \afterassignment,
\aftergroup, \expandafter, a Token parameter). An input level
that ends here closes (§362 end_file_reading) and §336
check_outer_validity looks at the status:
normal: no runaway; the read goes on in the enclosing input, asread_token_across_input_endsreads, so a primitive that is the last token of an\inputfile takes its token from the input that follows;defining,absorbing,aligning: the scan in progress ran off the file, and the primitive’s read meets it: the runaway is reported there and TeX’s recovery tokens are read (recover_at_file_end), so an\edef\x{\expandafterat a file’s end reads the inserted}and\xis empty, as in pdflatex;matching: TeX reads a macro’s arguments without expanding, so it gives no primitive’s read this status, but Rust does: an expandable primitive with typed parameters (\csname CSName,\number Number,\readline … Token) reads them atmatching, set byExpandable::read_call_arguments. The read stops at the file’s end (a residual:\csname a\expandafteras a file’s last tokens does not cross), and so does a macro’sTokenargument (the macro gets\relax, theTokenparameter’s end value).
\ifx and \ifdefined read at normal whatever the status (§507), with
read_token_across_input_ends. The status is consulted only once the
current input has run out.
Guards: token_kernel_gaps::*.