Skip to main content

read_redefinable_token

Function read_redefinable_token 

Source
pub fn read_redefinable_token() -> Result<Option<Token>>
Expand description

The control sequence a definition names: tex.web §1215 get_r_token, repeat get_token until cur_tok<>space_token (\def, \let, \futurelet, \chardef, \countdef …). Each read is read_primitive_token, so a bare \let or \def as a file’s last token takes its name from the input after the file, skipping the spaces there.

A name that is neither a control sequence nor an active character (cur_cs=0) is “Missing control sequence inserted”: the token is read again (back_input) and the frozen \inaccessible (§222 frozen_protection) is named instead, so \gdef{}X{Y} defines it and typesets X{Y}. yquant-doc.tex:3832’s \gdef{… (an \edef-expanded \pgfsyssoftpath@flushbuffers) had installed a macro on the Begin catcode, and every later { read a delimited argument: 1001 errors and a Fatal. Perl reads the name as a Token (TeX_Macro.pool.ltxml:174-177) and shares that. A frozen control sequence as the name (cur_cs>frozen_control_sequence, dropped with the same error) is not modelled: Rust has none.

A \noexpanded name is the control sequence it marks: §358 get_next sets cur_cs to the shadowed token, so \expandafter\def\noexpand\foo defines \foo. Rust’s marker is a \special_relax family token, which had defined the family’s shared \relax meaning instead.

Guards: rtoken_patchcmd::def_of_a_non_cs_defines_inaccessible, rtoken_patchcmd::let_family_of_a_non_cs_reads_the_token_again, rtoken_patchcmd::noexpand_marked_name_is_its_control_sequence.