Expand description
The Token and its Catcode
Structs§
- Field
Cover - A cover of a field’s stored value: the positions
start..end(end exclusive) of one field (field,0= none) that an invocation consumed, its own position and its arguments. Seefield_cover_pending_merge. - Field
Ledger Entry - One entry of the field ledger (
field_ledger_push): the cover of a box digested from a field token, and whether the structure the print is set in took the box instead of the document absorbing it (field_ledger_take). - Field
Ledger Scope - A stretch of digestion the document never keeps (a rehearsal of a frontmatter field’s value, latexml_engine’s
frontmatter observer), over which the field ledger records (
field_ledger_live, even once the placement settled it) and after which it is as it was: the entries pushed meanwhile are dropped, the pending cover and the settled flag put back, and the gate of field stamping (document::field_prov_stamped: a\titlethe rehearsal stamps) as it was (on drop). Its serials are read while it is open (field_ledger_entry); a print the document makes later is numbered as if it had never run. - Token
- The core immutable syntactic primitive resulting from TeX’s read-in and expansion process We allow the fields to be public, so that we can use builder macros such as
Enums§
- Catcode
- A Token category code, as in TeX
- Field
Invocation - What a field token’s invocation did (
FieldNotesHook), now that it read what it reads.
Constants§
- AUTHOR_
PROV_ POS_ MASK - The author field (
2) is the top bit alone, the id3being none: its positions take 15 bits, so a call’s own positions (the frontmatter observer’s rehearsal of one author block, positions per call) reach 32,767 — a block of 559 names past the 16,383 the stamps take (2204.09614, 2404.06718). The stamps’ tokens below 16,384 read as before. - FIELD_
PROV_ POS_ BITS - ======================================================================
Accessors.
The bits of a
Token::provbelow the field: the token’s position in the field’s stored value (saturating). - FIELD_
PROV_ POS_ MASK - The largest position a field’s stamps take, cumulative per document (
\lx@field@mark,\lx@field@stamp). - NOEXPAND_
PREFIX - Name of the bare no-op control sequence
\noexpandcollapses to, and the prefix of every member of the no-expand family. SeeToken::is_noexpand_family. - NOEXPAND_
SEP - Separator byte between the
\special_relaxprefix and the shadowed token’s text in a family token’s name.\x01is never valid in a CS name or active char, so\special_relax\x01\foois unambiguous and cannot collide with a real CS such as a (hypothetical)\special_relaxfoo.
Statics§
- TOKEN_
ALIGN - constant for an ALIGN “&” token
- TOKEN_
BEGIN - constant for a BEGIN “{” token
- TOKEN_
CR - constant for a CR “\n” token
- TOKEN_
END - constant for an END “}” token
- TOKEN_
ENDCSNAME - constant for T_CS(“\endcsname”)
- TOKEN_
EXPANDAFTER - constant for T_CS(“\expandafter”)
- TOKEN_
MATH - constant for a MATH “$” token
- TOKEN_
PARAM - constant for a PARAM “#” token
- TOKEN_
RELAX - constant for T_CS(“\relax”)
- TOKEN_
SPACE - constant for a SPACE “ “ token
- TOKEN_
SUB - constant for a SUB “_” token
- TOKEN_
SUPER - constant for a SUPER “^” token
Functions§
- field_
cover_ pending - The pending cover of a boxless invocation (
field_cover_pending_merge). - field_
cover_ pending_ merge - Merge
coverwith the pending cover of a boxless invocation when they touch (the same field,coverstarting inside or at the end of the pending one), clearing the pending cover either way: what a box digested from a field token covers of its stored value. - field_
cover_ set_ pending - Leave
coverpending for the next box of its field (field_cover_pending_merge), merged with the pending one it continues. - field_
ledger_ cover - The positions of field
field’s value covered by the ledger entries with the serials inserials(inclusivefirst..=lastintervals): sorted disjointstart..endintervals, merged where they touch. - field_
ledger_ entry - The entry the field ledger recorded with
serial(field_ledger_push). - field_
ledger_ live - Is the field ledger recording (
field_ledger_settle)? The stomach records a field token’s box only while it is. - field_
ledger_ push - Record the cover of a box digested from a field token (the field ledger); its serial, the box’s
fieldSerial. - field_
ledger_ settle - Stop recording field covers: the frontmatter placement settled the field ink (no run is marked after it).
- field_
ledger_ take - Note that the structure a print is set in took the box recorded with
serial(an alignment’s row-end marker, a value’s\\): no run absorbs it, and the run its row ends may cover it (FieldLedgerEntry::taken). - field_
notes_ hook - The hook
FieldNotesHooknames, while one is set. - field_
prov - The field provenance of the token at
posof fieldfield’s stored value (field1 or 2;0is no field). - field_
prov_ field - The field of a
Token::prov(0= none). - field_
prov_ pos - The position in its field’s stored value of a
Token::prov. - inherit_
field_ prov - The expansion of a token with a field provenance (
prov,Token::prov) is that field’s too: each of its tokens without a provenance of its own takesprov(an\andin\@authorexpands to ink of the author field). A no-op forprov0, the case of every token outside a frontmatter field’s store. - noexpand_
family - Build the no-expand family token shadowing
shadowed— the per-token, dump-safe representation of\noexpand <shadowed>(faithful to TeX’sno_expand_flag: the shadowed identity is preserved in the name; the family resolves to\relaxmeaning).shadowedis an expandable/undefined CS or active token (the only things\noexpandwraps; seeis_dont_expandable). - reset_
field_ cover_ pending - Clear the pending field cover and the ledger, and record again (conversion start).
- reset_
noexpand_ family_ memo - Clear the
Token::is_noexpand_familyper-symbol memo. Companion toarena::reset()— symbol indices are reused after a reset, so stale entries would alias unrelated strings (same bug class as the REPORT-map fix,7b64a48ad1). The storage is freed, not only emptied: a leaked per-thread static has no destructor, so what a reset keeps would outlive a thread that exits (the memo runs to megabytes, one byte per arena byte). - set_
field_ notes_ hook - Set (or, with
None, clear) the hookFieldNotesHooknames.
Type Aliases§
- Field
Notes Hook - What runs on each field token’s invocation while a rehearsal takes notes on what its boxes do not hold (the frontmatter
observer’s
field_notes, in the engine):Token::prov’s test in the stomach, then this. All the core knows of them, so no line of theirs sits among the code the core’s hot path is inlined from (Z01: the same lines here cost a text document 0.17 % ofinstructions:uwith no call made, a reshuffle of the crate’s codegen units).