parol/parser/
parol_grammar_trait.rs

1// ---------------------------------------------------------
2// This file was generated by parol.
3// It is not intended for manual editing and changes will be
4// lost after next build.
5// ---------------------------------------------------------
6
7// Disable clippy warnings that can result in the way how parol generates code.
8#![allow(clippy::enum_variant_names)]
9#![allow(clippy::large_enum_variant)]
10#![allow(clippy::upper_case_acronyms)]
11
12use parol_runtime::log::trace;
13#[allow(unused_imports)]
14use parol_runtime::parol_macros::{pop_and_reverse_item, pop_item};
15use parol_runtime::parser::{ParseTreeType, UserActionsTrait};
16use parol_runtime::{ParserError, Result, Token};
17
18/// Semantic actions trait generated for the user grammar
19/// All functions have default implementations.
20pub trait ParolGrammarTrait<'t> {
21    /// Semantic action for non-terminal 'Parol'
22    fn parol(&mut self, _arg: &Parol<'t>) -> Result<()> {
23        Ok(())
24    }
25
26    /// Semantic action for non-terminal 'Prolog'
27    fn prolog(&mut self, _arg: &Prolog<'t>) -> Result<()> {
28        Ok(())
29    }
30
31    /// Semantic action for non-terminal 'StartDeclaration'
32    fn start_declaration(&mut self, _arg: &StartDeclaration<'t>) -> Result<()> {
33        Ok(())
34    }
35
36    /// Semantic action for non-terminal 'Declaration'
37    fn declaration(&mut self, _arg: &Declaration<'t>) -> Result<()> {
38        Ok(())
39    }
40
41    /// Semantic action for non-terminal 'ScannerDirectives'
42    fn scanner_directives(&mut self, _arg: &ScannerDirectives<'t>) -> Result<()> {
43        Ok(())
44    }
45
46    /// Semantic action for non-terminal 'ScannerStateDirectives'
47    fn scanner_state_directives(&mut self, _arg: &ScannerStateDirectives<'t>) -> Result<()> {
48        Ok(())
49    }
50
51    /// Semantic action for non-terminal 'GrammarDefinition'
52    fn grammar_definition(&mut self, _arg: &GrammarDefinition<'t>) -> Result<()> {
53        Ok(())
54    }
55
56    /// Semantic action for non-terminal 'DoubleColon'
57    fn double_colon(&mut self, _arg: &DoubleColon<'t>) -> Result<()> {
58        Ok(())
59    }
60
61    /// Semantic action for non-terminal 'Production'
62    fn production(&mut self, _arg: &Production<'t>) -> Result<()> {
63        Ok(())
64    }
65
66    /// Semantic action for non-terminal 'Alternations'
67    fn alternations(&mut self, _arg: &Alternations<'t>) -> Result<()> {
68        Ok(())
69    }
70
71    /// Semantic action for non-terminal 'Alternation'
72    fn alternation(&mut self, _arg: &Alternation<'t>) -> Result<()> {
73        Ok(())
74    }
75
76    /// Semantic action for non-terminal 'Factor'
77    fn factor(&mut self, _arg: &Factor<'t>) -> Result<()> {
78        Ok(())
79    }
80
81    /// Semantic action for non-terminal 'Symbol'
82    fn symbol(&mut self, _arg: &Symbol<'t>) -> Result<()> {
83        Ok(())
84    }
85
86    /// Semantic action for non-terminal 'TokenLiteral'
87    fn token_literal(&mut self, _arg: &TokenLiteral<'t>) -> Result<()> {
88        Ok(())
89    }
90
91    /// Semantic action for non-terminal 'TokenExpression'
92    fn token_expression(&mut self, _arg: &TokenExpression<'t>) -> Result<()> {
93        Ok(())
94    }
95
96    /// Semantic action for non-terminal 'SimpleToken'
97    fn simple_token(&mut self, _arg: &SimpleToken<'t>) -> Result<()> {
98        Ok(())
99    }
100
101    /// Semantic action for non-terminal 'TokenWithStates'
102    fn token_with_states(&mut self, _arg: &TokenWithStates<'t>) -> Result<()> {
103        Ok(())
104    }
105
106    /// Semantic action for non-terminal 'String'
107    fn string(&mut self, _arg: &String<'t>) -> Result<()> {
108        Ok(())
109    }
110
111    /// Semantic action for non-terminal 'RawString'
112    fn raw_string(&mut self, _arg: &RawString<'t>) -> Result<()> {
113        Ok(())
114    }
115
116    /// Semantic action for non-terminal 'Regex'
117    fn regex(&mut self, _arg: &Regex<'t>) -> Result<()> {
118        Ok(())
119    }
120
121    /// Semantic action for non-terminal 'Group'
122    fn group(&mut self, _arg: &Group<'t>) -> Result<()> {
123        Ok(())
124    }
125
126    /// Semantic action for non-terminal 'Optional'
127    fn optional(&mut self, _arg: &Optional<'t>) -> Result<()> {
128        Ok(())
129    }
130
131    /// Semantic action for non-terminal 'Repeat'
132    fn repeat(&mut self, _arg: &Repeat<'t>) -> Result<()> {
133        Ok(())
134    }
135
136    /// Semantic action for non-terminal 'NonTerminal'
137    fn non_terminal(&mut self, _arg: &NonTerminal<'t>) -> Result<()> {
138        Ok(())
139    }
140
141    /// Semantic action for non-terminal 'Identifier'
142    fn identifier(&mut self, _arg: &Identifier<'t>) -> Result<()> {
143        Ok(())
144    }
145
146    /// Semantic action for non-terminal 'ScannerState'
147    fn scanner_state(&mut self, _arg: &ScannerState<'t>) -> Result<()> {
148        Ok(())
149    }
150
151    /// Semantic action for non-terminal 'IdentifierList'
152    fn identifier_list(&mut self, _arg: &IdentifierList<'t>) -> Result<()> {
153        Ok(())
154    }
155
156    /// Semantic action for non-terminal 'ASTControl'
157    fn a_s_t_control(&mut self, _arg: &ASTControl<'t>) -> Result<()> {
158        Ok(())
159    }
160
161    /// Semantic action for non-terminal 'MemberName'
162    fn member_name(&mut self, _arg: &MemberName<'t>) -> Result<()> {
163        Ok(())
164    }
165
166    /// Semantic action for non-terminal 'CutOperator'
167    fn cut_operator(&mut self, _arg: &CutOperator) -> Result<()> {
168        Ok(())
169    }
170
171    /// Semantic action for non-terminal 'UserTypeDeclaration'
172    fn user_type_declaration(&mut self, _arg: &UserTypeDeclaration) -> Result<()> {
173        Ok(())
174    }
175
176    /// Semantic action for non-terminal 'UserTypeName'
177    fn user_type_name(&mut self, _arg: &UserTypeName<'t>) -> Result<()> {
178        Ok(())
179    }
180
181    /// Semantic action for non-terminal 'LookAhead'
182    fn look_ahead(&mut self, _arg: &LookAhead<'t>) -> Result<()> {
183        Ok(())
184    }
185
186    /// Semantic action for non-terminal 'PositiveLookahead'
187    fn positive_lookahead(&mut self, _arg: &PositiveLookahead) -> Result<()> {
188        Ok(())
189    }
190
191    /// Semantic action for non-terminal 'NegativeLookahead'
192    fn negative_lookahead(&mut self, _arg: &NegativeLookahead) -> Result<()> {
193        Ok(())
194    }
195
196    /// This method provides skipped language comments.
197    /// If you need comments please provide your own implementation of this method.
198    fn on_comment(&mut self, _token: Token<'t>) {}
199}
200
201// -------------------------------------------------------------------------------------------------
202//
203// Output Types of productions deduced from the structure of the transformed grammar
204//
205
206///
207/// Type derived for production 7
208///
209/// `Declaration: '%title'^ /* Clipped */ String;`
210///
211#[allow(dead_code)]
212#[derive(Debug, Clone)]
213pub struct DeclarationPercentTitleString<'t> {
214    pub string: String<'t>,
215}
216
217///
218/// Type derived for production 8
219///
220/// `Declaration: '%comment'^ /* Clipped */ String;`
221///
222#[allow(dead_code)]
223#[derive(Debug, Clone)]
224pub struct DeclarationPercentCommentString<'t> {
225    pub string: String<'t>,
226}
227
228///
229/// Type derived for production 9
230///
231/// `Declaration: '%user_type'^ /* Clipped */ Identifier '='^ /* Clipped */ UserTypeName;`
232///
233#[allow(dead_code)]
234#[derive(Debug, Clone)]
235pub struct DeclarationPercentUserUnderscoreTypeIdentifierEquUserTypeName<'t> {
236    pub identifier: Identifier<'t>,
237    pub user_type_name: crate::parser::parol_grammar::UserDefinedTypeName,
238}
239
240///
241/// Type derived for production 10
242///
243/// `Declaration: "%nt_type" Identifier@nt_name "="^ /* Clipped */ UserTypeName@nt_type;`
244///
245#[allow(dead_code)]
246#[derive(Debug, Clone)]
247pub struct DeclarationPercentNtUnderscoreTypeNtNameEquNtType<'t> {
248    pub percent_nt_underscore_type: Token<'t>, /* %nt_type */
249    pub nt_name: Identifier<'t>,
250    pub nt_type: crate::parser::parol_grammar::UserDefinedTypeName,
251}
252
253///
254/// Type derived for production 11
255///
256/// `Declaration: "%t_type" UserTypeName@t_type;`
257///
258#[allow(dead_code)]
259#[derive(Debug, Clone)]
260pub struct DeclarationPercentTUnderscoreTypeTType<'t> {
261    pub percent_t_underscore_type: Token<'t>, /* %t_type */
262    pub t_type: crate::parser::parol_grammar::UserDefinedTypeName,
263}
264
265///
266/// Type derived for production 12
267///
268/// `Declaration: '%grammar_type'^ /* Clipped */ RawString;`
269///
270#[allow(dead_code)]
271#[derive(Debug, Clone)]
272pub struct DeclarationPercentGrammarUnderscoreTypeRawString<'t> {
273    pub raw_string: RawString<'t>,
274}
275
276///
277/// Type derived for production 13
278///
279/// `Declaration: ScannerDirectives;`
280///
281#[allow(dead_code)]
282#[derive(Debug, Clone)]
283pub struct DeclarationScannerDirectives<'t> {
284    pub scanner_directives: ScannerDirectives<'t>,
285}
286
287///
288/// Type derived for production 14
289///
290/// `ScannerDirectives: '%line_comment'^ /* Clipped */ TokenLiteral;`
291///
292#[allow(dead_code)]
293#[derive(Debug, Clone)]
294pub struct ScannerDirectivesPercentLineUnderscoreCommentTokenLiteral<'t> {
295    pub token_literal: TokenLiteral<'t>,
296}
297
298///
299/// Type derived for production 15
300///
301/// `ScannerDirectives: '%block_comment'^ /* Clipped */ TokenLiteral TokenLiteral;`
302///
303#[allow(dead_code)]
304#[derive(Debug, Clone)]
305pub struct ScannerDirectivesPercentBlockUnderscoreCommentTokenLiteralTokenLiteral<'t> {
306    pub token_literal: TokenLiteral<'t>,
307    pub token_literal0: TokenLiteral<'t>,
308}
309
310///
311/// Type derived for production 16
312///
313/// `ScannerDirectives: '%auto_newline_off'^ /* Clipped */;`
314///
315#[allow(dead_code)]
316#[derive(Debug, Clone)]
317pub struct ScannerDirectivesPercentAutoUnderscoreNewlineUnderscoreOff {}
318
319///
320/// Type derived for production 17
321///
322/// `ScannerDirectives: '%auto_ws_off'^ /* Clipped */;`
323///
324#[allow(dead_code)]
325#[derive(Debug, Clone)]
326pub struct ScannerDirectivesPercentAutoUnderscoreWsUnderscoreOff {}
327
328///
329/// Type derived for production 18
330///
331/// `ScannerDirectives: '%on'^ /* Clipped */ IdentifierList ScannerStateDirectives;`
332///
333#[allow(dead_code)]
334#[derive(Debug, Clone)]
335pub struct ScannerDirectivesPercentOnIdentifierListScannerStateDirectives<'t> {
336    pub identifier_list: IdentifierList<'t>,
337    pub scanner_state_directives: crate::parser::parol_grammar::ScannerStateSwitch,
338}
339
340///
341/// Type derived for production 19
342///
343/// `ScannerDirectives: '%allow_unmatched'^ /* Clipped */;`
344///
345#[allow(dead_code)]
346#[derive(Debug, Clone)]
347pub struct ScannerDirectivesPercentAllowUnderscoreUnmatched {}
348
349///
350/// Type derived for production 20
351///
352/// `ScannerStateDirectives: '%enter'^ /* Clipped */ Identifier;`
353///
354#[allow(dead_code)]
355#[derive(Debug, Clone)]
356pub struct ScannerStateDirectivesPercentEnterIdentifier<'t> {
357    pub identifier: Identifier<'t>,
358}
359
360///
361/// Type derived for production 21
362///
363/// `ScannerStateDirectives: '%push'^ /* Clipped */ Identifier;`
364///
365#[allow(dead_code)]
366#[derive(Debug, Clone)]
367pub struct ScannerStateDirectivesPercentPushIdentifier<'t> {
368    pub identifier: Identifier<'t>,
369}
370
371///
372/// Type derived for production 22
373///
374/// `ScannerStateDirectives: '%pop';`
375///
376#[allow(dead_code)]
377#[derive(Debug, Clone)]
378pub struct ScannerStateDirectivesPercentPop<'t> {
379    pub percent_pop: Token<'t>, /* %pop */
380}
381
382///
383/// Type derived for production 34
384///
385/// `Factor: Group;`
386///
387#[allow(dead_code)]
388#[derive(Debug, Clone)]
389pub struct FactorGroup<'t> {
390    pub group: Group<'t>,
391}
392
393///
394/// Type derived for production 35
395///
396/// `Factor: Repeat;`
397///
398#[allow(dead_code)]
399#[derive(Debug, Clone)]
400pub struct FactorRepeat<'t> {
401    pub repeat: Repeat<'t>,
402}
403
404///
405/// Type derived for production 36
406///
407/// `Factor: Optional;`
408///
409#[allow(dead_code)]
410#[derive(Debug, Clone)]
411pub struct FactorOptional<'t> {
412    pub optional: Optional<'t>,
413}
414
415///
416/// Type derived for production 37
417///
418/// `Factor: Symbol;`
419///
420#[allow(dead_code)]
421#[derive(Debug, Clone)]
422pub struct FactorSymbol<'t> {
423    pub symbol: Symbol<'t>,
424}
425
426///
427/// Type derived for production 38
428///
429/// `Symbol: NonTerminal;`
430///
431#[allow(dead_code)]
432#[derive(Debug, Clone)]
433pub struct SymbolNonTerminal<'t> {
434    pub non_terminal: NonTerminal<'t>,
435}
436
437///
438/// Type derived for production 39
439///
440/// `Symbol: SimpleToken;`
441///
442#[allow(dead_code)]
443#[derive(Debug, Clone)]
444pub struct SymbolSimpleToken<'t> {
445    pub simple_token: SimpleToken<'t>,
446}
447
448///
449/// Type derived for production 40
450///
451/// `Symbol: TokenWithStates;`
452///
453#[allow(dead_code)]
454#[derive(Debug, Clone)]
455pub struct SymbolTokenWithStates<'t> {
456    pub token_with_states: TokenWithStates<'t>,
457}
458
459///
460/// Type derived for production 41
461///
462/// `TokenLiteral: String;`
463///
464#[allow(dead_code)]
465#[derive(Debug, Clone)]
466pub struct TokenLiteralString<'t> {
467    pub string: String<'t>,
468}
469
470///
471/// Type derived for production 42
472///
473/// `TokenLiteral: RawString;`
474///
475#[allow(dead_code)]
476#[derive(Debug, Clone)]
477pub struct TokenLiteralRawString<'t> {
478    pub raw_string: RawString<'t>,
479}
480
481///
482/// Type derived for production 43
483///
484/// `TokenLiteral: Regex;`
485///
486#[allow(dead_code)]
487#[derive(Debug, Clone)]
488pub struct TokenLiteralRegex<'t> {
489    pub regex: Regex<'t>,
490}
491
492///
493/// Type derived for production 69
494///
495/// `ASTControl: CutOperator;`
496///
497#[allow(dead_code)]
498#[derive(Debug, Clone)]
499pub struct ASTControlCutOperator {
500    pub cut_operator: CutOperator,
501}
502
503///
504/// Type derived for production 70
505///
506/// `ASTControl: MemberName ASTControlOpt /* Option */;`
507///
508#[allow(dead_code)]
509#[derive(Debug, Clone)]
510pub struct ASTControlMemberNameASTControlOpt<'t> {
511    pub member_name: MemberName<'t>,
512    pub a_s_t_control_opt: Option<ASTControlOpt>,
513}
514
515///
516/// Type derived for production 71
517///
518/// `ASTControl: UserTypeDeclaration;`
519///
520#[allow(dead_code)]
521#[derive(Debug, Clone)]
522pub struct ASTControlUserTypeDeclaration {
523    pub user_type_declaration: UserTypeDeclaration,
524}
525
526///
527/// Type derived for production 81
528///
529/// `LookAheadGroup: PositiveLookahead;`
530///
531#[allow(dead_code)]
532#[derive(Debug, Clone)]
533pub struct LookAheadGroupPositiveLookahead {
534    pub positive_lookahead: PositiveLookahead,
535}
536
537///
538/// Type derived for production 82
539///
540/// `LookAheadGroup: NegativeLookahead;`
541///
542#[allow(dead_code)]
543#[derive(Debug, Clone)]
544pub struct LookAheadGroupNegativeLookahead {
545    pub negative_lookahead: NegativeLookahead,
546}
547
548// -------------------------------------------------------------------------------------------------
549//
550// Types of non-terminals deduced from the structure of the transformed grammar
551//
552
553///
554/// Type derived for non-terminal ASTControl
555///
556#[allow(dead_code)]
557#[derive(Debug, Clone)]
558pub enum ASTControl<'t> {
559    CutOperator(ASTControlCutOperator),
560    MemberNameASTControlOpt(ASTControlMemberNameASTControlOpt<'t>),
561    UserTypeDeclaration(ASTControlUserTypeDeclaration),
562}
563
564///
565/// Type derived for non-terminal ASTControlOpt
566///
567#[allow(dead_code)]
568#[derive(Debug, Clone)]
569pub struct ASTControlOpt {
570    pub user_type_declaration: UserTypeDeclaration,
571}
572
573///
574/// Type derived for non-terminal Alternation
575///
576#[allow(dead_code)]
577#[derive(Debug, Clone)]
578pub struct Alternation<'t> {
579    pub alternation_list: Vec<AlternationList<'t>>,
580}
581
582///
583/// Type derived for non-terminal AlternationList
584///
585#[allow(dead_code)]
586#[derive(Debug, Clone)]
587pub struct AlternationList<'t> {
588    pub factor: Factor<'t>,
589}
590
591///
592/// Type derived for non-terminal Alternations
593///
594#[allow(dead_code)]
595#[derive(Debug, Clone)]
596pub struct Alternations<'t> {
597    pub alternation: Alternation<'t>,
598    pub alternations_list: Vec<AlternationsList<'t>>,
599}
600
601///
602/// Type derived for non-terminal AlternationsList
603///
604#[allow(dead_code)]
605#[derive(Debug, Clone)]
606pub struct AlternationsList<'t> {
607    pub alternation: Alternation<'t>,
608}
609
610///
611/// Type derived for non-terminal CutOperator
612///
613#[allow(dead_code)]
614#[derive(Debug, Clone)]
615pub struct CutOperator {}
616
617///
618/// Type derived for non-terminal Declaration
619///
620#[allow(dead_code)]
621#[derive(Debug, Clone)]
622pub enum Declaration<'t> {
623    PercentTitleString(DeclarationPercentTitleString<'t>),
624    PercentCommentString(DeclarationPercentCommentString<'t>),
625    PercentUserUnderscoreTypeIdentifierEquUserTypeName(
626        DeclarationPercentUserUnderscoreTypeIdentifierEquUserTypeName<'t>,
627    ),
628    PercentNtUnderscoreTypeNtNameEquNtType(DeclarationPercentNtUnderscoreTypeNtNameEquNtType<'t>),
629    PercentTUnderscoreTypeTType(DeclarationPercentTUnderscoreTypeTType<'t>),
630    PercentGrammarUnderscoreTypeRawString(DeclarationPercentGrammarUnderscoreTypeRawString<'t>),
631    ScannerDirectives(DeclarationScannerDirectives<'t>),
632}
633
634///
635/// Type derived for non-terminal DoubleColon
636///
637#[allow(dead_code)]
638#[derive(Debug, Clone)]
639pub struct DoubleColon<'t> {
640    pub double_colon: Token<'t>, /* :: */
641}
642
643///
644/// Type derived for non-terminal Factor
645///
646#[allow(dead_code)]
647#[derive(Debug, Clone)]
648pub enum Factor<'t> {
649    Group(FactorGroup<'t>),
650    Repeat(FactorRepeat<'t>),
651    Optional(FactorOptional<'t>),
652    Symbol(FactorSymbol<'t>),
653}
654
655///
656/// Type derived for non-terminal GrammarDefinition
657///
658#[allow(dead_code)]
659#[derive(Debug, Clone)]
660pub struct GrammarDefinition<'t> {
661    pub production: Production<'t>,
662    pub grammar_definition_list: Vec<GrammarDefinitionList<'t>>,
663}
664
665///
666/// Type derived for non-terminal GrammarDefinitionList
667///
668#[allow(dead_code)]
669#[derive(Debug, Clone)]
670pub struct GrammarDefinitionList<'t> {
671    pub production: Production<'t>,
672}
673
674///
675/// Type derived for non-terminal Group
676///
677#[allow(dead_code)]
678#[derive(Debug, Clone)]
679pub struct Group<'t> {
680    pub l_paren: Token<'t>, /* ( */
681    pub alternations: Alternations<'t>,
682    pub r_paren: Token<'t>, /* ) */
683}
684
685///
686/// Type derived for non-terminal Identifier
687///
688#[allow(dead_code)]
689#[derive(Debug, Clone)]
690pub struct Identifier<'t> {
691    pub identifier: Token<'t>, /* [a-zA-Z_][a-zA-Z0-9_]* */
692}
693
694///
695/// Type derived for non-terminal IdentifierList
696///
697#[allow(dead_code)]
698#[derive(Debug, Clone)]
699pub struct IdentifierList<'t> {
700    pub identifier: Identifier<'t>,
701    pub identifier_list_list: Vec<IdentifierListList<'t>>,
702}
703
704///
705/// Type derived for non-terminal IdentifierListList
706///
707#[allow(dead_code)]
708#[derive(Debug, Clone)]
709pub struct IdentifierListList<'t> {
710    pub identifier: Identifier<'t>,
711}
712
713///
714/// Type derived for non-terminal LookAhead
715///
716#[allow(dead_code)]
717#[derive(Debug, Clone)]
718pub struct LookAhead<'t> {
719    pub look_ahead_group: LookAheadGroup,
720    pub token_literal: TokenLiteral<'t>,
721}
722
723///
724/// Type derived for non-terminal LookAheadGroup
725///
726#[allow(dead_code)]
727#[derive(Debug, Clone)]
728pub enum LookAheadGroup {
729    PositiveLookahead(LookAheadGroupPositiveLookahead),
730    NegativeLookahead(LookAheadGroupNegativeLookahead),
731}
732
733///
734/// Type derived for non-terminal MemberName
735///
736#[allow(dead_code)]
737#[derive(Debug, Clone)]
738pub struct MemberName<'t> {
739    pub identifier: Identifier<'t>,
740}
741
742///
743/// Type derived for non-terminal NegativeLookahead
744///
745#[allow(dead_code)]
746#[derive(Debug, Clone)]
747pub struct NegativeLookahead {}
748
749///
750/// Type derived for non-terminal NonTerminal
751///
752#[allow(dead_code)]
753#[derive(Debug, Clone)]
754pub struct NonTerminal<'t> {
755    pub identifier: Identifier<'t>,
756    pub non_terminal_opt: Option<NonTerminalOpt<'t>>,
757}
758
759///
760/// Type derived for non-terminal NonTerminalOpt
761///
762#[allow(dead_code)]
763#[derive(Debug, Clone)]
764pub struct NonTerminalOpt<'t> {
765    pub a_s_t_control: ASTControl<'t>,
766}
767
768///
769/// Type derived for non-terminal Optional
770///
771#[allow(dead_code)]
772#[derive(Debug, Clone)]
773pub struct Optional<'t> {
774    pub l_bracket: Token<'t>, /* [ */
775    pub alternations: Alternations<'t>,
776    pub r_bracket: Token<'t>, /* ] */
777}
778
779///
780/// Type derived for non-terminal Parol
781///
782#[allow(dead_code)]
783#[derive(Debug, Clone)]
784pub struct Parol<'t> {
785    pub prolog: Prolog<'t>,
786    pub grammar_definition: GrammarDefinition<'t>,
787}
788
789///
790/// Type derived for non-terminal PositiveLookahead
791///
792#[allow(dead_code)]
793#[derive(Debug, Clone)]
794pub struct PositiveLookahead {}
795
796///
797/// Type derived for non-terminal Production
798///
799#[allow(dead_code)]
800#[derive(Debug, Clone)]
801pub struct Production<'t> {
802    pub identifier: Identifier<'t>,
803    pub alternations: Alternations<'t>,
804}
805
806///
807/// Type derived for non-terminal Prolog
808///
809#[allow(dead_code)]
810#[derive(Debug, Clone)]
811pub struct Prolog<'t> {
812    pub start_declaration: StartDeclaration<'t>,
813    pub prolog_list: Vec<PrologList<'t>>,
814    pub prolog_list0: Vec<PrologList0>,
815}
816
817///
818/// Type derived for non-terminal PrologList
819///
820#[allow(dead_code)]
821#[derive(Debug, Clone)]
822pub struct PrologList<'t> {
823    pub declaration: Declaration<'t>,
824}
825
826///
827/// Type derived for non-terminal PrologList0
828///
829#[allow(dead_code)]
830#[derive(Debug, Clone)]
831pub struct PrologList0 {
832    pub scanner_state: crate::parser::parol_grammar::ScannerConfig,
833}
834
835///
836/// Type derived for non-terminal RawString
837///
838#[allow(dead_code)]
839#[derive(Debug, Clone)]
840pub struct RawString<'t> {
841    pub raw_string: Token<'t>, /* '(\\.|[^'])*' */
842}
843
844///
845/// Type derived for non-terminal Regex
846///
847#[allow(dead_code)]
848#[derive(Debug, Clone)]
849pub struct Regex<'t> {
850    pub regex: Token<'t>, /* /(\\.|[^\/])*\/ */
851}
852
853///
854/// Type derived for non-terminal Repeat
855///
856#[allow(dead_code)]
857#[derive(Debug, Clone)]
858pub struct Repeat<'t> {
859    pub l_brace: Token<'t>, /* { */
860    pub alternations: Alternations<'t>,
861    pub r_brace: Token<'t>, /* } */
862}
863
864///
865/// Type derived for non-terminal ScannerDirectives
866///
867#[allow(dead_code)]
868#[derive(Debug, Clone)]
869pub enum ScannerDirectives<'t> {
870    PercentLineUnderscoreCommentTokenLiteral(
871        ScannerDirectivesPercentLineUnderscoreCommentTokenLiteral<'t>,
872    ),
873    PercentBlockUnderscoreCommentTokenLiteralTokenLiteral(
874        ScannerDirectivesPercentBlockUnderscoreCommentTokenLiteralTokenLiteral<'t>,
875    ),
876    PercentAutoUnderscoreNewlineUnderscoreOff(
877        ScannerDirectivesPercentAutoUnderscoreNewlineUnderscoreOff,
878    ),
879    PercentAutoUnderscoreWsUnderscoreOff(ScannerDirectivesPercentAutoUnderscoreWsUnderscoreOff),
880    PercentOnIdentifierListScannerStateDirectives(
881        ScannerDirectivesPercentOnIdentifierListScannerStateDirectives<'t>,
882    ),
883    PercentAllowUnderscoreUnmatched(ScannerDirectivesPercentAllowUnderscoreUnmatched),
884}
885
886///
887/// Type derived for non-terminal ScannerState
888///
889#[allow(dead_code)]
890#[derive(Debug, Clone)]
891pub struct ScannerState<'t> {
892    pub state_name: Identifier<'t>,
893    pub scanner_state_list: Vec<ScannerStateList<'t>>,
894}
895
896///
897/// Type derived for non-terminal ScannerStateDirectives
898///
899#[allow(dead_code)]
900#[derive(Debug, Clone)]
901pub enum ScannerStateDirectives<'t> {
902    PercentEnterIdentifier(ScannerStateDirectivesPercentEnterIdentifier<'t>),
903    PercentPushIdentifier(ScannerStateDirectivesPercentPushIdentifier<'t>),
904    PercentPop(ScannerStateDirectivesPercentPop<'t>),
905}
906
907///
908/// Type derived for non-terminal ScannerStateList
909///
910#[allow(dead_code)]
911#[derive(Debug, Clone)]
912pub struct ScannerStateList<'t> {
913    pub scanner_directives: ScannerDirectives<'t>,
914}
915
916///
917/// Type derived for non-terminal SimpleToken
918///
919#[allow(dead_code)]
920#[derive(Debug, Clone)]
921pub struct SimpleToken<'t> {
922    pub token_expression: TokenExpression<'t>,
923    pub simple_token_opt: Option<SimpleTokenOpt<'t>>,
924}
925
926///
927/// Type derived for non-terminal SimpleTokenOpt
928///
929#[allow(dead_code)]
930#[derive(Debug, Clone)]
931pub struct SimpleTokenOpt<'t> {
932    pub a_s_t_control: ASTControl<'t>,
933}
934
935///
936/// Type derived for non-terminal StartDeclaration
937///
938#[allow(dead_code)]
939#[derive(Debug, Clone)]
940pub struct StartDeclaration<'t> {
941    pub identifier: Identifier<'t>,
942}
943
944///
945/// Type derived for non-terminal String
946///
947#[allow(dead_code)]
948#[derive(Debug, Clone)]
949pub struct String<'t> {
950    pub string: Token<'t>, /* "(\\.|[^"])*" */
951}
952
953///
954/// Type derived for non-terminal Symbol
955///
956#[allow(dead_code)]
957#[derive(Debug, Clone)]
958pub enum Symbol<'t> {
959    NonTerminal(SymbolNonTerminal<'t>),
960    SimpleToken(SymbolSimpleToken<'t>),
961    TokenWithStates(SymbolTokenWithStates<'t>),
962}
963
964///
965/// Type derived for non-terminal TokenExpression
966///
967#[allow(dead_code)]
968#[derive(Debug, Clone)]
969pub struct TokenExpression<'t> {
970    pub token_literal: TokenLiteral<'t>,
971    pub token_expression_opt: Option<TokenExpressionOpt<'t>>,
972}
973
974///
975/// Type derived for non-terminal TokenExpressionOpt
976///
977#[allow(dead_code)]
978#[derive(Debug, Clone)]
979pub struct TokenExpressionOpt<'t> {
980    pub look_ahead: LookAhead<'t>,
981}
982
983///
984/// Type derived for non-terminal TokenLiteral
985///
986#[allow(dead_code)]
987#[derive(Debug, Clone)]
988pub enum TokenLiteral<'t> {
989    String(TokenLiteralString<'t>),
990    RawString(TokenLiteralRawString<'t>),
991    Regex(TokenLiteralRegex<'t>),
992}
993
994///
995/// Type derived for non-terminal TokenWithStates
996///
997#[allow(dead_code)]
998#[derive(Debug, Clone)]
999pub struct TokenWithStates<'t> {
1000    pub identifier_list: IdentifierList<'t>,
1001    pub token_expression: TokenExpression<'t>,
1002    pub token_with_states_opt: Option<TokenWithStatesOpt<'t>>,
1003}
1004
1005///
1006/// Type derived for non-terminal TokenWithStatesOpt
1007///
1008#[allow(dead_code)]
1009#[derive(Debug, Clone)]
1010pub struct TokenWithStatesOpt<'t> {
1011    pub a_s_t_control: ASTControl<'t>,
1012}
1013
1014///
1015/// Type derived for non-terminal UserTypeDeclaration
1016///
1017#[allow(dead_code)]
1018#[derive(Debug, Clone)]
1019pub struct UserTypeDeclaration {
1020    pub user_type_name: crate::parser::parol_grammar::UserDefinedTypeName,
1021}
1022
1023///
1024/// Type derived for non-terminal UserTypeName
1025///
1026#[allow(dead_code)]
1027#[derive(Debug, Clone)]
1028pub struct UserTypeName<'t> {
1029    pub identifier: Identifier<'t>,
1030    pub user_type_name_list: Vec<UserTypeNameList<'t>>,
1031}
1032
1033///
1034/// Type derived for non-terminal UserTypeNameList
1035///
1036#[allow(dead_code)]
1037#[derive(Debug, Clone)]
1038pub struct UserTypeNameList<'t> {
1039    pub identifier: Identifier<'t>,
1040}
1041
1042// -------------------------------------------------------------------------------------------------
1043
1044///
1045/// Deduced ASTType of expanded grammar
1046///
1047#[allow(dead_code)]
1048#[derive(Debug, Clone)]
1049pub enum ASTType<'t> {
1050    ASTControl(ASTControl<'t>),
1051    ASTControlOpt(Option<ASTControlOpt>),
1052    Alternation(Alternation<'t>),
1053    AlternationList(Vec<AlternationList<'t>>),
1054    Alternations(Alternations<'t>),
1055    AlternationsList(Vec<AlternationsList<'t>>),
1056    CutOperator(CutOperator),
1057    Declaration(Declaration<'t>),
1058    DoubleColon(DoubleColon<'t>),
1059    Factor(Factor<'t>),
1060    GrammarDefinition(GrammarDefinition<'t>),
1061    GrammarDefinitionList(Vec<GrammarDefinitionList<'t>>),
1062    Group(Group<'t>),
1063    Identifier(Identifier<'t>),
1064    IdentifierList(IdentifierList<'t>),
1065    IdentifierListList(Vec<IdentifierListList<'t>>),
1066    LookAhead(LookAhead<'t>),
1067    LookAheadGroup(LookAheadGroup),
1068    MemberName(MemberName<'t>),
1069    NegativeLookahead(NegativeLookahead),
1070    NonTerminal(NonTerminal<'t>),
1071    NonTerminalOpt(Option<NonTerminalOpt<'t>>),
1072    Optional(Optional<'t>),
1073    Parol(Parol<'t>),
1074    PositiveLookahead(PositiveLookahead),
1075    Production(Production<'t>),
1076    Prolog(Prolog<'t>),
1077    PrologList(Vec<PrologList<'t>>),
1078    PrologList0(Vec<PrologList0>),
1079    RawString(RawString<'t>),
1080    Regex(Regex<'t>),
1081    Repeat(Repeat<'t>),
1082    ScannerDirectives(ScannerDirectives<'t>),
1083    ScannerState(ScannerState<'t>),
1084    ScannerStateDirectives(ScannerStateDirectives<'t>),
1085    ScannerStateList(Vec<ScannerStateList<'t>>),
1086    SimpleToken(SimpleToken<'t>),
1087    SimpleTokenOpt(Option<SimpleTokenOpt<'t>>),
1088    StartDeclaration(StartDeclaration<'t>),
1089    String(String<'t>),
1090    Symbol(Symbol<'t>),
1091    TokenExpression(TokenExpression<'t>),
1092    TokenExpressionOpt(Option<TokenExpressionOpt<'t>>),
1093    TokenLiteral(TokenLiteral<'t>),
1094    TokenWithStates(TokenWithStates<'t>),
1095    TokenWithStatesOpt(Option<TokenWithStatesOpt<'t>>),
1096    UserTypeDeclaration(UserTypeDeclaration),
1097    UserTypeName(UserTypeName<'t>),
1098    UserTypeNameList(Vec<UserTypeNameList<'t>>),
1099}
1100
1101// -------------------------------------------------------------------------------------------------
1102
1103/// Auto-implemented adapter grammar
1104///
1105/// The lifetime parameter `'t` refers to the lifetime of the scanned text.
1106/// The lifetime parameter `'u` refers to the lifetime of user grammar object.
1107///
1108#[allow(dead_code)]
1109pub struct ParolGrammarAuto<'t, 'u>
1110where
1111    't: 'u,
1112{
1113    // Mutable reference of the actual user grammar to be able to call the semantic actions on it
1114    user_grammar: &'u mut dyn ParolGrammarTrait<'t>,
1115    // Stack to construct the AST on it
1116    item_stack: Vec<ASTType<'t>>,
1117}
1118
1119///
1120/// The `ParolGrammarAuto` impl is automatically generated for the
1121/// given grammar.
1122///
1123impl<'t, 'u> ParolGrammarAuto<'t, 'u> {
1124    pub fn new(user_grammar: &'u mut dyn ParolGrammarTrait<'t>) -> Self {
1125        Self {
1126            user_grammar,
1127            item_stack: Vec::new(),
1128        }
1129    }
1130
1131    #[allow(dead_code)]
1132    fn push(&mut self, item: ASTType<'t>, context: &str) {
1133        trace!("push    {context}: {item:?}");
1134        self.item_stack.push(item)
1135    }
1136
1137    #[allow(dead_code)]
1138    fn pop(&mut self, context: &str) -> Option<ASTType<'t>> {
1139        let item = self.item_stack.pop();
1140        if let Some(ref item) = item {
1141            trace!("pop     {context}: {item:?}");
1142        }
1143        item
1144    }
1145
1146    #[allow(dead_code)]
1147    // Use this function for debugging purposes:
1148    // trace!("{}", self.trace_item_stack(context));
1149    fn trace_item_stack(&self, context: &str) -> std::string::String {
1150        format!(
1151            "Item stack at {}:\n{}",
1152            context,
1153            self.item_stack
1154                .iter()
1155                .rev()
1156                .map(|s| format!("  {s:?}"))
1157                .collect::<Vec<std::string::String>>()
1158                .join("\n")
1159        )
1160    }
1161
1162    /// Semantic action for production 0:
1163    ///
1164    /// `Parol: Prolog GrammarDefinition;`
1165    ///
1166    #[parol_runtime::function_name::named]
1167    fn parol(
1168        &mut self,
1169        _prolog: &ParseTreeType<'t>,
1170        _grammar_definition: &ParseTreeType<'t>,
1171    ) -> Result<()> {
1172        let context = function_name!();
1173        trace!("{}", self.trace_item_stack(context));
1174        let grammar_definition = pop_item!(self, grammar_definition, GrammarDefinition, context);
1175        let prolog = pop_item!(self, prolog, Prolog, context);
1176        let parol_built = Parol {
1177            prolog,
1178            grammar_definition,
1179        };
1180        // Calling user action here
1181        self.user_grammar.parol(&parol_built)?;
1182        self.push(ASTType::Parol(parol_built), context);
1183        Ok(())
1184    }
1185
1186    /// Semantic action for production 1:
1187    ///
1188    /// `Prolog: StartDeclaration PrologList /* Vec */ PrologList0 /* Vec */;`
1189    ///
1190    #[parol_runtime::function_name::named]
1191    fn prolog(
1192        &mut self,
1193        _start_declaration: &ParseTreeType<'t>,
1194        _prolog_list: &ParseTreeType<'t>,
1195        _prolog_list0: &ParseTreeType<'t>,
1196    ) -> Result<()> {
1197        let context = function_name!();
1198        trace!("{}", self.trace_item_stack(context));
1199        let prolog_list0 = pop_and_reverse_item!(self, prolog_list0, PrologList0, context);
1200        let prolog_list = pop_and_reverse_item!(self, prolog_list, PrologList, context);
1201        let start_declaration = pop_item!(self, start_declaration, StartDeclaration, context);
1202        let prolog_built = Prolog {
1203            start_declaration,
1204            prolog_list,
1205            prolog_list0,
1206        };
1207        // Calling user action here
1208        self.user_grammar.prolog(&prolog_built)?;
1209        self.push(ASTType::Prolog(prolog_built), context);
1210        Ok(())
1211    }
1212
1213    /// Semantic action for production 2:
1214    ///
1215    /// `PrologList0 /* Vec<T>::Push */: ScannerState PrologList0;`
1216    ///
1217    #[parol_runtime::function_name::named]
1218    fn prolog_list0_0(
1219        &mut self,
1220        _scanner_state: &ParseTreeType<'t>,
1221        _prolog_list0: &ParseTreeType<'t>,
1222    ) -> Result<()> {
1223        let context = function_name!();
1224        trace!("{}", self.trace_item_stack(context));
1225        let mut prolog_list0 = pop_item!(self, prolog_list0, PrologList0, context);
1226        let scanner_state = pop_item!(self, scanner_state, ScannerState, context);
1227        let prolog_list0_0_built = PrologList0 {
1228            scanner_state: (&scanner_state)
1229                .try_into()
1230                .map_err(parol_runtime::ParolError::UserError)?,
1231        };
1232        // Add an element to the vector
1233        prolog_list0.push(prolog_list0_0_built);
1234        self.push(ASTType::PrologList0(prolog_list0), context);
1235        Ok(())
1236    }
1237
1238    /// Semantic action for production 3:
1239    ///
1240    /// `PrologList0 /* Vec<T>::New */: ;`
1241    ///
1242    #[parol_runtime::function_name::named]
1243    fn prolog_list0_1(&mut self) -> Result<()> {
1244        let context = function_name!();
1245        trace!("{}", self.trace_item_stack(context));
1246        let prolog_list0_1_built = Vec::new();
1247        self.push(ASTType::PrologList0(prolog_list0_1_built), context);
1248        Ok(())
1249    }
1250
1251    /// Semantic action for production 4:
1252    ///
1253    /// `PrologList /* Vec<T>::Push */: Declaration PrologList;`
1254    ///
1255    #[parol_runtime::function_name::named]
1256    fn prolog_list_0(
1257        &mut self,
1258        _declaration: &ParseTreeType<'t>,
1259        _prolog_list: &ParseTreeType<'t>,
1260    ) -> Result<()> {
1261        let context = function_name!();
1262        trace!("{}", self.trace_item_stack(context));
1263        let mut prolog_list = pop_item!(self, prolog_list, PrologList, context);
1264        let declaration = pop_item!(self, declaration, Declaration, context);
1265        let prolog_list_0_built = PrologList { declaration };
1266        // Add an element to the vector
1267        prolog_list.push(prolog_list_0_built);
1268        self.push(ASTType::PrologList(prolog_list), context);
1269        Ok(())
1270    }
1271
1272    /// Semantic action for production 5:
1273    ///
1274    /// `PrologList /* Vec<T>::New */: ;`
1275    ///
1276    #[parol_runtime::function_name::named]
1277    fn prolog_list_1(&mut self) -> Result<()> {
1278        let context = function_name!();
1279        trace!("{}", self.trace_item_stack(context));
1280        let prolog_list_1_built = Vec::new();
1281        self.push(ASTType::PrologList(prolog_list_1_built), context);
1282        Ok(())
1283    }
1284
1285    /// Semantic action for production 6:
1286    ///
1287    /// `StartDeclaration: '%start'^ /* Clipped */ Identifier;`
1288    ///
1289    #[parol_runtime::function_name::named]
1290    fn start_declaration(
1291        &mut self,
1292        _percent_start: &ParseTreeType<'t>,
1293        _identifier: &ParseTreeType<'t>,
1294    ) -> Result<()> {
1295        let context = function_name!();
1296        trace!("{}", self.trace_item_stack(context));
1297        let identifier = pop_item!(self, identifier, Identifier, context);
1298        let start_declaration_built = StartDeclaration { identifier };
1299        // Calling user action here
1300        self.user_grammar
1301            .start_declaration(&start_declaration_built)?;
1302        self.push(ASTType::StartDeclaration(start_declaration_built), context);
1303        Ok(())
1304    }
1305
1306    /// Semantic action for production 7:
1307    ///
1308    /// `Declaration: '%title'^ /* Clipped */ String;`
1309    ///
1310    #[parol_runtime::function_name::named]
1311    fn declaration_0(
1312        &mut self,
1313        _percent_title: &ParseTreeType<'t>,
1314        _string: &ParseTreeType<'t>,
1315    ) -> Result<()> {
1316        let context = function_name!();
1317        trace!("{}", self.trace_item_stack(context));
1318        let string = pop_item!(self, string, String, context);
1319        let declaration_0_built = DeclarationPercentTitleString { string };
1320        let declaration_0_built = Declaration::PercentTitleString(declaration_0_built);
1321        // Calling user action here
1322        self.user_grammar.declaration(&declaration_0_built)?;
1323        self.push(ASTType::Declaration(declaration_0_built), context);
1324        Ok(())
1325    }
1326
1327    /// Semantic action for production 8:
1328    ///
1329    /// `Declaration: '%comment'^ /* Clipped */ String;`
1330    ///
1331    #[parol_runtime::function_name::named]
1332    fn declaration_1(
1333        &mut self,
1334        _percent_comment: &ParseTreeType<'t>,
1335        _string: &ParseTreeType<'t>,
1336    ) -> Result<()> {
1337        let context = function_name!();
1338        trace!("{}", self.trace_item_stack(context));
1339        let string = pop_item!(self, string, String, context);
1340        let declaration_1_built = DeclarationPercentCommentString { string };
1341        let declaration_1_built = Declaration::PercentCommentString(declaration_1_built);
1342        // Calling user action here
1343        self.user_grammar.declaration(&declaration_1_built)?;
1344        self.push(ASTType::Declaration(declaration_1_built), context);
1345        Ok(())
1346    }
1347
1348    /// Semantic action for production 9:
1349    ///
1350    /// `Declaration: '%user_type'^ /* Clipped */ Identifier '='^ /* Clipped */ UserTypeName;`
1351    ///
1352    #[parol_runtime::function_name::named]
1353    fn declaration_2(
1354        &mut self,
1355        _percent_user_underscore_type: &ParseTreeType<'t>,
1356        _identifier: &ParseTreeType<'t>,
1357        _equ: &ParseTreeType<'t>,
1358        _user_type_name: &ParseTreeType<'t>,
1359    ) -> Result<()> {
1360        let context = function_name!();
1361        trace!("{}", self.trace_item_stack(context));
1362        let user_type_name = pop_item!(self, user_type_name, UserTypeName, context);
1363        let identifier = pop_item!(self, identifier, Identifier, context);
1364        let declaration_2_built = DeclarationPercentUserUnderscoreTypeIdentifierEquUserTypeName {
1365            identifier,
1366            user_type_name: (&user_type_name)
1367                .try_into()
1368                .map_err(parol_runtime::ParolError::UserError)?,
1369        };
1370        let declaration_2_built =
1371            Declaration::PercentUserUnderscoreTypeIdentifierEquUserTypeName(declaration_2_built);
1372        // Calling user action here
1373        self.user_grammar.declaration(&declaration_2_built)?;
1374        self.push(ASTType::Declaration(declaration_2_built), context);
1375        Ok(())
1376    }
1377
1378    /// Semantic action for production 10:
1379    ///
1380    /// `Declaration: "%nt_type" Identifier@nt_name "="^ /* Clipped */ UserTypeName@nt_type;`
1381    ///
1382    #[parol_runtime::function_name::named]
1383    fn declaration_3(
1384        &mut self,
1385        percent_nt_underscore_type: &ParseTreeType<'t>,
1386        _nt_name: &ParseTreeType<'t>,
1387        _equ: &ParseTreeType<'t>,
1388        _nt_type: &ParseTreeType<'t>,
1389    ) -> Result<()> {
1390        let context = function_name!();
1391        trace!("{}", self.trace_item_stack(context));
1392        let percent_nt_underscore_type = percent_nt_underscore_type.token()?.clone();
1393        let nt_type = pop_item!(self, nt_type, UserTypeName, context);
1394        let nt_name = pop_item!(self, nt_name, Identifier, context);
1395        let declaration_3_built = DeclarationPercentNtUnderscoreTypeNtNameEquNtType {
1396            percent_nt_underscore_type,
1397            nt_name,
1398            nt_type: (&nt_type)
1399                .try_into()
1400                .map_err(parol_runtime::ParolError::UserError)?,
1401        };
1402        let declaration_3_built =
1403            Declaration::PercentNtUnderscoreTypeNtNameEquNtType(declaration_3_built);
1404        // Calling user action here
1405        self.user_grammar.declaration(&declaration_3_built)?;
1406        self.push(ASTType::Declaration(declaration_3_built), context);
1407        Ok(())
1408    }
1409
1410    /// Semantic action for production 11:
1411    ///
1412    /// `Declaration: "%t_type" UserTypeName@t_type;`
1413    ///
1414    #[parol_runtime::function_name::named]
1415    fn declaration_4(
1416        &mut self,
1417        percent_t_underscore_type: &ParseTreeType<'t>,
1418        _t_type: &ParseTreeType<'t>,
1419    ) -> Result<()> {
1420        let context = function_name!();
1421        trace!("{}", self.trace_item_stack(context));
1422        let percent_t_underscore_type = percent_t_underscore_type.token()?.clone();
1423        let t_type = pop_item!(self, t_type, UserTypeName, context);
1424        let declaration_4_built = DeclarationPercentTUnderscoreTypeTType {
1425            percent_t_underscore_type,
1426            t_type: (&t_type)
1427                .try_into()
1428                .map_err(parol_runtime::ParolError::UserError)?,
1429        };
1430        let declaration_4_built = Declaration::PercentTUnderscoreTypeTType(declaration_4_built);
1431        // Calling user action here
1432        self.user_grammar.declaration(&declaration_4_built)?;
1433        self.push(ASTType::Declaration(declaration_4_built), context);
1434        Ok(())
1435    }
1436
1437    /// Semantic action for production 12:
1438    ///
1439    /// `Declaration: '%grammar_type'^ /* Clipped */ RawString;`
1440    ///
1441    #[parol_runtime::function_name::named]
1442    fn declaration_5(
1443        &mut self,
1444        _percent_grammar_underscore_type: &ParseTreeType<'t>,
1445        _raw_string: &ParseTreeType<'t>,
1446    ) -> Result<()> {
1447        let context = function_name!();
1448        trace!("{}", self.trace_item_stack(context));
1449        let raw_string = pop_item!(self, raw_string, RawString, context);
1450        let declaration_5_built = DeclarationPercentGrammarUnderscoreTypeRawString { raw_string };
1451        let declaration_5_built =
1452            Declaration::PercentGrammarUnderscoreTypeRawString(declaration_5_built);
1453        // Calling user action here
1454        self.user_grammar.declaration(&declaration_5_built)?;
1455        self.push(ASTType::Declaration(declaration_5_built), context);
1456        Ok(())
1457    }
1458
1459    /// Semantic action for production 13:
1460    ///
1461    /// `Declaration: ScannerDirectives;`
1462    ///
1463    #[parol_runtime::function_name::named]
1464    fn declaration_6(&mut self, _scanner_directives: &ParseTreeType<'t>) -> Result<()> {
1465        let context = function_name!();
1466        trace!("{}", self.trace_item_stack(context));
1467        let scanner_directives = pop_item!(self, scanner_directives, ScannerDirectives, context);
1468        let declaration_6_built = DeclarationScannerDirectives { scanner_directives };
1469        let declaration_6_built = Declaration::ScannerDirectives(declaration_6_built);
1470        // Calling user action here
1471        self.user_grammar.declaration(&declaration_6_built)?;
1472        self.push(ASTType::Declaration(declaration_6_built), context);
1473        Ok(())
1474    }
1475
1476    /// Semantic action for production 14:
1477    ///
1478    /// `ScannerDirectives: '%line_comment'^ /* Clipped */ TokenLiteral;`
1479    ///
1480    #[parol_runtime::function_name::named]
1481    fn scanner_directives_0(
1482        &mut self,
1483        _percent_line_underscore_comment: &ParseTreeType<'t>,
1484        _token_literal: &ParseTreeType<'t>,
1485    ) -> Result<()> {
1486        let context = function_name!();
1487        trace!("{}", self.trace_item_stack(context));
1488        let token_literal = pop_item!(self, token_literal, TokenLiteral, context);
1489        let scanner_directives_0_built =
1490            ScannerDirectivesPercentLineUnderscoreCommentTokenLiteral { token_literal };
1491        let scanner_directives_0_built =
1492            ScannerDirectives::PercentLineUnderscoreCommentTokenLiteral(scanner_directives_0_built);
1493        // Calling user action here
1494        self.user_grammar
1495            .scanner_directives(&scanner_directives_0_built)?;
1496        self.push(
1497            ASTType::ScannerDirectives(scanner_directives_0_built),
1498            context,
1499        );
1500        Ok(())
1501    }
1502
1503    /// Semantic action for production 15:
1504    ///
1505    /// `ScannerDirectives: '%block_comment'^ /* Clipped */ TokenLiteral TokenLiteral;`
1506    ///
1507    #[parol_runtime::function_name::named]
1508    fn scanner_directives_1(
1509        &mut self,
1510        _percent_block_underscore_comment: &ParseTreeType<'t>,
1511        _token_literal: &ParseTreeType<'t>,
1512        _token_literal0: &ParseTreeType<'t>,
1513    ) -> Result<()> {
1514        let context = function_name!();
1515        trace!("{}", self.trace_item_stack(context));
1516        let token_literal0 = pop_item!(self, token_literal0, TokenLiteral, context);
1517        let token_literal = pop_item!(self, token_literal, TokenLiteral, context);
1518        let scanner_directives_1_built =
1519            ScannerDirectivesPercentBlockUnderscoreCommentTokenLiteralTokenLiteral {
1520                token_literal,
1521                token_literal0,
1522            };
1523        let scanner_directives_1_built =
1524            ScannerDirectives::PercentBlockUnderscoreCommentTokenLiteralTokenLiteral(
1525                scanner_directives_1_built,
1526            );
1527        // Calling user action here
1528        self.user_grammar
1529            .scanner_directives(&scanner_directives_1_built)?;
1530        self.push(
1531            ASTType::ScannerDirectives(scanner_directives_1_built),
1532            context,
1533        );
1534        Ok(())
1535    }
1536
1537    /// Semantic action for production 16:
1538    ///
1539    /// `ScannerDirectives: '%auto_newline_off'^ /* Clipped */;`
1540    ///
1541    #[parol_runtime::function_name::named]
1542    fn scanner_directives_2(
1543        &mut self,
1544        _percent_auto_underscore_newline_underscore_off: &ParseTreeType<'t>,
1545    ) -> Result<()> {
1546        let context = function_name!();
1547        trace!("{}", self.trace_item_stack(context));
1548        let scanner_directives_2_built =
1549            ScannerDirectivesPercentAutoUnderscoreNewlineUnderscoreOff {};
1550        let scanner_directives_2_built =
1551            ScannerDirectives::PercentAutoUnderscoreNewlineUnderscoreOff(
1552                scanner_directives_2_built,
1553            );
1554        // Calling user action here
1555        self.user_grammar
1556            .scanner_directives(&scanner_directives_2_built)?;
1557        self.push(
1558            ASTType::ScannerDirectives(scanner_directives_2_built),
1559            context,
1560        );
1561        Ok(())
1562    }
1563
1564    /// Semantic action for production 17:
1565    ///
1566    /// `ScannerDirectives: '%auto_ws_off'^ /* Clipped */;`
1567    ///
1568    #[parol_runtime::function_name::named]
1569    fn scanner_directives_3(
1570        &mut self,
1571        _percent_auto_underscore_ws_underscore_off: &ParseTreeType<'t>,
1572    ) -> Result<()> {
1573        let context = function_name!();
1574        trace!("{}", self.trace_item_stack(context));
1575        let scanner_directives_3_built = ScannerDirectivesPercentAutoUnderscoreWsUnderscoreOff {};
1576        let scanner_directives_3_built =
1577            ScannerDirectives::PercentAutoUnderscoreWsUnderscoreOff(scanner_directives_3_built);
1578        // Calling user action here
1579        self.user_grammar
1580            .scanner_directives(&scanner_directives_3_built)?;
1581        self.push(
1582            ASTType::ScannerDirectives(scanner_directives_3_built),
1583            context,
1584        );
1585        Ok(())
1586    }
1587
1588    /// Semantic action for production 18:
1589    ///
1590    /// `ScannerDirectives: '%on'^ /* Clipped */ IdentifierList ScannerStateDirectives;`
1591    ///
1592    #[parol_runtime::function_name::named]
1593    fn scanner_directives_4(
1594        &mut self,
1595        _percent_on: &ParseTreeType<'t>,
1596        _identifier_list: &ParseTreeType<'t>,
1597        _scanner_state_directives: &ParseTreeType<'t>,
1598    ) -> Result<()> {
1599        let context = function_name!();
1600        trace!("{}", self.trace_item_stack(context));
1601        let scanner_state_directives = pop_item!(
1602            self,
1603            scanner_state_directives,
1604            ScannerStateDirectives,
1605            context
1606        );
1607        let identifier_list = pop_item!(self, identifier_list, IdentifierList, context);
1608        let scanner_directives_4_built =
1609            ScannerDirectivesPercentOnIdentifierListScannerStateDirectives {
1610                identifier_list,
1611                scanner_state_directives: (&scanner_state_directives)
1612                    .try_into()
1613                    .map_err(parol_runtime::ParolError::UserError)?,
1614            };
1615        let scanner_directives_4_built =
1616            ScannerDirectives::PercentOnIdentifierListScannerStateDirectives(
1617                scanner_directives_4_built,
1618            );
1619        // Calling user action here
1620        self.user_grammar
1621            .scanner_directives(&scanner_directives_4_built)?;
1622        self.push(
1623            ASTType::ScannerDirectives(scanner_directives_4_built),
1624            context,
1625        );
1626        Ok(())
1627    }
1628
1629    /// Semantic action for production 19:
1630    ///
1631    /// `ScannerDirectives: '%allow_unmatched'^ /* Clipped */;`
1632    ///
1633    #[parol_runtime::function_name::named]
1634    fn scanner_directives_5(
1635        &mut self,
1636        _percent_allow_underscore_unmatched: &ParseTreeType<'t>,
1637    ) -> Result<()> {
1638        let context = function_name!();
1639        trace!("{}", self.trace_item_stack(context));
1640        let scanner_directives_5_built = ScannerDirectivesPercentAllowUnderscoreUnmatched {};
1641        let scanner_directives_5_built =
1642            ScannerDirectives::PercentAllowUnderscoreUnmatched(scanner_directives_5_built);
1643        // Calling user action here
1644        self.user_grammar
1645            .scanner_directives(&scanner_directives_5_built)?;
1646        self.push(
1647            ASTType::ScannerDirectives(scanner_directives_5_built),
1648            context,
1649        );
1650        Ok(())
1651    }
1652
1653    /// Semantic action for production 20:
1654    ///
1655    /// `ScannerStateDirectives: '%enter'^ /* Clipped */ Identifier;`
1656    ///
1657    #[parol_runtime::function_name::named]
1658    fn scanner_state_directives_0(
1659        &mut self,
1660        _percent_enter: &ParseTreeType<'t>,
1661        _identifier: &ParseTreeType<'t>,
1662    ) -> Result<()> {
1663        let context = function_name!();
1664        trace!("{}", self.trace_item_stack(context));
1665        let identifier = pop_item!(self, identifier, Identifier, context);
1666        let scanner_state_directives_0_built =
1667            ScannerStateDirectivesPercentEnterIdentifier { identifier };
1668        let scanner_state_directives_0_built =
1669            ScannerStateDirectives::PercentEnterIdentifier(scanner_state_directives_0_built);
1670        // Calling user action here
1671        self.user_grammar
1672            .scanner_state_directives(&scanner_state_directives_0_built)?;
1673        self.push(
1674            ASTType::ScannerStateDirectives(scanner_state_directives_0_built),
1675            context,
1676        );
1677        Ok(())
1678    }
1679
1680    /// Semantic action for production 21:
1681    ///
1682    /// `ScannerStateDirectives: '%push'^ /* Clipped */ Identifier;`
1683    ///
1684    #[parol_runtime::function_name::named]
1685    fn scanner_state_directives_1(
1686        &mut self,
1687        _percent_push: &ParseTreeType<'t>,
1688        _identifier: &ParseTreeType<'t>,
1689    ) -> Result<()> {
1690        let context = function_name!();
1691        trace!("{}", self.trace_item_stack(context));
1692        let identifier = pop_item!(self, identifier, Identifier, context);
1693        let scanner_state_directives_1_built =
1694            ScannerStateDirectivesPercentPushIdentifier { identifier };
1695        let scanner_state_directives_1_built =
1696            ScannerStateDirectives::PercentPushIdentifier(scanner_state_directives_1_built);
1697        // Calling user action here
1698        self.user_grammar
1699            .scanner_state_directives(&scanner_state_directives_1_built)?;
1700        self.push(
1701            ASTType::ScannerStateDirectives(scanner_state_directives_1_built),
1702            context,
1703        );
1704        Ok(())
1705    }
1706
1707    /// Semantic action for production 22:
1708    ///
1709    /// `ScannerStateDirectives: '%pop';`
1710    ///
1711    #[parol_runtime::function_name::named]
1712    fn scanner_state_directives_2(&mut self, percent_pop: &ParseTreeType<'t>) -> Result<()> {
1713        let context = function_name!();
1714        trace!("{}", self.trace_item_stack(context));
1715        let percent_pop = percent_pop.token()?.clone();
1716        let scanner_state_directives_2_built = ScannerStateDirectivesPercentPop { percent_pop };
1717        let scanner_state_directives_2_built =
1718            ScannerStateDirectives::PercentPop(scanner_state_directives_2_built);
1719        // Calling user action here
1720        self.user_grammar
1721            .scanner_state_directives(&scanner_state_directives_2_built)?;
1722        self.push(
1723            ASTType::ScannerStateDirectives(scanner_state_directives_2_built),
1724            context,
1725        );
1726        Ok(())
1727    }
1728
1729    /// Semantic action for production 23:
1730    ///
1731    /// `GrammarDefinition: '%%'^ /* Clipped */ Production GrammarDefinitionList /* Vec */;`
1732    ///
1733    #[parol_runtime::function_name::named]
1734    fn grammar_definition(
1735        &mut self,
1736        _percent_percent: &ParseTreeType<'t>,
1737        _production: &ParseTreeType<'t>,
1738        _grammar_definition_list: &ParseTreeType<'t>,
1739    ) -> Result<()> {
1740        let context = function_name!();
1741        trace!("{}", self.trace_item_stack(context));
1742        let grammar_definition_list = pop_and_reverse_item!(
1743            self,
1744            grammar_definition_list,
1745            GrammarDefinitionList,
1746            context
1747        );
1748        let production = pop_item!(self, production, Production, context);
1749        let grammar_definition_built = GrammarDefinition {
1750            production,
1751            grammar_definition_list,
1752        };
1753        // Calling user action here
1754        self.user_grammar
1755            .grammar_definition(&grammar_definition_built)?;
1756        self.push(
1757            ASTType::GrammarDefinition(grammar_definition_built),
1758            context,
1759        );
1760        Ok(())
1761    }
1762
1763    /// Semantic action for production 24:
1764    ///
1765    /// `GrammarDefinitionList /* Vec<T>::Push */: Production GrammarDefinitionList;`
1766    ///
1767    #[parol_runtime::function_name::named]
1768    fn grammar_definition_list_0(
1769        &mut self,
1770        _production: &ParseTreeType<'t>,
1771        _grammar_definition_list: &ParseTreeType<'t>,
1772    ) -> Result<()> {
1773        let context = function_name!();
1774        trace!("{}", self.trace_item_stack(context));
1775        let mut grammar_definition_list = pop_item!(
1776            self,
1777            grammar_definition_list,
1778            GrammarDefinitionList,
1779            context
1780        );
1781        let production = pop_item!(self, production, Production, context);
1782        let grammar_definition_list_0_built = GrammarDefinitionList { production };
1783        // Add an element to the vector
1784        grammar_definition_list.push(grammar_definition_list_0_built);
1785        self.push(
1786            ASTType::GrammarDefinitionList(grammar_definition_list),
1787            context,
1788        );
1789        Ok(())
1790    }
1791
1792    /// Semantic action for production 25:
1793    ///
1794    /// `GrammarDefinitionList /* Vec<T>::New */: ;`
1795    ///
1796    #[parol_runtime::function_name::named]
1797    fn grammar_definition_list_1(&mut self) -> Result<()> {
1798        let context = function_name!();
1799        trace!("{}", self.trace_item_stack(context));
1800        let grammar_definition_list_1_built = Vec::new();
1801        self.push(
1802            ASTType::GrammarDefinitionList(grammar_definition_list_1_built),
1803            context,
1804        );
1805        Ok(())
1806    }
1807
1808    /// Semantic action for production 26:
1809    ///
1810    /// `DoubleColon: '::';`
1811    ///
1812    #[parol_runtime::function_name::named]
1813    fn double_colon(&mut self, double_colon: &ParseTreeType<'t>) -> Result<()> {
1814        let context = function_name!();
1815        trace!("{}", self.trace_item_stack(context));
1816        let double_colon = double_colon.token()?.clone();
1817        let double_colon_built = DoubleColon { double_colon };
1818        // Calling user action here
1819        self.user_grammar.double_colon(&double_colon_built)?;
1820        self.push(ASTType::DoubleColon(double_colon_built), context);
1821        Ok(())
1822    }
1823
1824    /// Semantic action for production 27:
1825    ///
1826    /// `Production: Identifier ':'^ /* Clipped */ Alternations ';'^ /* Clipped */;`
1827    ///
1828    #[parol_runtime::function_name::named]
1829    fn production(
1830        &mut self,
1831        _identifier: &ParseTreeType<'t>,
1832        _colon: &ParseTreeType<'t>,
1833        _alternations: &ParseTreeType<'t>,
1834        _semicolon: &ParseTreeType<'t>,
1835    ) -> Result<()> {
1836        let context = function_name!();
1837        trace!("{}", self.trace_item_stack(context));
1838        let alternations = pop_item!(self, alternations, Alternations, context);
1839        let identifier = pop_item!(self, identifier, Identifier, context);
1840        let production_built = Production {
1841            identifier,
1842            alternations,
1843        };
1844        // Calling user action here
1845        self.user_grammar.production(&production_built)?;
1846        self.push(ASTType::Production(production_built), context);
1847        Ok(())
1848    }
1849
1850    /// Semantic action for production 28:
1851    ///
1852    /// `Alternations: Alternation AlternationsList /* Vec */;`
1853    ///
1854    #[parol_runtime::function_name::named]
1855    fn alternations(
1856        &mut self,
1857        _alternation: &ParseTreeType<'t>,
1858        _alternations_list: &ParseTreeType<'t>,
1859    ) -> Result<()> {
1860        let context = function_name!();
1861        trace!("{}", self.trace_item_stack(context));
1862        let alternations_list =
1863            pop_and_reverse_item!(self, alternations_list, AlternationsList, context);
1864        let alternation = pop_item!(self, alternation, Alternation, context);
1865        let alternations_built = Alternations {
1866            alternation,
1867            alternations_list,
1868        };
1869        // Calling user action here
1870        self.user_grammar.alternations(&alternations_built)?;
1871        self.push(ASTType::Alternations(alternations_built), context);
1872        Ok(())
1873    }
1874
1875    /// Semantic action for production 29:
1876    ///
1877    /// `AlternationsList /* Vec<T>::Push */: '|'^ /* Clipped */ Alternation AlternationsList;`
1878    ///
1879    #[parol_runtime::function_name::named]
1880    fn alternations_list_0(
1881        &mut self,
1882        _or: &ParseTreeType<'t>,
1883        _alternation: &ParseTreeType<'t>,
1884        _alternations_list: &ParseTreeType<'t>,
1885    ) -> Result<()> {
1886        let context = function_name!();
1887        trace!("{}", self.trace_item_stack(context));
1888        let mut alternations_list = pop_item!(self, alternations_list, AlternationsList, context);
1889        let alternation = pop_item!(self, alternation, Alternation, context);
1890        let alternations_list_0_built = AlternationsList { alternation };
1891        // Add an element to the vector
1892        alternations_list.push(alternations_list_0_built);
1893        self.push(ASTType::AlternationsList(alternations_list), context);
1894        Ok(())
1895    }
1896
1897    /// Semantic action for production 30:
1898    ///
1899    /// `AlternationsList /* Vec<T>::New */: ;`
1900    ///
1901    #[parol_runtime::function_name::named]
1902    fn alternations_list_1(&mut self) -> Result<()> {
1903        let context = function_name!();
1904        trace!("{}", self.trace_item_stack(context));
1905        let alternations_list_1_built = Vec::new();
1906        self.push(
1907            ASTType::AlternationsList(alternations_list_1_built),
1908            context,
1909        );
1910        Ok(())
1911    }
1912
1913    /// Semantic action for production 31:
1914    ///
1915    /// `Alternation: AlternationList /* Vec */;`
1916    ///
1917    #[parol_runtime::function_name::named]
1918    fn alternation(&mut self, _alternation_list: &ParseTreeType<'t>) -> Result<()> {
1919        let context = function_name!();
1920        trace!("{}", self.trace_item_stack(context));
1921        let alternation_list =
1922            pop_and_reverse_item!(self, alternation_list, AlternationList, context);
1923        let alternation_built = Alternation { alternation_list };
1924        // Calling user action here
1925        self.user_grammar.alternation(&alternation_built)?;
1926        self.push(ASTType::Alternation(alternation_built), context);
1927        Ok(())
1928    }
1929
1930    /// Semantic action for production 32:
1931    ///
1932    /// `AlternationList /* Vec<T>::Push */: Factor AlternationList;`
1933    ///
1934    #[parol_runtime::function_name::named]
1935    fn alternation_list_0(
1936        &mut self,
1937        _factor: &ParseTreeType<'t>,
1938        _alternation_list: &ParseTreeType<'t>,
1939    ) -> Result<()> {
1940        let context = function_name!();
1941        trace!("{}", self.trace_item_stack(context));
1942        let mut alternation_list = pop_item!(self, alternation_list, AlternationList, context);
1943        let factor = pop_item!(self, factor, Factor, context);
1944        let alternation_list_0_built = AlternationList { factor };
1945        // Add an element to the vector
1946        alternation_list.push(alternation_list_0_built);
1947        self.push(ASTType::AlternationList(alternation_list), context);
1948        Ok(())
1949    }
1950
1951    /// Semantic action for production 33:
1952    ///
1953    /// `AlternationList /* Vec<T>::New */: ;`
1954    ///
1955    #[parol_runtime::function_name::named]
1956    fn alternation_list_1(&mut self) -> Result<()> {
1957        let context = function_name!();
1958        trace!("{}", self.trace_item_stack(context));
1959        let alternation_list_1_built = Vec::new();
1960        self.push(ASTType::AlternationList(alternation_list_1_built), context);
1961        Ok(())
1962    }
1963
1964    /// Semantic action for production 34:
1965    ///
1966    /// `Factor: Group;`
1967    ///
1968    #[parol_runtime::function_name::named]
1969    fn factor_0(&mut self, _group: &ParseTreeType<'t>) -> Result<()> {
1970        let context = function_name!();
1971        trace!("{}", self.trace_item_stack(context));
1972        let group = pop_item!(self, group, Group, context);
1973        let factor_0_built = FactorGroup { group };
1974        let factor_0_built = Factor::Group(factor_0_built);
1975        // Calling user action here
1976        self.user_grammar.factor(&factor_0_built)?;
1977        self.push(ASTType::Factor(factor_0_built), context);
1978        Ok(())
1979    }
1980
1981    /// Semantic action for production 35:
1982    ///
1983    /// `Factor: Repeat;`
1984    ///
1985    #[parol_runtime::function_name::named]
1986    fn factor_1(&mut self, _repeat: &ParseTreeType<'t>) -> Result<()> {
1987        let context = function_name!();
1988        trace!("{}", self.trace_item_stack(context));
1989        let repeat = pop_item!(self, repeat, Repeat, context);
1990        let factor_1_built = FactorRepeat { repeat };
1991        let factor_1_built = Factor::Repeat(factor_1_built);
1992        // Calling user action here
1993        self.user_grammar.factor(&factor_1_built)?;
1994        self.push(ASTType::Factor(factor_1_built), context);
1995        Ok(())
1996    }
1997
1998    /// Semantic action for production 36:
1999    ///
2000    /// `Factor: Optional;`
2001    ///
2002    #[parol_runtime::function_name::named]
2003    fn factor_2(&mut self, _optional: &ParseTreeType<'t>) -> Result<()> {
2004        let context = function_name!();
2005        trace!("{}", self.trace_item_stack(context));
2006        let optional = pop_item!(self, optional, Optional, context);
2007        let factor_2_built = FactorOptional { optional };
2008        let factor_2_built = Factor::Optional(factor_2_built);
2009        // Calling user action here
2010        self.user_grammar.factor(&factor_2_built)?;
2011        self.push(ASTType::Factor(factor_2_built), context);
2012        Ok(())
2013    }
2014
2015    /// Semantic action for production 37:
2016    ///
2017    /// `Factor: Symbol;`
2018    ///
2019    #[parol_runtime::function_name::named]
2020    fn factor_3(&mut self, _symbol: &ParseTreeType<'t>) -> Result<()> {
2021        let context = function_name!();
2022        trace!("{}", self.trace_item_stack(context));
2023        let symbol = pop_item!(self, symbol, Symbol, context);
2024        let factor_3_built = FactorSymbol { symbol };
2025        let factor_3_built = Factor::Symbol(factor_3_built);
2026        // Calling user action here
2027        self.user_grammar.factor(&factor_3_built)?;
2028        self.push(ASTType::Factor(factor_3_built), context);
2029        Ok(())
2030    }
2031
2032    /// Semantic action for production 38:
2033    ///
2034    /// `Symbol: NonTerminal;`
2035    ///
2036    #[parol_runtime::function_name::named]
2037    fn symbol_0(&mut self, _non_terminal: &ParseTreeType<'t>) -> Result<()> {
2038        let context = function_name!();
2039        trace!("{}", self.trace_item_stack(context));
2040        let non_terminal = pop_item!(self, non_terminal, NonTerminal, context);
2041        let symbol_0_built = SymbolNonTerminal { non_terminal };
2042        let symbol_0_built = Symbol::NonTerminal(symbol_0_built);
2043        // Calling user action here
2044        self.user_grammar.symbol(&symbol_0_built)?;
2045        self.push(ASTType::Symbol(symbol_0_built), context);
2046        Ok(())
2047    }
2048
2049    /// Semantic action for production 39:
2050    ///
2051    /// `Symbol: SimpleToken;`
2052    ///
2053    #[parol_runtime::function_name::named]
2054    fn symbol_1(&mut self, _simple_token: &ParseTreeType<'t>) -> Result<()> {
2055        let context = function_name!();
2056        trace!("{}", self.trace_item_stack(context));
2057        let simple_token = pop_item!(self, simple_token, SimpleToken, context);
2058        let symbol_1_built = SymbolSimpleToken { simple_token };
2059        let symbol_1_built = Symbol::SimpleToken(symbol_1_built);
2060        // Calling user action here
2061        self.user_grammar.symbol(&symbol_1_built)?;
2062        self.push(ASTType::Symbol(symbol_1_built), context);
2063        Ok(())
2064    }
2065
2066    /// Semantic action for production 40:
2067    ///
2068    /// `Symbol: TokenWithStates;`
2069    ///
2070    #[parol_runtime::function_name::named]
2071    fn symbol_2(&mut self, _token_with_states: &ParseTreeType<'t>) -> Result<()> {
2072        let context = function_name!();
2073        trace!("{}", self.trace_item_stack(context));
2074        let token_with_states = pop_item!(self, token_with_states, TokenWithStates, context);
2075        let symbol_2_built = SymbolTokenWithStates { token_with_states };
2076        let symbol_2_built = Symbol::TokenWithStates(symbol_2_built);
2077        // Calling user action here
2078        self.user_grammar.symbol(&symbol_2_built)?;
2079        self.push(ASTType::Symbol(symbol_2_built), context);
2080        Ok(())
2081    }
2082
2083    /// Semantic action for production 41:
2084    ///
2085    /// `TokenLiteral: String;`
2086    ///
2087    #[parol_runtime::function_name::named]
2088    fn token_literal_0(&mut self, _string: &ParseTreeType<'t>) -> Result<()> {
2089        let context = function_name!();
2090        trace!("{}", self.trace_item_stack(context));
2091        let string = pop_item!(self, string, String, context);
2092        let token_literal_0_built = TokenLiteralString { string };
2093        let token_literal_0_built = TokenLiteral::String(token_literal_0_built);
2094        // Calling user action here
2095        self.user_grammar.token_literal(&token_literal_0_built)?;
2096        self.push(ASTType::TokenLiteral(token_literal_0_built), context);
2097        Ok(())
2098    }
2099
2100    /// Semantic action for production 42:
2101    ///
2102    /// `TokenLiteral: RawString;`
2103    ///
2104    #[parol_runtime::function_name::named]
2105    fn token_literal_1(&mut self, _raw_string: &ParseTreeType<'t>) -> Result<()> {
2106        let context = function_name!();
2107        trace!("{}", self.trace_item_stack(context));
2108        let raw_string = pop_item!(self, raw_string, RawString, context);
2109        let token_literal_1_built = TokenLiteralRawString { raw_string };
2110        let token_literal_1_built = TokenLiteral::RawString(token_literal_1_built);
2111        // Calling user action here
2112        self.user_grammar.token_literal(&token_literal_1_built)?;
2113        self.push(ASTType::TokenLiteral(token_literal_1_built), context);
2114        Ok(())
2115    }
2116
2117    /// Semantic action for production 43:
2118    ///
2119    /// `TokenLiteral: Regex;`
2120    ///
2121    #[parol_runtime::function_name::named]
2122    fn token_literal_2(&mut self, _regex: &ParseTreeType<'t>) -> Result<()> {
2123        let context = function_name!();
2124        trace!("{}", self.trace_item_stack(context));
2125        let regex = pop_item!(self, regex, Regex, context);
2126        let token_literal_2_built = TokenLiteralRegex { regex };
2127        let token_literal_2_built = TokenLiteral::Regex(token_literal_2_built);
2128        // Calling user action here
2129        self.user_grammar.token_literal(&token_literal_2_built)?;
2130        self.push(ASTType::TokenLiteral(token_literal_2_built), context);
2131        Ok(())
2132    }
2133
2134    /// Semantic action for production 44:
2135    ///
2136    /// `TokenExpression: TokenLiteral TokenExpressionOpt /* Option */;`
2137    ///
2138    #[parol_runtime::function_name::named]
2139    fn token_expression(
2140        &mut self,
2141        _token_literal: &ParseTreeType<'t>,
2142        _token_expression_opt: &ParseTreeType<'t>,
2143    ) -> Result<()> {
2144        let context = function_name!();
2145        trace!("{}", self.trace_item_stack(context));
2146        let token_expression_opt =
2147            pop_item!(self, token_expression_opt, TokenExpressionOpt, context);
2148        let token_literal = pop_item!(self, token_literal, TokenLiteral, context);
2149        let token_expression_built = TokenExpression {
2150            token_literal,
2151            token_expression_opt,
2152        };
2153        // Calling user action here
2154        self.user_grammar
2155            .token_expression(&token_expression_built)?;
2156        self.push(ASTType::TokenExpression(token_expression_built), context);
2157        Ok(())
2158    }
2159
2160    /// Semantic action for production 45:
2161    ///
2162    /// `TokenExpressionOpt /* Option<T>::Some */: LookAhead;`
2163    ///
2164    #[parol_runtime::function_name::named]
2165    fn token_expression_opt_0(&mut self, _look_ahead: &ParseTreeType<'t>) -> Result<()> {
2166        let context = function_name!();
2167        trace!("{}", self.trace_item_stack(context));
2168        let look_ahead = pop_item!(self, look_ahead, LookAhead, context);
2169        let token_expression_opt_0_built = TokenExpressionOpt { look_ahead };
2170        self.push(
2171            ASTType::TokenExpressionOpt(Some(token_expression_opt_0_built)),
2172            context,
2173        );
2174        Ok(())
2175    }
2176
2177    /// Semantic action for production 46:
2178    ///
2179    /// `TokenExpressionOpt /* Option<T>::None */: ;`
2180    ///
2181    #[parol_runtime::function_name::named]
2182    fn token_expression_opt_1(&mut self) -> Result<()> {
2183        let context = function_name!();
2184        trace!("{}", self.trace_item_stack(context));
2185        self.push(ASTType::TokenExpressionOpt(None), context);
2186        Ok(())
2187    }
2188
2189    /// Semantic action for production 47:
2190    ///
2191    /// `SimpleToken: TokenExpression SimpleTokenOpt /* Option */;`
2192    ///
2193    #[parol_runtime::function_name::named]
2194    fn simple_token(
2195        &mut self,
2196        _token_expression: &ParseTreeType<'t>,
2197        _simple_token_opt: &ParseTreeType<'t>,
2198    ) -> Result<()> {
2199        let context = function_name!();
2200        trace!("{}", self.trace_item_stack(context));
2201        let simple_token_opt = pop_item!(self, simple_token_opt, SimpleTokenOpt, context);
2202        let token_expression = pop_item!(self, token_expression, TokenExpression, context);
2203        let simple_token_built = SimpleToken {
2204            token_expression,
2205            simple_token_opt,
2206        };
2207        // Calling user action here
2208        self.user_grammar.simple_token(&simple_token_built)?;
2209        self.push(ASTType::SimpleToken(simple_token_built), context);
2210        Ok(())
2211    }
2212
2213    /// Semantic action for production 48:
2214    ///
2215    /// `SimpleTokenOpt /* Option<T>::Some */: ASTControl;`
2216    ///
2217    #[parol_runtime::function_name::named]
2218    fn simple_token_opt_0(&mut self, _a_s_t_control: &ParseTreeType<'t>) -> Result<()> {
2219        let context = function_name!();
2220        trace!("{}", self.trace_item_stack(context));
2221        let a_s_t_control = pop_item!(self, a_s_t_control, ASTControl, context);
2222        let simple_token_opt_0_built = SimpleTokenOpt { a_s_t_control };
2223        self.push(
2224            ASTType::SimpleTokenOpt(Some(simple_token_opt_0_built)),
2225            context,
2226        );
2227        Ok(())
2228    }
2229
2230    /// Semantic action for production 49:
2231    ///
2232    /// `SimpleTokenOpt /* Option<T>::None */: ;`
2233    ///
2234    #[parol_runtime::function_name::named]
2235    fn simple_token_opt_1(&mut self) -> Result<()> {
2236        let context = function_name!();
2237        trace!("{}", self.trace_item_stack(context));
2238        self.push(ASTType::SimpleTokenOpt(None), context);
2239        Ok(())
2240    }
2241
2242    /// Semantic action for production 50:
2243    ///
2244    /// `TokenWithStates: '<'^ /* Clipped */ IdentifierList '>'^ /* Clipped */ TokenExpression TokenWithStatesOpt /* Option */;`
2245    ///
2246    #[parol_runtime::function_name::named]
2247    fn token_with_states(
2248        &mut self,
2249        _l_t: &ParseTreeType<'t>,
2250        _identifier_list: &ParseTreeType<'t>,
2251        _g_t: &ParseTreeType<'t>,
2252        _token_expression: &ParseTreeType<'t>,
2253        _token_with_states_opt: &ParseTreeType<'t>,
2254    ) -> Result<()> {
2255        let context = function_name!();
2256        trace!("{}", self.trace_item_stack(context));
2257        let token_with_states_opt =
2258            pop_item!(self, token_with_states_opt, TokenWithStatesOpt, context);
2259        let token_expression = pop_item!(self, token_expression, TokenExpression, context);
2260        let identifier_list = pop_item!(self, identifier_list, IdentifierList, context);
2261        let token_with_states_built = TokenWithStates {
2262            identifier_list,
2263            token_expression,
2264            token_with_states_opt,
2265        };
2266        // Calling user action here
2267        self.user_grammar
2268            .token_with_states(&token_with_states_built)?;
2269        self.push(ASTType::TokenWithStates(token_with_states_built), context);
2270        Ok(())
2271    }
2272
2273    /// Semantic action for production 51:
2274    ///
2275    /// `TokenWithStatesOpt /* Option<T>::Some */: ASTControl;`
2276    ///
2277    #[parol_runtime::function_name::named]
2278    fn token_with_states_opt_0(&mut self, _a_s_t_control: &ParseTreeType<'t>) -> Result<()> {
2279        let context = function_name!();
2280        trace!("{}", self.trace_item_stack(context));
2281        let a_s_t_control = pop_item!(self, a_s_t_control, ASTControl, context);
2282        let token_with_states_opt_0_built = TokenWithStatesOpt { a_s_t_control };
2283        self.push(
2284            ASTType::TokenWithStatesOpt(Some(token_with_states_opt_0_built)),
2285            context,
2286        );
2287        Ok(())
2288    }
2289
2290    /// Semantic action for production 52:
2291    ///
2292    /// `TokenWithStatesOpt /* Option<T>::None */: ;`
2293    ///
2294    #[parol_runtime::function_name::named]
2295    fn token_with_states_opt_1(&mut self) -> Result<()> {
2296        let context = function_name!();
2297        trace!("{}", self.trace_item_stack(context));
2298        self.push(ASTType::TokenWithStatesOpt(None), context);
2299        Ok(())
2300    }
2301
2302    /// Semantic action for production 53:
2303    ///
2304    /// `String: /"(\\.|[^"])*"/;`
2305    ///
2306    #[parol_runtime::function_name::named]
2307    fn string(&mut self, string: &ParseTreeType<'t>) -> Result<()> {
2308        let context = function_name!();
2309        trace!("{}", self.trace_item_stack(context));
2310        let string = string.token()?.clone();
2311        let string_built = String { string };
2312        // Calling user action here
2313        self.user_grammar.string(&string_built)?;
2314        self.push(ASTType::String(string_built), context);
2315        Ok(())
2316    }
2317
2318    /// Semantic action for production 54:
2319    ///
2320    /// `RawString: /'(\\.|[^'])*'/;`
2321    ///
2322    #[parol_runtime::function_name::named]
2323    fn raw_string(&mut self, raw_string: &ParseTreeType<'t>) -> Result<()> {
2324        let context = function_name!();
2325        trace!("{}", self.trace_item_stack(context));
2326        let raw_string = raw_string.token()?.clone();
2327        let raw_string_built = RawString { raw_string };
2328        // Calling user action here
2329        self.user_grammar.raw_string(&raw_string_built)?;
2330        self.push(ASTType::RawString(raw_string_built), context);
2331        Ok(())
2332    }
2333
2334    /// Semantic action for production 55:
2335    ///
2336    /// `Regex: "/(\\.|[^\/])*/";`
2337    ///
2338    #[parol_runtime::function_name::named]
2339    fn regex(&mut self, regex: &ParseTreeType<'t>) -> Result<()> {
2340        let context = function_name!();
2341        trace!("{}", self.trace_item_stack(context));
2342        let regex = regex.token()?.clone();
2343        let regex_built = Regex { regex };
2344        // Calling user action here
2345        self.user_grammar.regex(&regex_built)?;
2346        self.push(ASTType::Regex(regex_built), context);
2347        Ok(())
2348    }
2349
2350    /// Semantic action for production 56:
2351    ///
2352    /// `Group: '(' Alternations ')';`
2353    ///
2354    #[parol_runtime::function_name::named]
2355    fn group(
2356        &mut self,
2357        l_paren: &ParseTreeType<'t>,
2358        _alternations: &ParseTreeType<'t>,
2359        r_paren: &ParseTreeType<'t>,
2360    ) -> Result<()> {
2361        let context = function_name!();
2362        trace!("{}", self.trace_item_stack(context));
2363        let l_paren = l_paren.token()?.clone();
2364        let r_paren = r_paren.token()?.clone();
2365        let alternations = pop_item!(self, alternations, Alternations, context);
2366        let group_built = Group {
2367            l_paren,
2368            alternations,
2369            r_paren,
2370        };
2371        // Calling user action here
2372        self.user_grammar.group(&group_built)?;
2373        self.push(ASTType::Group(group_built), context);
2374        Ok(())
2375    }
2376
2377    /// Semantic action for production 57:
2378    ///
2379    /// `Optional: '[' Alternations ']';`
2380    ///
2381    #[parol_runtime::function_name::named]
2382    fn optional(
2383        &mut self,
2384        l_bracket: &ParseTreeType<'t>,
2385        _alternations: &ParseTreeType<'t>,
2386        r_bracket: &ParseTreeType<'t>,
2387    ) -> Result<()> {
2388        let context = function_name!();
2389        trace!("{}", self.trace_item_stack(context));
2390        let l_bracket = l_bracket.token()?.clone();
2391        let r_bracket = r_bracket.token()?.clone();
2392        let alternations = pop_item!(self, alternations, Alternations, context);
2393        let optional_built = Optional {
2394            l_bracket,
2395            alternations,
2396            r_bracket,
2397        };
2398        // Calling user action here
2399        self.user_grammar.optional(&optional_built)?;
2400        self.push(ASTType::Optional(optional_built), context);
2401        Ok(())
2402    }
2403
2404    /// Semantic action for production 58:
2405    ///
2406    /// `Repeat: '{' Alternations '}';`
2407    ///
2408    #[parol_runtime::function_name::named]
2409    fn repeat(
2410        &mut self,
2411        l_brace: &ParseTreeType<'t>,
2412        _alternations: &ParseTreeType<'t>,
2413        r_brace: &ParseTreeType<'t>,
2414    ) -> Result<()> {
2415        let context = function_name!();
2416        trace!("{}", self.trace_item_stack(context));
2417        let l_brace = l_brace.token()?.clone();
2418        let r_brace = r_brace.token()?.clone();
2419        let alternations = pop_item!(self, alternations, Alternations, context);
2420        let repeat_built = Repeat {
2421            l_brace,
2422            alternations,
2423            r_brace,
2424        };
2425        // Calling user action here
2426        self.user_grammar.repeat(&repeat_built)?;
2427        self.push(ASTType::Repeat(repeat_built), context);
2428        Ok(())
2429    }
2430
2431    /// Semantic action for production 59:
2432    ///
2433    /// `NonTerminal: Identifier NonTerminalOpt /* Option */;`
2434    ///
2435    #[parol_runtime::function_name::named]
2436    fn non_terminal(
2437        &mut self,
2438        _identifier: &ParseTreeType<'t>,
2439        _non_terminal_opt: &ParseTreeType<'t>,
2440    ) -> Result<()> {
2441        let context = function_name!();
2442        trace!("{}", self.trace_item_stack(context));
2443        let non_terminal_opt = pop_item!(self, non_terminal_opt, NonTerminalOpt, context);
2444        let identifier = pop_item!(self, identifier, Identifier, context);
2445        let non_terminal_built = NonTerminal {
2446            identifier,
2447            non_terminal_opt,
2448        };
2449        // Calling user action here
2450        self.user_grammar.non_terminal(&non_terminal_built)?;
2451        self.push(ASTType::NonTerminal(non_terminal_built), context);
2452        Ok(())
2453    }
2454
2455    /// Semantic action for production 60:
2456    ///
2457    /// `NonTerminalOpt /* Option<T>::Some */: ASTControl;`
2458    ///
2459    #[parol_runtime::function_name::named]
2460    fn non_terminal_opt_0(&mut self, _a_s_t_control: &ParseTreeType<'t>) -> Result<()> {
2461        let context = function_name!();
2462        trace!("{}", self.trace_item_stack(context));
2463        let a_s_t_control = pop_item!(self, a_s_t_control, ASTControl, context);
2464        let non_terminal_opt_0_built = NonTerminalOpt { a_s_t_control };
2465        self.push(
2466            ASTType::NonTerminalOpt(Some(non_terminal_opt_0_built)),
2467            context,
2468        );
2469        Ok(())
2470    }
2471
2472    /// Semantic action for production 61:
2473    ///
2474    /// `NonTerminalOpt /* Option<T>::None */: ;`
2475    ///
2476    #[parol_runtime::function_name::named]
2477    fn non_terminal_opt_1(&mut self) -> Result<()> {
2478        let context = function_name!();
2479        trace!("{}", self.trace_item_stack(context));
2480        self.push(ASTType::NonTerminalOpt(None), context);
2481        Ok(())
2482    }
2483
2484    /// Semantic action for production 62:
2485    ///
2486    /// `Identifier: /[a-zA-Z_][a-zA-Z0-9_]*/;`
2487    ///
2488    #[parol_runtime::function_name::named]
2489    fn identifier(&mut self, identifier: &ParseTreeType<'t>) -> Result<()> {
2490        let context = function_name!();
2491        trace!("{}", self.trace_item_stack(context));
2492        let identifier = identifier.token()?.clone();
2493        let identifier_built = Identifier { identifier };
2494        // Calling user action here
2495        self.user_grammar.identifier(&identifier_built)?;
2496        self.push(ASTType::Identifier(identifier_built), context);
2497        Ok(())
2498    }
2499
2500    /// Semantic action for production 63:
2501    ///
2502    /// `ScannerState: '%scanner'^ /* Clipped */ Identifier@state_name '{'^ /* Clipped */ ScannerStateList /* Vec */ '}'^ /* Clipped */;`
2503    ///
2504    #[parol_runtime::function_name::named]
2505    fn scanner_state(
2506        &mut self,
2507        _percent_scanner: &ParseTreeType<'t>,
2508        _state_name: &ParseTreeType<'t>,
2509        _l_brace: &ParseTreeType<'t>,
2510        _scanner_state_list: &ParseTreeType<'t>,
2511        _r_brace: &ParseTreeType<'t>,
2512    ) -> Result<()> {
2513        let context = function_name!();
2514        trace!("{}", self.trace_item_stack(context));
2515        let scanner_state_list =
2516            pop_and_reverse_item!(self, scanner_state_list, ScannerStateList, context);
2517        let state_name = pop_item!(self, state_name, Identifier, context);
2518        let scanner_state_built = ScannerState {
2519            state_name,
2520            scanner_state_list,
2521        };
2522        // Calling user action here
2523        self.user_grammar.scanner_state(&scanner_state_built)?;
2524        self.push(ASTType::ScannerState(scanner_state_built), context);
2525        Ok(())
2526    }
2527
2528    /// Semantic action for production 64:
2529    ///
2530    /// `ScannerStateList /* Vec<T>::Push */: ScannerDirectives ScannerStateList;`
2531    ///
2532    #[parol_runtime::function_name::named]
2533    fn scanner_state_list_0(
2534        &mut self,
2535        _scanner_directives: &ParseTreeType<'t>,
2536        _scanner_state_list: &ParseTreeType<'t>,
2537    ) -> Result<()> {
2538        let context = function_name!();
2539        trace!("{}", self.trace_item_stack(context));
2540        let mut scanner_state_list = pop_item!(self, scanner_state_list, ScannerStateList, context);
2541        let scanner_directives = pop_item!(self, scanner_directives, ScannerDirectives, context);
2542        let scanner_state_list_0_built = ScannerStateList { scanner_directives };
2543        // Add an element to the vector
2544        scanner_state_list.push(scanner_state_list_0_built);
2545        self.push(ASTType::ScannerStateList(scanner_state_list), context);
2546        Ok(())
2547    }
2548
2549    /// Semantic action for production 65:
2550    ///
2551    /// `ScannerStateList /* Vec<T>::New */: ;`
2552    ///
2553    #[parol_runtime::function_name::named]
2554    fn scanner_state_list_1(&mut self) -> Result<()> {
2555        let context = function_name!();
2556        trace!("{}", self.trace_item_stack(context));
2557        let scanner_state_list_1_built = Vec::new();
2558        self.push(
2559            ASTType::ScannerStateList(scanner_state_list_1_built),
2560            context,
2561        );
2562        Ok(())
2563    }
2564
2565    /// Semantic action for production 66:
2566    ///
2567    /// `IdentifierList: Identifier IdentifierListList /* Vec */;`
2568    ///
2569    #[parol_runtime::function_name::named]
2570    fn identifier_list(
2571        &mut self,
2572        _identifier: &ParseTreeType<'t>,
2573        _identifier_list_list: &ParseTreeType<'t>,
2574    ) -> Result<()> {
2575        let context = function_name!();
2576        trace!("{}", self.trace_item_stack(context));
2577        let identifier_list_list =
2578            pop_and_reverse_item!(self, identifier_list_list, IdentifierListList, context);
2579        let identifier = pop_item!(self, identifier, Identifier, context);
2580        let identifier_list_built = IdentifierList {
2581            identifier,
2582            identifier_list_list,
2583        };
2584        // Calling user action here
2585        self.user_grammar.identifier_list(&identifier_list_built)?;
2586        self.push(ASTType::IdentifierList(identifier_list_built), context);
2587        Ok(())
2588    }
2589
2590    /// Semantic action for production 67:
2591    ///
2592    /// `IdentifierListList /* Vec<T>::Push */: ','^ /* Clipped */ Identifier IdentifierListList;`
2593    ///
2594    #[parol_runtime::function_name::named]
2595    fn identifier_list_list_0(
2596        &mut self,
2597        _comma: &ParseTreeType<'t>,
2598        _identifier: &ParseTreeType<'t>,
2599        _identifier_list_list: &ParseTreeType<'t>,
2600    ) -> Result<()> {
2601        let context = function_name!();
2602        trace!("{}", self.trace_item_stack(context));
2603        let mut identifier_list_list =
2604            pop_item!(self, identifier_list_list, IdentifierListList, context);
2605        let identifier = pop_item!(self, identifier, Identifier, context);
2606        let identifier_list_list_0_built = IdentifierListList { identifier };
2607        // Add an element to the vector
2608        identifier_list_list.push(identifier_list_list_0_built);
2609        self.push(ASTType::IdentifierListList(identifier_list_list), context);
2610        Ok(())
2611    }
2612
2613    /// Semantic action for production 68:
2614    ///
2615    /// `IdentifierListList /* Vec<T>::New */: ;`
2616    ///
2617    #[parol_runtime::function_name::named]
2618    fn identifier_list_list_1(&mut self) -> Result<()> {
2619        let context = function_name!();
2620        trace!("{}", self.trace_item_stack(context));
2621        let identifier_list_list_1_built = Vec::new();
2622        self.push(
2623            ASTType::IdentifierListList(identifier_list_list_1_built),
2624            context,
2625        );
2626        Ok(())
2627    }
2628
2629    /// Semantic action for production 69:
2630    ///
2631    /// `ASTControl: CutOperator;`
2632    ///
2633    #[parol_runtime::function_name::named]
2634    fn a_s_t_control_0(&mut self, _cut_operator: &ParseTreeType<'t>) -> Result<()> {
2635        let context = function_name!();
2636        trace!("{}", self.trace_item_stack(context));
2637        let cut_operator = pop_item!(self, cut_operator, CutOperator, context);
2638        let a_s_t_control_0_built = ASTControlCutOperator { cut_operator };
2639        let a_s_t_control_0_built = ASTControl::CutOperator(a_s_t_control_0_built);
2640        // Calling user action here
2641        self.user_grammar.a_s_t_control(&a_s_t_control_0_built)?;
2642        self.push(ASTType::ASTControl(a_s_t_control_0_built), context);
2643        Ok(())
2644    }
2645
2646    /// Semantic action for production 70:
2647    ///
2648    /// `ASTControl: MemberName ASTControlOpt /* Option */;`
2649    ///
2650    #[parol_runtime::function_name::named]
2651    fn a_s_t_control_1(
2652        &mut self,
2653        _member_name: &ParseTreeType<'t>,
2654        _a_s_t_control_opt: &ParseTreeType<'t>,
2655    ) -> Result<()> {
2656        let context = function_name!();
2657        trace!("{}", self.trace_item_stack(context));
2658        let a_s_t_control_opt = pop_item!(self, a_s_t_control_opt, ASTControlOpt, context);
2659        let member_name = pop_item!(self, member_name, MemberName, context);
2660        let a_s_t_control_1_built = ASTControlMemberNameASTControlOpt {
2661            member_name,
2662            a_s_t_control_opt,
2663        };
2664        let a_s_t_control_1_built = ASTControl::MemberNameASTControlOpt(a_s_t_control_1_built);
2665        // Calling user action here
2666        self.user_grammar.a_s_t_control(&a_s_t_control_1_built)?;
2667        self.push(ASTType::ASTControl(a_s_t_control_1_built), context);
2668        Ok(())
2669    }
2670
2671    /// Semantic action for production 71:
2672    ///
2673    /// `ASTControl: UserTypeDeclaration;`
2674    ///
2675    #[parol_runtime::function_name::named]
2676    fn a_s_t_control_2(&mut self, _user_type_declaration: &ParseTreeType<'t>) -> Result<()> {
2677        let context = function_name!();
2678        trace!("{}", self.trace_item_stack(context));
2679        let user_type_declaration =
2680            pop_item!(self, user_type_declaration, UserTypeDeclaration, context);
2681        let a_s_t_control_2_built = ASTControlUserTypeDeclaration {
2682            user_type_declaration,
2683        };
2684        let a_s_t_control_2_built = ASTControl::UserTypeDeclaration(a_s_t_control_2_built);
2685        // Calling user action here
2686        self.user_grammar.a_s_t_control(&a_s_t_control_2_built)?;
2687        self.push(ASTType::ASTControl(a_s_t_control_2_built), context);
2688        Ok(())
2689    }
2690
2691    /// Semantic action for production 72:
2692    ///
2693    /// `ASTControlOpt /* Option<T>::Some */: UserTypeDeclaration;`
2694    ///
2695    #[parol_runtime::function_name::named]
2696    fn a_s_t_control_opt_0(&mut self, _user_type_declaration: &ParseTreeType<'t>) -> Result<()> {
2697        let context = function_name!();
2698        trace!("{}", self.trace_item_stack(context));
2699        let user_type_declaration =
2700            pop_item!(self, user_type_declaration, UserTypeDeclaration, context);
2701        let a_s_t_control_opt_0_built = ASTControlOpt {
2702            user_type_declaration,
2703        };
2704        self.push(
2705            ASTType::ASTControlOpt(Some(a_s_t_control_opt_0_built)),
2706            context,
2707        );
2708        Ok(())
2709    }
2710
2711    /// Semantic action for production 73:
2712    ///
2713    /// `ASTControlOpt /* Option<T>::None */: ;`
2714    ///
2715    #[parol_runtime::function_name::named]
2716    fn a_s_t_control_opt_1(&mut self) -> Result<()> {
2717        let context = function_name!();
2718        trace!("{}", self.trace_item_stack(context));
2719        self.push(ASTType::ASTControlOpt(None), context);
2720        Ok(())
2721    }
2722
2723    /// Semantic action for production 74:
2724    ///
2725    /// `MemberName: '@'^ /* Clipped */ Identifier;`
2726    ///
2727    #[parol_runtime::function_name::named]
2728    fn member_name(
2729        &mut self,
2730        _at: &ParseTreeType<'t>,
2731        _identifier: &ParseTreeType<'t>,
2732    ) -> Result<()> {
2733        let context = function_name!();
2734        trace!("{}", self.trace_item_stack(context));
2735        let identifier = pop_item!(self, identifier, Identifier, context);
2736        let member_name_built = MemberName { identifier };
2737        // Calling user action here
2738        self.user_grammar.member_name(&member_name_built)?;
2739        self.push(ASTType::MemberName(member_name_built), context);
2740        Ok(())
2741    }
2742
2743    /// Semantic action for production 75:
2744    ///
2745    /// `CutOperator: '^'^ /* Clipped */;`
2746    ///
2747    #[parol_runtime::function_name::named]
2748    fn cut_operator(&mut self, _cut_operator: &ParseTreeType<'t>) -> Result<()> {
2749        let context = function_name!();
2750        trace!("{}", self.trace_item_stack(context));
2751        let cut_operator_built = CutOperator {};
2752        // Calling user action here
2753        self.user_grammar.cut_operator(&cut_operator_built)?;
2754        self.push(ASTType::CutOperator(cut_operator_built), context);
2755        Ok(())
2756    }
2757
2758    /// Semantic action for production 76:
2759    ///
2760    /// `UserTypeDeclaration: ':'^ /* Clipped */ UserTypeName;`
2761    ///
2762    #[parol_runtime::function_name::named]
2763    fn user_type_declaration(
2764        &mut self,
2765        _colon: &ParseTreeType<'t>,
2766        _user_type_name: &ParseTreeType<'t>,
2767    ) -> Result<()> {
2768        let context = function_name!();
2769        trace!("{}", self.trace_item_stack(context));
2770        let user_type_name = pop_item!(self, user_type_name, UserTypeName, context);
2771        let user_type_declaration_built = UserTypeDeclaration {
2772            user_type_name: (&user_type_name)
2773                .try_into()
2774                .map_err(parol_runtime::ParolError::UserError)?,
2775        };
2776        // Calling user action here
2777        self.user_grammar
2778            .user_type_declaration(&user_type_declaration_built)?;
2779        self.push(
2780            ASTType::UserTypeDeclaration(user_type_declaration_built),
2781            context,
2782        );
2783        Ok(())
2784    }
2785
2786    /// Semantic action for production 77:
2787    ///
2788    /// `UserTypeName: Identifier UserTypeNameList /* Vec */;`
2789    ///
2790    #[parol_runtime::function_name::named]
2791    fn user_type_name(
2792        &mut self,
2793        _identifier: &ParseTreeType<'t>,
2794        _user_type_name_list: &ParseTreeType<'t>,
2795    ) -> Result<()> {
2796        let context = function_name!();
2797        trace!("{}", self.trace_item_stack(context));
2798        let user_type_name_list =
2799            pop_and_reverse_item!(self, user_type_name_list, UserTypeNameList, context);
2800        let identifier = pop_item!(self, identifier, Identifier, context);
2801        let user_type_name_built = UserTypeName {
2802            identifier,
2803            user_type_name_list,
2804        };
2805        // Calling user action here
2806        self.user_grammar.user_type_name(&user_type_name_built)?;
2807        self.push(ASTType::UserTypeName(user_type_name_built), context);
2808        Ok(())
2809    }
2810
2811    /// Semantic action for production 78:
2812    ///
2813    /// `UserTypeNameList /* Vec<T>::Push */: DoubleColon^ /* Clipped */ Identifier UserTypeNameList;`
2814    ///
2815    #[parol_runtime::function_name::named]
2816    fn user_type_name_list_0(
2817        &mut self,
2818        _double_colon: &ParseTreeType<'t>,
2819        _identifier: &ParseTreeType<'t>,
2820        _user_type_name_list: &ParseTreeType<'t>,
2821    ) -> Result<()> {
2822        let context = function_name!();
2823        trace!("{}", self.trace_item_stack(context));
2824        let mut user_type_name_list =
2825            pop_item!(self, user_type_name_list, UserTypeNameList, context);
2826        let identifier = pop_item!(self, identifier, Identifier, context);
2827        self.pop(context);
2828        let user_type_name_list_0_built = UserTypeNameList { identifier };
2829        // Add an element to the vector
2830        user_type_name_list.push(user_type_name_list_0_built);
2831        self.push(ASTType::UserTypeNameList(user_type_name_list), context);
2832        Ok(())
2833    }
2834
2835    /// Semantic action for production 79:
2836    ///
2837    /// `UserTypeNameList /* Vec<T>::New */: ;`
2838    ///
2839    #[parol_runtime::function_name::named]
2840    fn user_type_name_list_1(&mut self) -> Result<()> {
2841        let context = function_name!();
2842        trace!("{}", self.trace_item_stack(context));
2843        let user_type_name_list_1_built = Vec::new();
2844        self.push(
2845            ASTType::UserTypeNameList(user_type_name_list_1_built),
2846            context,
2847        );
2848        Ok(())
2849    }
2850
2851    /// Semantic action for production 80:
2852    ///
2853    /// `LookAhead: LookAheadGroup TokenLiteral;`
2854    ///
2855    #[parol_runtime::function_name::named]
2856    fn look_ahead(
2857        &mut self,
2858        _look_ahead_group: &ParseTreeType<'t>,
2859        _token_literal: &ParseTreeType<'t>,
2860    ) -> Result<()> {
2861        let context = function_name!();
2862        trace!("{}", self.trace_item_stack(context));
2863        let token_literal = pop_item!(self, token_literal, TokenLiteral, context);
2864        let look_ahead_group = pop_item!(self, look_ahead_group, LookAheadGroup, context);
2865        let look_ahead_built = LookAhead {
2866            look_ahead_group,
2867            token_literal,
2868        };
2869        // Calling user action here
2870        self.user_grammar.look_ahead(&look_ahead_built)?;
2871        self.push(ASTType::LookAhead(look_ahead_built), context);
2872        Ok(())
2873    }
2874
2875    /// Semantic action for production 81:
2876    ///
2877    /// `LookAheadGroup: PositiveLookahead;`
2878    ///
2879    #[parol_runtime::function_name::named]
2880    fn look_ahead_group_0(&mut self, _positive_lookahead: &ParseTreeType<'t>) -> Result<()> {
2881        let context = function_name!();
2882        trace!("{}", self.trace_item_stack(context));
2883        let positive_lookahead = pop_item!(self, positive_lookahead, PositiveLookahead, context);
2884        let look_ahead_group_0_built = LookAheadGroupPositiveLookahead { positive_lookahead };
2885        let look_ahead_group_0_built = LookAheadGroup::PositiveLookahead(look_ahead_group_0_built);
2886        self.push(ASTType::LookAheadGroup(look_ahead_group_0_built), context);
2887        Ok(())
2888    }
2889
2890    /// Semantic action for production 82:
2891    ///
2892    /// `LookAheadGroup: NegativeLookahead;`
2893    ///
2894    #[parol_runtime::function_name::named]
2895    fn look_ahead_group_1(&mut self, _negative_lookahead: &ParseTreeType<'t>) -> Result<()> {
2896        let context = function_name!();
2897        trace!("{}", self.trace_item_stack(context));
2898        let negative_lookahead = pop_item!(self, negative_lookahead, NegativeLookahead, context);
2899        let look_ahead_group_1_built = LookAheadGroupNegativeLookahead { negative_lookahead };
2900        let look_ahead_group_1_built = LookAheadGroup::NegativeLookahead(look_ahead_group_1_built);
2901        self.push(ASTType::LookAheadGroup(look_ahead_group_1_built), context);
2902        Ok(())
2903    }
2904
2905    /// Semantic action for production 83:
2906    ///
2907    /// `PositiveLookahead: '?='^ /* Clipped */;`
2908    ///
2909    #[parol_runtime::function_name::named]
2910    fn positive_lookahead(&mut self, _positive_lookahead: &ParseTreeType<'t>) -> Result<()> {
2911        let context = function_name!();
2912        trace!("{}", self.trace_item_stack(context));
2913        let positive_lookahead_built = PositiveLookahead {};
2914        // Calling user action here
2915        self.user_grammar
2916            .positive_lookahead(&positive_lookahead_built)?;
2917        self.push(
2918            ASTType::PositiveLookahead(positive_lookahead_built),
2919            context,
2920        );
2921        Ok(())
2922    }
2923
2924    /// Semantic action for production 84:
2925    ///
2926    /// `NegativeLookahead: '?!'^ /* Clipped */;`
2927    ///
2928    #[parol_runtime::function_name::named]
2929    fn negative_lookahead(&mut self, _negative_lookahead: &ParseTreeType<'t>) -> Result<()> {
2930        let context = function_name!();
2931        trace!("{}", self.trace_item_stack(context));
2932        let negative_lookahead_built = NegativeLookahead {};
2933        // Calling user action here
2934        self.user_grammar
2935            .negative_lookahead(&negative_lookahead_built)?;
2936        self.push(
2937            ASTType::NegativeLookahead(negative_lookahead_built),
2938            context,
2939        );
2940        Ok(())
2941    }
2942}
2943
2944impl<'t> UserActionsTrait<'t> for ParolGrammarAuto<'t, '_> {
2945    ///
2946    /// This function is implemented automatically for the user's item ParolGrammar.
2947    ///
2948    fn call_semantic_action_for_production_number(
2949        &mut self,
2950        prod_num: usize,
2951        children: &[ParseTreeType<'t>],
2952    ) -> Result<()> {
2953        match prod_num {
2954            0 => self.parol(&children[0], &children[1]),
2955            1 => self.prolog(&children[0], &children[1], &children[2]),
2956            2 => self.prolog_list0_0(&children[0], &children[1]),
2957            3 => self.prolog_list0_1(),
2958            4 => self.prolog_list_0(&children[0], &children[1]),
2959            5 => self.prolog_list_1(),
2960            6 => self.start_declaration(&children[0], &children[1]),
2961            7 => self.declaration_0(&children[0], &children[1]),
2962            8 => self.declaration_1(&children[0], &children[1]),
2963            9 => self.declaration_2(&children[0], &children[1], &children[2], &children[3]),
2964            10 => self.declaration_3(&children[0], &children[1], &children[2], &children[3]),
2965            11 => self.declaration_4(&children[0], &children[1]),
2966            12 => self.declaration_5(&children[0], &children[1]),
2967            13 => self.declaration_6(&children[0]),
2968            14 => self.scanner_directives_0(&children[0], &children[1]),
2969            15 => self.scanner_directives_1(&children[0], &children[1], &children[2]),
2970            16 => self.scanner_directives_2(&children[0]),
2971            17 => self.scanner_directives_3(&children[0]),
2972            18 => self.scanner_directives_4(&children[0], &children[1], &children[2]),
2973            19 => self.scanner_directives_5(&children[0]),
2974            20 => self.scanner_state_directives_0(&children[0], &children[1]),
2975            21 => self.scanner_state_directives_1(&children[0], &children[1]),
2976            22 => self.scanner_state_directives_2(&children[0]),
2977            23 => self.grammar_definition(&children[0], &children[1], &children[2]),
2978            24 => self.grammar_definition_list_0(&children[0], &children[1]),
2979            25 => self.grammar_definition_list_1(),
2980            26 => self.double_colon(&children[0]),
2981            27 => self.production(&children[0], &children[1], &children[2], &children[3]),
2982            28 => self.alternations(&children[0], &children[1]),
2983            29 => self.alternations_list_0(&children[0], &children[1], &children[2]),
2984            30 => self.alternations_list_1(),
2985            31 => self.alternation(&children[0]),
2986            32 => self.alternation_list_0(&children[0], &children[1]),
2987            33 => self.alternation_list_1(),
2988            34 => self.factor_0(&children[0]),
2989            35 => self.factor_1(&children[0]),
2990            36 => self.factor_2(&children[0]),
2991            37 => self.factor_3(&children[0]),
2992            38 => self.symbol_0(&children[0]),
2993            39 => self.symbol_1(&children[0]),
2994            40 => self.symbol_2(&children[0]),
2995            41 => self.token_literal_0(&children[0]),
2996            42 => self.token_literal_1(&children[0]),
2997            43 => self.token_literal_2(&children[0]),
2998            44 => self.token_expression(&children[0], &children[1]),
2999            45 => self.token_expression_opt_0(&children[0]),
3000            46 => self.token_expression_opt_1(),
3001            47 => self.simple_token(&children[0], &children[1]),
3002            48 => self.simple_token_opt_0(&children[0]),
3003            49 => self.simple_token_opt_1(),
3004            50 => self.token_with_states(
3005                &children[0],
3006                &children[1],
3007                &children[2],
3008                &children[3],
3009                &children[4],
3010            ),
3011            51 => self.token_with_states_opt_0(&children[0]),
3012            52 => self.token_with_states_opt_1(),
3013            53 => self.string(&children[0]),
3014            54 => self.raw_string(&children[0]),
3015            55 => self.regex(&children[0]),
3016            56 => self.group(&children[0], &children[1], &children[2]),
3017            57 => self.optional(&children[0], &children[1], &children[2]),
3018            58 => self.repeat(&children[0], &children[1], &children[2]),
3019            59 => self.non_terminal(&children[0], &children[1]),
3020            60 => self.non_terminal_opt_0(&children[0]),
3021            61 => self.non_terminal_opt_1(),
3022            62 => self.identifier(&children[0]),
3023            63 => self.scanner_state(
3024                &children[0],
3025                &children[1],
3026                &children[2],
3027                &children[3],
3028                &children[4],
3029            ),
3030            64 => self.scanner_state_list_0(&children[0], &children[1]),
3031            65 => self.scanner_state_list_1(),
3032            66 => self.identifier_list(&children[0], &children[1]),
3033            67 => self.identifier_list_list_0(&children[0], &children[1], &children[2]),
3034            68 => self.identifier_list_list_1(),
3035            69 => self.a_s_t_control_0(&children[0]),
3036            70 => self.a_s_t_control_1(&children[0], &children[1]),
3037            71 => self.a_s_t_control_2(&children[0]),
3038            72 => self.a_s_t_control_opt_0(&children[0]),
3039            73 => self.a_s_t_control_opt_1(),
3040            74 => self.member_name(&children[0], &children[1]),
3041            75 => self.cut_operator(&children[0]),
3042            76 => self.user_type_declaration(&children[0], &children[1]),
3043            77 => self.user_type_name(&children[0], &children[1]),
3044            78 => self.user_type_name_list_0(&children[0], &children[1], &children[2]),
3045            79 => self.user_type_name_list_1(),
3046            80 => self.look_ahead(&children[0], &children[1]),
3047            81 => self.look_ahead_group_0(&children[0]),
3048            82 => self.look_ahead_group_1(&children[0]),
3049            83 => self.positive_lookahead(&children[0]),
3050            84 => self.negative_lookahead(&children[0]),
3051            _ => Err(ParserError::InternalError(format!(
3052                "Unhandled production number: {prod_num}"
3053            ))
3054            .into()),
3055        }
3056    }
3057
3058    fn on_comment(&mut self, token: Token<'t>) {
3059        self.user_grammar.on_comment(token)
3060    }
3061}