Skip to main content

is_def_prefix_command

Function is_def_prefix_command 

Source
pub fn is_def_prefix_command(text: &str) -> bool
Expand description

Kept at this path for parser and formatter callers. The TeX \def-family primitives, whose next token is always the control sequence being (re)defined. A control-symbol name would otherwise be misparsed as live syntax — \def\[{…}/\def\]{…} (a document class restyling display math, stacks-project issue #65) reads as a math opener, \def\\{…} as a line break — so [Parser::command] consumes it as a plain token inside the \def’s node. A control-word name already parses benignly as a generic command and keeps its current shape. A closed, curated set read as a static fact, mirroring [is_definition_body_command]; the definition is never executed.

Also read by the formatter’s expl3 region gate (in the badness-formatter crate): a toggle spelling immediately preceded by one of these is a definee, never an executed catcode switch, so it must not open a formatter-owned region.