Skip to main content

big_code_analysis_ast/languages/
language_irules.rs

1// See `src/languages/mod.rs` for the rationale behind the per-file
2// pedantic carve-outs below.
3#![allow(clippy::match_same_arms, clippy::too_many_lines)]
4// One variant per grammar kind id, named after the rule; the name is
5// the documentation and there is nothing per-variant to add.
6#![allow(missing_docs)]
7
8// Code generated; DO NOT EDIT.
9
10use num_derive::FromPrimitive;
11
12#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
13pub enum Irules {
14    End = 0,
15    SimpleWord = 1,
16    LF = 2,
17    SEMI = 3,
18    Comment = 4,
19    When = 5,
20    EventName = 6,
21    Priority = 7,
22    Timing = 8,
23    On = 9,
24    Off = 10,
25    Dict = 11,
26    For2 = 12,
27    Update = 13,
28    With = 14,
29    Regexp2 = 15,
30    DASHabout = 16,
31    DASHexpanded = 17,
32    DASHindices = 18,
33    DASHline = 19,
34    DASHlinestop = 20,
35    DASHlineanchor = 21,
36    DASHnocase = 22,
37    DASHall = 23,
38    DASHinline = 24,
39    DASHstart = 25,
40    DASHDASH = 26,
41    Switch2 = 27,
42    DASHexact = 28,
43    DASHglob = 29,
44    DASHregexp = 30,
45    DASHmatchvar = 31,
46    DASHindexvar = 32,
47    LBRACE = 33,
48    RBRACE = 34,
49    While2 = 35,
50    Expr2 = 36,
51    Foreach2 = 37,
52    Global2 = 38,
53    Namespace2 = 39,
54    Try2 = 40,
55    Trap = 41,
56    Finally2 = 42,
57    Unpack = 43,
58    COLONCOLON = 44,
59    IdentImm = 45,
60    LPAREN = 46,
61    RPAREN = 47,
62    DOLLAR = 48,
63    Id = 49,
64    Set2 = 50,
65    Proc = 51,
66    Number = 52,
67    Boolean = 53,
68    LPAREN2 = 54,
69    DASH = 55,
70    PLUS = 56,
71    TILDE = 57,
72    BANG = 58,
73    Not = 59,
74    STARSTAR = 60,
75    SLASH = 61,
76    STAR = 62,
77    PERCENT = 63,
78    LTLT = 64,
79    GTGT = 65,
80    GT = 66,
81    LT = 67,
82    GTEQ = 68,
83    LTEQ = 69,
84    EQEQ = 70,
85    BANGEQ = 71,
86    Eq = 72,
87    Ne = 73,
88    StartsWith = 74,
89    EndsWith = 75,
90    Contains = 76,
91    Equals = 77,
92    Matches = 78,
93    MatchesRegex = 79,
94    MatchesGlob = 80,
95    In = 81,
96    Ni = 82,
97    AMP = 83,
98    CARET = 84,
99    PIPE = 85,
100    AMPAMP = 86,
101    And = 87,
102    PIPEPIPE = 88,
103    Or = 89,
104    QMARK = 90,
105    COLON = 91,
106    Elseif2 = 92,
107    Else2 = 93,
108    If2 = 94,
109    Catch2 = 95,
110    DQUOTE = 96,
111    EscapedCharacter = 97,
112    QuotedWordContent = 98,
113    LBRACK = 99,
114    RBRACK = 100,
115    Concat = 101,
116    Immediate = 102,
117    SourceFile = 103,
118    WhenEvent = 104,
119    EventModifier = 105,
120    DictFor = 106,
121    DictUpdate = 107,
122    DictWith = 108,
123    Regexp = 109,
124    Switch = 110,
125    SwitchArm = 111,
126    For = 112,
127    While = 113,
128    ExprCmd = 114,
129    Foreach = 115,
130    Global = 116,
131    Namespace = 117,
132    Try = 118,
133    OnHandler = 119,
134    TrapHandler = 120,
135    Finally = 121,
136    Command2 = 122,
137    Command = 123,
138    WordList = 124,
139    WordSimple = 125,
140    ConcatWord = 126,
141    NsDelim = 127,
142    Id2 = 128,
143    ArrayIndex = 129,
144    VariableSubstitution = 130,
145    BracedId = 131,
146    BracedWord = 132,
147    BracedWordSimple = 133,
148    Set = 134,
149    Procedure = 135,
150    ArgumentWord = 136,
151    Argument = 137,
152    Arguments = 138,
153    ExprAtomNoBrace = 139,
154    Expr3 = 140,
155    Expr = 141,
156    UnaryExpr = 142,
157    BinopExpr = 143,
158    TernaryExpr = 144,
159    Elseif = 145,
160    Else = 146,
161    If = 147,
162    Conditional = 148,
163    Catch = 149,
164    QuotedWord = 150,
165    CommandSubstitution = 151,
166    SourceFileRepeat1 = 152,
167    WhenEventRepeat1 = 153,
168    DictUpdateRepeat1 = 154,
169    RegexpRepeat1 = 155,
170    RegexpRepeat2 = 156,
171    SwitchRepeat1 = 157,
172    SwitchRepeat2 = 158,
173    SwitchRepeat3 = 159,
174    TryRepeat1 = 160,
175    WordListRepeat1 = 161,
176    WordSimpleRepeat1 = 162,
177    ConcatWordRepeat1 = 163,
178    IdImmediateRepeat1 = 164,
179    BracedWordRepeat1 = 165,
180    BracedWordRepeat2 = 166,
181    ArgumentsRepeat1 = 167,
182    IfRepeat1 = 168,
183    QuotedWordRepeat1 = 169,
184    Error = 170,
185}
186
187impl From<Irules> for &'static str {
188    #[inline]
189    fn from(tok: Irules) -> Self {
190        match tok {
191            Irules::End => "end",
192            Irules::SimpleWord => "simple_word",
193            Irules::LF => "\n",
194            Irules::SEMI => ";",
195            Irules::Comment => "comment",
196            Irules::When => "when",
197            Irules::EventName => "event_name",
198            Irules::Priority => "priority",
199            Irules::Timing => "timing",
200            Irules::On => "on",
201            Irules::Off => "off",
202            Irules::Dict => "dict",
203            Irules::For2 => "for",
204            Irules::Update => "update",
205            Irules::With => "with",
206            Irules::Regexp2 => "regexp",
207            Irules::DASHabout => "-about",
208            Irules::DASHexpanded => "-expanded",
209            Irules::DASHindices => "-indices",
210            Irules::DASHline => "-line",
211            Irules::DASHlinestop => "-linestop",
212            Irules::DASHlineanchor => "-lineanchor",
213            Irules::DASHnocase => "-nocase",
214            Irules::DASHall => "-all",
215            Irules::DASHinline => "-inline",
216            Irules::DASHstart => "-start",
217            Irules::DASHDASH => "--",
218            Irules::Switch2 => "switch",
219            Irules::DASHexact => "-exact",
220            Irules::DASHglob => "-glob",
221            Irules::DASHregexp => "-regexp",
222            Irules::DASHmatchvar => "-matchvar",
223            Irules::DASHindexvar => "-indexvar",
224            Irules::LBRACE => "{",
225            Irules::RBRACE => "}",
226            Irules::While2 => "while",
227            Irules::Expr2 => "expr",
228            Irules::Foreach2 => "foreach",
229            Irules::Global2 => "global",
230            Irules::Namespace2 => "namespace",
231            Irules::Try2 => "try",
232            Irules::Trap => "trap",
233            Irules::Finally2 => "finally",
234            Irules::Unpack => "unpack",
235            Irules::COLONCOLON => "::",
236            Irules::IdentImm => "_ident_imm",
237            Irules::LPAREN => "(",
238            Irules::RPAREN => ")",
239            Irules::DOLLAR => "$",
240            Irules::Id => "id",
241            Irules::Set2 => "set",
242            Irules::Proc => "proc",
243            Irules::Number => "number",
244            Irules::Boolean => "_boolean",
245            Irules::LPAREN2 => "(",
246            Irules::DASH => "-",
247            Irules::PLUS => "+",
248            Irules::TILDE => "~",
249            Irules::BANG => "!",
250            Irules::Not => "not",
251            Irules::STARSTAR => "**",
252            Irules::SLASH => "/",
253            Irules::STAR => "*",
254            Irules::PERCENT => "%",
255            Irules::LTLT => "<<",
256            Irules::GTGT => ">>",
257            Irules::GT => ">",
258            Irules::LT => "<",
259            Irules::GTEQ => ">=",
260            Irules::LTEQ => "<=",
261            Irules::EQEQ => "==",
262            Irules::BANGEQ => "!=",
263            Irules::Eq => "eq",
264            Irules::Ne => "ne",
265            Irules::StartsWith => "starts_with",
266            Irules::EndsWith => "ends_with",
267            Irules::Contains => "contains",
268            Irules::Equals => "equals",
269            Irules::Matches => "matches",
270            Irules::MatchesRegex => "matches_regex",
271            Irules::MatchesGlob => "matches_glob",
272            Irules::In => "in",
273            Irules::Ni => "ni",
274            Irules::AMP => "&",
275            Irules::CARET => "^",
276            Irules::PIPE => "|",
277            Irules::AMPAMP => "&&",
278            Irules::And => "and",
279            Irules::PIPEPIPE => "||",
280            Irules::Or => "or",
281            Irules::QMARK => "?",
282            Irules::COLON => ":",
283            Irules::Elseif2 => "elseif",
284            Irules::Else2 => "else",
285            Irules::If2 => "if",
286            Irules::Catch2 => "catch",
287            Irules::DQUOTE => "\"",
288            Irules::EscapedCharacter => "escaped_character",
289            Irules::QuotedWordContent => "_quoted_word_content",
290            Irules::LBRACK => "[",
291            Irules::RBRACK => "]",
292            Irules::Concat => "_concat",
293            Irules::Immediate => "_immediate",
294            Irules::SourceFile => "source_file",
295            Irules::WhenEvent => "when_event",
296            Irules::EventModifier => "event_modifier",
297            Irules::DictFor => "dict_for",
298            Irules::DictUpdate => "dict_update",
299            Irules::DictWith => "dict_with",
300            Irules::Regexp => "regexp",
301            Irules::Switch => "switch",
302            Irules::SwitchArm => "switch_arm",
303            Irules::For => "for",
304            Irules::While => "while",
305            Irules::ExprCmd => "expr_cmd",
306            Irules::Foreach => "foreach",
307            Irules::Global => "global",
308            Irules::Namespace => "namespace",
309            Irules::Try => "try",
310            Irules::OnHandler => "on_handler",
311            Irules::TrapHandler => "trap_handler",
312            Irules::Finally => "finally",
313            Irules::Command2 => "_command",
314            Irules::Command => "command",
315            Irules::WordList => "word_list",
316            Irules::WordSimple => "_word_simple",
317            Irules::ConcatWord => "_concat_word",
318            Irules::NsDelim => "_ns_delim",
319            Irules::Id2 => "id",
320            Irules::ArrayIndex => "array_index",
321            Irules::VariableSubstitution => "variable_substitution",
322            Irules::BracedId => "_braced_id",
323            Irules::BracedWord => "braced_word",
324            Irules::BracedWordSimple => "braced_word_simple",
325            Irules::Set => "set",
326            Irules::Procedure => "procedure",
327            Irules::ArgumentWord => "_argument_word",
328            Irules::Argument => "argument",
329            Irules::Arguments => "arguments",
330            Irules::ExprAtomNoBrace => "_expr_atom_no_brace",
331            Irules::Expr3 => "_expr",
332            Irules::Expr => "expr",
333            Irules::UnaryExpr => "unary_expr",
334            Irules::BinopExpr => "binop_expr",
335            Irules::TernaryExpr => "ternary_expr",
336            Irules::Elseif => "elseif",
337            Irules::Else => "else",
338            Irules::If => "if",
339            Irules::Conditional => "_conditional",
340            Irules::Catch => "catch",
341            Irules::QuotedWord => "quoted_word",
342            Irules::CommandSubstitution => "command_substitution",
343            Irules::SourceFileRepeat1 => "source_file_repeat1",
344            Irules::WhenEventRepeat1 => "when_event_repeat1",
345            Irules::DictUpdateRepeat1 => "dict_update_repeat1",
346            Irules::RegexpRepeat1 => "regexp_repeat1",
347            Irules::RegexpRepeat2 => "regexp_repeat2",
348            Irules::SwitchRepeat1 => "switch_repeat1",
349            Irules::SwitchRepeat2 => "switch_repeat2",
350            Irules::SwitchRepeat3 => "switch_repeat3",
351            Irules::TryRepeat1 => "try_repeat1",
352            Irules::WordListRepeat1 => "word_list_repeat1",
353            Irules::WordSimpleRepeat1 => "_word_simple_repeat1",
354            Irules::ConcatWordRepeat1 => "_concat_word_repeat1",
355            Irules::IdImmediateRepeat1 => "_id_immediate_repeat1",
356            Irules::BracedWordRepeat1 => "braced_word_repeat1",
357            Irules::BracedWordRepeat2 => "braced_word_repeat2",
358            Irules::ArgumentsRepeat1 => "arguments_repeat1",
359            Irules::IfRepeat1 => "if_repeat1",
360            Irules::QuotedWordRepeat1 => "quoted_word_repeat1",
361            Irules::Error => "ERROR",
362        }
363    }
364}
365
366impl From<u16> for Irules {
367    #[inline]
368    fn from(x: u16) -> Self {
369        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
370    }
371}
372
373// Irules == u16
374impl PartialEq<u16> for Irules {
375    #[inline]
376    fn eq(&self, x: &u16) -> bool {
377        *self == Into::<Self>::into(*x)
378    }
379}
380
381// u16 == Irules
382impl PartialEq<Irules> for u16 {
383    #[inline]
384    fn eq(&self, x: &Irules) -> bool {
385        *x == *self
386    }
387}