eure-tree 0.1.9

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

#[allow(dead_code)]
impl NonTerminalKind {
    pub fn from_non_terminal_name(name: &str) -> Self {
        match name {
            "Array" => Self::Array,
            "ArrayBegin" => Self::ArrayBegin,
            "ArrayElements" => Self::ArrayElements,
            "ArrayElementsOpt" => Self::ArrayElementsOpt,
            "ArrayElementsTail" => Self::ArrayElementsTail,
            "ArrayElementsTailOpt" => Self::ArrayElementsTailOpt,
            "ArrayEnd" => Self::ArrayEnd,
            "ArrayMarker" => Self::ArrayMarker,
            "ArrayMarkerOpt" => Self::ArrayMarkerOpt,
            "ArrayMarkerOptGroup" => Self::ArrayMarkerOptGroup,
            "ArrayOpt" => Self::ArrayOpt,
            "At" => Self::At,
            "Backtick2" => Self::Backtick2,
            "Backtick3" => Self::Backtick3,
            "Backtick4" => Self::Backtick4,
            "Backtick5" => Self::Backtick5,
            "BacktickDelim" => Self::BacktickDelim,
            "Begin" => Self::Begin,
            "Bind" => Self::Bind,
            "Binding" => Self::Binding,
            "BindingRhs" => Self::BindingRhs,
            "BlockBody" => Self::BlockBody,
            "Boolean" => Self::Boolean,
            "Caret" => Self::Caret,
            "CodeBlock" => Self::CodeBlock,
            "CodeBlock3" => Self::CodeBlock3,
            "CodeBlock3List" => Self::CodeBlock3List,
            "CodeBlock3ListGroup" => Self::CodeBlock3ListGroup,
            "CodeBlock4" => Self::CodeBlock4,
            "CodeBlock4List" => Self::CodeBlock4List,
            "CodeBlock4ListGroup" => Self::CodeBlock4ListGroup,
            "CodeBlock5" => Self::CodeBlock5,
            "CodeBlock5List" => Self::CodeBlock5List,
            "CodeBlock5ListGroup" => Self::CodeBlock5ListGroup,
            "CodeBlock6" => Self::CodeBlock6,
            "CodeBlock6List" => Self::CodeBlock6List,
            "CodeBlock6ListGroup" => Self::CodeBlock6ListGroup,
            "CodeBlockEnd3" => Self::CodeBlockEnd3,
            "CodeBlockEnd4" => Self::CodeBlockEnd4,
            "CodeBlockEnd5" => Self::CodeBlockEnd5,
            "CodeBlockEnd6" => Self::CodeBlockEnd6,
            "CodeBlockStart3" => Self::CodeBlockStart3,
            "CodeBlockStart4" => Self::CodeBlockStart4,
            "CodeBlockStart5" => Self::CodeBlockStart5,
            "CodeBlockStart6" => Self::CodeBlockStart6,
            "Comma" => Self::Comma,
            "Continue" => Self::Continue,
            "DelimCode" => Self::DelimCode,
            "DelimCode1" => Self::DelimCode1,
            "DelimCode1List" => Self::DelimCode1List,
            "DelimCode1ListGroup" => Self::DelimCode1ListGroup,
            "DelimCode2" => Self::DelimCode2,
            "DelimCode2List" => Self::DelimCode2List,
            "DelimCode2ListGroup" => Self::DelimCode2ListGroup,
            "DelimCode3" => Self::DelimCode3,
            "DelimCode3List" => Self::DelimCode3List,
            "DelimCode3ListGroup" => Self::DelimCode3ListGroup,
            "DelimCodeEnd1" => Self::DelimCodeEnd1,
            "DelimCodeEnd2" => Self::DelimCodeEnd2,
            "DelimCodeEnd3" => Self::DelimCodeEnd3,
            "DelimCodeStart1" => Self::DelimCodeStart1,
            "DelimCodeStart2" => Self::DelimCodeStart2,
            "DelimCodeStart3" => Self::DelimCodeStart3,
            "Dot" => Self::Dot,
            "DotKey" => Self::DotKey,
            "End" => Self::End,
            "Eure" => Self::Eure,
            "EureList" => Self::EureList,
            "EureList0" => Self::EureList0,
            "EureOpt" => Self::EureOpt,
            "Ext" => Self::Ext,
            "ExtensionNameSpace" => Self::ExtensionNameSpace,
            "False" => Self::False,
            "FirstKey" => Self::FirstKey,
            "FlatBody" => Self::FlatBody,
            "FlatBodyList" => Self::FlatBodyList,
            "FlatRootBinding" => Self::FlatRootBinding,
            "Float" => Self::Float,
            "GrammarNewline" => Self::GrammarNewline,
            "Hole" => Self::Hole,
            "Ident" => Self::Ident,
            "Inf" => Self::Inf,
            "InlineCode" => Self::InlineCode,
            "InlineCode1" => Self::InlineCode1,
            "Integer" => Self::Integer,
            "Key" => Self::Key,
            "KeyIdent" => Self::KeyIdent,
            "KeyTail" => Self::KeyTail,
            "KeyTuple" => Self::KeyTuple,
            "KeyTupleElements" => Self::KeyTupleElements,
            "KeyTupleElementsOpt" => Self::KeyTupleElementsOpt,
            "KeyTupleElementsTail" => Self::KeyTupleElementsTail,
            "KeyTupleElementsTailOpt" => Self::KeyTupleElementsTailOpt,
            "KeyTupleOpt" => Self::KeyTupleOpt,
            "KeyValue" => Self::KeyValue,
            "Keys" => Self::Keys,
            "KeysList" => Self::KeysList,
            "LParen" => Self::LParen,
            "LitStr" => Self::LitStr,
            "LitStr1" => Self::LitStr1,
            "LitStr1End" => Self::LitStr1End,
            "LitStr1List" => Self::LitStr1List,
            "LitStr1ListGroup" => Self::LitStr1ListGroup,
            "LitStr1Start" => Self::LitStr1Start,
            "LitStr2" => Self::LitStr2,
            "LitStr2End" => Self::LitStr2End,
            "LitStr2List" => Self::LitStr2List,
            "LitStr2ListGroup" => Self::LitStr2ListGroup,
            "LitStr2Start" => Self::LitStr2Start,
            "LitStr3" => Self::LitStr3,
            "LitStr3End" => Self::LitStr3End,
            "LitStr3List" => Self::LitStr3List,
            "LitStr3ListGroup" => Self::LitStr3ListGroup,
            "LitStr3Start" => Self::LitStr3Start,
            "MapBind" => Self::MapBind,
            "NaN" => Self::NaN,
            "NewlineBind" => Self::NewlineBind,
            "NewlineHead" => Self::NewlineHead,
            "NewlineHeadOpt" => Self::NewlineHeadOpt,
            "NewlineTextStart" => Self::NewlineTextStart,
            "NoBacktick" => Self::NoBacktick,
            "NoSQuote" => Self::NoSQuote,
            "Null" => Self::Null,
            "Number" => Self::Number,
            "Object" => Self::Object,
            "ObjectList" => Self::ObjectList,
            "ObjectOpt" => Self::ObjectOpt,
            "ObjectOpt0" => Self::ObjectOpt0,
            "ObjectOpt1" => Self::ObjectOpt1,
            "RParen" => Self::RParen,
            "RootBinding" => Self::RootBinding,
            "RootTextBinding" => Self::RootTextBinding,
            "RootTextBindingOpt" => Self::RootTextBindingOpt,
            "RootTextBindingOpt0" => Self::RootTextBindingOpt0,
            "RootTextBindingOpt1" => Self::RootTextBindingOpt1,
            "RootValueBinding" => Self::RootValueBinding,
            "SQuote" => Self::SQuote,
            "Section" => Self::Section,
            "SectionBinding" => Self::SectionBinding,
            "SectionBody" => Self::SectionBody,
            "SectionBodyOpt" => Self::SectionBodyOpt,
            "SectionHead" => Self::SectionHead,
            "Str" => Self::Str,
            "String" => Self::String,
            "Strings" => Self::Strings,
            "StringsList" => Self::StringsList,
            "Text" => Self::Text,
            "TextBinding" => Self::TextBinding,
            "TextBindingOpt" => Self::TextBindingOpt,
            "TextBindingOpt0" => Self::TextBindingOpt0,
            "TextBindingOpt1" => Self::TextBindingOpt1,
            "TextStart" => Self::TextStart,
            "TopLevelBinding" => Self::TopLevelBinding,
            "True" => Self::True,
            "Tuple" => Self::Tuple,
            "TupleElements" => Self::TupleElements,
            "TupleElementsOpt" => Self::TupleElementsOpt,
            "TupleElementsTail" => Self::TupleElementsTail,
            "TupleElementsTailOpt" => Self::TupleElementsTailOpt,
            "TupleIndex" => Self::TupleIndex,
            "TupleOpt" => Self::TupleOpt,
            "Value" => Self::Value,
            "ValueBinding" => Self::ValueBinding,
            "Ws" => Self::Ws,
            "" => Self::Root,
            _ => panic!("Invalid non-terminal name: {}", name),
        }
    }
}
impl std::fmt::Display for TerminalKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::NewLine => write!(f, stringify!(NewLine)),
            Self::Whitespace => write!(f, stringify!(Whitespace)),
            Self::LineComment => write!(f, stringify!(LineComment)),
            Self::BlockComment => write!(f, stringify!(BlockComment)),
            Self::Hash => write!(f, stringify!(Hash)),
            Self::MapBind => write!(f, stringify!(MapBind)),
            Self::Integer => write!(f, stringify!(Integer)),
            Self::Float => write!(f, stringify!(Float)),
            Self::Inf => write!(f, stringify!(Inf)),
            Self::NaN => write!(f, stringify!(NaN)),
            Self::True => write!(f, stringify!(True)),
            Self::False => write!(f, stringify!(False)),
            Self::Null => write!(f, stringify!(Null)),
            Self::Hole => write!(f, stringify!(Hole)),
            Self::Str => write!(f, stringify!(Str)),
            Self::LitStr => write!(f, stringify!(LitStr)),
            Self::Text => write!(f, stringify!(Text)),
            Self::InlineCode1 => write!(f, stringify!(InlineCode1)),
            Self::LitStr3Start => write!(f, stringify!(LitStr3Start)),
            Self::LitStr2Start => write!(f, stringify!(LitStr2Start)),
            Self::LitStr1Start => write!(f, stringify!(LitStr1Start)),
            Self::DelimCodeStart3 => write!(f, stringify!(DelimCodeStart3)),
            Self::DelimCodeStart2 => write!(f, stringify!(DelimCodeStart2)),
            Self::DelimCodeStart1 => write!(f, stringify!(DelimCodeStart1)),
            Self::CodeBlockStart3 => write!(f, stringify!(CodeBlockStart3)),
            Self::CodeBlockStart4 => write!(f, stringify!(CodeBlockStart4)),
            Self::CodeBlockStart5 => write!(f, stringify!(CodeBlockStart5)),
            Self::CodeBlockStart6 => write!(f, stringify!(CodeBlockStart6)),
            Self::CodeBlockEnd3 => write!(f, stringify!(CodeBlockEnd3)),
            Self::Backtick2 => write!(f, stringify!(Backtick2)),
            Self::CodeBlockEnd4 => write!(f, stringify!(CodeBlockEnd4)),
            Self::Backtick3 => write!(f, stringify!(Backtick3)),
            Self::CodeBlockEnd5 => write!(f, stringify!(CodeBlockEnd5)),
            Self::Backtick4 => write!(f, stringify!(Backtick4)),
            Self::CodeBlockEnd6 => write!(f, stringify!(CodeBlockEnd6)),
            Self::Backtick5 => write!(f, stringify!(Backtick5)),
            Self::NoBacktick => write!(f, stringify!(NoBacktick)),
            Self::LitStr3End => write!(f, stringify!(LitStr3End)),
            Self::LitStr2End => write!(f, stringify!(LitStr2End)),
            Self::LitStr1End => write!(f, stringify!(LitStr1End)),
            Self::SQuote => write!(f, stringify!(SQuote)),
            Self::NoSQuote => write!(f, stringify!(NoSQuote)),
            Self::DelimCodeEnd3 => write!(f, stringify!(DelimCodeEnd3)),
            Self::DelimCodeEnd2 => write!(f, stringify!(DelimCodeEnd2)),
            Self::DelimCodeEnd1 => write!(f, stringify!(DelimCodeEnd1)),
            Self::BacktickDelim => write!(f, stringify!(BacktickDelim)),
            Self::GrammarNewline => write!(f, stringify!(GrammarNewline)),
            Self::Ws => write!(f, stringify!(Ws)),
            Self::At => write!(f, stringify!(At)),
            Self::Dollar => write!(f, stringify!(Dollar)),
            Self::Dot => write!(f, stringify!(Dot)),
            Self::LBrace => write!(f, stringify!(LBrace)),
            Self::RBrace => write!(f, stringify!(RBrace)),
            Self::LBracket => write!(f, stringify!(LBracket)),
            Self::RBracket => write!(f, stringify!(RBracket)),
            Self::Circumflex => write!(f, stringify!(Circumflex)),
            Self::LParen => write!(f, stringify!(LParen)),
            Self::RParen => write!(f, stringify!(RParen)),
            Self::NewlineBind => write!(f, stringify!(NewlineBind)),
            Self::Bind => write!(f, stringify!(Bind)),
            Self::Comma => write!(f, stringify!(Comma)),
            Self::Esc => write!(f, stringify!(Esc)),
            Self::NewlineTextStart => write!(f, stringify!(NewlineTextStart)),
            Self::TextStart => write!(f, stringify!(TextStart)),
            Self::Ident => write!(f, stringify!(Ident)),
        }
    }
}

