Skip to main content

parol/parser/
parol_parser.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
7use parol_runtime::{
8    ParolError, ParseTree, TokenStream,
9    parser::{
10        LLKParser, LookaheadDFA, ParseType, Production, Trans, parse_tree_type::TreeConstruct,
11    },
12};
13use scnr2::scanner;
14use std::path::Path;
15
16use crate::parser::parol_grammar::ParolGrammar;
17use crate::parser::parol_grammar_trait::ParolGrammarAuto;
18
19pub const TERMINAL_NAMES: &[&str; 46] = &[
20    /*  0 */ "EndOfInput",
21    /*  1 */ "Newline",
22    /*  2 */ "Whitespace",
23    /*  3 */ "LineComment",
24    /*  4 */ "BlockComment",
25    /*  5 */ "PercentStart",
26    /*  6 */ "PercentTitle",
27    /*  7 */ "PercentComment",
28    /*  8 */ "PercentUserUnderscoreType",
29    /*  9 */ "Equ",
30    /* 10 */ "PercentNtUnderscoreType",
31    /* 11 */ "PercentTUnderscoreType",
32    /* 12 */ "PercentGrammarUnderscoreType",
33    /* 13 */ "PercentLineUnderscoreComment",
34    /* 14 */ "PercentBlockUnderscoreComment",
35    /* 15 */ "PercentAutoUnderscoreNewlineUnderscoreOff",
36    /* 16 */ "PercentAutoUnderscoreWsUnderscoreOff",
37    /* 17 */ "PercentOn",
38    /* 18 */ "PercentAllowUnderscoreUnmatched",
39    /* 19 */ "PercentEnter",
40    /* 20 */ "PercentPush",
41    /* 21 */ "PercentPop",
42    /* 22 */ "PercentPercent",
43    /* 23 */ "DoubleColon",
44    /* 24 */ "Colon",
45    /* 25 */ "Semicolon",
46    /* 26 */ "Or",
47    /* 27 */ "LT",
48    /* 28 */ "GT",
49    /* 29 */ "String",
50    /* 30 */ "RawString",
51    /* 31 */ "Regex",
52    /* 32 */ "LParen",
53    /* 33 */ "RParen",
54    /* 34 */ "LBracket",
55    /* 35 */ "RBracket",
56    /* 36 */ "LBrace",
57    /* 37 */ "RBrace",
58    /* 38 */ "Identifier",
59    /* 39 */ "PercentScanner",
60    /* 40 */ "Comma",
61    /* 41 */ "At",
62    /* 42 */ "CutOperator",
63    /* 43 */ "PositiveLookahead",
64    /* 44 */ "NegativeLookahead",
65    /* 45 */ "Error",
66];
67
68scanner! {
69    ParolGrammarScanner {
70        mode INITIAL {
71            token r"\r\n|\r|\n" => 1; // "Newline"
72            token r"[\s--\r\n]+" => 2; // "Whitespace"
73            token r"//.*(\r\n|\r|\n)?" => 3; // "LineComment"
74            token r"/\*/?([^/]|[^*]/)*\*/" => 4; // "BlockComment"
75            token r"%start" => 5; // "PercentStart"
76            token r"%title" => 6; // "PercentTitle"
77            token r"%comment" => 7; // "PercentComment"
78            token r"%user_type" => 8; // "PercentUserUnderscoreType"
79            token r"=" => 9; // "Equ"
80            token r"%nt_type" => 10; // "PercentNtUnderscoreType"
81            token r"%t_type" => 11; // "PercentTUnderscoreType"
82            token r"%grammar_type" => 12; // "PercentGrammarUnderscoreType"
83            token r"%line_comment" => 13; // "PercentLineUnderscoreComment"
84            token r"%block_comment" => 14; // "PercentBlockUnderscoreComment"
85            token r"%auto_newline_off" => 15; // "PercentAutoUnderscoreNewlineUnderscoreOff"
86            token r"%auto_ws_off" => 16; // "PercentAutoUnderscoreWsUnderscoreOff"
87            token r"%on" => 17; // "PercentOn"
88            token r"%allow_unmatched" => 18; // "PercentAllowUnderscoreUnmatched"
89            token r"%enter" => 19; // "PercentEnter"
90            token r"%push" => 20; // "PercentPush"
91            token r"%pop" => 21; // "PercentPop"
92            token r"%%" => 22; // "PercentPercent"
93            token r"::" => 23; // "DoubleColon"
94            token r":" => 24; // "Colon"
95            token r";" => 25; // "Semicolon"
96            token r"\|" => 26; // "Or"
97            token r"<" => 27; // "LT"
98            token r">" => 28; // "GT"
99            token r#""(\\.|[^"])*""# => 29; // "String"
100            token r"'(\\.|[^'])*'" => 30; // "RawString"
101            token r"/(\\.|[^\/])*/" => 31; // "Regex"
102            token r"\(" => 32; // "LParen"
103            token r"\)" => 33; // "RParen"
104            token r"\[" => 34; // "LBracket"
105            token r"\]" => 35; // "RBracket"
106            token r"\{" => 36; // "LBrace"
107            token r"\}" => 37; // "RBrace"
108            token r"[a-zA-Z_][a-zA-Z0-9_]*" => 38; // "Identifier"
109            token r"%scanner" => 39; // "PercentScanner"
110            token r"," => 40; // "Comma"
111            token r"@" => 41; // "At"
112            token r"\^" => 42; // "CutOperator"
113            token r"\?=" => 43; // "PositiveLookahead"
114            token r"\?!" => 44; // "NegativeLookahead"
115            token r"." => 45; // "Error"
116        }
117    }
118}
119
120const MAX_K: usize = 1;
121
122pub const NON_TERMINALS: &[&str; 49] = &[
123    /*  0 */ "ASTControl",
124    /*  1 */ "ASTControlOpt",
125    /*  2 */ "Alternation",
126    /*  3 */ "AlternationList",
127    /*  4 */ "Alternations",
128    /*  5 */ "AlternationsList",
129    /*  6 */ "CutOperator",
130    /*  7 */ "Declaration",
131    /*  8 */ "DoubleColon",
132    /*  9 */ "Factor",
133    /* 10 */ "GrammarDefinition",
134    /* 11 */ "GrammarDefinitionList",
135    /* 12 */ "Group",
136    /* 13 */ "Identifier",
137    /* 14 */ "IdentifierList",
138    /* 15 */ "IdentifierListList",
139    /* 16 */ "LookAhead",
140    /* 17 */ "LookAheadGroup",
141    /* 18 */ "MemberName",
142    /* 19 */ "NegativeLookahead",
143    /* 20 */ "NonTerminal",
144    /* 21 */ "NonTerminalOpt",
145    /* 22 */ "Optional",
146    /* 23 */ "Parol",
147    /* 24 */ "PositiveLookahead",
148    /* 25 */ "Production",
149    /* 26 */ "Prolog",
150    /* 27 */ "PrologList",
151    /* 28 */ "PrologList0",
152    /* 29 */ "RawString",
153    /* 30 */ "Regex",
154    /* 31 */ "Repeat",
155    /* 32 */ "ScannerDirectives",
156    /* 33 */ "ScannerState",
157    /* 34 */ "ScannerStateDirectives",
158    /* 35 */ "ScannerStateList",
159    /* 36 */ "SimpleToken",
160    /* 37 */ "SimpleTokenOpt",
161    /* 38 */ "StartDeclaration",
162    /* 39 */ "String",
163    /* 40 */ "Symbol",
164    /* 41 */ "TokenExpression",
165    /* 42 */ "TokenExpressionOpt",
166    /* 43 */ "TokenLiteral",
167    /* 44 */ "TokenWithStates",
168    /* 45 */ "TokenWithStatesOpt",
169    /* 46 */ "UserTypeDeclaration",
170    /* 47 */ "UserTypeName",
171    /* 48 */ "UserTypeNameList",
172];
173
174pub const LOOKAHEAD_AUTOMATA: &[LookaheadDFA; 49] = &[
175    /* 0 - "ASTControl" */
176    LookaheadDFA {
177        prod0: -1,
178        transitions: &[
179            Trans(0, 24, 3, 71),
180            Trans(0, 41, 2, 70),
181            Trans(0, 42, 1, 69),
182        ],
183        k: 1,
184    },
185    /* 1 - "ASTControlOpt" */
186    LookaheadDFA {
187        prod0: -1,
188        transitions: &[
189            Trans(0, 24, 1, 72),
190            Trans(0, 25, 2, 73),
191            Trans(0, 26, 2, 73),
192            Trans(0, 27, 2, 73),
193            Trans(0, 29, 2, 73),
194            Trans(0, 30, 2, 73),
195            Trans(0, 31, 2, 73),
196            Trans(0, 32, 2, 73),
197            Trans(0, 33, 2, 73),
198            Trans(0, 34, 2, 73),
199            Trans(0, 35, 2, 73),
200            Trans(0, 36, 2, 73),
201            Trans(0, 37, 2, 73),
202            Trans(0, 38, 2, 73),
203        ],
204        k: 1,
205    },
206    /* 2 - "Alternation" */
207    LookaheadDFA {
208        prod0: 31,
209        transitions: &[],
210        k: 0,
211    },
212    /* 3 - "AlternationList" */
213    LookaheadDFA {
214        prod0: -1,
215        transitions: &[
216            Trans(0, 25, 2, 33),
217            Trans(0, 26, 2, 33),
218            Trans(0, 27, 1, 32),
219            Trans(0, 29, 1, 32),
220            Trans(0, 30, 1, 32),
221            Trans(0, 31, 1, 32),
222            Trans(0, 32, 1, 32),
223            Trans(0, 33, 2, 33),
224            Trans(0, 34, 1, 32),
225            Trans(0, 35, 2, 33),
226            Trans(0, 36, 1, 32),
227            Trans(0, 37, 2, 33),
228            Trans(0, 38, 1, 32),
229        ],
230        k: 1,
231    },
232    /* 4 - "Alternations" */
233    LookaheadDFA {
234        prod0: 28,
235        transitions: &[],
236        k: 0,
237    },
238    /* 5 - "AlternationsList" */
239    LookaheadDFA {
240        prod0: -1,
241        transitions: &[
242            Trans(0, 25, 2, 30),
243            Trans(0, 26, 1, 29),
244            Trans(0, 33, 2, 30),
245            Trans(0, 35, 2, 30),
246            Trans(0, 37, 2, 30),
247        ],
248        k: 1,
249    },
250    /* 6 - "CutOperator" */
251    LookaheadDFA {
252        prod0: 75,
253        transitions: &[],
254        k: 0,
255    },
256    /* 7 - "Declaration" */
257    LookaheadDFA {
258        prod0: -1,
259        transitions: &[
260            Trans(0, 6, 1, 7),
261            Trans(0, 7, 2, 8),
262            Trans(0, 8, 3, 9),
263            Trans(0, 10, 4, 10),
264            Trans(0, 11, 5, 11),
265            Trans(0, 12, 6, 12),
266            Trans(0, 13, 7, 13),
267            Trans(0, 14, 7, 13),
268            Trans(0, 15, 7, 13),
269            Trans(0, 16, 7, 13),
270            Trans(0, 17, 7, 13),
271            Trans(0, 18, 7, 13),
272        ],
273        k: 1,
274    },
275    /* 8 - "DoubleColon" */
276    LookaheadDFA {
277        prod0: 26,
278        transitions: &[],
279        k: 0,
280    },
281    /* 9 - "Factor" */
282    LookaheadDFA {
283        prod0: -1,
284        transitions: &[
285            Trans(0, 27, 4, 37),
286            Trans(0, 29, 4, 37),
287            Trans(0, 30, 4, 37),
288            Trans(0, 31, 4, 37),
289            Trans(0, 32, 1, 34),
290            Trans(0, 34, 3, 36),
291            Trans(0, 36, 2, 35),
292            Trans(0, 38, 4, 37),
293        ],
294        k: 1,
295    },
296    /* 10 - "GrammarDefinition" */
297    LookaheadDFA {
298        prod0: 23,
299        transitions: &[],
300        k: 0,
301    },
302    /* 11 - "GrammarDefinitionList" */
303    LookaheadDFA {
304        prod0: -1,
305        transitions: &[Trans(0, 0, 2, 25), Trans(0, 38, 1, 24)],
306        k: 1,
307    },
308    /* 12 - "Group" */
309    LookaheadDFA {
310        prod0: 56,
311        transitions: &[],
312        k: 0,
313    },
314    /* 13 - "Identifier" */
315    LookaheadDFA {
316        prod0: 62,
317        transitions: &[],
318        k: 0,
319    },
320    /* 14 - "IdentifierList" */
321    LookaheadDFA {
322        prod0: 66,
323        transitions: &[],
324        k: 0,
325    },
326    /* 15 - "IdentifierListList" */
327    LookaheadDFA {
328        prod0: -1,
329        transitions: &[
330            Trans(0, 19, 2, 68),
331            Trans(0, 20, 2, 68),
332            Trans(0, 21, 2, 68),
333            Trans(0, 28, 2, 68),
334            Trans(0, 40, 1, 67),
335        ],
336        k: 1,
337    },
338    /* 16 - "LookAhead" */
339    LookaheadDFA {
340        prod0: 80,
341        transitions: &[],
342        k: 0,
343    },
344    /* 17 - "LookAheadGroup" */
345    LookaheadDFA {
346        prod0: -1,
347        transitions: &[Trans(0, 43, 1, 81), Trans(0, 44, 2, 82)],
348        k: 1,
349    },
350    /* 18 - "MemberName" */
351    LookaheadDFA {
352        prod0: 74,
353        transitions: &[],
354        k: 0,
355    },
356    /* 19 - "NegativeLookahead" */
357    LookaheadDFA {
358        prod0: 84,
359        transitions: &[],
360        k: 0,
361    },
362    /* 20 - "NonTerminal" */
363    LookaheadDFA {
364        prod0: 59,
365        transitions: &[],
366        k: 0,
367    },
368    /* 21 - "NonTerminalOpt" */
369    LookaheadDFA {
370        prod0: -1,
371        transitions: &[
372            Trans(0, 24, 1, 60),
373            Trans(0, 25, 2, 61),
374            Trans(0, 26, 2, 61),
375            Trans(0, 27, 2, 61),
376            Trans(0, 29, 2, 61),
377            Trans(0, 30, 2, 61),
378            Trans(0, 31, 2, 61),
379            Trans(0, 32, 2, 61),
380            Trans(0, 33, 2, 61),
381            Trans(0, 34, 2, 61),
382            Trans(0, 35, 2, 61),
383            Trans(0, 36, 2, 61),
384            Trans(0, 37, 2, 61),
385            Trans(0, 38, 2, 61),
386            Trans(0, 41, 1, 60),
387            Trans(0, 42, 1, 60),
388        ],
389        k: 1,
390    },
391    /* 22 - "Optional" */
392    LookaheadDFA {
393        prod0: 57,
394        transitions: &[],
395        k: 0,
396    },
397    /* 23 - "Parol" */
398    LookaheadDFA {
399        prod0: 0,
400        transitions: &[],
401        k: 0,
402    },
403    /* 24 - "PositiveLookahead" */
404    LookaheadDFA {
405        prod0: 83,
406        transitions: &[],
407        k: 0,
408    },
409    /* 25 - "Production" */
410    LookaheadDFA {
411        prod0: 27,
412        transitions: &[],
413        k: 0,
414    },
415    /* 26 - "Prolog" */
416    LookaheadDFA {
417        prod0: 1,
418        transitions: &[],
419        k: 0,
420    },
421    /* 27 - "PrologList" */
422    LookaheadDFA {
423        prod0: -1,
424        transitions: &[
425            Trans(0, 6, 1, 4),
426            Trans(0, 7, 1, 4),
427            Trans(0, 8, 1, 4),
428            Trans(0, 10, 1, 4),
429            Trans(0, 11, 1, 4),
430            Trans(0, 12, 1, 4),
431            Trans(0, 13, 1, 4),
432            Trans(0, 14, 1, 4),
433            Trans(0, 15, 1, 4),
434            Trans(0, 16, 1, 4),
435            Trans(0, 17, 1, 4),
436            Trans(0, 18, 1, 4),
437            Trans(0, 22, 2, 5),
438            Trans(0, 39, 2, 5),
439        ],
440        k: 1,
441    },
442    /* 28 - "PrologList0" */
443    LookaheadDFA {
444        prod0: -1,
445        transitions: &[Trans(0, 22, 2, 3), Trans(0, 39, 1, 2)],
446        k: 1,
447    },
448    /* 29 - "RawString" */
449    LookaheadDFA {
450        prod0: 54,
451        transitions: &[],
452        k: 0,
453    },
454    /* 30 - "Regex" */
455    LookaheadDFA {
456        prod0: 55,
457        transitions: &[],
458        k: 0,
459    },
460    /* 31 - "Repeat" */
461    LookaheadDFA {
462        prod0: 58,
463        transitions: &[],
464        k: 0,
465    },
466    /* 32 - "ScannerDirectives" */
467    LookaheadDFA {
468        prod0: -1,
469        transitions: &[
470            Trans(0, 13, 1, 14),
471            Trans(0, 14, 2, 15),
472            Trans(0, 15, 3, 16),
473            Trans(0, 16, 4, 17),
474            Trans(0, 17, 5, 18),
475            Trans(0, 18, 6, 19),
476        ],
477        k: 1,
478    },
479    /* 33 - "ScannerState" */
480    LookaheadDFA {
481        prod0: 63,
482        transitions: &[],
483        k: 0,
484    },
485    /* 34 - "ScannerStateDirectives" */
486    LookaheadDFA {
487        prod0: -1,
488        transitions: &[
489            Trans(0, 19, 1, 20),
490            Trans(0, 20, 2, 21),
491            Trans(0, 21, 3, 22),
492        ],
493        k: 1,
494    },
495    /* 35 - "ScannerStateList" */
496    LookaheadDFA {
497        prod0: -1,
498        transitions: &[
499            Trans(0, 13, 1, 64),
500            Trans(0, 14, 1, 64),
501            Trans(0, 15, 1, 64),
502            Trans(0, 16, 1, 64),
503            Trans(0, 17, 1, 64),
504            Trans(0, 18, 1, 64),
505            Trans(0, 37, 2, 65),
506        ],
507        k: 1,
508    },
509    /* 36 - "SimpleToken" */
510    LookaheadDFA {
511        prod0: 47,
512        transitions: &[],
513        k: 0,
514    },
515    /* 37 - "SimpleTokenOpt" */
516    LookaheadDFA {
517        prod0: -1,
518        transitions: &[
519            Trans(0, 24, 1, 48),
520            Trans(0, 25, 2, 49),
521            Trans(0, 26, 2, 49),
522            Trans(0, 27, 2, 49),
523            Trans(0, 29, 2, 49),
524            Trans(0, 30, 2, 49),
525            Trans(0, 31, 2, 49),
526            Trans(0, 32, 2, 49),
527            Trans(0, 33, 2, 49),
528            Trans(0, 34, 2, 49),
529            Trans(0, 35, 2, 49),
530            Trans(0, 36, 2, 49),
531            Trans(0, 37, 2, 49),
532            Trans(0, 38, 2, 49),
533            Trans(0, 41, 1, 48),
534            Trans(0, 42, 1, 48),
535        ],
536        k: 1,
537    },
538    /* 38 - "StartDeclaration" */
539    LookaheadDFA {
540        prod0: 6,
541        transitions: &[],
542        k: 0,
543    },
544    /* 39 - "String" */
545    LookaheadDFA {
546        prod0: 53,
547        transitions: &[],
548        k: 0,
549    },
550    /* 40 - "Symbol" */
551    LookaheadDFA {
552        prod0: -1,
553        transitions: &[
554            Trans(0, 27, 3, 40),
555            Trans(0, 29, 2, 39),
556            Trans(0, 30, 2, 39),
557            Trans(0, 31, 2, 39),
558            Trans(0, 38, 1, 38),
559        ],
560        k: 1,
561    },
562    /* 41 - "TokenExpression" */
563    LookaheadDFA {
564        prod0: 44,
565        transitions: &[],
566        k: 0,
567    },
568    /* 42 - "TokenExpressionOpt" */
569    LookaheadDFA {
570        prod0: -1,
571        transitions: &[
572            Trans(0, 24, 2, 46),
573            Trans(0, 25, 2, 46),
574            Trans(0, 26, 2, 46),
575            Trans(0, 27, 2, 46),
576            Trans(0, 29, 2, 46),
577            Trans(0, 30, 2, 46),
578            Trans(0, 31, 2, 46),
579            Trans(0, 32, 2, 46),
580            Trans(0, 33, 2, 46),
581            Trans(0, 34, 2, 46),
582            Trans(0, 35, 2, 46),
583            Trans(0, 36, 2, 46),
584            Trans(0, 37, 2, 46),
585            Trans(0, 38, 2, 46),
586            Trans(0, 41, 2, 46),
587            Trans(0, 42, 2, 46),
588            Trans(0, 43, 1, 45),
589            Trans(0, 44, 1, 45),
590        ],
591        k: 1,
592    },
593    /* 43 - "TokenLiteral" */
594    LookaheadDFA {
595        prod0: -1,
596        transitions: &[
597            Trans(0, 29, 1, 41),
598            Trans(0, 30, 2, 42),
599            Trans(0, 31, 3, 43),
600        ],
601        k: 1,
602    },
603    /* 44 - "TokenWithStates" */
604    LookaheadDFA {
605        prod0: 50,
606        transitions: &[],
607        k: 0,
608    },
609    /* 45 - "TokenWithStatesOpt" */
610    LookaheadDFA {
611        prod0: -1,
612        transitions: &[
613            Trans(0, 24, 1, 51),
614            Trans(0, 25, 2, 52),
615            Trans(0, 26, 2, 52),
616            Trans(0, 27, 2, 52),
617            Trans(0, 29, 2, 52),
618            Trans(0, 30, 2, 52),
619            Trans(0, 31, 2, 52),
620            Trans(0, 32, 2, 52),
621            Trans(0, 33, 2, 52),
622            Trans(0, 34, 2, 52),
623            Trans(0, 35, 2, 52),
624            Trans(0, 36, 2, 52),
625            Trans(0, 37, 2, 52),
626            Trans(0, 38, 2, 52),
627            Trans(0, 41, 1, 51),
628            Trans(0, 42, 1, 51),
629        ],
630        k: 1,
631    },
632    /* 46 - "UserTypeDeclaration" */
633    LookaheadDFA {
634        prod0: 76,
635        transitions: &[],
636        k: 0,
637    },
638    /* 47 - "UserTypeName" */
639    LookaheadDFA {
640        prod0: 77,
641        transitions: &[],
642        k: 0,
643    },
644    /* 48 - "UserTypeNameList" */
645    LookaheadDFA {
646        prod0: -1,
647        transitions: &[
648            Trans(0, 6, 2, 79),
649            Trans(0, 7, 2, 79),
650            Trans(0, 8, 2, 79),
651            Trans(0, 10, 2, 79),
652            Trans(0, 11, 2, 79),
653            Trans(0, 12, 2, 79),
654            Trans(0, 13, 2, 79),
655            Trans(0, 14, 2, 79),
656            Trans(0, 15, 2, 79),
657            Trans(0, 16, 2, 79),
658            Trans(0, 17, 2, 79),
659            Trans(0, 18, 2, 79),
660            Trans(0, 22, 2, 79),
661            Trans(0, 23, 1, 78),
662            Trans(0, 25, 2, 79),
663            Trans(0, 26, 2, 79),
664            Trans(0, 27, 2, 79),
665            Trans(0, 29, 2, 79),
666            Trans(0, 30, 2, 79),
667            Trans(0, 31, 2, 79),
668            Trans(0, 32, 2, 79),
669            Trans(0, 33, 2, 79),
670            Trans(0, 34, 2, 79),
671            Trans(0, 35, 2, 79),
672            Trans(0, 36, 2, 79),
673            Trans(0, 37, 2, 79),
674            Trans(0, 38, 2, 79),
675            Trans(0, 39, 2, 79),
676        ],
677        k: 1,
678    },
679];
680
681pub const PRODUCTIONS: &[Production; 85] = &[
682    // 0 - Parol: Prolog GrammarDefinition;
683    Production {
684        lhs: 23,
685        production: &[ParseType::N(10), ParseType::N(26)],
686    },
687    // 1 - Prolog: StartDeclaration PrologList /* Vec */ PrologList0 /* Vec */;
688    Production {
689        lhs: 26,
690        production: &[ParseType::N(28), ParseType::N(27), ParseType::N(38)],
691    },
692    // 2 - PrologList0: ScannerState : crate::parser::parol_grammar::ScannerConfig  PrologList0;
693    Production {
694        lhs: 28,
695        production: &[ParseType::N(28), ParseType::N(33)],
696    },
697    // 3 - PrologList0: ;
698    Production {
699        lhs: 28,
700        production: &[],
701    },
702    // 4 - PrologList: Declaration PrologList;
703    Production {
704        lhs: 27,
705        production: &[ParseType::N(27), ParseType::N(7)],
706    },
707    // 5 - PrologList: ;
708    Production {
709        lhs: 27,
710        production: &[],
711    },
712    // 6 - StartDeclaration: '%start'^ /* Clipped */ Identifier;
713    Production {
714        lhs: 38,
715        production: &[ParseType::N(13), ParseType::T(5)],
716    },
717    // 7 - Declaration: '%title'^ /* Clipped */ String;
718    Production {
719        lhs: 7,
720        production: &[ParseType::N(39), ParseType::T(6)],
721    },
722    // 8 - Declaration: '%comment'^ /* Clipped */ String;
723    Production {
724        lhs: 7,
725        production: &[ParseType::N(39), ParseType::T(7)],
726    },
727    // 9 - Declaration: '%user_type'^ /* Clipped */ Identifier '='^ /* Clipped */ UserTypeName : crate::parser::parol_grammar::UserDefinedTypeName ;
728    Production {
729        lhs: 7,
730        production: &[
731            ParseType::N(47),
732            ParseType::T(9),
733            ParseType::N(13),
734            ParseType::T(8),
735        ],
736    },
737    // 10 - Declaration: "%nt_type"^ /* Clipped */ Identifier@nt_name '='^ /* Clipped */ UserTypeName@nt_type : crate::parser::parol_grammar::UserDefinedTypeName ;
738    Production {
739        lhs: 7,
740        production: &[
741            ParseType::N(47),
742            ParseType::T(9),
743            ParseType::N(13),
744            ParseType::T(10),
745        ],
746    },
747    // 11 - Declaration: "%t_type"^ /* Clipped */ UserTypeName@t_type : crate::parser::parol_grammar::UserDefinedTypeName ;
748    Production {
749        lhs: 7,
750        production: &[ParseType::N(47), ParseType::T(11)],
751    },
752    // 12 - Declaration: '%grammar_type'^ /* Clipped */ RawString;
753    Production {
754        lhs: 7,
755        production: &[ParseType::N(29), ParseType::T(12)],
756    },
757    // 13 - Declaration: ScannerDirectives;
758    Production {
759        lhs: 7,
760        production: &[ParseType::N(32)],
761    },
762    // 14 - ScannerDirectives: '%line_comment'^ /* Clipped */ TokenLiteral;
763    Production {
764        lhs: 32,
765        production: &[ParseType::N(43), ParseType::T(13)],
766    },
767    // 15 - ScannerDirectives: '%block_comment'^ /* Clipped */ TokenLiteral TokenLiteral;
768    Production {
769        lhs: 32,
770        production: &[ParseType::N(43), ParseType::N(43), ParseType::T(14)],
771    },
772    // 16 - ScannerDirectives: '%auto_newline_off'^ /* Clipped */;
773    Production {
774        lhs: 32,
775        production: &[ParseType::T(15)],
776    },
777    // 17 - ScannerDirectives: '%auto_ws_off'^ /* Clipped */;
778    Production {
779        lhs: 32,
780        production: &[ParseType::T(16)],
781    },
782    // 18 - ScannerDirectives: '%on'^ /* Clipped */ IdentifierList ScannerStateDirectives : crate::parser::parol_grammar::ScannerStateSwitch ;
783    Production {
784        lhs: 32,
785        production: &[ParseType::N(34), ParseType::N(14), ParseType::T(17)],
786    },
787    // 19 - ScannerDirectives: '%allow_unmatched'^ /* Clipped */;
788    Production {
789        lhs: 32,
790        production: &[ParseType::T(18)],
791    },
792    // 20 - ScannerStateDirectives: '%enter'^ /* Clipped */ Identifier;
793    Production {
794        lhs: 34,
795        production: &[ParseType::N(13), ParseType::T(19)],
796    },
797    // 21 - ScannerStateDirectives: '%push'^ /* Clipped */ Identifier;
798    Production {
799        lhs: 34,
800        production: &[ParseType::N(13), ParseType::T(20)],
801    },
802    // 22 - ScannerStateDirectives: '%pop';
803    Production {
804        lhs: 34,
805        production: &[ParseType::T(21)],
806    },
807    // 23 - GrammarDefinition: '%%'^ /* Clipped */ Production GrammarDefinitionList /* Vec */;
808    Production {
809        lhs: 10,
810        production: &[ParseType::N(11), ParseType::N(25), ParseType::T(22)],
811    },
812    // 24 - GrammarDefinitionList: Production GrammarDefinitionList;
813    Production {
814        lhs: 11,
815        production: &[ParseType::N(11), ParseType::N(25)],
816    },
817    // 25 - GrammarDefinitionList: ;
818    Production {
819        lhs: 11,
820        production: &[],
821    },
822    // 26 - DoubleColon: '::';
823    Production {
824        lhs: 8,
825        production: &[ParseType::T(23)],
826    },
827    // 27 - Production: Identifier ':'^ /* Clipped */ Alternations ';'^ /* Clipped */;
828    Production {
829        lhs: 25,
830        production: &[
831            ParseType::T(25),
832            ParseType::N(4),
833            ParseType::T(24),
834            ParseType::N(13),
835        ],
836    },
837    // 28 - Alternations: Alternation AlternationsList /* Vec */;
838    Production {
839        lhs: 4,
840        production: &[ParseType::N(5), ParseType::N(2)],
841    },
842    // 29 - AlternationsList: '|'^ /* Clipped */ Alternation AlternationsList;
843    Production {
844        lhs: 5,
845        production: &[ParseType::N(5), ParseType::N(2), ParseType::T(26)],
846    },
847    // 30 - AlternationsList: ;
848    Production {
849        lhs: 5,
850        production: &[],
851    },
852    // 31 - Alternation: AlternationList /* Vec */;
853    Production {
854        lhs: 2,
855        production: &[ParseType::N(3)],
856    },
857    // 32 - AlternationList: Factor AlternationList;
858    Production {
859        lhs: 3,
860        production: &[ParseType::N(3), ParseType::N(9)],
861    },
862    // 33 - AlternationList: ;
863    Production {
864        lhs: 3,
865        production: &[],
866    },
867    // 34 - Factor: Group;
868    Production {
869        lhs: 9,
870        production: &[ParseType::N(12)],
871    },
872    // 35 - Factor: Repeat;
873    Production {
874        lhs: 9,
875        production: &[ParseType::N(31)],
876    },
877    // 36 - Factor: Optional;
878    Production {
879        lhs: 9,
880        production: &[ParseType::N(22)],
881    },
882    // 37 - Factor: Symbol;
883    Production {
884        lhs: 9,
885        production: &[ParseType::N(40)],
886    },
887    // 38 - Symbol: NonTerminal;
888    Production {
889        lhs: 40,
890        production: &[ParseType::N(20)],
891    },
892    // 39 - Symbol: SimpleToken;
893    Production {
894        lhs: 40,
895        production: &[ParseType::N(36)],
896    },
897    // 40 - Symbol: TokenWithStates;
898    Production {
899        lhs: 40,
900        production: &[ParseType::N(44)],
901    },
902    // 41 - TokenLiteral: String;
903    Production {
904        lhs: 43,
905        production: &[ParseType::N(39)],
906    },
907    // 42 - TokenLiteral: RawString;
908    Production {
909        lhs: 43,
910        production: &[ParseType::N(29)],
911    },
912    // 43 - TokenLiteral: Regex;
913    Production {
914        lhs: 43,
915        production: &[ParseType::N(30)],
916    },
917    // 44 - TokenExpression: TokenLiteral TokenExpressionOpt /* Option */;
918    Production {
919        lhs: 41,
920        production: &[ParseType::N(42), ParseType::N(43)],
921    },
922    // 45 - TokenExpressionOpt: LookAhead;
923    Production {
924        lhs: 42,
925        production: &[ParseType::N(16)],
926    },
927    // 46 - TokenExpressionOpt: ;
928    Production {
929        lhs: 42,
930        production: &[],
931    },
932    // 47 - SimpleToken: TokenExpression SimpleTokenOpt /* Option */;
933    Production {
934        lhs: 36,
935        production: &[ParseType::N(37), ParseType::N(41)],
936    },
937    // 48 - SimpleTokenOpt: ASTControl;
938    Production {
939        lhs: 37,
940        production: &[ParseType::N(0)],
941    },
942    // 49 - SimpleTokenOpt: ;
943    Production {
944        lhs: 37,
945        production: &[],
946    },
947    // 50 - TokenWithStates: '<'^ /* Clipped */ IdentifierList '>'^ /* Clipped */ TokenExpression TokenWithStatesOpt /* Option */;
948    Production {
949        lhs: 44,
950        production: &[
951            ParseType::N(45),
952            ParseType::N(41),
953            ParseType::T(28),
954            ParseType::N(14),
955            ParseType::T(27),
956        ],
957    },
958    // 51 - TokenWithStatesOpt: ASTControl;
959    Production {
960        lhs: 45,
961        production: &[ParseType::N(0)],
962    },
963    // 52 - TokenWithStatesOpt: ;
964    Production {
965        lhs: 45,
966        production: &[],
967    },
968    // 53 - String: /"(\\.|[^"])*"/;
969    Production {
970        lhs: 39,
971        production: &[ParseType::T(29)],
972    },
973    // 54 - RawString: /'(\\.|[^'])*'/;
974    Production {
975        lhs: 29,
976        production: &[ParseType::T(30)],
977    },
978    // 55 - Regex: "/(\\.|[^\/])*/";
979    Production {
980        lhs: 30,
981        production: &[ParseType::T(31)],
982    },
983    // 56 - Group: '(' Alternations ')';
984    Production {
985        lhs: 12,
986        production: &[ParseType::T(33), ParseType::N(4), ParseType::T(32)],
987    },
988    // 57 - Optional: '[' Alternations ']';
989    Production {
990        lhs: 22,
991        production: &[ParseType::T(35), ParseType::N(4), ParseType::T(34)],
992    },
993    // 58 - Repeat: '{' Alternations '}';
994    Production {
995        lhs: 31,
996        production: &[ParseType::T(37), ParseType::N(4), ParseType::T(36)],
997    },
998    // 59 - NonTerminal: Identifier NonTerminalOpt /* Option */;
999    Production {
1000        lhs: 20,
1001        production: &[ParseType::N(21), ParseType::N(13)],
1002    },
1003    // 60 - NonTerminalOpt: ASTControl;
1004    Production {
1005        lhs: 21,
1006        production: &[ParseType::N(0)],
1007    },
1008    // 61 - NonTerminalOpt: ;
1009    Production {
1010        lhs: 21,
1011        production: &[],
1012    },
1013    // 62 - Identifier: /[a-zA-Z_][a-zA-Z0-9_]*/;
1014    Production {
1015        lhs: 13,
1016        production: &[ParseType::T(38)],
1017    },
1018    // 63 - ScannerState: '%scanner'^ /* Clipped */ Identifier@state_name '{'^ /* Clipped */ ScannerStateList /* Vec */ '}'^ /* Clipped */;
1019    Production {
1020        lhs: 33,
1021        production: &[
1022            ParseType::T(37),
1023            ParseType::N(35),
1024            ParseType::T(36),
1025            ParseType::N(13),
1026            ParseType::T(39),
1027        ],
1028    },
1029    // 64 - ScannerStateList: ScannerDirectives ScannerStateList;
1030    Production {
1031        lhs: 35,
1032        production: &[ParseType::N(35), ParseType::N(32)],
1033    },
1034    // 65 - ScannerStateList: ;
1035    Production {
1036        lhs: 35,
1037        production: &[],
1038    },
1039    // 66 - IdentifierList: Identifier IdentifierListList /* Vec */;
1040    Production {
1041        lhs: 14,
1042        production: &[ParseType::N(15), ParseType::N(13)],
1043    },
1044    // 67 - IdentifierListList: ','^ /* Clipped */ Identifier IdentifierListList;
1045    Production {
1046        lhs: 15,
1047        production: &[ParseType::N(15), ParseType::N(13), ParseType::T(40)],
1048    },
1049    // 68 - IdentifierListList: ;
1050    Production {
1051        lhs: 15,
1052        production: &[],
1053    },
1054    // 69 - ASTControl: CutOperator;
1055    Production {
1056        lhs: 0,
1057        production: &[ParseType::N(6)],
1058    },
1059    // 70 - ASTControl: MemberName ASTControlOpt /* Option */;
1060    Production {
1061        lhs: 0,
1062        production: &[ParseType::N(1), ParseType::N(18)],
1063    },
1064    // 71 - ASTControl: UserTypeDeclaration;
1065    Production {
1066        lhs: 0,
1067        production: &[ParseType::N(46)],
1068    },
1069    // 72 - ASTControlOpt: UserTypeDeclaration;
1070    Production {
1071        lhs: 1,
1072        production: &[ParseType::N(46)],
1073    },
1074    // 73 - ASTControlOpt: ;
1075    Production {
1076        lhs: 1,
1077        production: &[],
1078    },
1079    // 74 - MemberName: '@'^ /* Clipped */ Identifier;
1080    Production {
1081        lhs: 18,
1082        production: &[ParseType::N(13), ParseType::T(41)],
1083    },
1084    // 75 - CutOperator: '^'^ /* Clipped */;
1085    Production {
1086        lhs: 6,
1087        production: &[ParseType::T(42)],
1088    },
1089    // 76 - UserTypeDeclaration: ':'^ /* Clipped */ UserTypeName : crate::parser::parol_grammar::UserDefinedTypeName ;
1090    Production {
1091        lhs: 46,
1092        production: &[ParseType::N(47), ParseType::T(24)],
1093    },
1094    // 77 - UserTypeName: Identifier UserTypeNameList /* Vec */;
1095    Production {
1096        lhs: 47,
1097        production: &[ParseType::N(48), ParseType::N(13)],
1098    },
1099    // 78 - UserTypeNameList: DoubleColon^ /* Clipped */ Identifier UserTypeNameList;
1100    Production {
1101        lhs: 48,
1102        production: &[ParseType::N(48), ParseType::N(13), ParseType::N(8)],
1103    },
1104    // 79 - UserTypeNameList: ;
1105    Production {
1106        lhs: 48,
1107        production: &[],
1108    },
1109    // 80 - LookAhead: LookAheadGroup TokenLiteral;
1110    Production {
1111        lhs: 16,
1112        production: &[ParseType::N(43), ParseType::N(17)],
1113    },
1114    // 81 - LookAheadGroup: PositiveLookahead;
1115    Production {
1116        lhs: 17,
1117        production: &[ParseType::N(24)],
1118    },
1119    // 82 - LookAheadGroup: NegativeLookahead;
1120    Production {
1121        lhs: 17,
1122        production: &[ParseType::N(19)],
1123    },
1124    // 83 - PositiveLookahead: '?='^ /* Clipped */;
1125    Production {
1126        lhs: 24,
1127        production: &[ParseType::T(43)],
1128    },
1129    // 84 - NegativeLookahead: '?!'^ /* Clipped */;
1130    Production {
1131        lhs: 19,
1132        production: &[ParseType::T(44)],
1133    },
1134];
1135
1136pub fn parse<'t, T>(
1137    input: &'t str,
1138    file_name: T,
1139    user_actions: &mut ParolGrammar<'t>,
1140) -> Result<ParseTree, ParolError>
1141where
1142    T: AsRef<Path>,
1143{
1144    use parol_runtime::{
1145        parser::{parse_tree_type::SynTree, parser_types::SynTreeFlavor},
1146        syntree::Builder,
1147    };
1148    let mut builder = Builder::<SynTree, SynTreeFlavor>::new_with();
1149    parse_into(input, &mut builder, file_name, user_actions)?;
1150    Ok(builder.build()?)
1151}
1152#[allow(dead_code)]
1153pub fn parse_into<'t, T: TreeConstruct<'t>>(
1154    input: &'t str,
1155    tree_builder: &mut T,
1156    file_name: impl AsRef<Path>,
1157    user_actions: &mut ParolGrammar<'t>,
1158) -> Result<(), ParolError>
1159where
1160    ParolError: From<T::Error>,
1161{
1162    use parol_grammar_scanner::ParolGrammarScanner;
1163    let mut llk_parser = LLKParser::new(
1164        23,
1165        LOOKAHEAD_AUTOMATA,
1166        PRODUCTIONS,
1167        TERMINAL_NAMES,
1168        NON_TERMINALS,
1169    );
1170    let scanner = ParolGrammarScanner::new();
1171    // Initialize wrapper
1172    let mut user_actions = ParolGrammarAuto::new(user_actions);
1173    llk_parser.parse_into(
1174        tree_builder,
1175        TokenStream::new(
1176            input,
1177            file_name,
1178            scanner.scanner_impl.clone(),
1179            &ParolGrammarScanner::match_function,
1180            MAX_K,
1181        )
1182        .unwrap(),
1183        &mut user_actions,
1184    )
1185}