Skip to main content

retex_engine/
cmd_gen.rs

1// @generated by tools/gen_primitives.py — do not edit.
2//! Command codes, numbered as LuaTeX's `token.commands()` reports them.
3
4/// A command code (TeX's `eq_type`/`cur_cmd`).
5#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6#[repr(u8)]
7pub enum Cmd {
8    /// `relax`.
9    Relax = 0,
10    /// `left_brace`.
11    LeftBrace = 1,
12    /// `right_brace`.
13    RightBrace = 2,
14    /// `math_shift`.
15    MathShift = 3,
16    /// `tab_mark`.
17    TabMark = 4,
18    /// `car_ret`.
19    CarRet = 5,
20    /// `mac_param`.
21    MacParam = 6,
22    /// `sup_mark`.
23    SupMark = 7,
24    /// `sub_mark`.
25    SubMark = 8,
26    /// `endv`.
27    Endv = 9,
28    /// `spacer`.
29    Spacer = 10,
30    /// `letter`.
31    Letter = 11,
32    /// `other_char`.
33    OtherChar = 12,
34    /// `par_end`.
35    ParEnd = 13,
36    /// `stop`.
37    Stop = 14,
38    /// `delim_num`.
39    DelimNum = 15,
40    /// `char_num`.
41    CharNum = 16,
42    /// `math_char_num`.
43    MathCharNum = 17,
44    /// `mark`.
45    Mark = 18,
46    /// `node`.
47    Node = 19,
48    /// `xray`.
49    Xray = 20,
50    /// `make_box`.
51    MakeBox = 21,
52    /// `hmove`.
53    Hmove = 22,
54    /// `vmove`.
55    Vmove = 23,
56    /// `un_hbox`.
57    UnHbox = 24,
58    /// `un_vbox`.
59    UnVbox = 25,
60    /// `remove_item`.
61    RemoveItem = 26,
62    /// `hskip`.
63    Hskip = 27,
64    /// `vskip`.
65    Vskip = 28,
66    /// `mskip`.
67    Mskip = 29,
68    /// `kern`.
69    Kern = 30,
70    /// `mkern`.
71    Mkern = 31,
72    /// `leader_ship`.
73    LeaderShip = 32,
74    /// `halign`.
75    Halign = 33,
76    /// `valign`.
77    Valign = 34,
78    /// `no_align`.
79    NoAlign = 35,
80    /// `vrule`.
81    Vrule = 36,
82    /// `hrule`.
83    Hrule = 37,
84    /// `novrule`.
85    Novrule = 38,
86    /// `nohrule`.
87    Nohrule = 39,
88    /// `insert`.
89    Insert = 40,
90    /// `vadjust`.
91    Vadjust = 41,
92    /// `ignore_spaces`.
93    IgnoreSpaces = 42,
94    /// `after_assignment`.
95    AfterAssignment = 43,
96    /// `after_group`.
97    AfterGroup = 44,
98    /// `partoken_name`.
99    PartokenName = 45,
100    /// `break_penalty`.
101    BreakPenalty = 46,
102    /// `start_par`.
103    StartPar = 47,
104    /// `ital_corr`.
105    ItalCorr = 48,
106    /// `accent`.
107    Accent = 49,
108    /// `math_accent`.
109    MathAccent = 50,
110    /// `discretionary`.
111    Discretionary = 51,
112    /// `eq_no`.
113    EqNo = 52,
114    /// `left_right`.
115    LeftRight = 53,
116    /// `math_comp`.
117    MathComp = 54,
118    /// `limit_switch`.
119    LimitSwitch = 55,
120    /// `above`.
121    Above = 56,
122    /// `math_style`.
123    MathStyle = 57,
124    /// `math_choice`.
125    MathChoice = 58,
126    /// `non_script`.
127    NonScript = 59,
128    /// `vcenter`.
129    Vcenter = 60,
130    /// `case_shift`.
131    CaseShift = 61,
132    /// `message`.
133    Message = 62,
134    /// `normal`.
135    Normal = 63,
136    /// `extension`.
137    Extension = 64,
138    /// `option`.
139    Option = 65,
140    /// `lua_function_call`.
141    LuaFunctionCall = 66,
142    /// `lua_bytecode_call`.
143    LuaBytecodeCall = 67,
144    /// `lua_call`.
145    LuaCall = 68,
146    /// `in_stream`.
147    InStream = 69,
148    /// `begin_group`.
149    BeginGroup = 70,
150    /// `end_group`.
151    EndGroup = 71,
152    /// `omit`.
153    Omit = 72,
154    /// `ex_space`.
155    ExSpace = 73,
156    /// `boundary`.
157    Boundary = 74,
158    /// `radical`.
159    Radical = 75,
160    /// `super_sub_script`.
161    SuperSubScript = 76,
162    /// `no_super_sub_script`.
163    NoSuperSubScript = 77,
164    /// `math_shift_cs`.
165    MathShiftCs = 78,
166    /// `end_cs_name`.
167    EndCsName = 79,
168    /// `char_ghost`.
169    CharGhost = 80,
170    /// `assign_local_box`.
171    AssignLocalBox = 81,
172    /// `char_given`.
173    CharGiven = 82,
174    /// `math_given`.
175    MathGiven = 83,
176    /// `xmath_given`.
177    XmathGiven = 84,
178    /// `last_item`.
179    LastItem = 85,
180    /// `toks_register`.
181    ToksRegister = 86,
182    /// `assign_toks`.
183    AssignToks = 87,
184    /// `assign_int`.
185    AssignInt = 88,
186    /// `assign_attr`.
187    AssignAttr = 89,
188    /// `assign_dimen`.
189    AssignDimen = 90,
190    /// `assign_glue`.
191    AssignGlue = 91,
192    /// `assign_mu_glue`.
193    AssignMuGlue = 92,
194    /// `assign_font_dimen`.
195    AssignFontDimen = 93,
196    /// `assign_font_int`.
197    AssignFontInt = 94,
198    /// `assign_hang_indent`.
199    AssignHangIndent = 95,
200    /// `set_aux`.
201    SetAux = 96,
202    /// `set_prev_graf`.
203    SetPrevGraf = 97,
204    /// `set_page_dimen`.
205    SetPageDimen = 98,
206    /// `set_page_int`.
207    SetPageInt = 99,
208    /// `set_box_dimen`.
209    SetBoxDimen = 100,
210    /// `set_tex_shape`.
211    SetTexShape = 101,
212    /// `set_etex_shape`.
213    SetEtexShape = 102,
214    /// `def_char_code`.
215    DefCharCode = 103,
216    /// `def_del_code`.
217    DefDelCode = 104,
218    /// `extdef_math_code`.
219    ExtdefMathCode = 105,
220    /// `extdef_del_code`.
221    ExtdefDelCode = 106,
222    /// `def_family`.
223    DefFamily = 107,
224    /// `set_math_param`.
225    SetMathParam = 108,
226    /// `set_font`.
227    SetFont = 109,
228    /// `def_font`.
229    DefFont = 110,
230    /// `register`.
231    Register = 111,
232    /// `assign_box_direction`.
233    AssignBoxDirection = 112,
234    /// `assign_box_dir`.
235    AssignBoxDir = 113,
236    /// `assign_direction`.
237    AssignDirection = 114,
238    /// `assign_dir`.
239    AssignDir = 115,
240    /// `combinetoks`.
241    Combinetoks = 116,
242    /// `advance`.
243    Advance = 117,
244    /// `multiply`.
245    Multiply = 118,
246    /// `divide`.
247    Divide = 119,
248    /// `prefix`.
249    Prefix = 120,
250    /// `let`.
251    Let = 121,
252    /// `shorthand_def`.
253    ShorthandDef = 122,
254    /// `def_lua_call`.
255    DefLuaCall = 123,
256    /// `read_to_cs`.
257    ReadToCs = 124,
258    /// `def`.
259    Def = 125,
260    /// `set_box`.
261    SetBox = 126,
262    /// `hyph_data`.
263    HyphData = 127,
264    /// `set_interaction`.
265    SetInteraction = 128,
266    /// `letterspace_font`.
267    LetterspaceFont = 129,
268    /// `expand_font`.
269    ExpandFont = 130,
270    /// `copy_font`.
271    CopyFont = 131,
272    /// `set_font_id`.
273    SetFontId = 132,
274    /// `undefined_cs`.
275    UndefinedCs = 133,
276    /// `expand_after`.
277    ExpandAfter = 134,
278    /// `no_expand`.
279    NoExpand = 135,
280    /// `input`.
281    Input = 136,
282    /// `lua_expandable_call`.
283    LuaExpandableCall = 137,
284    /// `lua_local_call`.
285    LuaLocalCall = 138,
286    /// `if_test`.
287    IfTest = 139,
288    /// `fi_or_else`.
289    FiOrElse = 140,
290    /// `cs_name`.
291    CsName = 141,
292    /// `convert`.
293    Convert = 142,
294    /// `variable`.
295    Variable = 143,
296    /// `feedback`.
297    Feedback = 144,
298    /// `the`.
299    The = 145,
300    /// `top_bot_mark`.
301    TopBotMark = 146,
302    /// `call`.
303    Call = 147,
304    /// `long_call`.
305    LongCall = 148,
306    /// `outer_call`.
307    OuterCall = 149,
308    /// `long_outer_call`.
309    LongOuterCall = 150,
310    /// `end_template`.
311    EndTemplate = 151,
312    /// `dont_expand`.
313    DontExpand = 152,
314    /// `glue_ref`.
315    GlueRef = 153,
316    /// `shape_ref`.
317    ShapeRef = 154,
318    /// `box_ref`.
319    BoxRef = 155,
320    /// `data`.
321    Data = 156,
322}
323
324impl Cmd {
325    /// All command codes, indexed by their numeric value.
326    pub const ALL: [Cmd; 157] = [
327        Cmd::Relax,
328        Cmd::LeftBrace,
329        Cmd::RightBrace,
330        Cmd::MathShift,
331        Cmd::TabMark,
332        Cmd::CarRet,
333        Cmd::MacParam,
334        Cmd::SupMark,
335        Cmd::SubMark,
336        Cmd::Endv,
337        Cmd::Spacer,
338        Cmd::Letter,
339        Cmd::OtherChar,
340        Cmd::ParEnd,
341        Cmd::Stop,
342        Cmd::DelimNum,
343        Cmd::CharNum,
344        Cmd::MathCharNum,
345        Cmd::Mark,
346        Cmd::Node,
347        Cmd::Xray,
348        Cmd::MakeBox,
349        Cmd::Hmove,
350        Cmd::Vmove,
351        Cmd::UnHbox,
352        Cmd::UnVbox,
353        Cmd::RemoveItem,
354        Cmd::Hskip,
355        Cmd::Vskip,
356        Cmd::Mskip,
357        Cmd::Kern,
358        Cmd::Mkern,
359        Cmd::LeaderShip,
360        Cmd::Halign,
361        Cmd::Valign,
362        Cmd::NoAlign,
363        Cmd::Vrule,
364        Cmd::Hrule,
365        Cmd::Novrule,
366        Cmd::Nohrule,
367        Cmd::Insert,
368        Cmd::Vadjust,
369        Cmd::IgnoreSpaces,
370        Cmd::AfterAssignment,
371        Cmd::AfterGroup,
372        Cmd::PartokenName,
373        Cmd::BreakPenalty,
374        Cmd::StartPar,
375        Cmd::ItalCorr,
376        Cmd::Accent,
377        Cmd::MathAccent,
378        Cmd::Discretionary,
379        Cmd::EqNo,
380        Cmd::LeftRight,
381        Cmd::MathComp,
382        Cmd::LimitSwitch,
383        Cmd::Above,
384        Cmd::MathStyle,
385        Cmd::MathChoice,
386        Cmd::NonScript,
387        Cmd::Vcenter,
388        Cmd::CaseShift,
389        Cmd::Message,
390        Cmd::Normal,
391        Cmd::Extension,
392        Cmd::Option,
393        Cmd::LuaFunctionCall,
394        Cmd::LuaBytecodeCall,
395        Cmd::LuaCall,
396        Cmd::InStream,
397        Cmd::BeginGroup,
398        Cmd::EndGroup,
399        Cmd::Omit,
400        Cmd::ExSpace,
401        Cmd::Boundary,
402        Cmd::Radical,
403        Cmd::SuperSubScript,
404        Cmd::NoSuperSubScript,
405        Cmd::MathShiftCs,
406        Cmd::EndCsName,
407        Cmd::CharGhost,
408        Cmd::AssignLocalBox,
409        Cmd::CharGiven,
410        Cmd::MathGiven,
411        Cmd::XmathGiven,
412        Cmd::LastItem,
413        Cmd::ToksRegister,
414        Cmd::AssignToks,
415        Cmd::AssignInt,
416        Cmd::AssignAttr,
417        Cmd::AssignDimen,
418        Cmd::AssignGlue,
419        Cmd::AssignMuGlue,
420        Cmd::AssignFontDimen,
421        Cmd::AssignFontInt,
422        Cmd::AssignHangIndent,
423        Cmd::SetAux,
424        Cmd::SetPrevGraf,
425        Cmd::SetPageDimen,
426        Cmd::SetPageInt,
427        Cmd::SetBoxDimen,
428        Cmd::SetTexShape,
429        Cmd::SetEtexShape,
430        Cmd::DefCharCode,
431        Cmd::DefDelCode,
432        Cmd::ExtdefMathCode,
433        Cmd::ExtdefDelCode,
434        Cmd::DefFamily,
435        Cmd::SetMathParam,
436        Cmd::SetFont,
437        Cmd::DefFont,
438        Cmd::Register,
439        Cmd::AssignBoxDirection,
440        Cmd::AssignBoxDir,
441        Cmd::AssignDirection,
442        Cmd::AssignDir,
443        Cmd::Combinetoks,
444        Cmd::Advance,
445        Cmd::Multiply,
446        Cmd::Divide,
447        Cmd::Prefix,
448        Cmd::Let,
449        Cmd::ShorthandDef,
450        Cmd::DefLuaCall,
451        Cmd::ReadToCs,
452        Cmd::Def,
453        Cmd::SetBox,
454        Cmd::HyphData,
455        Cmd::SetInteraction,
456        Cmd::LetterspaceFont,
457        Cmd::ExpandFont,
458        Cmd::CopyFont,
459        Cmd::SetFontId,
460        Cmd::UndefinedCs,
461        Cmd::ExpandAfter,
462        Cmd::NoExpand,
463        Cmd::Input,
464        Cmd::LuaExpandableCall,
465        Cmd::LuaLocalCall,
466        Cmd::IfTest,
467        Cmd::FiOrElse,
468        Cmd::CsName,
469        Cmd::Convert,
470        Cmd::Variable,
471        Cmd::Feedback,
472        Cmd::The,
473        Cmd::TopBotMark,
474        Cmd::Call,
475        Cmd::LongCall,
476        Cmd::OuterCall,
477        Cmd::LongOuterCall,
478        Cmd::EndTemplate,
479        Cmd::DontExpand,
480        Cmd::GlueRef,
481        Cmd::ShapeRef,
482        Cmd::BoxRef,
483        Cmd::Data,
484    ];
485
486    /// LuaTeX's name for the command (`token.get_cmdname`).
487    pub fn name(self) -> &'static str {
488        match self {
489            Cmd::Relax => "relax",
490            Cmd::LeftBrace => "left_brace",
491            Cmd::RightBrace => "right_brace",
492            Cmd::MathShift => "math_shift",
493            Cmd::TabMark => "tab_mark",
494            Cmd::CarRet => "car_ret",
495            Cmd::MacParam => "mac_param",
496            Cmd::SupMark => "sup_mark",
497            Cmd::SubMark => "sub_mark",
498            Cmd::Endv => "endv",
499            Cmd::Spacer => "spacer",
500            Cmd::Letter => "letter",
501            Cmd::OtherChar => "other_char",
502            Cmd::ParEnd => "par_end",
503            Cmd::Stop => "stop",
504            Cmd::DelimNum => "delim_num",
505            Cmd::CharNum => "char_num",
506            Cmd::MathCharNum => "math_char_num",
507            Cmd::Mark => "mark",
508            Cmd::Node => "node",
509            Cmd::Xray => "xray",
510            Cmd::MakeBox => "make_box",
511            Cmd::Hmove => "hmove",
512            Cmd::Vmove => "vmove",
513            Cmd::UnHbox => "un_hbox",
514            Cmd::UnVbox => "un_vbox",
515            Cmd::RemoveItem => "remove_item",
516            Cmd::Hskip => "hskip",
517            Cmd::Vskip => "vskip",
518            Cmd::Mskip => "mskip",
519            Cmd::Kern => "kern",
520            Cmd::Mkern => "mkern",
521            Cmd::LeaderShip => "leader_ship",
522            Cmd::Halign => "halign",
523            Cmd::Valign => "valign",
524            Cmd::NoAlign => "no_align",
525            Cmd::Vrule => "vrule",
526            Cmd::Hrule => "hrule",
527            Cmd::Novrule => "novrule",
528            Cmd::Nohrule => "nohrule",
529            Cmd::Insert => "insert",
530            Cmd::Vadjust => "vadjust",
531            Cmd::IgnoreSpaces => "ignore_spaces",
532            Cmd::AfterAssignment => "after_assignment",
533            Cmd::AfterGroup => "after_group",
534            Cmd::PartokenName => "partoken_name",
535            Cmd::BreakPenalty => "break_penalty",
536            Cmd::StartPar => "start_par",
537            Cmd::ItalCorr => "ital_corr",
538            Cmd::Accent => "accent",
539            Cmd::MathAccent => "math_accent",
540            Cmd::Discretionary => "discretionary",
541            Cmd::EqNo => "eq_no",
542            Cmd::LeftRight => "left_right",
543            Cmd::MathComp => "math_comp",
544            Cmd::LimitSwitch => "limit_switch",
545            Cmd::Above => "above",
546            Cmd::MathStyle => "math_style",
547            Cmd::MathChoice => "math_choice",
548            Cmd::NonScript => "non_script",
549            Cmd::Vcenter => "vcenter",
550            Cmd::CaseShift => "case_shift",
551            Cmd::Message => "message",
552            Cmd::Normal => "normal",
553            Cmd::Extension => "extension",
554            Cmd::Option => "option",
555            Cmd::LuaFunctionCall => "lua_function_call",
556            Cmd::LuaBytecodeCall => "lua_bytecode_call",
557            Cmd::LuaCall => "lua_call",
558            Cmd::InStream => "in_stream",
559            Cmd::BeginGroup => "begin_group",
560            Cmd::EndGroup => "end_group",
561            Cmd::Omit => "omit",
562            Cmd::ExSpace => "ex_space",
563            Cmd::Boundary => "boundary",
564            Cmd::Radical => "radical",
565            Cmd::SuperSubScript => "super_sub_script",
566            Cmd::NoSuperSubScript => "no_super_sub_script",
567            Cmd::MathShiftCs => "math_shift_cs",
568            Cmd::EndCsName => "end_cs_name",
569            Cmd::CharGhost => "char_ghost",
570            Cmd::AssignLocalBox => "assign_local_box",
571            Cmd::CharGiven => "char_given",
572            Cmd::MathGiven => "math_given",
573            Cmd::XmathGiven => "xmath_given",
574            Cmd::LastItem => "last_item",
575            Cmd::ToksRegister => "toks_register",
576            Cmd::AssignToks => "assign_toks",
577            Cmd::AssignInt => "assign_int",
578            Cmd::AssignAttr => "assign_attr",
579            Cmd::AssignDimen => "assign_dimen",
580            Cmd::AssignGlue => "assign_glue",
581            Cmd::AssignMuGlue => "assign_mu_glue",
582            Cmd::AssignFontDimen => "assign_font_dimen",
583            Cmd::AssignFontInt => "assign_font_int",
584            Cmd::AssignHangIndent => "assign_hang_indent",
585            Cmd::SetAux => "set_aux",
586            Cmd::SetPrevGraf => "set_prev_graf",
587            Cmd::SetPageDimen => "set_page_dimen",
588            Cmd::SetPageInt => "set_page_int",
589            Cmd::SetBoxDimen => "set_box_dimen",
590            Cmd::SetTexShape => "set_tex_shape",
591            Cmd::SetEtexShape => "set_etex_shape",
592            Cmd::DefCharCode => "def_char_code",
593            Cmd::DefDelCode => "def_del_code",
594            Cmd::ExtdefMathCode => "extdef_math_code",
595            Cmd::ExtdefDelCode => "extdef_del_code",
596            Cmd::DefFamily => "def_family",
597            Cmd::SetMathParam => "set_math_param",
598            Cmd::SetFont => "set_font",
599            Cmd::DefFont => "def_font",
600            Cmd::Register => "register",
601            Cmd::AssignBoxDirection => "assign_box_direction",
602            Cmd::AssignBoxDir => "assign_box_dir",
603            Cmd::AssignDirection => "assign_direction",
604            Cmd::AssignDir => "assign_dir",
605            Cmd::Combinetoks => "combinetoks",
606            Cmd::Advance => "advance",
607            Cmd::Multiply => "multiply",
608            Cmd::Divide => "divide",
609            Cmd::Prefix => "prefix",
610            Cmd::Let => "let",
611            Cmd::ShorthandDef => "shorthand_def",
612            Cmd::DefLuaCall => "def_lua_call",
613            Cmd::ReadToCs => "read_to_cs",
614            Cmd::Def => "def",
615            Cmd::SetBox => "set_box",
616            Cmd::HyphData => "hyph_data",
617            Cmd::SetInteraction => "set_interaction",
618            Cmd::LetterspaceFont => "letterspace_font",
619            Cmd::ExpandFont => "expand_font",
620            Cmd::CopyFont => "copy_font",
621            Cmd::SetFontId => "set_font_id",
622            Cmd::UndefinedCs => "undefined_cs",
623            Cmd::ExpandAfter => "expand_after",
624            Cmd::NoExpand => "no_expand",
625            Cmd::Input => "input",
626            Cmd::LuaExpandableCall => "lua_expandable_call",
627            Cmd::LuaLocalCall => "lua_local_call",
628            Cmd::IfTest => "if_test",
629            Cmd::FiOrElse => "fi_or_else",
630            Cmd::CsName => "cs_name",
631            Cmd::Convert => "convert",
632            Cmd::Variable => "variable",
633            Cmd::Feedback => "feedback",
634            Cmd::The => "the",
635            Cmd::TopBotMark => "top_bot_mark",
636            Cmd::Call => "call",
637            Cmd::LongCall => "long_call",
638            Cmd::OuterCall => "outer_call",
639            Cmd::LongOuterCall => "long_outer_call",
640            Cmd::EndTemplate => "end_template",
641            Cmd::DontExpand => "dont_expand",
642            Cmd::GlueRef => "glue_ref",
643            Cmd::ShapeRef => "shape_ref",
644            Cmd::BoxRef => "box_ref",
645            Cmd::Data => "data",
646        }
647    }
648}