1#![allow(clippy::match_same_arms, clippy::too_many_lines)]
4#![allow(missing_docs)]
7
8use num_derive::FromPrimitive;
11
12#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
13pub enum Elixir {
14 End = 0,
15 TerminatorToken1 = 1,
16 SEMI = 2,
17 LPAREN = 3,
18 RPAREN = 4,
19 IdentifierToken1 = 5,
20 DOTDOTDOT = 6,
21 Alias = 7,
22 Integer = 8,
23 Float = 9,
24 Char = 10,
25 True = 11,
26 False = 12,
27 Nil2 = 13,
28 Atom = 14,
29 DQUOTE = 15,
30 SQUOTE = 16,
31 SQUOTESQUOTESQUOTE = 17,
32 DQUOTEDQUOTEDQUOTE = 18,
33 LBRACE = 19,
34 RBRACE = 20,
35 LBRACK = 21,
36 RBRACK = 22,
37 LT = 23,
38 GT = 24,
39 PIPE = 25,
40 SLASH = 26,
41 HASHLBRACE = 27,
42 EscapeSequence = 28,
43 TILDE = 29,
44 SigilName = 30,
45 SigilName2 = 31,
46 SigilModifiers = 32,
47 COMMA = 33,
48 Keyword = 34,
49 QuotedKeywordToken1 = 35,
50 LTLT = 36,
51 GTGT = 37,
52 PERCENT = 38,
53 DOTDOT = 39,
54 AMP = 40,
55 PLUS = 41,
56 DASH = 42,
57 BANG = 43,
58 CARET = 44,
59 TILDETILDETILDE = 45,
60 Not = 46,
61 AT = 47,
62 LTDASH = 48,
63 BSLASHBSLASH = 49,
64 When = 50,
65 COLONCOLON = 51,
66 EQGT = 52,
67 EQ = 53,
68 PIPEPIPE = 54,
69 PIPEPIPEPIPE = 55,
70 Or = 56,
71 AMPAMP = 57,
72 AMPAMPAMP = 58,
73 And = 59,
74 EQEQ = 60,
75 BANGEQ = 61,
76 EQTILDE = 62,
77 EQEQEQ = 63,
78 BANGEQEQ = 64,
79 LTEQ = 65,
80 GTEQ = 66,
81 PIPEGT = 67,
82 LTLTLT = 68,
83 GTGTGT = 69,
84 LTLTTILDE = 70,
85 TILDEGTGT = 71,
86 LTTILDE = 72,
87 TILDEGT = 73,
88 LTTILDEGT = 74,
89 LTPIPEGT = 75,
90 In = 76,
91 CARETCARETCARET = 77,
92 SLASHSLASH = 78,
93 PLUSPLUS = 79,
94 DASHDASH = 80,
95 PLUSPLUSPLUS = 81,
96 DASHDASHDASH = 82,
97 LTGT = 83,
98 STAR = 84,
99 STARSTAR = 85,
100 DASHGT = 86,
101 DOT = 87,
102 After = 88,
103 Catch = 89,
104 Do = 90,
105 Else = 91,
106 End2 = 92,
107 Fn = 93,
108 Rescue = 94,
109 LPAREN2 = 95,
110 LBRACK2 = 96,
111 Comment = 97,
112 QuotedContent = 98,
113 QuotedContent2 = 99,
114 QuotedContent3 = 100,
115 QuotedContent4 = 101,
116 QuotedContent5 = 102,
117 QuotedContent6 = 103,
118 QuotedContent7 = 104,
119 QuotedContent8 = 105,
120 QuotedContent9 = 106,
121 QuotedContent10 = 107,
122 QuotedContent11 = 108,
123 QuotedContent12 = 109,
124 QuotedContent13 = 110,
125 QuotedContent14 = 111,
126 QuotedContent15 = 112,
127 QuotedContent16 = 113,
128 QuotedContent17 = 114,
129 QuotedContent18 = 115,
130 QuotedContent19 = 116,
131 QuotedContent20 = 117,
132 NewlineBeforeDo = 118,
133 NewlineBeforeBinaryOperator = 119,
134 NewlineBeforeComment = 120,
135 BeforeUnaryOp = 121,
136 Notin = 122,
137 COLON = 123,
138 Source = 124,
139 Terminator = 125,
140 Expression = 126,
141 Block = 127,
142 Identifier = 128,
143 Boolean = 129,
144 Nil = 130,
145 Atom2 = 131,
146 QuotedAtom = 132,
147 QuotedIDouble = 133,
148 QuotedDouble = 134,
149 QuotedISingle = 135,
150 QuotedSingle = 136,
151 QuotedIHeredocSingle = 137,
152 QuotedHeredocSingle = 138,
153 QuotedIHeredocDouble = 139,
154 QuotedHeredocDouble = 140,
155 QuotedIParenthesis = 141,
156 QuotedParenthesis = 142,
157 QuotedICurly = 143,
158 QuotedCurly = 144,
159 QuotedISquare = 145,
160 QuotedSquare = 146,
161 QuotedIAngle = 147,
162 QuotedAngle = 148,
163 QuotedIBar = 149,
164 QuotedBar = 150,
165 QuotedISlash = 151,
166 QuotedSlash = 152,
167 String = 153,
168 Charlist = 154,
169 Interpolation = 155,
170 Sigil = 156,
171 Keywords = 157,
172 Keywords2 = 158,
173 Pair = 159,
174 Keyword2 = 160,
175 QuotedKeyword = 161,
176 List = 162,
177 Tuple = 163,
178 Bitstring = 164,
179 Map = 165,
180 Struct = 166,
181 ItemsWithTrailingSeparator = 167,
182 NullaryOperator = 168,
183 UnaryOperator = 169,
184 CaptureExpression = 170,
185 BinaryOperator = 171,
186 OperatorIdentifier = 172,
187 Dot = 173,
188 Call = 174,
189 CallWithoutParentheses = 175,
190 CallWithParentheses = 176,
191 LocalCallWithoutParentheses = 177,
192 LocalCallWithParentheses = 178,
193 LocalCallJustDoBlock = 179,
194 RemoteCallWithoutParentheses = 180,
195 RemoteCallWithParentheses = 181,
196 Dot2 = 182,
197 AnonymousCall = 183,
198 Dot3 = 184,
199 DoubleCall = 185,
200 Arguments = 186,
201 Arguments2 = 187,
202 CallArgumentsWithTrailingSeparator = 188,
203 Arguments3 = 189,
204 DoBlock = 190,
205 AfterBlock = 191,
206 RescueBlock = 192,
207 CatchBlock = 193,
208 ElseBlock = 194,
209 AccessCall = 195,
210 StabClause = 196,
211 StabClauseLeft = 197,
212 Arguments4 = 198,
213 Arguments5 = 199,
214 BinaryOperator2 = 200,
215 BinaryOperator3 = 201,
216 Body = 202,
217 AnonymousFunction = 203,
218 SourceRepeat1 = 204,
219 TerminatorRepeat1 = 205,
220 BlockRepeat1 = 206,
221 BlockRepeat2 = 207,
222 QuotedIDoubleRepeat1 = 208,
223 QuotedDoubleRepeat1 = 209,
224 QuotedISingleRepeat1 = 210,
225 QuotedSingleRepeat1 = 211,
226 QuotedIHeredocSingleRepeat1 = 212,
227 QuotedHeredocSingleRepeat1 = 213,
228 QuotedIHeredocDoubleRepeat1 = 214,
229 QuotedHeredocDoubleRepeat1 = 215,
230 QuotedIParenthesisRepeat1 = 216,
231 QuotedParenthesisRepeat1 = 217,
232 QuotedICurlyRepeat1 = 218,
233 QuotedCurlyRepeat1 = 219,
234 QuotedISquareRepeat1 = 220,
235 QuotedSquareRepeat1 = 221,
236 QuotedIAngleRepeat1 = 222,
237 QuotedAngleRepeat1 = 223,
238 QuotedIBarRepeat1 = 224,
239 QuotedBarRepeat1 = 225,
240 QuotedISlashRepeat1 = 226,
241 QuotedSlashRepeat1 = 227,
242 KeywordsRepeat1 = 228,
243 ItemsWithTrailingSeparatorRepeat1 = 229,
244 DoBlockRepeat1 = 230,
245 StabClauseArgumentsWithParenthesesRepeat1 = 231,
246 StabClauseArgumentsWithoutParenthesesRepeat1 = 232,
247 AnonymousFunctionRepeat1 = 233,
248 MapContent = 234,
249 Error = 235,
250}
251
252impl From<Elixir> for &'static str {
253 #[inline]
254 fn from(tok: Elixir) -> Self {
255 match tok {
256 Elixir::End => "end",
257 Elixir::TerminatorToken1 => "_terminator_token1",
258 Elixir::SEMI => ";",
259 Elixir::LPAREN => "(",
260 Elixir::RPAREN => ")",
261 Elixir::IdentifierToken1 => "identifier_token1",
262 Elixir::DOTDOTDOT => "...",
263 Elixir::Alias => "alias",
264 Elixir::Integer => "integer",
265 Elixir::Float => "float",
266 Elixir::Char => "char",
267 Elixir::True => "true",
268 Elixir::False => "false",
269 Elixir::Nil2 => "nil",
270 Elixir::Atom => "atom",
271 Elixir::DQUOTE => "\"",
272 Elixir::SQUOTE => "'",
273 Elixir::SQUOTESQUOTESQUOTE => "'''",
274 Elixir::DQUOTEDQUOTEDQUOTE => "\"\"\"",
275 Elixir::LBRACE => "{",
276 Elixir::RBRACE => "}",
277 Elixir::LBRACK => "[",
278 Elixir::RBRACK => "]",
279 Elixir::LT => "<",
280 Elixir::GT => ">",
281 Elixir::PIPE => "|",
282 Elixir::SLASH => "/",
283 Elixir::HASHLBRACE => "#{",
284 Elixir::EscapeSequence => "escape_sequence",
285 Elixir::TILDE => "~",
286 Elixir::SigilName => "sigil_name",
287 Elixir::SigilName2 => "sigil_name",
288 Elixir::SigilModifiers => "sigil_modifiers",
289 Elixir::COMMA => ",",
290 Elixir::Keyword => "keyword",
291 Elixir::QuotedKeywordToken1 => "quoted_keyword_token1",
292 Elixir::LTLT => "<<",
293 Elixir::GTGT => ">>",
294 Elixir::PERCENT => "%",
295 Elixir::DOTDOT => "..",
296 Elixir::AMP => "&",
297 Elixir::PLUS => "+",
298 Elixir::DASH => "-",
299 Elixir::BANG => "!",
300 Elixir::CARET => "^",
301 Elixir::TILDETILDETILDE => "~~~",
302 Elixir::Not => "not",
303 Elixir::AT => "@",
304 Elixir::LTDASH => "<-",
305 Elixir::BSLASHBSLASH => "\\\\",
306 Elixir::When => "when",
307 Elixir::COLONCOLON => "::",
308 Elixir::EQGT => "=>",
309 Elixir::EQ => "=",
310 Elixir::PIPEPIPE => "||",
311 Elixir::PIPEPIPEPIPE => "|||",
312 Elixir::Or => "or",
313 Elixir::AMPAMP => "&&",
314 Elixir::AMPAMPAMP => "&&&",
315 Elixir::And => "and",
316 Elixir::EQEQ => "==",
317 Elixir::BANGEQ => "!=",
318 Elixir::EQTILDE => "=~",
319 Elixir::EQEQEQ => "===",
320 Elixir::BANGEQEQ => "!==",
321 Elixir::LTEQ => "<=",
322 Elixir::GTEQ => ">=",
323 Elixir::PIPEGT => "|>",
324 Elixir::LTLTLT => "<<<",
325 Elixir::GTGTGT => ">>>",
326 Elixir::LTLTTILDE => "<<~",
327 Elixir::TILDEGTGT => "~>>",
328 Elixir::LTTILDE => "<~",
329 Elixir::TILDEGT => "~>",
330 Elixir::LTTILDEGT => "<~>",
331 Elixir::LTPIPEGT => "<|>",
332 Elixir::In => "in",
333 Elixir::CARETCARETCARET => "^^^",
334 Elixir::SLASHSLASH => "//",
335 Elixir::PLUSPLUS => "++",
336 Elixir::DASHDASH => "--",
337 Elixir::PLUSPLUSPLUS => "+++",
338 Elixir::DASHDASHDASH => "---",
339 Elixir::LTGT => "<>",
340 Elixir::STAR => "*",
341 Elixir::STARSTAR => "**",
342 Elixir::DASHGT => "->",
343 Elixir::DOT => ".",
344 Elixir::After => "after",
345 Elixir::Catch => "catch",
346 Elixir::Do => "do",
347 Elixir::Else => "else",
348 Elixir::End2 => "end",
349 Elixir::Fn => "fn",
350 Elixir::Rescue => "rescue",
351 Elixir::LPAREN2 => "(",
352 Elixir::LBRACK2 => "[",
353 Elixir::Comment => "comment",
354 Elixir::QuotedContent => "quoted_content",
355 Elixir::QuotedContent2 => "quoted_content",
356 Elixir::QuotedContent3 => "quoted_content",
357 Elixir::QuotedContent4 => "quoted_content",
358 Elixir::QuotedContent5 => "quoted_content",
359 Elixir::QuotedContent6 => "quoted_content",
360 Elixir::QuotedContent7 => "quoted_content",
361 Elixir::QuotedContent8 => "quoted_content",
362 Elixir::QuotedContent9 => "quoted_content",
363 Elixir::QuotedContent10 => "quoted_content",
364 Elixir::QuotedContent11 => "quoted_content",
365 Elixir::QuotedContent12 => "quoted_content",
366 Elixir::QuotedContent13 => "quoted_content",
367 Elixir::QuotedContent14 => "quoted_content",
368 Elixir::QuotedContent15 => "quoted_content",
369 Elixir::QuotedContent16 => "quoted_content",
370 Elixir::QuotedContent17 => "quoted_content",
371 Elixir::QuotedContent18 => "quoted_content",
372 Elixir::QuotedContent19 => "quoted_content",
373 Elixir::QuotedContent20 => "quoted_content",
374 Elixir::NewlineBeforeDo => "_newline_before_do",
375 Elixir::NewlineBeforeBinaryOperator => "_newline_before_binary_operator",
376 Elixir::NewlineBeforeComment => "_newline_before_comment",
377 Elixir::BeforeUnaryOp => "_before_unary_op",
378 Elixir::Notin => "not in",
379 Elixir::COLON => ":",
380 Elixir::Source => "source",
381 Elixir::Terminator => "_terminator",
382 Elixir::Expression => "_expression",
383 Elixir::Block => "block",
384 Elixir::Identifier => "identifier",
385 Elixir::Boolean => "boolean",
386 Elixir::Nil => "nil",
387 Elixir::Atom2 => "_atom",
388 Elixir::QuotedAtom => "quoted_atom",
389 Elixir::QuotedIDouble => "_quoted_i_double",
390 Elixir::QuotedDouble => "_quoted_double",
391 Elixir::QuotedISingle => "_quoted_i_single",
392 Elixir::QuotedSingle => "_quoted_single",
393 Elixir::QuotedIHeredocSingle => "_quoted_i_heredoc_single",
394 Elixir::QuotedHeredocSingle => "_quoted_heredoc_single",
395 Elixir::QuotedIHeredocDouble => "_quoted_i_heredoc_double",
396 Elixir::QuotedHeredocDouble => "_quoted_heredoc_double",
397 Elixir::QuotedIParenthesis => "_quoted_i_parenthesis",
398 Elixir::QuotedParenthesis => "_quoted_parenthesis",
399 Elixir::QuotedICurly => "_quoted_i_curly",
400 Elixir::QuotedCurly => "_quoted_curly",
401 Elixir::QuotedISquare => "_quoted_i_square",
402 Elixir::QuotedSquare => "_quoted_square",
403 Elixir::QuotedIAngle => "_quoted_i_angle",
404 Elixir::QuotedAngle => "_quoted_angle",
405 Elixir::QuotedIBar => "_quoted_i_bar",
406 Elixir::QuotedBar => "_quoted_bar",
407 Elixir::QuotedISlash => "_quoted_i_slash",
408 Elixir::QuotedSlash => "_quoted_slash",
409 Elixir::String => "string",
410 Elixir::Charlist => "charlist",
411 Elixir::Interpolation => "interpolation",
412 Elixir::Sigil => "sigil",
413 Elixir::Keywords => "keywords",
414 Elixir::Keywords2 => "keywords",
415 Elixir::Pair => "pair",
416 Elixir::Keyword2 => "_keyword",
417 Elixir::QuotedKeyword => "quoted_keyword",
418 Elixir::List => "list",
419 Elixir::Tuple => "tuple",
420 Elixir::Bitstring => "bitstring",
421 Elixir::Map => "map",
422 Elixir::Struct => "struct",
423 Elixir::ItemsWithTrailingSeparator => "_items_with_trailing_separator",
424 Elixir::NullaryOperator => "_nullary_operator",
425 Elixir::UnaryOperator => "unary_operator",
426 Elixir::CaptureExpression => "_capture_expression",
427 Elixir::BinaryOperator => "binary_operator",
428 Elixir::OperatorIdentifier => "operator_identifier",
429 Elixir::Dot => "dot",
430 Elixir::Call => "call",
431 Elixir::CallWithoutParentheses => "_call_without_parentheses",
432 Elixir::CallWithParentheses => "_call_with_parentheses",
433 Elixir::LocalCallWithoutParentheses => "_local_call_without_parentheses",
434 Elixir::LocalCallWithParentheses => "_local_call_with_parentheses",
435 Elixir::LocalCallJustDoBlock => "_local_call_just_do_block",
436 Elixir::RemoteCallWithoutParentheses => "_remote_call_without_parentheses",
437 Elixir::RemoteCallWithParentheses => "_remote_call_with_parentheses",
438 Elixir::Dot2 => "dot",
439 Elixir::AnonymousCall => "_anonymous_call",
440 Elixir::Dot3 => "dot",
441 Elixir::DoubleCall => "_double_call",
442 Elixir::Arguments => "arguments",
443 Elixir::Arguments2 => "arguments",
444 Elixir::CallArgumentsWithTrailingSeparator => "_call_arguments_with_trailing_separator",
445 Elixir::Arguments3 => "arguments",
446 Elixir::DoBlock => "do_block",
447 Elixir::AfterBlock => "after_block",
448 Elixir::RescueBlock => "rescue_block",
449 Elixir::CatchBlock => "catch_block",
450 Elixir::ElseBlock => "else_block",
451 Elixir::AccessCall => "access_call",
452 Elixir::StabClause => "stab_clause",
453 Elixir::StabClauseLeft => "_stab_clause_left",
454 Elixir::Arguments4 => "arguments",
455 Elixir::Arguments5 => "arguments",
456 Elixir::BinaryOperator2 => "binary_operator",
457 Elixir::BinaryOperator3 => "binary_operator",
458 Elixir::Body => "body",
459 Elixir::AnonymousFunction => "anonymous_function",
460 Elixir::SourceRepeat1 => "source_repeat1",
461 Elixir::TerminatorRepeat1 => "_terminator_repeat1",
462 Elixir::BlockRepeat1 => "block_repeat1",
463 Elixir::BlockRepeat2 => "block_repeat2",
464 Elixir::QuotedIDoubleRepeat1 => "_quoted_i_double_repeat1",
465 Elixir::QuotedDoubleRepeat1 => "_quoted_double_repeat1",
466 Elixir::QuotedISingleRepeat1 => "_quoted_i_single_repeat1",
467 Elixir::QuotedSingleRepeat1 => "_quoted_single_repeat1",
468 Elixir::QuotedIHeredocSingleRepeat1 => "_quoted_i_heredoc_single_repeat1",
469 Elixir::QuotedHeredocSingleRepeat1 => "_quoted_heredoc_single_repeat1",
470 Elixir::QuotedIHeredocDoubleRepeat1 => "_quoted_i_heredoc_double_repeat1",
471 Elixir::QuotedHeredocDoubleRepeat1 => "_quoted_heredoc_double_repeat1",
472 Elixir::QuotedIParenthesisRepeat1 => "_quoted_i_parenthesis_repeat1",
473 Elixir::QuotedParenthesisRepeat1 => "_quoted_parenthesis_repeat1",
474 Elixir::QuotedICurlyRepeat1 => "_quoted_i_curly_repeat1",
475 Elixir::QuotedCurlyRepeat1 => "_quoted_curly_repeat1",
476 Elixir::QuotedISquareRepeat1 => "_quoted_i_square_repeat1",
477 Elixir::QuotedSquareRepeat1 => "_quoted_square_repeat1",
478 Elixir::QuotedIAngleRepeat1 => "_quoted_i_angle_repeat1",
479 Elixir::QuotedAngleRepeat1 => "_quoted_angle_repeat1",
480 Elixir::QuotedIBarRepeat1 => "_quoted_i_bar_repeat1",
481 Elixir::QuotedBarRepeat1 => "_quoted_bar_repeat1",
482 Elixir::QuotedISlashRepeat1 => "_quoted_i_slash_repeat1",
483 Elixir::QuotedSlashRepeat1 => "_quoted_slash_repeat1",
484 Elixir::KeywordsRepeat1 => "keywords_repeat1",
485 Elixir::ItemsWithTrailingSeparatorRepeat1 => "_items_with_trailing_separator_repeat1",
486 Elixir::DoBlockRepeat1 => "do_block_repeat1",
487 Elixir::StabClauseArgumentsWithParenthesesRepeat1 => {
488 "_stab_clause_arguments_with_parentheses_repeat1"
489 }
490 Elixir::StabClauseArgumentsWithoutParenthesesRepeat1 => {
491 "_stab_clause_arguments_without_parentheses_repeat1"
492 }
493 Elixir::AnonymousFunctionRepeat1 => "anonymous_function_repeat1",
494 Elixir::MapContent => "map_content",
495 Elixir::Error => "ERROR",
496 }
497 }
498}
499
500impl From<u16> for Elixir {
501 #[inline]
502 fn from(x: u16) -> Self {
503 num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
504 }
505}
506
507impl PartialEq<u16> for Elixir {
509 #[inline]
510 fn eq(&self, x: &u16) -> bool {
511 *self == Into::<Self>::into(*x)
512 }
513}
514
515impl PartialEq<Elixir> for u16 {
517 #[inline]
518 fn eq(&self, x: &Elixir) -> bool {
519 *x == *self
520 }
521}