1#[allow(dead_code)]
4#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub enum NonTerminalKind {
6 Array,
7 ArrayBegin,
8 ArrayElements,
9 ArrayElementsOpt,
10 ArrayElementsTail,
11 ArrayElementsTailOpt,
12 ArrayEnd,
13 ArrayMarker,
14 ArrayMarkerOpt,
15 ArrayOpt,
16 At,
17 Backtick2,
18 Backtick3,
19 Backtick4,
20 Backtick5,
21 BacktickDelim,
22 Begin,
23 Bind,
24 Binding,
25 BindingRhs,
26 BlockBody,
27 Boolean,
28 CodeBlock,
29 CodeBlock3,
30 CodeBlock3List,
31 CodeBlock3ListGroup,
32 CodeBlock4,
33 CodeBlock4List,
34 CodeBlock4ListGroup,
35 CodeBlock5,
36 CodeBlock5List,
37 CodeBlock5ListGroup,
38 CodeBlock6,
39 CodeBlock6List,
40 CodeBlock6ListGroup,
41 CodeBlockEnd3,
42 CodeBlockEnd4,
43 CodeBlockEnd5,
44 CodeBlockEnd6,
45 CodeBlockStart3,
46 CodeBlockStart4,
47 CodeBlockStart5,
48 CodeBlockStart6,
49 Comma,
50 Continue,
51 DelimCode,
52 DelimCode1,
53 DelimCode1List,
54 DelimCode1ListGroup,
55 DelimCode2,
56 DelimCode2List,
57 DelimCode2ListGroup,
58 DelimCode3,
59 DelimCode3List,
60 DelimCode3ListGroup,
61 DelimCodeEnd1,
62 DelimCodeEnd2,
63 DelimCodeEnd3,
64 DelimCodeStart1,
65 DelimCodeStart2,
66 DelimCodeStart3,
67 Dot,
68 DotKey,
69 End,
70 Eure,
71 EureList,
72 EureList0,
73 EureOpt,
74 Ext,
75 ExtensionNameSpace,
76 False,
77 FirstKey,
78 FlatBody,
79 FlatBodyList,
80 FlatRootBinding,
81 Float,
82 GrammarNewline,
83 Hole,
84 Ident,
85 Inf,
86 InlineCode,
87 InlineCode1,
88 Integer,
89 Key,
90 KeyIdent,
91 KeyTail,
92 KeyTuple,
93 KeyTupleElements,
94 KeyTupleElementsOpt,
95 KeyTupleElementsTail,
96 KeyTupleElementsTailOpt,
97 KeyTupleOpt,
98 KeyValue,
99 Keys,
100 KeysList,
101 LParen,
102 LitStr,
103 LitStr1,
104 LitStr1End,
105 LitStr1List,
106 LitStr1ListGroup,
107 LitStr1Start,
108 LitStr2,
109 LitStr2End,
110 LitStr2List,
111 LitStr2ListGroup,
112 LitStr2Start,
113 LitStr3,
114 LitStr3End,
115 LitStr3List,
116 LitStr3ListGroup,
117 LitStr3Start,
118 MapBind,
119 NaN,
120 NewlineBind,
121 NewlineHead,
122 NewlineHeadOpt,
123 NewlineTextStart,
124 NoBacktick,
125 NoSQuote,
126 Null,
127 Number,
128 Object,
129 ObjectList,
130 ObjectOpt,
131 ObjectOpt0,
132 ObjectOpt1,
133 RParen,
134 RootBinding,
135 RootTextBinding,
136 RootTextBindingOpt,
137 RootTextBindingOpt0,
138 RootTextBindingOpt1,
139 RootValueBinding,
140 SQuote,
141 Section,
142 SectionBinding,
143 SectionBody,
144 SectionBodyOpt,
145 SectionHead,
146 Str,
147 String,
148 Strings,
149 StringsList,
150 Text,
151 TextBinding,
152 TextBindingOpt,
153 TextBindingOpt0,
154 TextBindingOpt1,
155 TextStart,
156 TopLevelBinding,
157 True,
158 Tuple,
159 TupleElements,
160 TupleElementsOpt,
161 TupleElementsTail,
162 TupleElementsTailOpt,
163 TupleIndex,
164 TupleOpt,
165 Value,
166 ValueBinding,
167 Ws,
168 Root,
169}
170#[allow(dead_code)]
171#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
172pub enum TerminalKind {
173 NewLine,
174 Whitespace,
175 LineComment,
176 BlockComment,
177 Hash,
178 MapBind,
179 Integer,
180 Float,
181 Inf,
182 NaN,
183 True,
184 False,
185 Null,
186 Hole,
187 Str,
188 LitStr,
189 Text,
190 InlineCode1,
191 LitStr3Start,
192 LitStr2Start,
193 LitStr1Start,
194 DelimCodeStart3,
195 DelimCodeStart2,
196 DelimCodeStart1,
197 CodeBlockStart3,
198 CodeBlockStart4,
199 CodeBlockStart5,
200 CodeBlockStart6,
201 CodeBlockEnd3,
202 Backtick2,
203 CodeBlockEnd4,
204 Backtick3,
205 CodeBlockEnd5,
206 Backtick4,
207 CodeBlockEnd6,
208 Backtick5,
209 NoBacktick,
210 LitStr3End,
211 LitStr2End,
212 LitStr1End,
213 SQuote,
214 NoSQuote,
215 DelimCodeEnd3,
216 DelimCodeEnd2,
217 DelimCodeEnd1,
218 BacktickDelim,
219 GrammarNewline,
220 Ws,
221 At,
222 Dollar,
223 Dot,
224 LBrace,
225 RBrace,
226 LBracket,
227 RBracket,
228 LParen,
229 RParen,
230 NewlineBind,
231 Bind,
232 Comma,
233 Esc,
234 NewlineTextStart,
235 TextStart,
236 Ident,
237}
238#[allow(dead_code)]
239impl TerminalKind {
240 pub fn from_terminal_index(index: u16) -> Self {
241 match index {
242 1 => Self::NewLine,
243 2 => Self::Whitespace,
244 3 => Self::LineComment,
245 4 => Self::BlockComment,
246 5 => Self::Hash,
247 6 => Self::MapBind,
248 7 => Self::Integer,
249 8 => Self::Float,
250 9 => Self::Inf,
251 10 => Self::NaN,
252 11 => Self::True,
253 12 => Self::False,
254 13 => Self::Null,
255 14 => Self::Hole,
256 15 => Self::Str,
257 16 => Self::LitStr,
258 17 => Self::Text,
259 18 => Self::InlineCode1,
260 19 => Self::LitStr3Start,
261 20 => Self::LitStr2Start,
262 21 => Self::LitStr1Start,
263 22 => Self::DelimCodeStart3,
264 23 => Self::DelimCodeStart2,
265 24 => Self::DelimCodeStart1,
266 25 => Self::CodeBlockStart3,
267 26 => Self::CodeBlockStart4,
268 27 => Self::CodeBlockStart5,
269 28 => Self::CodeBlockStart6,
270 29 => Self::CodeBlockEnd3,
271 30 => Self::Backtick2,
272 31 => Self::CodeBlockEnd4,
273 32 => Self::Backtick3,
274 33 => Self::CodeBlockEnd5,
275 34 => Self::Backtick4,
276 35 => Self::CodeBlockEnd6,
277 36 => Self::Backtick5,
278 37 => Self::NoBacktick,
279 38 => Self::LitStr3End,
280 39 => Self::LitStr2End,
281 40 => Self::LitStr1End,
282 41 => Self::SQuote,
283 42 => Self::NoSQuote,
284 43 => Self::DelimCodeEnd3,
285 44 => Self::DelimCodeEnd2,
286 45 => Self::DelimCodeEnd1,
287 46 => Self::BacktickDelim,
288 47 => Self::GrammarNewline,
289 48 => Self::Ws,
290 49 => Self::At,
291 50 => Self::Dollar,
292 51 => Self::Dot,
293 52 => Self::LBrace,
294 53 => Self::RBrace,
295 54 => Self::LBracket,
296 55 => Self::RBracket,
297 56 => Self::LParen,
298 57 => Self::RParen,
299 58 => Self::NewlineBind,
300 59 => Self::Bind,
301 60 => Self::Comma,
302 61 => Self::Esc,
303 62 => Self::NewlineTextStart,
304 63 => Self::TextStart,
305 64 => Self::Ident,
306 _ => panic!("Invalid terminal index: {}", index),
307 }
308 }
309 pub fn is_builtin_terminal(&self) -> bool {
310 matches!(
311 self,
312 TerminalKind::NewLine
313 | TerminalKind::Whitespace
314 | TerminalKind::LineComment
315 | TerminalKind::BlockComment
316 )
317 }
318 pub fn is_builtin_new_line(&self) -> bool {
319 matches!(self, TerminalKind::NewLine)
320 }
321 pub fn is_builtin_whitespace(&self) -> bool {
322 matches!(self, TerminalKind::Whitespace)
323 }
324 pub fn is_builtin_line_comment(&self) -> bool {
325 matches!(self, TerminalKind::LineComment)
326 }
327 pub fn is_builtin_block_comment(&self) -> bool {
328 matches!(self, TerminalKind::BlockComment)
329 }
330}
331
332#[allow(dead_code)]
333impl NonTerminalKind {
334 pub fn from_non_terminal_name(name: &str) -> Self {
335 match name {
336 "Array" => Self::Array,
337 "ArrayBegin" => Self::ArrayBegin,
338 "ArrayElements" => Self::ArrayElements,
339 "ArrayElementsOpt" => Self::ArrayElementsOpt,
340 "ArrayElementsTail" => Self::ArrayElementsTail,
341 "ArrayElementsTailOpt" => Self::ArrayElementsTailOpt,
342 "ArrayEnd" => Self::ArrayEnd,
343 "ArrayMarker" => Self::ArrayMarker,
344 "ArrayMarkerOpt" => Self::ArrayMarkerOpt,
345 "ArrayOpt" => Self::ArrayOpt,
346 "At" => Self::At,
347 "Backtick2" => Self::Backtick2,
348 "Backtick3" => Self::Backtick3,
349 "Backtick4" => Self::Backtick4,
350 "Backtick5" => Self::Backtick5,
351 "BacktickDelim" => Self::BacktickDelim,
352 "Begin" => Self::Begin,
353 "Bind" => Self::Bind,
354 "Binding" => Self::Binding,
355 "BindingRhs" => Self::BindingRhs,
356 "BlockBody" => Self::BlockBody,
357 "Boolean" => Self::Boolean,
358 "CodeBlock" => Self::CodeBlock,
359 "CodeBlock3" => Self::CodeBlock3,
360 "CodeBlock3List" => Self::CodeBlock3List,
361 "CodeBlock3ListGroup" => Self::CodeBlock3ListGroup,
362 "CodeBlock4" => Self::CodeBlock4,
363 "CodeBlock4List" => Self::CodeBlock4List,
364 "CodeBlock4ListGroup" => Self::CodeBlock4ListGroup,
365 "CodeBlock5" => Self::CodeBlock5,
366 "CodeBlock5List" => Self::CodeBlock5List,
367 "CodeBlock5ListGroup" => Self::CodeBlock5ListGroup,
368 "CodeBlock6" => Self::CodeBlock6,
369 "CodeBlock6List" => Self::CodeBlock6List,
370 "CodeBlock6ListGroup" => Self::CodeBlock6ListGroup,
371 "CodeBlockEnd3" => Self::CodeBlockEnd3,
372 "CodeBlockEnd4" => Self::CodeBlockEnd4,
373 "CodeBlockEnd5" => Self::CodeBlockEnd5,
374 "CodeBlockEnd6" => Self::CodeBlockEnd6,
375 "CodeBlockStart3" => Self::CodeBlockStart3,
376 "CodeBlockStart4" => Self::CodeBlockStart4,
377 "CodeBlockStart5" => Self::CodeBlockStart5,
378 "CodeBlockStart6" => Self::CodeBlockStart6,
379 "Comma" => Self::Comma,
380 "Continue" => Self::Continue,
381 "DelimCode" => Self::DelimCode,
382 "DelimCode1" => Self::DelimCode1,
383 "DelimCode1List" => Self::DelimCode1List,
384 "DelimCode1ListGroup" => Self::DelimCode1ListGroup,
385 "DelimCode2" => Self::DelimCode2,
386 "DelimCode2List" => Self::DelimCode2List,
387 "DelimCode2ListGroup" => Self::DelimCode2ListGroup,
388 "DelimCode3" => Self::DelimCode3,
389 "DelimCode3List" => Self::DelimCode3List,
390 "DelimCode3ListGroup" => Self::DelimCode3ListGroup,
391 "DelimCodeEnd1" => Self::DelimCodeEnd1,
392 "DelimCodeEnd2" => Self::DelimCodeEnd2,
393 "DelimCodeEnd3" => Self::DelimCodeEnd3,
394 "DelimCodeStart1" => Self::DelimCodeStart1,
395 "DelimCodeStart2" => Self::DelimCodeStart2,
396 "DelimCodeStart3" => Self::DelimCodeStart3,
397 "Dot" => Self::Dot,
398 "DotKey" => Self::DotKey,
399 "End" => Self::End,
400 "Eure" => Self::Eure,
401 "EureList" => Self::EureList,
402 "EureList0" => Self::EureList0,
403 "EureOpt" => Self::EureOpt,
404 "Ext" => Self::Ext,
405 "ExtensionNameSpace" => Self::ExtensionNameSpace,
406 "False" => Self::False,
407 "FirstKey" => Self::FirstKey,
408 "FlatBody" => Self::FlatBody,
409 "FlatBodyList" => Self::FlatBodyList,
410 "FlatRootBinding" => Self::FlatRootBinding,
411 "Float" => Self::Float,
412 "GrammarNewline" => Self::GrammarNewline,
413 "Hole" => Self::Hole,
414 "Ident" => Self::Ident,
415 "Inf" => Self::Inf,
416 "InlineCode" => Self::InlineCode,
417 "InlineCode1" => Self::InlineCode1,
418 "Integer" => Self::Integer,
419 "Key" => Self::Key,
420 "KeyIdent" => Self::KeyIdent,
421 "KeyTail" => Self::KeyTail,
422 "KeyTuple" => Self::KeyTuple,
423 "KeyTupleElements" => Self::KeyTupleElements,
424 "KeyTupleElementsOpt" => Self::KeyTupleElementsOpt,
425 "KeyTupleElementsTail" => Self::KeyTupleElementsTail,
426 "KeyTupleElementsTailOpt" => Self::KeyTupleElementsTailOpt,
427 "KeyTupleOpt" => Self::KeyTupleOpt,
428 "KeyValue" => Self::KeyValue,
429 "Keys" => Self::Keys,
430 "KeysList" => Self::KeysList,
431 "LParen" => Self::LParen,
432 "LitStr" => Self::LitStr,
433 "LitStr1" => Self::LitStr1,
434 "LitStr1End" => Self::LitStr1End,
435 "LitStr1List" => Self::LitStr1List,
436 "LitStr1ListGroup" => Self::LitStr1ListGroup,
437 "LitStr1Start" => Self::LitStr1Start,
438 "LitStr2" => Self::LitStr2,
439 "LitStr2End" => Self::LitStr2End,
440 "LitStr2List" => Self::LitStr2List,
441 "LitStr2ListGroup" => Self::LitStr2ListGroup,
442 "LitStr2Start" => Self::LitStr2Start,
443 "LitStr3" => Self::LitStr3,
444 "LitStr3End" => Self::LitStr3End,
445 "LitStr3List" => Self::LitStr3List,
446 "LitStr3ListGroup" => Self::LitStr3ListGroup,
447 "LitStr3Start" => Self::LitStr3Start,
448 "MapBind" => Self::MapBind,
449 "NaN" => Self::NaN,
450 "NewlineBind" => Self::NewlineBind,
451 "NewlineHead" => Self::NewlineHead,
452 "NewlineHeadOpt" => Self::NewlineHeadOpt,
453 "NewlineTextStart" => Self::NewlineTextStart,
454 "NoBacktick" => Self::NoBacktick,
455 "NoSQuote" => Self::NoSQuote,
456 "Null" => Self::Null,
457 "Number" => Self::Number,
458 "Object" => Self::Object,
459 "ObjectList" => Self::ObjectList,
460 "ObjectOpt" => Self::ObjectOpt,
461 "ObjectOpt0" => Self::ObjectOpt0,
462 "ObjectOpt1" => Self::ObjectOpt1,
463 "RParen" => Self::RParen,
464 "RootBinding" => Self::RootBinding,
465 "RootTextBinding" => Self::RootTextBinding,
466 "RootTextBindingOpt" => Self::RootTextBindingOpt,
467 "RootTextBindingOpt0" => Self::RootTextBindingOpt0,
468 "RootTextBindingOpt1" => Self::RootTextBindingOpt1,
469 "RootValueBinding" => Self::RootValueBinding,
470 "SQuote" => Self::SQuote,
471 "Section" => Self::Section,
472 "SectionBinding" => Self::SectionBinding,
473 "SectionBody" => Self::SectionBody,
474 "SectionBodyOpt" => Self::SectionBodyOpt,
475 "SectionHead" => Self::SectionHead,
476 "Str" => Self::Str,
477 "String" => Self::String,
478 "Strings" => Self::Strings,
479 "StringsList" => Self::StringsList,
480 "Text" => Self::Text,
481 "TextBinding" => Self::TextBinding,
482 "TextBindingOpt" => Self::TextBindingOpt,
483 "TextBindingOpt0" => Self::TextBindingOpt0,
484 "TextBindingOpt1" => Self::TextBindingOpt1,
485 "TextStart" => Self::TextStart,
486 "TopLevelBinding" => Self::TopLevelBinding,
487 "True" => Self::True,
488 "Tuple" => Self::Tuple,
489 "TupleElements" => Self::TupleElements,
490 "TupleElementsOpt" => Self::TupleElementsOpt,
491 "TupleElementsTail" => Self::TupleElementsTail,
492 "TupleElementsTailOpt" => Self::TupleElementsTailOpt,
493 "TupleIndex" => Self::TupleIndex,
494 "TupleOpt" => Self::TupleOpt,
495 "Value" => Self::Value,
496 "ValueBinding" => Self::ValueBinding,
497 "Ws" => Self::Ws,
498 "" => Self::Root,
499 _ => panic!("Invalid non-terminal name: {}", name),
500 }
501 }
502}
503impl std::fmt::Display for TerminalKind {
504 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
505 match self {
506 Self::NewLine => write!(f, stringify!(NewLine)),
507 Self::Whitespace => write!(f, stringify!(Whitespace)),
508 Self::LineComment => write!(f, stringify!(LineComment)),
509 Self::BlockComment => write!(f, stringify!(BlockComment)),
510 Self::Hash => write!(f, stringify!(Hash)),
511 Self::MapBind => write!(f, stringify!(MapBind)),
512 Self::Integer => write!(f, stringify!(Integer)),
513 Self::Float => write!(f, stringify!(Float)),
514 Self::Inf => write!(f, stringify!(Inf)),
515 Self::NaN => write!(f, stringify!(NaN)),
516 Self::True => write!(f, stringify!(True)),
517 Self::False => write!(f, stringify!(False)),
518 Self::Null => write!(f, stringify!(Null)),
519 Self::Hole => write!(f, stringify!(Hole)),
520 Self::Str => write!(f, stringify!(Str)),
521 Self::LitStr => write!(f, stringify!(LitStr)),
522 Self::Text => write!(f, stringify!(Text)),
523 Self::InlineCode1 => write!(f, stringify!(InlineCode1)),
524 Self::LitStr3Start => write!(f, stringify!(LitStr3Start)),
525 Self::LitStr2Start => write!(f, stringify!(LitStr2Start)),
526 Self::LitStr1Start => write!(f, stringify!(LitStr1Start)),
527 Self::DelimCodeStart3 => write!(f, stringify!(DelimCodeStart3)),
528 Self::DelimCodeStart2 => write!(f, stringify!(DelimCodeStart2)),
529 Self::DelimCodeStart1 => write!(f, stringify!(DelimCodeStart1)),
530 Self::CodeBlockStart3 => write!(f, stringify!(CodeBlockStart3)),
531 Self::CodeBlockStart4 => write!(f, stringify!(CodeBlockStart4)),
532 Self::CodeBlockStart5 => write!(f, stringify!(CodeBlockStart5)),
533 Self::CodeBlockStart6 => write!(f, stringify!(CodeBlockStart6)),
534 Self::CodeBlockEnd3 => write!(f, stringify!(CodeBlockEnd3)),
535 Self::Backtick2 => write!(f, stringify!(Backtick2)),
536 Self::CodeBlockEnd4 => write!(f, stringify!(CodeBlockEnd4)),
537 Self::Backtick3 => write!(f, stringify!(Backtick3)),
538 Self::CodeBlockEnd5 => write!(f, stringify!(CodeBlockEnd5)),
539 Self::Backtick4 => write!(f, stringify!(Backtick4)),
540 Self::CodeBlockEnd6 => write!(f, stringify!(CodeBlockEnd6)),
541 Self::Backtick5 => write!(f, stringify!(Backtick5)),
542 Self::NoBacktick => write!(f, stringify!(NoBacktick)),
543 Self::LitStr3End => write!(f, stringify!(LitStr3End)),
544 Self::LitStr2End => write!(f, stringify!(LitStr2End)),
545 Self::LitStr1End => write!(f, stringify!(LitStr1End)),
546 Self::SQuote => write!(f, stringify!(SQuote)),
547 Self::NoSQuote => write!(f, stringify!(NoSQuote)),
548 Self::DelimCodeEnd3 => write!(f, stringify!(DelimCodeEnd3)),
549 Self::DelimCodeEnd2 => write!(f, stringify!(DelimCodeEnd2)),
550 Self::DelimCodeEnd1 => write!(f, stringify!(DelimCodeEnd1)),
551 Self::BacktickDelim => write!(f, stringify!(BacktickDelim)),
552 Self::GrammarNewline => write!(f, stringify!(GrammarNewline)),
553 Self::Ws => write!(f, stringify!(Ws)),
554 Self::At => write!(f, stringify!(At)),
555 Self::Dollar => write!(f, stringify!(Dollar)),
556 Self::Dot => write!(f, stringify!(Dot)),
557 Self::LBrace => write!(f, stringify!(LBrace)),
558 Self::RBrace => write!(f, stringify!(RBrace)),
559 Self::LBracket => write!(f, stringify!(LBracket)),
560 Self::RBracket => write!(f, stringify!(RBracket)),
561 Self::LParen => write!(f, stringify!(LParen)),
562 Self::RParen => write!(f, stringify!(RParen)),
563 Self::NewlineBind => write!(f, stringify!(NewlineBind)),
564 Self::Bind => write!(f, stringify!(Bind)),
565 Self::Comma => write!(f, stringify!(Comma)),
566 Self::Esc => write!(f, stringify!(Esc)),
567 Self::NewlineTextStart => write!(f, stringify!(NewlineTextStart)),
568 Self::TextStart => write!(f, stringify!(TextStart)),
569 Self::Ident => write!(f, stringify!(Ident)),
570 }
571 }
572}
573
574impl std::fmt::Display for NonTerminalKind {
575 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
576 match self {
577 Self::Array => write!(f, stringify!(Array)),
578 Self::ArrayBegin => write!(f, stringify!(ArrayBegin)),
579 Self::ArrayElements => write!(f, stringify!(ArrayElements)),
580 Self::ArrayElementsOpt => write!(f, stringify!(ArrayElementsOpt)),
581 Self::ArrayElementsTail => write!(f, stringify!(ArrayElementsTail)),
582 Self::ArrayElementsTailOpt => write!(f, stringify!(ArrayElementsTailOpt)),
583 Self::ArrayEnd => write!(f, stringify!(ArrayEnd)),
584 Self::ArrayMarker => write!(f, stringify!(ArrayMarker)),
585 Self::ArrayMarkerOpt => write!(f, stringify!(ArrayMarkerOpt)),
586 Self::ArrayOpt => write!(f, stringify!(ArrayOpt)),
587 Self::At => write!(f, stringify!(At)),
588 Self::Backtick2 => write!(f, stringify!(Backtick2)),
589 Self::Backtick3 => write!(f, stringify!(Backtick3)),
590 Self::Backtick4 => write!(f, stringify!(Backtick4)),
591 Self::Backtick5 => write!(f, stringify!(Backtick5)),
592 Self::BacktickDelim => write!(f, stringify!(BacktickDelim)),
593 Self::Begin => write!(f, stringify!(Begin)),
594 Self::Bind => write!(f, stringify!(Bind)),
595 Self::Binding => write!(f, stringify!(Binding)),
596 Self::BindingRhs => write!(f, stringify!(BindingRhs)),
597 Self::BlockBody => write!(f, stringify!(BlockBody)),
598 Self::Boolean => write!(f, stringify!(Boolean)),
599 Self::CodeBlock => write!(f, stringify!(CodeBlock)),
600 Self::CodeBlock3 => write!(f, stringify!(CodeBlock3)),
601 Self::CodeBlock3List => write!(f, stringify!(CodeBlock3List)),
602 Self::CodeBlock3ListGroup => write!(f, stringify!(CodeBlock3ListGroup)),
603 Self::CodeBlock4 => write!(f, stringify!(CodeBlock4)),
604 Self::CodeBlock4List => write!(f, stringify!(CodeBlock4List)),
605 Self::CodeBlock4ListGroup => write!(f, stringify!(CodeBlock4ListGroup)),
606 Self::CodeBlock5 => write!(f, stringify!(CodeBlock5)),
607 Self::CodeBlock5List => write!(f, stringify!(CodeBlock5List)),
608 Self::CodeBlock5ListGroup => write!(f, stringify!(CodeBlock5ListGroup)),
609 Self::CodeBlock6 => write!(f, stringify!(CodeBlock6)),
610 Self::CodeBlock6List => write!(f, stringify!(CodeBlock6List)),
611 Self::CodeBlock6ListGroup => write!(f, stringify!(CodeBlock6ListGroup)),
612 Self::CodeBlockEnd3 => write!(f, stringify!(CodeBlockEnd3)),
613 Self::CodeBlockEnd4 => write!(f, stringify!(CodeBlockEnd4)),
614 Self::CodeBlockEnd5 => write!(f, stringify!(CodeBlockEnd5)),
615 Self::CodeBlockEnd6 => write!(f, stringify!(CodeBlockEnd6)),
616 Self::CodeBlockStart3 => write!(f, stringify!(CodeBlockStart3)),
617 Self::CodeBlockStart4 => write!(f, stringify!(CodeBlockStart4)),
618 Self::CodeBlockStart5 => write!(f, stringify!(CodeBlockStart5)),
619 Self::CodeBlockStart6 => write!(f, stringify!(CodeBlockStart6)),
620 Self::Comma => write!(f, stringify!(Comma)),
621 Self::Continue => write!(f, stringify!(Continue)),
622 Self::DelimCode => write!(f, stringify!(DelimCode)),
623 Self::DelimCode1 => write!(f, stringify!(DelimCode1)),
624 Self::DelimCode1List => write!(f, stringify!(DelimCode1List)),
625 Self::DelimCode1ListGroup => write!(f, stringify!(DelimCode1ListGroup)),
626 Self::DelimCode2 => write!(f, stringify!(DelimCode2)),
627 Self::DelimCode2List => write!(f, stringify!(DelimCode2List)),
628 Self::DelimCode2ListGroup => write!(f, stringify!(DelimCode2ListGroup)),
629 Self::DelimCode3 => write!(f, stringify!(DelimCode3)),
630 Self::DelimCode3List => write!(f, stringify!(DelimCode3List)),
631 Self::DelimCode3ListGroup => write!(f, stringify!(DelimCode3ListGroup)),
632 Self::DelimCodeEnd1 => write!(f, stringify!(DelimCodeEnd1)),
633 Self::DelimCodeEnd2 => write!(f, stringify!(DelimCodeEnd2)),
634 Self::DelimCodeEnd3 => write!(f, stringify!(DelimCodeEnd3)),
635 Self::DelimCodeStart1 => write!(f, stringify!(DelimCodeStart1)),
636 Self::DelimCodeStart2 => write!(f, stringify!(DelimCodeStart2)),
637 Self::DelimCodeStart3 => write!(f, stringify!(DelimCodeStart3)),
638 Self::Dot => write!(f, stringify!(Dot)),
639 Self::DotKey => write!(f, stringify!(DotKey)),
640 Self::End => write!(f, stringify!(End)),
641 Self::Eure => write!(f, stringify!(Eure)),
642 Self::EureList => write!(f, stringify!(EureList)),
643 Self::EureList0 => write!(f, stringify!(EureList0)),
644 Self::EureOpt => write!(f, stringify!(EureOpt)),
645 Self::Ext => write!(f, stringify!(Ext)),
646 Self::ExtensionNameSpace => write!(f, stringify!(ExtensionNameSpace)),
647 Self::False => write!(f, stringify!(False)),
648 Self::FirstKey => write!(f, stringify!(FirstKey)),
649 Self::FlatBody => write!(f, stringify!(FlatBody)),
650 Self::FlatBodyList => write!(f, stringify!(FlatBodyList)),
651 Self::FlatRootBinding => write!(f, stringify!(FlatRootBinding)),
652 Self::Float => write!(f, stringify!(Float)),
653 Self::GrammarNewline => write!(f, stringify!(GrammarNewline)),
654 Self::Hole => write!(f, stringify!(Hole)),
655 Self::Ident => write!(f, stringify!(Ident)),
656 Self::Inf => write!(f, stringify!(Inf)),
657 Self::InlineCode => write!(f, stringify!(InlineCode)),
658 Self::InlineCode1 => write!(f, stringify!(InlineCode1)),
659 Self::Integer => write!(f, stringify!(Integer)),
660 Self::Key => write!(f, stringify!(Key)),
661 Self::KeyIdent => write!(f, stringify!(KeyIdent)),
662 Self::KeyTail => write!(f, stringify!(KeyTail)),
663 Self::KeyTuple => write!(f, stringify!(KeyTuple)),
664 Self::KeyTupleElements => write!(f, stringify!(KeyTupleElements)),
665 Self::KeyTupleElementsOpt => write!(f, stringify!(KeyTupleElementsOpt)),
666 Self::KeyTupleElementsTail => write!(f, stringify!(KeyTupleElementsTail)),
667 Self::KeyTupleElementsTailOpt => write!(f, stringify!(KeyTupleElementsTailOpt)),
668 Self::KeyTupleOpt => write!(f, stringify!(KeyTupleOpt)),
669 Self::KeyValue => write!(f, stringify!(KeyValue)),
670 Self::Keys => write!(f, stringify!(Keys)),
671 Self::KeysList => write!(f, stringify!(KeysList)),
672 Self::LParen => write!(f, stringify!(LParen)),
673 Self::LitStr => write!(f, stringify!(LitStr)),
674 Self::LitStr1 => write!(f, stringify!(LitStr1)),
675 Self::LitStr1End => write!(f, stringify!(LitStr1End)),
676 Self::LitStr1List => write!(f, stringify!(LitStr1List)),
677 Self::LitStr1ListGroup => write!(f, stringify!(LitStr1ListGroup)),
678 Self::LitStr1Start => write!(f, stringify!(LitStr1Start)),
679 Self::LitStr2 => write!(f, stringify!(LitStr2)),
680 Self::LitStr2End => write!(f, stringify!(LitStr2End)),
681 Self::LitStr2List => write!(f, stringify!(LitStr2List)),
682 Self::LitStr2ListGroup => write!(f, stringify!(LitStr2ListGroup)),
683 Self::LitStr2Start => write!(f, stringify!(LitStr2Start)),
684 Self::LitStr3 => write!(f, stringify!(LitStr3)),
685 Self::LitStr3End => write!(f, stringify!(LitStr3End)),
686 Self::LitStr3List => write!(f, stringify!(LitStr3List)),
687 Self::LitStr3ListGroup => write!(f, stringify!(LitStr3ListGroup)),
688 Self::LitStr3Start => write!(f, stringify!(LitStr3Start)),
689 Self::MapBind => write!(f, stringify!(MapBind)),
690 Self::NaN => write!(f, stringify!(NaN)),
691 Self::NewlineBind => write!(f, stringify!(NewlineBind)),
692 Self::NewlineHead => write!(f, stringify!(NewlineHead)),
693 Self::NewlineHeadOpt => write!(f, stringify!(NewlineHeadOpt)),
694 Self::NewlineTextStart => write!(f, stringify!(NewlineTextStart)),
695 Self::NoBacktick => write!(f, stringify!(NoBacktick)),
696 Self::NoSQuote => write!(f, stringify!(NoSQuote)),
697 Self::Null => write!(f, stringify!(Null)),
698 Self::Number => write!(f, stringify!(Number)),
699 Self::Object => write!(f, stringify!(Object)),
700 Self::ObjectList => write!(f, stringify!(ObjectList)),
701 Self::ObjectOpt => write!(f, stringify!(ObjectOpt)),
702 Self::ObjectOpt0 => write!(f, stringify!(ObjectOpt0)),
703 Self::ObjectOpt1 => write!(f, stringify!(ObjectOpt1)),
704 Self::RParen => write!(f, stringify!(RParen)),
705 Self::RootBinding => write!(f, stringify!(RootBinding)),
706 Self::RootTextBinding => write!(f, stringify!(RootTextBinding)),
707 Self::RootTextBindingOpt => write!(f, stringify!(RootTextBindingOpt)),
708 Self::RootTextBindingOpt0 => write!(f, stringify!(RootTextBindingOpt0)),
709 Self::RootTextBindingOpt1 => write!(f, stringify!(RootTextBindingOpt1)),
710 Self::RootValueBinding => write!(f, stringify!(RootValueBinding)),
711 Self::SQuote => write!(f, stringify!(SQuote)),
712 Self::Section => write!(f, stringify!(Section)),
713 Self::SectionBinding => write!(f, stringify!(SectionBinding)),
714 Self::SectionBody => write!(f, stringify!(SectionBody)),
715 Self::SectionBodyOpt => write!(f, stringify!(SectionBodyOpt)),
716 Self::SectionHead => write!(f, stringify!(SectionHead)),
717 Self::Str => write!(f, stringify!(Str)),
718 Self::String => write!(f, stringify!(String)),
719 Self::Strings => write!(f, stringify!(Strings)),
720 Self::StringsList => write!(f, stringify!(StringsList)),
721 Self::Text => write!(f, stringify!(Text)),
722 Self::TextBinding => write!(f, stringify!(TextBinding)),
723 Self::TextBindingOpt => write!(f, stringify!(TextBindingOpt)),
724 Self::TextBindingOpt0 => write!(f, stringify!(TextBindingOpt0)),
725 Self::TextBindingOpt1 => write!(f, stringify!(TextBindingOpt1)),
726 Self::TextStart => write!(f, stringify!(TextStart)),
727 Self::TopLevelBinding => write!(f, stringify!(TopLevelBinding)),
728 Self::True => write!(f, stringify!(True)),
729 Self::Tuple => write!(f, stringify!(Tuple)),
730 Self::TupleElements => write!(f, stringify!(TupleElements)),
731 Self::TupleElementsOpt => write!(f, stringify!(TupleElementsOpt)),
732 Self::TupleElementsTail => write!(f, stringify!(TupleElementsTail)),
733 Self::TupleElementsTailOpt => write!(f, stringify!(TupleElementsTailOpt)),
734 Self::TupleIndex => write!(f, stringify!(TupleIndex)),
735 Self::TupleOpt => write!(f, stringify!(TupleOpt)),
736 Self::Value => write!(f, stringify!(Value)),
737 Self::ValueBinding => write!(f, stringify!(ValueBinding)),
738 Self::Ws => write!(f, stringify!(Ws)),
739 Self::Root => write!(f, stringify!(Root)),
740 }
741 }
742}
743
744#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
745pub enum NodeKind<T, Nt> {
746 Terminal(T),
747 NonTerminal(Nt),
748}