pub struct Expandable {Show 17 fields
pub is_protected: bool,
pub peeks_by_futurelet: bool,
pub is_long: bool,
pub checks_par: bool,
pub is_outer: bool,
pub has_cc_arg: bool,
pub alias: Option<String>,
pub locator: Locator,
pub cs: Token,
pub paramlist: Option<Parameters>,
pub expansion: Option<ExpansionBody>,
pub origin: DefinitionOrigin,
pub special_call: SpecialCall,
pub plan: OnceCell<Box<[BodyPiece]>>,
pub dropped_by_design: u16,
pub made_in_own_file: bool,
pub stored: OnceCell<Box<StoredParameters>>,
}Fields§
§is_protected: bool§peeks_by_futurelet: boolSee Definition::peeks_by_futurelet: set by the kernel’s peeking
closures, and for every macro whose leading argument is a \newcommand
optional one (crate::parameter::Parameter::testopt).
is_long: bool§checks_par: booltex.web §392/§399: reading this macro’s arguments, a \par token ends the call — “Paragraph ended before
\x was complete” (§396). Only a non-\long macro whose long-ness is TeX’s (tex_declared, made at a
Format, File or Document origin): LaTeXML’s own DefMacro!s are non-long without meaning it (Perl stores
isLong and never reads it, Expandable.pm:46), so they are not checked. A \let copy keeps it (the meaning
carries the long-ness). Witness 1001.1670; guards scanner_status::a_par_*, DIVERGENCES #442.
is_outer: bool§has_cc_arg: bool§alias: Option<String>§locator: Locator§cs: Token§paramlist: Option<Parameters>§expansion: Option<ExpansionBody>§origin: DefinitionOrigin§special_call: SpecialCallSee SpecialCall. Not part of the meaning (PartialEq).
plan: OnceCell<Box<[BodyPiece]>>The token-list body’s Tokens::substitution_plan, built at the first call that substitutes.
dropped_by_design: u16The arguments the binding declares this macro drops by design (ExpandableOptions::drops), bit n for #n.
Not part of the meaning (PartialEq).
made_in_own_file: boolMade while a raw class or a raw file of the document’s own directory was read
(crate::definition::origin::reading_own_file), which the title-page check’s third source reads
(Self::watched_call). Not part of the meaning (PartialEq).
stored: OnceCell<Box<StoredParameters>>The body’s StoredParameters, read at the first call the store watch sees.
Implementations§
Source§impl Expandable
impl Expandable
Sourcepub fn yields_calls(&self) -> bool
pub fn yields_calls(&self) -> bool
pub fn new( cs: Token, paramlist: Option<Parameters>, expansion_opt: Option<ExpansionBody>, traits: Option<ExpandableOptions>, ) -> Result<Self>
Trait Implementations§
Source§impl Clone for Expandable
impl Clone for Expandable
Source§impl Debug for Expandable
impl Debug for Expandable
Source§impl Default for Expandable
impl Default for Expandable
Source§impl Definition for Expandable
impl Definition for Expandable
Source§fn invoke(&self, once_only: bool) -> Result<Tokens>
fn invoke(&self, once_only: bool) -> Result<Tokens>
Expand the expandable control sequence. This should be carried out by the Gullet.
Source§fn invoke_onto_input(&self, once_only: bool) -> Result<()>
fn invoke_onto_input(&self, once_only: bool) -> Result<()>
Self::invoke onto the input, a token-list body without building the expansion: the parameterless
body is pushed as stored, a body with parameters through its substitution plan
(crate::gullet::unread_substituted). Closures, argument-only definitions and a watched call (whose
arguments are kept, as Self::invoke keeps them) take the general path.
fn is_protected(&self) -> bool
Source§fn peeks_by_futurelet(&self) -> bool
fn peeks_by_futurelet(&self) -> bool
\@ifnextchar does (1756-1760): by \futurelet, behind an unexpandable
\let. A number scan (tex.web §445) ends at such a macro instead of
expanding it (see gullet::expands_now). A binding closure that makes an
assignment as it expands carries it too when its TeX original reaches an
unexpandable token (\begingroup, \let, \relax) before it acts:
etoolbox’s \newrobustcmd and \patchcmd, amsthm’s \pushQED.fn get_parameters(&self) -> Option<&Parameters>
fn get_num_args(&self) -> usize
Source§fn get_cs(&self) -> Cow<'_, Token>
fn get_cs(&self) -> Cow<'_, Token>
fn get_cs_name(&self) -> Cow<'_, str>
fn get_expansion(&self) -> Option<&ExpansionBody>
fn get_alias(&self) -> Option<&String>
Source§fn native_expansion(&self) -> Result<Option<Tokens>>
fn native_expansion(&self) -> Result<Option<Tokens>>
expandable::SpecialCall::Native, for a call the gullet expands in full: only there, so a one-step
\expandafter and every other reader of the expansion get the macro’s own body.fn invoke_primitive(&self) -> Result<Vec<Digested>>
fn before_digest(&self) -> Option<&Vec<BeforeDigestClosure>>
fn after_digest(&self) -> Option<&Vec<DigestionClosure>>
fn do_absorption( &self, _document: &mut Document, _whatsit: &Whatsit, ) -> Result<Vec<Node>>
fn get_cs_or_alias(&self) -> Cow<'_, Token>
fn get_sizer(&self) -> Option<SizingClosure>
Source§fn declared_mode(&self) -> Option<DeclaredMode>
fn declared_mode(&self) -> Option<DeclaredMode>
DeclaredMode); None for definitions
not made by a definer that takes mode options (macros, registers, raw-TeX definitions,
a primitive built by hand). The audit reads None on a primitive or constructor as
declaring nothing.Source§fn declared_font(&self) -> Option<&FontDirective>
fn declared_font(&self) -> Option<&FontDirective>
font => {…} option), which its
digestion merges into the current font; None for every other definition. latex.ltx’s
\@fontswitch reads a math alphabet as a switch to the group’s end (\mathrm\relax with
\math@bgroup let to \relax, latex.ltx:14312-14321): the binding’s switch merges this font
(\lx@math@alphabet@switch, latex_constructs/sect13.rs).Source§fn replacement_template(&self) -> Option<&'static str>
fn replacement_template(&self) -> Option<&'static str>
DefConstructor!
with a string replacement), when no construction hook (before_construct, after_construct) adds to it. None
for a closure replacement, a constructor made at run time and every other definition: what it builds cannot be
read off it (the frontmatter’s no-ink test, latexml_engine util_text.rs first_ink, counts such a whatsit as ink).fn is_register(&self) -> bool
fn is_prefix(&self) -> bool
fn is_readonly(&self) -> bool
fn get_test(&self) -> Option<&ConditionalClosure>
fn get_conditional_type(&self) -> Option<ConditionalType>
fn read_arguments(&self) -> Result<Vec<ArgWrap>>where
Self: Sized,
fn invocation( &mut self, args: Vec<Option<Tokens>>, _gullet: &mut Gullet, ) -> Result<Tokens>
fn after_digest_body(&self) -> Option<&Vec<DigestionClosure>>
fn capture_body(&self) -> bool
fn execute_before_digest(&self) -> Result<Vec<Digested>>
fn execute_after_digest(&self, whatsit: &mut Whatsit) -> Result<Vec<Digested>>
fn execute_after_digest_body( &self, whatsit: &mut Whatsit, ) -> Result<Vec<Digested>>
fn value_of(&self, _args: Vec<ArgWrap>) -> Option<RegisterValue>
Source§fn set_value(
&self,
_value: RegisterValue,
_scope: Option<Scope>,
_args: Vec<ArgWrap>,
) -> Result<()>
fn set_value( &self, _value: RegisterValue, _scope: Option<Scope>, _args: Vec<ArgWrap>, ) -> Result<()>
fn register_type(&self) -> Option<RegisterType>
fn get_reversion_spec(&self) -> Option<Reversion>
fn stringify_type(&self, deftype: &str) -> String
Source§impl From<Expandable> for Stored
Storing all definitions is expected - Expandable case
impl From<Expandable> for Stored
Storing all definitions is expected - Expandable case
Source§fn from(definition: Expandable) -> Self
fn from(definition: Expandable) -> Self
Source§impl Object for Expandable
impl Object for Expandable
fn is_definition(&self) -> bool
fn is_expandable(&self) -> bool
Source§fn get_locator(&self) -> Option<Locator>
fn get_locator(&self) -> Option<Locator>
None is the honest
“no recorded source position” (replacing the old Locator::default()
file!()/line!() sentinel). For “where the parser is now” (error
reporting, box creation), use the free fn gullet::get_locator().Source§fn get_origin(&self) -> DefinitionOrigin
fn get_origin(&self) -> DefinitionOrigin
definition::origin). The
default is Unknown, which counts as LaTeXML’s own.