1
// auto-generated: "lalrpop 0.20.0"
2
// sha3: 701e228ccc68fcb86b5e6bc4719626fbfefefe31d323679d55e15d929f4a2974
3
use std::convert::TryInto;
4
use crate::Error;
5
use crate::packet::Any;
6
use crate::packet::Signature;
7
use crate::packet::UserID;
8
use crate::packet::UserAttribute;
9
use crate::packet::{key, Key};
10
use crate::packet::Unknown;
11
use crate::Packet;
12
use crate::policy::HashAlgoSecurity::SecondPreImageResistance;
13
use crate::cert::prelude::*;
14
use crate::cert::parser::low_level::lexer;
15
use crate::cert::parser::low_level::lexer::{Token, Component};
16
use crate::cert::parser::low_level::grammar_util::*;
17
use crate::cert::ComponentBundles;
18
use crate::cert::bundle::{
19
    PrimaryKeyBundle,
20
    SubkeyBundle,
21
    UserIDBundle,
22
    UserAttributeBundle,
23
    UnknownBundle,
24
};
25
use lalrpop_util::ParseError;
26
#[allow(unused_extern_crates)]
27
extern crate lalrpop_util as __lalrpop_util;
28
#[allow(unused_imports)]
29
use self::__lalrpop_util::state_machine as __state_machine;
30
extern crate core;
31
extern crate alloc;
32

            
33
#[rustfmt::skip]
34
#[allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens, clippy::all)]
35
mod __parse__Cert {
36

            
37
    use std::convert::TryInto;
38
    use crate::Error;
39
    use crate::packet::Any;
40
    use crate::packet::Signature;
41
    use crate::packet::UserID;
42
    use crate::packet::UserAttribute;
43
    use crate::packet::{key, Key};
44
    use crate::packet::Unknown;
45
    use crate::Packet;
46
    use crate::policy::HashAlgoSecurity::SecondPreImageResistance;
47
    use crate::cert::prelude::*;
48
    use crate::cert::parser::low_level::lexer;
49
    use crate::cert::parser::low_level::lexer::{Token, Component};
50
    use crate::cert::parser::low_level::grammar_util::*;
51
    use crate::cert::ComponentBundles;
52
    use crate::cert::bundle::{
53
    PrimaryKeyBundle,
54
    SubkeyBundle,
55
    UserIDBundle,
56
    UserAttributeBundle,
57
    UnknownBundle,
58
};
59
    use lalrpop_util::ParseError;
60
    #[allow(unused_extern_crates)]
61
    extern crate lalrpop_util as __lalrpop_util;
62
    #[allow(unused_imports)]
63
    use self::__lalrpop_util::state_machine as __state_machine;
64
    extern crate core;
65
    extern crate alloc;
66
    use super::__ToTriple;
67
    #[allow(dead_code)]
68
    pub(crate) enum __Symbol<>
69
     {
70
        Variant0(lexer::Token),
71
        Variant1(Option<Cert>),
72
        Variant2(Option<Component>),
73
        Variant3(Option<Vec<Component>>),
74
        Variant4(Option<Vec<Signature>>),
75
        Variant5(Option<(Packet, Vec<Signature>)>),
76
        Variant6(Option<Packet>),
77
        Variant7(Option<PacketOrUnknown<Key<key::PublicParts, key::SubordinateRole>>>),
78
        Variant8(Option<Unknown>),
79
        Variant9(Option<PacketOrUnknown<UserAttribute>>),
80
        Variant10(Option<PacketOrUnknown<UserID>>),
81
    }
82
    const __ACTION: &[i8] = &[
83
        // State 0
84
        10, 0, 11, 0, 0, 0, 0, 0, 0,
85
        // State 1
86
        0, -6, 0, -6, 0, 0, -6, -6, -6,
87
        // State 2
88
        0, -8, 0, -8, -8, -8, -8, -8, -8,
89
        // State 3
90
        0, 14, 0, 15, 0, 0, 16, 17, 18,
91
        // State 4
92
        0, -8, 0, -8, -8, -8, -8, -8, -8,
93
        // State 5
94
        0, -8, 0, -8, -8, -8, -8, -8, -8,
95
        // State 6
96
        0, -8, 0, -8, -8, -8, -8, -8, -8,
97
        // State 7
98
        0, -8, 0, -8, -8, -8, -8, -8, -8,
99
        // State 8
100
        0, 0, 0, 0, 0, 0, 0, 0, 0,
101
        // State 9
102
        0, -12, 0, -12, -12, -12, -12, -12, -12,
103
        // State 10
104
        0, -13, 0, -13, -13, -13, -13, -13, -13,
105
        // State 11
106
        0, -11, 0, -11, 19, 20, -11, -11, -11,
107
        // State 12
108
        0, -7, 0, -7, 0, 0, -7, -7, -7,
109
        // State 13
110
        0, -14, 0, -14, -14, -14, -14, -14, -14,
111
        // State 14
112
        0, -15, 0, -15, -15, -15, -15, -15, -15,
113
        // State 15
114
        0, -16, 0, -16, -16, -16, -16, -16, -16,
115
        // State 16
116
        0, -18, 0, -18, -18, -18, -18, -18, -18,
117
        // State 17
118
        0, -17, 0, -17, -17, -17, -17, -17, -17,
119
        // State 18
120
        0, -9, 0, -9, -9, -9, -9, -9, -9,
121
        // State 19
122
        0, -10, 0, -10, -10, -10, -10, -10, -10,
123
        // State 20
124
        0, -2, 0, -2, 19, 20, -2, -2, -2,
125
        // State 21
126
        0, -5, 0, -5, 19, 20, -5, -5, -5,
127
        // State 22
128
        0, -4, 0, -4, 19, 20, -4, -4, -4,
129
        // State 23
130
        0, -3, 0, -3, 19, 20, -3, -3, -3,
131
    ];
132
    fn __action(state: i8, integer: usize) -> i8 {
133
        __ACTION[(state as usize) * 9 + integer]
134
    }
135
    const __EOF_ACTION: &[i8] = &[
136
        // State 0
137
        0,
138
        // State 1
139
        -6,
140
        // State 2
141
        -8,
142
        // State 3
143
        -1,
144
        // State 4
145
        -8,
146
        // State 5
147
        -8,
148
        // State 6
149
        -8,
150
        // State 7
151
        -8,
152
        // State 8
153
        -19,
154
        // State 9
155
        -12,
156
        // State 10
157
        -13,
158
        // State 11
159
        -11,
160
        // State 12
161
        -7,
162
        // State 13
163
        -14,
164
        // State 14
165
        -15,
166
        // State 15
167
        -16,
168
        // State 16
169
        -18,
170
        // State 17
171
        -17,
172
        // State 18
173
        -9,
174
        // State 19
175
        -10,
176
        // State 20
177
        -2,
178
        // State 21
179
        -5,
180
        // State 22
181
        -4,
182
        // State 23
183
        -3,
184
    ];
185
    fn __goto(state: i8, nt: usize) -> i8 {
186
        match nt {
187
            0 => 8,
188
            1 => 12,
189
            2 => 3,
190
            3 => match state {
191
                4 => 20,
192
                5 => 21,
193
                6 => 22,
194
                7 => 23,
195
                _ => 11,
196
            },
197
            4 => 1,
198
            5 => 2,
199
            6 => 4,
200
            7 => 5,
201
            8 => 6,
202
            9 => 7,
203
            _ => 0,
204
        }
205
    }
206
    const __TERMINAL: &[&str] = &[
207
        r###"PUBLIC_KEY"###,
208
        r###"PUBLIC_SUBKEY"###,
209
        r###"SECRET_KEY"###,
210
        r###"SECRET_SUBKEY"###,
211
        r###"SIGNATURE"###,
212
        r###"TRUST"###,
213
        r###"UNKNOWN"###,
214
        r###"USERID"###,
215
        r###"USER_ATTRIBUTE"###,
216
    ];
217
    fn __expected_tokens(__state: i8) -> alloc::vec::Vec<alloc::string::String> {
218
        __TERMINAL.iter().enumerate().filter_map(|(index, terminal)| {
219
            let next_state = __action(__state, index);
220
            if next_state == 0 {
221
                None
222
            } else {
223
                Some(alloc::string::ToString::to_string(terminal))
224
            }
225
        }).collect()
226
    }
227
    fn __expected_tokens_from_states<
228
    >(
229
        __states: &[i8],
230
        _: core::marker::PhantomData<()>,
231
    ) -> alloc::vec::Vec<alloc::string::String>
232
    {
233
        __TERMINAL.iter().enumerate().filter_map(|(index, terminal)| {
234
            if __accepts(None, __states, Some(index), core::marker::PhantomData::<()>) {
235
                Some(alloc::string::ToString::to_string(terminal))
236
            } else {
237
                None
238
            }
239
        }).collect()
240
    }
241
    pub(crate) struct __StateMachine<>
242
    where 
243
    {
244
        __phantom: core::marker::PhantomData<()>,
245
    }
246
    impl<> __state_machine::ParserDefinition for __StateMachine<>
247
    where 
248
    {
249
        type Location = usize;
250
        type Error = Error;
251
        type Token = lexer::Token;
252
        type TokenIndex = usize;
253
        type Symbol = __Symbol<>;
254
        type Success = Option<Cert>;
255
        type StateIndex = i8;
256
        type Action = i8;
257
        type ReduceIndex = i8;
258
        type NonterminalIndex = usize;
259

            
260
        #[inline]
261
        fn start_location(&self) -> Self::Location {
262
              Default::default()
263
        }
264

            
265
        #[inline]
266
        fn start_state(&self) -> Self::StateIndex {
267
              0
268
        }
269

            
270
        #[inline]
271
        fn token_to_index(&self, token: &Self::Token) -> Option<usize> {
272
            __token_to_integer(token, core::marker::PhantomData::<()>)
273
        }
274

            
275
        #[inline]
276
        fn action(&self, state: i8, integer: usize) -> i8 {
277
            __action(state, integer)
278
        }
279

            
280
        #[inline]
281
        fn error_action(&self, state: i8) -> i8 {
282
            __action(state, 9 - 1)
283
        }
284

            
285
        #[inline]
286
        fn eof_action(&self, state: i8) -> i8 {
287
            __EOF_ACTION[state as usize]
288
        }
289

            
290
        #[inline]
291
        fn goto(&self, state: i8, nt: usize) -> i8 {
292
            __goto(state, nt)
293
        }
294

            
295
        fn token_to_symbol(&self, token_index: usize, token: Self::Token) -> Self::Symbol {
296
            __token_to_symbol(token_index, token, core::marker::PhantomData::<()>)
297
        }
298

            
299
        fn expected_tokens(&self, state: i8) -> alloc::vec::Vec<alloc::string::String> {
300
            __expected_tokens(state)
301
        }
302

            
303
        fn expected_tokens_from_states(&self, states: &[i8]) -> alloc::vec::Vec<alloc::string::String> {
304
            __expected_tokens_from_states(states, core::marker::PhantomData::<()>)
305
        }
306

            
307
        #[inline]
308
        fn uses_error_recovery(&self) -> bool {
309
            false
310
        }
311

            
312
        #[inline]
313
        fn error_recovery_symbol(
314
            &self,
315
            recovery: __state_machine::ErrorRecovery<Self>,
316
        ) -> Self::Symbol {
317
            panic!("error recovery not enabled for this grammar")
318
        }
319

            
320
        fn reduce(
321
            &mut self,
322
            action: i8,
323
            start_location: Option<&Self::Location>,
324
            states: &mut alloc::vec::Vec<i8>,
325
            symbols: &mut alloc::vec::Vec<__state_machine::SymbolTriple<Self>>,
326
        ) -> Option<__state_machine::ParseResult<Self>> {
327
            __reduce(
328
                action,
329
                start_location,
330
                states,
331
                symbols,
332
                core::marker::PhantomData::<()>,
333
            )
334
        }
335

            
336
        fn simulate_reduce(&self, action: i8) -> __state_machine::SimulatedReduce<Self> {
337
            __simulate_reduce(action, core::marker::PhantomData::<()>)
338
        }
339
    }
340
    fn __token_to_integer<
341
    >(
342
        __token: &lexer::Token,
343
        _: core::marker::PhantomData<()>,
344
    ) -> Option<usize>
345
    {
346
        match *__token {
347
            lexer::Token::PublicKey(_) if true => Some(0),
348
            lexer::Token::PublicSubkey(_) if true => Some(1),
349
            lexer::Token::SecretKey(_) if true => Some(2),
350
            lexer::Token::SecretSubkey(_) if true => Some(3),
351
            lexer::Token::Signature(_) if true => Some(4),
352
            lexer::Token::Trust(_) if true => Some(5),
353
            lexer::Token::Unknown(_, _) if true => Some(6),
354
            lexer::Token::UserID(_) if true => Some(7),
355
            lexer::Token::UserAttribute(_) if true => Some(8),
356
            _ => None,
357
        }
358
    }
359
    fn __token_to_symbol<
360
    >(
361
        __token_index: usize,
362
        __token: lexer::Token,
363
        _: core::marker::PhantomData<()>,
364
    ) -> __Symbol<>
365
    {
366
        match __token_index {
367
            0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 => __Symbol::Variant0(__token),
368
            _ => unreachable!(),
369
        }
370
    }
371
    fn __simulate_reduce<
372
    >(
373
        __reduce_index: i8,
374
        _: core::marker::PhantomData<()>,
375
    ) -> __state_machine::SimulatedReduce<__StateMachine<>>
376
    {
377
        match __reduce_index {
378
            0 => {
379
                __state_machine::SimulatedReduce::Reduce {
380
                    states_to_pop: 2,
381
                    nonterminal_produced: 0,
382
                }
383
            }
384
            1 => {
385
                __state_machine::SimulatedReduce::Reduce {
386
                    states_to_pop: 2,
387
                    nonterminal_produced: 1,
388
                }
389
            }
390
            2 => {
391
                __state_machine::SimulatedReduce::Reduce {
392
                    states_to_pop: 2,
393
                    nonterminal_produced: 1,
394
                }
395
            }
396
            3 => {
397
                __state_machine::SimulatedReduce::Reduce {
398
                    states_to_pop: 2,
399
                    nonterminal_produced: 1,
400
                }
401
            }
402
            4 => {
403
                __state_machine::SimulatedReduce::Reduce {
404
                    states_to_pop: 2,
405
                    nonterminal_produced: 1,
406
                }
407
            }
408
            5 => {
409
                __state_machine::SimulatedReduce::Reduce {
410
                    states_to_pop: 0,
411
                    nonterminal_produced: 2,
412
                }
413
            }
414
            6 => {
415
                __state_machine::SimulatedReduce::Reduce {
416
                    states_to_pop: 2,
417
                    nonterminal_produced: 2,
418
                }
419
            }
420
            7 => {
421
                __state_machine::SimulatedReduce::Reduce {
422
                    states_to_pop: 0,
423
                    nonterminal_produced: 3,
424
                }
425
            }
426
            8 => {
427
                __state_machine::SimulatedReduce::Reduce {
428
                    states_to_pop: 2,
429
                    nonterminal_produced: 3,
430
                }
431
            }
432
            9 => {
433
                __state_machine::SimulatedReduce::Reduce {
434
                    states_to_pop: 2,
435
                    nonterminal_produced: 3,
436
                }
437
            }
438
            10 => {
439
                __state_machine::SimulatedReduce::Reduce {
440
                    states_to_pop: 2,
441
                    nonterminal_produced: 4,
442
                }
443
            }
444
            11 => {
445
                __state_machine::SimulatedReduce::Reduce {
446
                    states_to_pop: 1,
447
                    nonterminal_produced: 5,
448
                }
449
            }
450
            12 => {
451
                __state_machine::SimulatedReduce::Reduce {
452
                    states_to_pop: 1,
453
                    nonterminal_produced: 5,
454
                }
455
            }
456
            13 => {
457
                __state_machine::SimulatedReduce::Reduce {
458
                    states_to_pop: 1,
459
                    nonterminal_produced: 6,
460
                }
461
            }
462
            14 => {
463
                __state_machine::SimulatedReduce::Reduce {
464
                    states_to_pop: 1,
465
                    nonterminal_produced: 6,
466
                }
467
            }
468
            15 => {
469
                __state_machine::SimulatedReduce::Reduce {
470
                    states_to_pop: 1,
471
                    nonterminal_produced: 7,
472
                }
473
            }
474
            16 => {
475
                __state_machine::SimulatedReduce::Reduce {
476
                    states_to_pop: 1,
477
                    nonterminal_produced: 8,
478
                }
479
            }
480
            17 => {
481
                __state_machine::SimulatedReduce::Reduce {
482
                    states_to_pop: 1,
483
                    nonterminal_produced: 9,
484
                }
485
            }
486
            18 => __state_machine::SimulatedReduce::Accept,
487
            _ => panic!("invalid reduction index {}", __reduce_index)
488
        }
489
    }
490
    pub struct CertParser {
491
        _priv: (),
492
    }
493

            
494
    impl CertParser {
495
        pub fn new() -> CertParser {
496
            CertParser {
497
                _priv: (),
498
            }
499
        }
500

            
501
        #[allow(dead_code)]
502
        pub fn parse<
503
            __TOKEN: __ToTriple<>,
504
            __TOKENS: IntoIterator<Item=__TOKEN>,
505
        >(
506
            &self,
507
            __tokens0: __TOKENS,
508
        ) -> Result<Option<Cert>, __lalrpop_util::ParseError<usize, lexer::Token, Error>>
509
        {
510
            let __tokens = __tokens0.into_iter();
511
            let mut __tokens = __tokens.map(|t| __ToTriple::to_triple(t));
512
            __state_machine::Parser::drive(
513
                __StateMachine {
514
                    __phantom: core::marker::PhantomData::<()>,
515
                },
516
                __tokens,
517
            )
518
        }
519
    }
520
    fn __accepts<
521
    >(
522
        __error_state: Option<i8>,
523
        __states: &[i8],
524
        __opt_integer: Option<usize>,
525
        _: core::marker::PhantomData<()>,
526
    ) -> bool
527
    {
528
        let mut __states = __states.to_vec();
529
        __states.extend(__error_state);
530
        loop {
531
            let mut __states_len = __states.len();
532
            let __top = __states[__states_len - 1];
533
            let __action = match __opt_integer {
534
                None => __EOF_ACTION[__top as usize],
535
                Some(__integer) => __action(__top, __integer),
536
            };
537
            if __action == 0 { return false; }
538
            if __action > 0 { return true; }
539
            let (__to_pop, __nt) = match __simulate_reduce(-(__action + 1), core::marker::PhantomData::<()>) {
540
                __state_machine::SimulatedReduce::Reduce {
541
                    states_to_pop, nonterminal_produced
542
                } => (states_to_pop, nonterminal_produced),
543
                __state_machine::SimulatedReduce::Accept => return true,
544
            };
545
            __states_len -= __to_pop;
546
            __states.truncate(__states_len);
547
            let __top = __states[__states_len - 1];
548
            let __next_state = __goto(__top, __nt);
549
            __states.push(__next_state);
550
        }
551
    }
552
    pub(crate) fn __reduce<
553
    >(
554
        __action: i8,
555
        __lookahead_start: Option<&usize>,
556
        __states: &mut alloc::vec::Vec<i8>,
557
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
558
        _: core::marker::PhantomData<()>,
559
    ) -> Option<Result<Option<Cert>,__lalrpop_util::ParseError<usize, lexer::Token, Error>>>
560
    {
561
        let (__pop_states, __nonterminal) = match __action {
562
            0 => {
563
                // Cert = Primary, OptionalComponents => ActionFn(1);
564
                assert!(__symbols.len() >= 2);
565
                let __sym1 = __pop_Variant3(__symbols);
566
                let __sym0 = __pop_Variant5(__symbols);
567
                let __start = __sym0.0;
568
                let __end = __sym1.2;
569
                let __nt = match super::__action1::<>(__sym0, __sym1) {
570
                    Ok(v) => v,
571
                    Err(e) => return Some(Err(e)),
572
                };
573
                __symbols.push((__start, __Symbol::Variant1(__nt), __end));
574
                (2, 0)
575
            }
576
            1 => {
577
                __reduce1(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
578
            }
579
            2 => {
580
                __reduce2(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
581
            }
582
            3 => {
583
                __reduce3(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
584
            }
585
            4 => {
586
                __reduce4(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
587
            }
588
            5 => {
589
                __reduce5(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
590
            }
591
            6 => {
592
                __reduce6(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
593
            }
594
            7 => {
595
                __reduce7(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
596
            }
597
            8 => {
598
                __reduce8(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
599
            }
600
            9 => {
601
                __reduce9(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
602
            }
603
            10 => {
604
                __reduce10(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
605
            }
606
            11 => {
607
                __reduce11(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
608
            }
609
            12 => {
610
                __reduce12(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
611
            }
612
            13 => {
613
                __reduce13(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
614
            }
615
            14 => {
616
                __reduce14(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
617
            }
618
            15 => {
619
                __reduce15(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
620
            }
621
            16 => {
622
                __reduce16(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
623
            }
624
            17 => {
625
                __reduce17(__lookahead_start, __symbols, core::marker::PhantomData::<()>)
626
            }
627
            18 => {
628
                // __Cert = Cert => ActionFn(0);
629
                let __sym0 = __pop_Variant1(__symbols);
630
                let __start = __sym0.0;
631
                let __end = __sym0.2;
632
                let __nt = super::__action0::<>(__sym0);
633
                return Some(Ok(__nt));
634
            }
635
            _ => panic!("invalid action code {}", __action)
636
        };
637
        let __states_len = __states.len();
638
        __states.truncate(__states_len - __pop_states);
639
        let __state = *__states.last().unwrap();
640
        let __next_state = __goto(__state, __nonterminal);
641
        __states.push(__next_state);
642
        None
643
    }
644
    #[inline(never)]
645
    fn __symbol_type_mismatch() -> ! {
646
        panic!("symbol type mismatch")
647
    }
648
    fn __pop_Variant5<
649
    >(
650
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
651
    ) -> (usize, Option<(Packet, Vec<Signature>)>, usize)
652
     {
653
        match __symbols.pop() {
654
            Some((__l, __Symbol::Variant5(__v), __r)) => (__l, __v, __r),
655
            _ => __symbol_type_mismatch()
656
        }
657
    }
658
    fn __pop_Variant1<
659
    >(
660
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
661
    ) -> (usize, Option<Cert>, usize)
662
     {
663
        match __symbols.pop() {
664
            Some((__l, __Symbol::Variant1(__v), __r)) => (__l, __v, __r),
665
            _ => __symbol_type_mismatch()
666
        }
667
    }
668
    fn __pop_Variant2<
669
    >(
670
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
671
    ) -> (usize, Option<Component>, usize)
672
     {
673
        match __symbols.pop() {
674
            Some((__l, __Symbol::Variant2(__v), __r)) => (__l, __v, __r),
675
            _ => __symbol_type_mismatch()
676
        }
677
    }
678
    fn __pop_Variant6<
679
    >(
680
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
681
    ) -> (usize, Option<Packet>, usize)
682
     {
683
        match __symbols.pop() {
684
            Some((__l, __Symbol::Variant6(__v), __r)) => (__l, __v, __r),
685
            _ => __symbol_type_mismatch()
686
        }
687
    }
688
    fn __pop_Variant7<
689
    >(
690
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
691
    ) -> (usize, Option<PacketOrUnknown<Key<key::PublicParts, key::SubordinateRole>>>, usize)
692
     {
693
        match __symbols.pop() {
694
            Some((__l, __Symbol::Variant7(__v), __r)) => (__l, __v, __r),
695
            _ => __symbol_type_mismatch()
696
        }
697
    }
698
    fn __pop_Variant9<
699
    >(
700
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
701
    ) -> (usize, Option<PacketOrUnknown<UserAttribute>>, usize)
702
     {
703
        match __symbols.pop() {
704
            Some((__l, __Symbol::Variant9(__v), __r)) => (__l, __v, __r),
705
            _ => __symbol_type_mismatch()
706
        }
707
    }
708
    fn __pop_Variant10<
709
    >(
710
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
711
    ) -> (usize, Option<PacketOrUnknown<UserID>>, usize)
712
     {
713
        match __symbols.pop() {
714
            Some((__l, __Symbol::Variant10(__v), __r)) => (__l, __v, __r),
715
            _ => __symbol_type_mismatch()
716
        }
717
    }
718
    fn __pop_Variant8<
719
    >(
720
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
721
    ) -> (usize, Option<Unknown>, usize)
722
     {
723
        match __symbols.pop() {
724
            Some((__l, __Symbol::Variant8(__v), __r)) => (__l, __v, __r),
725
            _ => __symbol_type_mismatch()
726
        }
727
    }
728
    fn __pop_Variant3<
729
    >(
730
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
731
    ) -> (usize, Option<Vec<Component>>, usize)
732
     {
733
        match __symbols.pop() {
734
            Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r),
735
            _ => __symbol_type_mismatch()
736
        }
737
    }
738
    fn __pop_Variant4<
739
    >(
740
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
741
    ) -> (usize, Option<Vec<Signature>>, usize)
742
     {
743
        match __symbols.pop() {
744
            Some((__l, __Symbol::Variant4(__v), __r)) => (__l, __v, __r),
745
            _ => __symbol_type_mismatch()
746
        }
747
    }
748
    fn __pop_Variant0<
749
    >(
750
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>
751
    ) -> (usize, lexer::Token, usize)
752
     {
753
        match __symbols.pop() {
754
            Some((__l, __Symbol::Variant0(__v), __r)) => (__l, __v, __r),
755
            _ => __symbol_type_mismatch()
756
        }
757
    }
758
    pub(crate) fn __reduce1<
759
    >(
760
        __lookahead_start: Option<&usize>,
761
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
762
        _: core::marker::PhantomData<()>,
763
    ) -> (usize, usize)
764
    {
765
        // Component = Subkey, OptionalSignatures => ActionFn(10);
766
        assert!(__symbols.len() >= 2);
767
        let __sym1 = __pop_Variant4(__symbols);
768
        let __sym0 = __pop_Variant7(__symbols);
769
        let __start = __sym0.0;
770
        let __end = __sym1.2;
771
        let __nt = super::__action10::<>(__sym0, __sym1);
772
        __symbols.push((__start, __Symbol::Variant2(__nt), __end));
773
        (2, 1)
774
    }
775
    pub(crate) fn __reduce2<
776
    >(
777
        __lookahead_start: Option<&usize>,
778
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
779
        _: core::marker::PhantomData<()>,
780
    ) -> (usize, usize)
781
    {
782
        // Component = UserID, OptionalSignatures => ActionFn(11);
783
        assert!(__symbols.len() >= 2);
784
        let __sym1 = __pop_Variant4(__symbols);
785
        let __sym0 = __pop_Variant10(__symbols);
786
        let __start = __sym0.0;
787
        let __end = __sym1.2;
788
        let __nt = super::__action11::<>(__sym0, __sym1);
789
        __symbols.push((__start, __Symbol::Variant2(__nt), __end));
790
        (2, 1)
791
    }
792
    pub(crate) fn __reduce3<
793
    >(
794
        __lookahead_start: Option<&usize>,
795
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
796
        _: core::marker::PhantomData<()>,
797
    ) -> (usize, usize)
798
    {
799
        // Component = UserAttribute, OptionalSignatures => ActionFn(12);
800
        assert!(__symbols.len() >= 2);
801
        let __sym1 = __pop_Variant4(__symbols);
802
        let __sym0 = __pop_Variant9(__symbols);
803
        let __start = __sym0.0;
804
        let __end = __sym1.2;
805
        let __nt = super::__action12::<>(__sym0, __sym1);
806
        __symbols.push((__start, __Symbol::Variant2(__nt), __end));
807
        (2, 1)
808
    }
809
    pub(crate) fn __reduce4<
810
    >(
811
        __lookahead_start: Option<&usize>,
812
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
813
        _: core::marker::PhantomData<()>,
814
    ) -> (usize, usize)
815
    {
816
        // Component = Unknown, OptionalSignatures => ActionFn(13);
817
        assert!(__symbols.len() >= 2);
818
        let __sym1 = __pop_Variant4(__symbols);
819
        let __sym0 = __pop_Variant8(__symbols);
820
        let __start = __sym0.0;
821
        let __end = __sym1.2;
822
        let __nt = super::__action13::<>(__sym0, __sym1);
823
        __symbols.push((__start, __Symbol::Variant2(__nt), __end));
824
        (2, 1)
825
    }
826
    pub(crate) fn __reduce5<
827
    >(
828
        __lookahead_start: Option<&usize>,
829
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
830
        _: core::marker::PhantomData<()>,
831
    ) -> (usize, usize)
832
    {
833
        // OptionalComponents =  => ActionFn(8);
834
        let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default();
835
        let __end = __start.clone();
836
        let __nt = super::__action8::<>(&__start, &__end);
837
        __symbols.push((__start, __Symbol::Variant3(__nt), __end));
838
        (0, 2)
839
    }
840
    pub(crate) fn __reduce6<
841
    >(
842
        __lookahead_start: Option<&usize>,
843
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
844
        _: core::marker::PhantomData<()>,
845
    ) -> (usize, usize)
846
    {
847
        // OptionalComponents = OptionalComponents, Component => ActionFn(9);
848
        assert!(__symbols.len() >= 2);
849
        let __sym1 = __pop_Variant2(__symbols);
850
        let __sym0 = __pop_Variant3(__symbols);
851
        let __start = __sym0.0;
852
        let __end = __sym1.2;
853
        let __nt = super::__action9::<>(__sym0, __sym1);
854
        __symbols.push((__start, __Symbol::Variant3(__nt), __end));
855
        (2, 2)
856
    }
857
    pub(crate) fn __reduce7<
858
    >(
859
        __lookahead_start: Option<&usize>,
860
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
861
        _: core::marker::PhantomData<()>,
862
    ) -> (usize, usize)
863
    {
864
        // OptionalSignatures =  => ActionFn(5);
865
        let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default();
866
        let __end = __start.clone();
867
        let __nt = super::__action5::<>(&__start, &__end);
868
        __symbols.push((__start, __Symbol::Variant4(__nt), __end));
869
        (0, 3)
870
    }
871
    pub(crate) fn __reduce8<
872
    >(
873
        __lookahead_start: Option<&usize>,
874
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
875
        _: core::marker::PhantomData<()>,
876
    ) -> (usize, usize)
877
    {
878
        // OptionalSignatures = OptionalSignatures, SIGNATURE => ActionFn(6);
879
        assert!(__symbols.len() >= 2);
880
        let __sym1 = __pop_Variant0(__symbols);
881
        let __sym0 = __pop_Variant4(__symbols);
882
        let __start = __sym0.0;
883
        let __end = __sym1.2;
884
        let __nt = super::__action6::<>(__sym0, __sym1);
885
        __symbols.push((__start, __Symbol::Variant4(__nt), __end));
886
        (2, 3)
887
    }
888
    pub(crate) fn __reduce9<
889
    >(
890
        __lookahead_start: Option<&usize>,
891
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
892
        _: core::marker::PhantomData<()>,
893
    ) -> (usize, usize)
894
    {
895
        // OptionalSignatures = OptionalSignatures, TRUST => ActionFn(7);
896
        assert!(__symbols.len() >= 2);
897
        let __sym1 = __pop_Variant0(__symbols);
898
        let __sym0 = __pop_Variant4(__symbols);
899
        let __start = __sym0.0;
900
        let __end = __sym1.2;
901
        let __nt = super::__action7::<>(__sym0, __sym1);
902
        __symbols.push((__start, __Symbol::Variant4(__nt), __end));
903
        (2, 3)
904
    }
905
    pub(crate) fn __reduce10<
906
    >(
907
        __lookahead_start: Option<&usize>,
908
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
909
        _: core::marker::PhantomData<()>,
910
    ) -> (usize, usize)
911
    {
912
        // Primary = PrimaryKey, OptionalSignatures => ActionFn(2);
913
        assert!(__symbols.len() >= 2);
914
        let __sym1 = __pop_Variant4(__symbols);
915
        let __sym0 = __pop_Variant6(__symbols);
916
        let __start = __sym0.0;
917
        let __end = __sym1.2;
918
        let __nt = super::__action2::<>(__sym0, __sym1);
919
        __symbols.push((__start, __Symbol::Variant5(__nt), __end));
920
        (2, 4)
921
    }
922
    pub(crate) fn __reduce11<
923
    >(
924
        __lookahead_start: Option<&usize>,
925
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
926
        _: core::marker::PhantomData<()>,
927
    ) -> (usize, usize)
928
    {
929
        // PrimaryKey = PUBLIC_KEY => ActionFn(3);
930
        let __sym0 = __pop_Variant0(__symbols);
931
        let __start = __sym0.0;
932
        let __end = __sym0.2;
933
        let __nt = super::__action3::<>(__sym0);
934
        __symbols.push((__start, __Symbol::Variant6(__nt), __end));
935
        (1, 5)
936
    }
937
    pub(crate) fn __reduce12<
938
    >(
939
        __lookahead_start: Option<&usize>,
940
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
941
        _: core::marker::PhantomData<()>,
942
    ) -> (usize, usize)
943
    {
944
        // PrimaryKey = SECRET_KEY => ActionFn(4);
945
        let __sym0 = __pop_Variant0(__symbols);
946
        let __start = __sym0.0;
947
        let __end = __sym0.2;
948
        let __nt = super::__action4::<>(__sym0);
949
        __symbols.push((__start, __Symbol::Variant6(__nt), __end));
950
        (1, 5)
951
    }
952
    pub(crate) fn __reduce13<
953
    >(
954
        __lookahead_start: Option<&usize>,
955
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
956
        _: core::marker::PhantomData<()>,
957
    ) -> (usize, usize)
958
    {
959
        // Subkey = PUBLIC_SUBKEY => ActionFn(14);
960
        let __sym0 = __pop_Variant0(__symbols);
961
        let __start = __sym0.0;
962
        let __end = __sym0.2;
963
        let __nt = super::__action14::<>(__sym0);
964
        __symbols.push((__start, __Symbol::Variant7(__nt), __end));
965
        (1, 6)
966
    }
967
    pub(crate) fn __reduce14<
968
    >(
969
        __lookahead_start: Option<&usize>,
970
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
971
        _: core::marker::PhantomData<()>,
972
    ) -> (usize, usize)
973
    {
974
        // Subkey = SECRET_SUBKEY => ActionFn(15);
975
        let __sym0 = __pop_Variant0(__symbols);
976
        let __start = __sym0.0;
977
        let __end = __sym0.2;
978
        let __nt = super::__action15::<>(__sym0);
979
        __symbols.push((__start, __Symbol::Variant7(__nt), __end));
980
        (1, 6)
981
    }
982
    pub(crate) fn __reduce15<
983
    >(
984
        __lookahead_start: Option<&usize>,
985
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
986
        _: core::marker::PhantomData<()>,
987
    ) -> (usize, usize)
988
    {
989
        // Unknown = UNKNOWN => ActionFn(18);
990
        let __sym0 = __pop_Variant0(__symbols);
991
        let __start = __sym0.0;
992
        let __end = __sym0.2;
993
        let __nt = super::__action18::<>(__sym0);
994
        __symbols.push((__start, __Symbol::Variant8(__nt), __end));
995
        (1, 7)
996
    }
997
    pub(crate) fn __reduce16<
998
    >(
999
        __lookahead_start: Option<&usize>,
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
        _: core::marker::PhantomData<()>,
    ) -> (usize, usize)
    {
        // UserAttribute = USER_ATTRIBUTE => ActionFn(17);
        let __sym0 = __pop_Variant0(__symbols);
        let __start = __sym0.0;
        let __end = __sym0.2;
        let __nt = super::__action17::<>(__sym0);
        __symbols.push((__start, __Symbol::Variant9(__nt), __end));
        (1, 8)
    }
    pub(crate) fn __reduce17<
    >(
        __lookahead_start: Option<&usize>,
        __symbols: &mut alloc::vec::Vec<(usize,__Symbol<>,usize)>,
        _: core::marker::PhantomData<()>,
    ) -> (usize, usize)
    {
        // UserID = USERID => ActionFn(16);
        let __sym0 = __pop_Variant0(__symbols);
        let __start = __sym0.0;
        let __end = __sym0.2;
        let __nt = super::__action16::<>(__sym0);
        __symbols.push((__start, __Symbol::Variant10(__nt), __end));
        (1, 9)
    }
}
pub use self::__parse__Cert::CertParser;
#[allow(clippy::too_many_arguments)]
fn __action0<
>(
    (_, __0, _): (usize, Option<Cert>, usize),
) -> Option<Cert>
{
    __0
}
#[allow(clippy::too_many_arguments)]
fn __action1<
>(
    (_, p, _): (usize, Option<(Packet, Vec<Signature>)>, usize),
    (_, c, _): (usize, Option<Vec<Component>>, usize),
) -> Result<Option<Cert>,__lalrpop_util::ParseError<usize,lexer::Token,Error>>
{
    {
        match p {
            Some((Packet::PublicKey(_), _))
            | Some((Packet::SecretKey(_), _)) => {
                let (key, sigs) = match p {
                    Some((Packet::PublicKey(key), sigs)) => (key, sigs),
                    Some((Packet::SecretKey(key), sigs)) => (key.into(), sigs),
                    _ => unreachable!(),
                };
                let c = c.unwrap();
                let sec = key.hash_algo_security();
                let mut cert = Cert {
                    primary: PrimaryKeyBundle {
                        component: key,
                        hash_algo_security: sec,
                        self_signatures: vec![],
                        certifications: sigs,
                        attestations: vec![],
                        self_revocations: vec![],
                        other_revocations: vec![],
                    },
                    subkeys: ComponentBundles::new(),
                    userids: ComponentBundles::new(),
                    user_attributes: ComponentBundles::new(),
                    unknowns: ComponentBundles::new(),
                    bad: vec![],
                };
                for c in c.into_iter() {
                    match c {
                        Component::SubkeyBundle(b) =>
                            cert.subkeys.push(b),
                        Component::UserIDBundle(b) =>
                            cert.userids.push(b),
                        Component::UserAttributeBundle(b) =>
                            cert.user_attributes.push(b),
                        Component::UnknownBundle(b) =>
                            cert.unknowns.push(b),
                    }
                }
                Ok(Some(cert))
            }
            Some((Packet::Unknown(unknown), sigs)) => {
                let mut packets: Vec<Packet> = Default::default();
                packets.push(unknown.into());
                for sig in sigs {
                    packets.push(sig.into());
                }
                for c in c.unwrap_or_default().into_iter() {
                    match c {
                        Component::SubkeyBundle(b) =>
                            b.into_packets().for_each(|p| packets.push(p)),
                        Component::UserIDBundle(b) =>
                            b.into_packets().for_each(|p| packets.push(p)),
                        Component::UserAttributeBundle(b) =>
                            b.into_packets().for_each(|p| packets.push(p)),
                        Component::UnknownBundle(b) =>
                            b.into_packets().for_each(|p| packets.push(p)),
                    }
                }
                Err(ParseError::User {
                    error: Error::UnsupportedCert2(
                        "Unsupported primary key".into(),
                        packets),
                })
            }
            None => {
                // Just validating a cert...
                assert!(c.is_none() || c.unwrap().len() == 0);
                Ok(None)
            }
            Some((pkt, _)) =>
              unreachable!("Expected key or unknown packet, got {:?}", pkt),
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action2<
>(
    (_, pk, _): (usize, Option<Packet>, usize),
    (_, sigs, _): (usize, Option<Vec<Signature>>, usize),
) -> Option<(Packet, Vec<Signature>)>
{
    {
        if let Some(pk) = pk {
            Some((pk, sigs.unwrap()))
        } else {
            // Just validating a cert...
            assert!(sigs.is_none() || sigs.unwrap().len() == 0);
            None
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action3<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<Packet>
{
    t.into()
}
#[allow(clippy::too_many_arguments)]
fn __action4<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<Packet>
{
    t.into()
}
#[allow(clippy::too_many_arguments)]
fn __action5<
>(
    __lookbehind: &usize,
    __lookahead: &usize,
) -> Option<Vec<Signature>>
{
    Some(vec![])
}
#[allow(clippy::too_many_arguments)]
fn __action6<
>(
    (_, sigs, _): (usize, Option<Vec<Signature>>, usize),
    (_, sig, _): (usize, lexer::Token, usize),
) -> Option<Vec<Signature>>
{
    {
        match sig {
            Token::Signature(Some(Packet::Signature(sig))) => {
                assert!(sigs.is_some());
                let mut sigs = sigs.unwrap();
                sigs.push(sig);
                Some(sigs)
            }
            Token::Signature(Some(Packet::Unknown(_sig))) => {
                // Ignore unsupported / bad signatures.
                assert!(sigs.is_some());
                sigs
            }
            // Just validating a cert...
            Token::Signature(None) => return None,
            tok => unreachable!("Expected signature token, got {:?}", tok),
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action7<
>(
    (_, __0, _): (usize, Option<Vec<Signature>>, usize),
    (_, _, _): (usize, lexer::Token, usize),
) -> Option<Vec<Signature>>
{
    __0
}
#[allow(clippy::too_many_arguments)]
fn __action8<
>(
    __lookbehind: &usize,
    __lookahead: &usize,
) -> Option<Vec<Component>>
{
    Some(vec![])
}
#[allow(clippy::too_many_arguments)]
fn __action9<
>(
    (_, cs, _): (usize, Option<Vec<Component>>, usize),
    (_, c, _): (usize, Option<Component>, usize),
) -> Option<Vec<Component>>
{
    {
        if let Some(c) = c {
            let mut cs = cs.unwrap();
            cs.push(c);
            Some(cs)
        } else {
            // Just validating a cert...
            None
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action10<
>(
    (_, key, _): (usize, Option<PacketOrUnknown<Key<key::PublicParts, key::SubordinateRole>>>, usize),
    (_, sigs, _): (usize, Option<Vec<Signature>>, usize),
) -> Option<Component>
{
    {
        match key {
            Some(Ok(key)) => {
                let sigs = sigs.unwrap();
                let sec = key.hash_algo_security();
                Some(Component::SubkeyBundle(SubkeyBundle {
                    component: key,
                    hash_algo_security: sec,
                    self_signatures: vec![],
                    certifications: sigs,
                    attestations: vec![],
                    self_revocations: vec![],
                    other_revocations: vec![],
                }))
            },
            Some(Err(u)) => Some(Component::UnknownBundle(UnknownBundle {
                component: u,
                hash_algo_security: SecondPreImageResistance,
                self_signatures: vec![],
                certifications: sigs.unwrap_or_default(),
                attestations: vec![],
                self_revocations: vec![],
                other_revocations: vec![],
            })),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action11<
>(
    (_, u, _): (usize, Option<PacketOrUnknown<UserID>>, usize),
    (_, sigs, _): (usize, Option<Vec<Signature>>, usize),
) -> Option<Component>
{
    {
        match u {
            Some(Ok(u)) => {
                let sigs = sigs.unwrap();
                let sec = u.hash_algo_security();
                Some(Component::UserIDBundle(UserIDBundle {
                    component: u,
                    hash_algo_security: sec,
                    self_signatures: vec![],
                    certifications: sigs,
                    attestations: vec![],
                    self_revocations: vec![],
                    other_revocations: vec![],
                }))
            },
            Some(Err(u)) => Some(Component::UnknownBundle(UnknownBundle {
                component: u,
                hash_algo_security: SecondPreImageResistance,
                self_signatures: vec![],
                certifications: sigs.unwrap_or_default(),
                attestations: vec![],
                self_revocations: vec![],
                other_revocations: vec![],
            })),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action12<
>(
    (_, u, _): (usize, Option<PacketOrUnknown<UserAttribute>>, usize),
    (_, sigs, _): (usize, Option<Vec<Signature>>, usize),
) -> Option<Component>
{
    {
        match u {
            Some(Ok(u)) => {
                let sigs = sigs.unwrap();
                let sec = u.hash_algo_security();
                Some(Component::UserAttributeBundle(UserAttributeBundle {
                    component: u,
                    hash_algo_security: sec,
                    self_signatures: vec![],
                    certifications: sigs,
                    attestations: vec![],
                    self_revocations: vec![],
                    other_revocations: vec![],
                }))
            },
            Some(Err(u)) => Some(Component::UnknownBundle(UnknownBundle {
                component: u,
                hash_algo_security: SecondPreImageResistance,
                self_signatures: vec![],
                certifications: sigs.unwrap_or_default(),
                attestations: vec![],
                self_revocations: vec![],
                other_revocations: vec![],
            })),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action13<
>(
    (_, u, _): (usize, Option<Unknown>, usize),
    (_, sigs, _): (usize, Option<Vec<Signature>>, usize),
) -> Option<Component>
{
    {
        match u {
            Some(u) => {
                let sigs = sigs.unwrap();
                let sec = u.hash_algo_security();
                Some(Component::UnknownBundle(UnknownBundle {
                    component: u,
                    hash_algo_security: sec,
                    self_signatures: vec![],
                    certifications: sigs,
                    attestations: vec![],
                    self_revocations: vec![],
                    other_revocations: vec![],
                }))
            },
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action14<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<PacketOrUnknown<Key<key::PublicParts, key::SubordinateRole>>>
{
    {
        match Option::<Packet>::from(t) {
            Some(p) => Some(p.downcast().map_err(
                |p| p.try_into().expect("infallible for unknown and this packet"))),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action15<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<PacketOrUnknown<Key<key::PublicParts, key::SubordinateRole>>>
{
    {
        match Option::<Packet>::from(t) {
            Some(p) => Some(Any::<key::SecretSubkey>::downcast(p)
                .map_err(
                    |p| p.try_into().expect("infallible for unknown and this packet"))
                .map(|sk| sk.parts_into_public())),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action16<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<PacketOrUnknown<UserID>>
{
    {
        match Option::<Packet>::from(t) {
            Some(p) => Some(p.downcast().map_err(
                |p| p.try_into().expect("infallible for unknown and this packet"))),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action17<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<PacketOrUnknown<UserAttribute>>
{
    {
        match Option::<Packet>::from(t) {
            Some(p) => Some(p.downcast().map_err(
                |p| p.try_into().expect("infallible for unknown and this packet"))),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::too_many_arguments)]
fn __action18<
>(
    (_, t, _): (usize, lexer::Token, usize),
) -> Option<Unknown>
{
    {
        match Option::<Packet>::from(t) {
            Some(p) => p.try_into().ok(),
            // Just validating a cert...
            None => None,
        }
    }
}
#[allow(clippy::type_complexity)]
pub trait __ToTriple<>
{
    fn to_triple(value: Self) -> Result<(usize,lexer::Token,usize), __lalrpop_util::ParseError<usize, lexer::Token, Error>>;
}
impl<> __ToTriple<> for (usize, lexer::Token, usize)
{
    fn to_triple(value: Self) -> Result<(usize,lexer::Token,usize), __lalrpop_util::ParseError<usize, lexer::Token, Error>> {
        Ok(value)
    }
}
impl<> __ToTriple<> for Result<(usize, lexer::Token, usize), Error>
{
    fn to_triple(value: Self) -> Result<(usize,lexer::Token,usize), __lalrpop_util::ParseError<usize, lexer::Token, Error>> {
        match value {
            Ok(v) => Ok(v),
            Err(error) => Err(__lalrpop_util::ParseError::User { error }),
        }
    }
}