impl std::fmt::Display for NonTerminalKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Array => write!(f, stringify!(Array)),
            Self::ArrayBegin => write!(f, stringify!(ArrayBegin)),
            Self::ArrayElements => write!(f, stringify!(ArrayElements)),
            Self::ArrayElementsOpt => write!(f, stringify!(ArrayElementsOpt)),
            Self::ArrayElementsTail => write!(f, stringify!(ArrayElementsTail)),
            Self::ArrayElementsTailOpt => write!(f, stringify!(ArrayElementsTailOpt)),
            Self::ArrayEnd => write!(f, stringify!(ArrayEnd)),
            Self::ArrayMarker => write!(f, stringify!(ArrayMarker)),
            Self::ArrayMarkerOpt => write!(f, stringify!(ArrayMarkerOpt)),
            Self::ArrayMarkerOptGroup => write!(f, stringify!(ArrayMarkerOptGroup)),
            Self::ArrayOpt => write!(f, stringify!(ArrayOpt)),
            Self::At => write!(f, stringify!(At)),
            Self::Backtick2 => write!(f, stringify!(Backtick2)),
            Self::Backtick3 => write!(f, stringify!(Backtick3)),
            Self::Backtick4 => write!(f, stringify!(Backtick4)),
            Self::Backtick5 => write!(f, stringify!(Backtick5)),
            Self::BacktickDelim => write!(f, stringify!(BacktickDelim)),
            Self::Begin => write!(f, stringify!(Begin)),
            Self::Bind => write!(f, stringify!(Bind)),
            Self::Binding => write!(f, stringify!(Binding)),
            Self::BindingRhs => write!(f, stringify!(BindingRhs)),
            Self::BlockBody => write!(f, stringify!(BlockBody)),
            Self::Boolean => write!(f, stringify!(Boolean)),
            Self::Caret => write!(f, stringify!(Caret)),
            Self::CodeBlock => write!(f, stringify!(CodeBlock)),
            Self::CodeBlock3 => write!(f, stringify!(CodeBlock3)),
            Self::CodeBlock3List => write!(f, stringify!(CodeBlock3List)),
            Self::CodeBlock3ListGroup => write!(f, stringify!(CodeBlock3ListGroup)),
            Self::CodeBlock4 => write!(f, stringify!(CodeBlock4)),
            Self::CodeBlock4List => write!(f, stringify!(CodeBlock4List)),
            Self::CodeBlock4ListGroup => write!(f, stringify!(CodeBlock4ListGroup)),
            Self::CodeBlock5 => write!(f, stringify!(CodeBlock5)),
            Self::CodeBlock5List => write!(f, stringify!(CodeBlock5List)),
            Self::CodeBlock5ListGroup => write!(f, stringify!(CodeBlock5ListGroup)),
            Self::CodeBlock6 => write!(f, stringify!(CodeBlock6)),
            Self::CodeBlock6List => write!(f, stringify!(CodeBlock6List)),
            Self::CodeBlock6ListGroup => write!(f, stringify!(CodeBlock6ListGroup)),
            Self::CodeBlockEnd3 => write!(f, stringify!(CodeBlockEnd3)),
            Self::CodeBlockEnd4 => write!(f, stringify!(CodeBlockEnd4)),
            Self::CodeBlockEnd5 => write!(f, stringify!(CodeBlockEnd5)),
            Self::CodeBlockEnd6 => write!(f, stringify!(CodeBlockEnd6)),
            Self::CodeBlockStart3 => write!(f, stringify!(CodeBlockStart3)),
            Self::CodeBlockStart4 => write!(f, stringify!(CodeBlockStart4)),
            Self::CodeBlockStart5 => write!(f, stringify!(CodeBlockStart5)),
            Self::CodeBlockStart6 => write!(f, stringify!(CodeBlockStart6)),
            Self::Comma => write!(f, stringify!(Comma)),
            Self::Continue => write!(f, stringify!(Continue)),
            Self::DelimCode => write!(f, stringify!(DelimCode)),
            Self::DelimCode1 => write!(f, stringify!(DelimCode1)),
            Self::DelimCode1List => write!(f, stringify!(DelimCode1List)),
            Self::DelimCode1ListGroup => write!(f, stringify!(DelimCode1ListGroup)),
            Self::DelimCode2 => write!(f, stringify!(DelimCode2)),
            Self::DelimCode2List => write!(f, stringify!(DelimCode2List)),
            Self::DelimCode2ListGroup => write!(f, stringify!(DelimCode2ListGroup)),
            Self::DelimCode3 => write!(f, stringify!(DelimCode3)),
            Self::DelimCode3List => write!(f, stringify!(DelimCode3List)),
            Self::DelimCode3ListGroup => write!(f, stringify!(DelimCode3ListGroup)),
            Self::DelimCodeEnd1 => write!(f, stringify!(DelimCodeEnd1)),
            Self::DelimCodeEnd2 => write!(f, stringify!(DelimCodeEnd2)),
            Self::DelimCodeEnd3 => write!(f, stringify!(DelimCodeEnd3)),
            Self::DelimCodeStart1 => write!(f, stringify!(DelimCodeStart1)),
            Self::DelimCodeStart2 => write!(f, stringify!(DelimCodeStart2)),
            Self::DelimCodeStart3 => write!(f, stringify!(DelimCodeStart3)),
            Self::Dot => write!(f, stringify!(Dot)),
            Self::DotKey => write!(f, stringify!(DotKey)),
            Self::End => write!(f, stringify!(End)),
            Self::Eure => write!(f, stringify!(Eure)),
            Self::EureList => write!(f, stringify!(EureList)),
            Self::EureList0 => write!(f, stringify!(EureList0)),
            Self::EureOpt => write!(f, stringify!(EureOpt)),
            Self::Ext => write!(f, stringify!(Ext)),
            Self::ExtensionNameSpace => write!(f, stringify!(ExtensionNameSpace)),
            Self::False => write!(f, stringify!(False)),
            Self::FirstKey => write!(f, stringify!(FirstKey)),
            Self::FlatBody => write!(f, stringify!(FlatBody)),
            Self::FlatBodyList => write!(f, stringify!(FlatBodyList)),
            Self::FlatRootBinding => write!(f, stringify!(FlatRootBinding)),
            Self::Float => write!(f, stringify!(Float)),
            Self::GrammarNewline => write!(f, stringify!(GrammarNewline)),
            Self::Hole => write!(f, stringify!(Hole)),
            Self::Ident => write!(f, stringify!(Ident)),
            Self::Inf => write!(f, stringify!(Inf)),
            Self::InlineCode => write!(f, stringify!(InlineCode)),
            Self::InlineCode1 => write!(f, stringify!(InlineCode1)),
            Self::Integer => write!(f, stringify!(Integer)),
            Self::Key => write!(f, stringify!(Key)),
            Self::KeyIdent => write!(f, stringify!(KeyIdent)),
            Self::KeyTail => write!(f, stringify!(KeyTail)),
            Self::KeyTuple => write!(f, stringify!(KeyTuple)),
            Self::KeyTupleElements => write!(f, stringify!(KeyTupleElements)),
            Self::KeyTupleElementsOpt => write!(f, stringify!(KeyTupleElementsOpt)),
            Self::KeyTupleElementsTail => write!(f, stringify!(KeyTupleElementsTail)),
            Self::KeyTupleElementsTailOpt => write!(f, stringify!(KeyTupleElementsTailOpt)),
            Self::KeyTupleOpt => write!(f, stringify!(KeyTupleOpt)),
            Self::KeyValue => write!(f, stringify!(KeyValue)),
            Self::Keys => write!(f, stringify!(Keys)),
            Self::KeysList => write!(f, stringify!(KeysList)),
            Self::LParen => write!(f, stringify!(LParen)),
            Self::LitStr => write!(f, stringify!(LitStr)),
            Self::LitStr1 => write!(f, stringify!(LitStr1)),
            Self::LitStr1End => write!(f, stringify!(LitStr1End)),
            Self::LitStr1List => write!(f, stringify!(LitStr1List)),
            Self::LitStr1ListGroup => write!(f, stringify!(LitStr1ListGroup)),
            Self::LitStr1Start => write!(f, stringify!(LitStr1Start)),
            Self::LitStr2 => write!(f, stringify!(LitStr2)),
            Self::LitStr2End => write!(f, stringify!(LitStr2End)),
            Self::LitStr2List => write!(f, stringify!(LitStr2List)),
            Self::LitStr2ListGroup => write!(f, stringify!(LitStr2ListGroup)),
            Self::LitStr2Start => write!(f, stringify!(LitStr2Start)),
            Self::LitStr3 => write!(f, stringify!(LitStr3)),
            Self::LitStr3End => write!(f, stringify!(LitStr3End)),
            Self::LitStr3List => write!(f, stringify!(LitStr3List)),
            Self::LitStr3ListGroup => write!(f, stringify!(LitStr3ListGroup)),
            Self::LitStr3Start => write!(f, stringify!(LitStr3Start)),
            Self::MapBind => write!(f, stringify!(MapBind)),
            Self::NaN => write!(f, stringify!(NaN)),
            Self::NewlineBind => write!(f, stringify!(NewlineBind)),
            Self::NewlineHead => write!(f, stringify!(NewlineHead)),
            Self::NewlineHeadOpt => write!(f, stringify!(NewlineHeadOpt)),
            Self::NewlineTextStart => write!(f, stringify!(NewlineTextStart)),
            Self::NoBacktick => write!(f, stringify!(NoBacktick)),
            Self::NoSQuote => write!(f, stringify!(NoSQuote)),
            Self::Null => write!(f, stringify!(Null)),
            Self::Number => write!(f, stringify!(Number)),
            Self::Object => write!(f, stringify!(Object)),
            Self::ObjectList => write!(f, stringify!(ObjectList)),
            Self::ObjectOpt => write!(f, stringify!(ObjectOpt)),
            Self::ObjectOpt0 => write!(f, stringify!(ObjectOpt0)),
            Self::ObjectOpt1 => write!(f, stringify!(ObjectOpt1)),
            Self::RParen => write!(f, stringify!(RParen)),
            Self::RootBinding => write!(f, stringify!(RootBinding)),
            Self::RootTextBinding => write!(f, stringify!(RootTextBinding)),
            Self::RootTextBindingOpt => write!(f, stringify!(RootTextBindingOpt)),
            Self::RootTextBindingOpt0 => write!(f, stringify!(RootTextBindingOpt0)),
            Self::RootTextBindingOpt1 => write!(f, stringify!(RootTextBindingOpt1)),
            Self::RootValueBinding => write!(f, stringify!(RootValueBinding)),
            Self::SQuote => write!(f, stringify!(SQuote)),
            Self::Section => write!(f, stringify!(Section)),
            Self::SectionBinding => write!(f, stringify!(SectionBinding)),
            Self::SectionBody => write!(f, stringify!(SectionBody)),
            Self::SectionBodyOpt => write!(f, stringify!(SectionBodyOpt)),
            Self::SectionHead => write!(f, stringify!(SectionHead)),
            Self::Str => write!(f, stringify!(Str)),
            Self::String => write!(f, stringify!(String)),
            Self::Strings => write!(f, stringify!(Strings)),
            Self::StringsList => write!(f, stringify!(StringsList)),
            Self::Text => write!(f, stringify!(Text)),
            Self::TextBinding => write!(f, stringify!(TextBinding)),
            Self::TextBindingOpt => write!(f, stringify!(TextBindingOpt)),
            Self::TextBindingOpt0 => write!(f, stringify!(TextBindingOpt0)),
            Self::TextBindingOpt1 => write!(f, stringify!(TextBindingOpt1)),
            Self::TextStart => write!(f, stringify!(TextStart)),
            Self::TopLevelBinding => write!(f, stringify!(TopLevelBinding)),
            Self::True => write!(f, stringify!(True)),
            Self::Tuple => write!(f, stringify!(Tuple)),
            Self::TupleElements => write!(f, stringify!(TupleElements)),
            Self::TupleElementsOpt => write!(f, stringify!(TupleElementsOpt)),
            Self::TupleElementsTail => write!(f, stringify!(TupleElementsTail)),
            Self::TupleElementsTailOpt => write!(f, stringify!(TupleElementsTailOpt)),
            Self::TupleIndex => write!(f, stringify!(TupleIndex)),
            Self::TupleOpt => write!(f, stringify!(TupleOpt)),
            Self::Value => write!(f, stringify!(Value)),
            Self::ValueBinding => write!(f, stringify!(ValueBinding)),
            Self::Ws => write!(f, stringify!(Ws)),
            Self::Root => write!(f, stringify!(Root)),
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum NodeKind<T, Nt> {
    Terminal(T),
    NonTerminal(Nt),
}