class Token
A token object has the properties of the relax
primitive.
Alternatively you can use a getter get_<fieldname> to access a property
of a token.
The numbers that represent a catcode are the same as in TeX itself, so using this information assumes that you know a bit about TeX's internals. The other numbers and names are used consistently but are not frozen. So, when you use them for comparing you can best query a known primitive or character first to see the values.
Reference:
- Source file of the
LuaTeXmanual: luatex-tex.tex#L2285-L2310
😱 Types incomplete or incorrect? 🙏 Please contribute!
fields
Token.command
A number representing the internal command number (catcode in case of a character), for example: 1 (left_brace), 2 (right_brace), 3 (math_shift), 4 (tab_mark), 6 (mac_param), 7 (sup_mark), 8 (sub_mark), 10 (spacer), 11 (letter), 12 (other), 147 (call).
Token.cmdname
The type of the command, for example letter.
Token.csname
The associated control sequence (if applicable), for example bigskip.
Token.id
The unique id of the token, for example 6876.
Token.tok
The full token number as stored in TeX, for example 536883863.
Token.active
A boolean indicating the active state of the token, for example true.
Token.expandable
A boolean indicating if the token (macro) is expandable, for example true.
Token.protected
A boolean indicating if the token (macro) is protected, for example false.
Token.mode
A number either representing a character or another entity, for example 1007.
Token.index
A number running from 0x0000 upto 0xFFFF indicating a TeX register index. In case of letters the unicode code point, for example 398 = Ǝ.