blob: 65964817696ed7891630135af0e0f8735506fae6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
|
# Main region.
lex
token DEF / 'def' /
token LEX / 'lex' /
token END / 'end' /
token TOKEN / 'token' /
token RL / 'rl' /
token IGNORE / 'ignore' /
token PRINT / 'print' /
token PRINTS / 'prints' /
token PRINT_XML / 'print_xml' /
token PRINT_XML_AC / 'print_xml_ac' /
token PARSE / 'parse' /
token PARSE_TREE / 'parse_tree' /
token PARSE_STOP / 'parse_stop' /
token CONS / 'construct' | 'cons' /
token MATCH / 'match' /
token REQUIRE / 'require' /
token SEND / 'send' /
token SEND_TREE / 'send_tree' /
token NAMESPACE / 'namespace' /
token FOR / 'for' /
token IF / 'if' /
token YIELD / 'yield' /
token WHILE / 'while' /
token ELSIF / 'elsif' /
token ELSE / 'else' /
token IN / 'in' /
token PARSER / 'parser' | 'accum' /
token LIST / 'list' /
token LIST_EL / 'list_el' /
token MAP / 'map' /
token MAP_EL / 'map_el' /
token PTR / 'ptr' /
token ITER / 'iter' /
token REF / 'ref' /
token EXPORT / 'export' /
token RETURN / 'return' /
token BREAK / 'break' /
token REJECT / 'reject' /
token REDUCEFIRST / 'reducefirst' /
token ALIAS / 'alias' /
token COMMIT / 'commit' /
token NEW / 'new' /
token PREEOF / 'preeof' /
token GLOBAL / 'global' /
token EOS / 'eos' /
token CAST / 'cast' /
token SWITCH / 'switch' /
token CASE / 'case' /
token DEFAULT / 'default' /
token INT / 'int' /
token BOOL / 'bool' /
token MAKE_TOKEN / 'make_token' /
token MAKE_TREE / 'make_tree' /
token TYPEID / 'typeid' /
token LITERAL / 'literal' /
token CONTEXT / 'context' /
token STRUCT / 'struct' /
token NI /'ni'/
token NIL / 'nil' /
token TRUE / 'true' /
token FALSE / 'false' /
token LEFT /'left'/
token RIGHT /'right'/
token NONASSOC /'nonassoc'/
token INCLUDE /'include'/
token id /
( 'a' .. 'z' | 'A' .. 'Z' | '_' ) .
( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' ) *
/
token number
/ ( '0' .. '9' ) + /
token backtick_lit
/ '`' . ^( ' ' | '\n' | '\t' | ']' )+ | '`]' /
token DQ / '\"' / ni
token SQ / '\'' / ni
token TILDE / '~' / ni
token SQOPEN /'['/
token SQCLOSE /']'/
token BAR /'|'/
token FSLASH /'/'/
token COLON /':'/
token DOUBLE_COLON /'::'/
token DOT /'.'/
token ARROW /'->'/
token POPEN /'('/
token PCLOSE /')'/
token COPEN /'{'/
token CCLOSE /'}'/
token STAR /'*'/
token QUESTION /'?'/
token EQUALS /'='/
token EQEQ /'=='/
token NEQ /'!='/
token COMMA /','/
token LT /'<'/
token GT /'>'/
token LTEQ /'<='/
token GTEQ /'>='/
token BANG /'!'/
token DOLLAR /'$'/
token CARET /'^'/
token PERCENT /'%'/
token PLUS /'+'/
token MINUS /'-'/
token AMPAMP /'&&'/
token BARBAR /'||'/
ignore / ( '\n' | '\t' | ' ' )+ /
ignore / '#' . ( ^'\n' )* . '\n' /
end
lex
token CONS_DQ / '\"' /
token CONS_DQ_NL / '\n' /
token CONS_SQOPEN / '[' /
token CONS_SQCLOSE / ']' /
token dq_cons_data
/ ( ^( '\n' | '\"' | '[' | ']' | '\\' ) | '\\' . any )+ /
end
lex
token CONS_SQ / '\'' /
token CONS_SQ_NL / '\n' /
token sq_cons_data
/ ( ^( '\n' | '\'' | '\\' ) | '\\' . any )+ /
end
lex
token TILDE_NL / '\n' /
token tilde_data
/ ( ^'\n' )+ /
end
lex
token lex_id /
( 'a' .. 'z' | 'A' .. 'Z' | '_' ) .
( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' ) *
/
token lex_uint
/ ( '0' .. '9' )+ /
token lex_hex
/ '0x' . ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )+ /
token lex_lit /
'\'' . ( ^( '\'' | '\\' ) | '\\' . any )* . ( '\'' | '\'i' ) |
'\"' . ( ^( '\"' | '\\' ) | '\\' . any )* . ( '\"' | '\"i' )
/
token LEX_DOT /'.'/
token LEX_BAR /'|'/
token LEX_AMP /'&'/
token LEX_DASH /'-'/
token LEX_POPEN /'('/
token LEX_PCLOSE /')'/
token LEX_STAR /'*'/
token LEX_STARSTAR /'**'/
token LEX_QUESTION /'?'/
token LEX_PLUS /'+'/
token LEX_CARET /'^'/
token LEX_DOTDOT /'..'/
token LEX_SQOPEN_POS /'['/ ni
token LEX_SQOPEN_NEG /'[^'/ ni
token LEX_FSLASH /'/'/
token LEX_DASHDASH /'--'/
token LEX_COLON_GT /':>'/
token LEX_COLON_GTGT /':>>'/
token LEX_LT_COLON /'<:'/
ignore /
( '\n' | '\t' | ' ' ) .
( '\n' | '\t' | ' ' )*
/
ignore / '#' . ( ^'\n' )* . '\n' /
end
lex
token RE_DASH / '-' /
token RE_CHAR / ^( '\\' | '-' | ']' ) | '\\' . any /
token RE_SQCLOSE / ']' /
end
def start
[RootItemList: root_item*]
def root_item
[rl_def] :Rl commit
| [literal_def] :Literal commit
| [token_def] :Token commit
| [ic_def] :IgnoreCollector commit
| [ignore_def] :Ignore commit
| [cfl_def] :Cfl commit
| [region_def] :Region commit
| [struct_def] :Struct commit
| [namespace_def] :Namespace commit
| [function_def] :Function commit
| [in_host_def] :InHost commit
| [iter_def] :Iter commit
| [statement] :Statement commit
| [global_def] :Global commit
| [export_def] :Export commit
| [pre_eof_def] :PreEof commit
| [precedence_def] :Precedence commit
| [alias_def] :Alias commit
| [include] :Include commit
def include
[INCLUDE SQ SqConsDataList: sq_cons_data* sq_lit_term]
def precedence_def
[pred_type pred_token_list]
def pred_type
[LEFT] :Left
| [RIGHT] :Right
| [NONASSOC] :NonAssoc
def pred_token_list
[pred_token_list COMMA pred_token] :List
| [pred_token] :Base
def pred_token
[region_qual id] :Id
| [region_qual backtick_lit] :Lit
def pre_eof_def
[PREEOF COPEN lang_stmt_list CCLOSE]
def alias_def
[ALIAS id type_ref]
def struct_item
[struct_var_def] :StructVar commit
| [literal_def] :Literal commit
| [rl_def] :Rl commit
| [token_def] :Token commit
| [ic_def] :IgnoreCollector commit
| [ignore_def] :Ignore commit
| [cfl_def] :Cfl commit
| [region_def] :Region commit
| [struct_def] :Struct commit
| [function_def] :Function commit
| [in_host_def] :InHost commit
| [iter_def] :Iter commit
| [export_def] :Export commit
| [pre_eof_def] :PreEof commit
| [precedence_def] :Precedence commit
| [alias_def] :Alias commit
def export_def
[EXPORT var_def opt_def_init]
def global_def
[GLOBAL var_def opt_def_init]
def iter_def
[ITER id POPEN ParamVarDefList: param_var_def_list PCLOSE
COPEN lang_stmt_list CCLOSE]
def reference_type_ref
[REF LT type_ref GT]
def param_var_def_seq
[param_var_def COMMA param_var_def_seq]
| [param_var_def]
def param_var_def_list
[param_var_def_seq]
| []
def param_var_def
[id COLON type_ref] :Type
| [id COLON reference_type_ref] :Ref
def opt_export
[EXPORT] :Export
| []
def function_def
[opt_export type_ref id
POPEN ParamVarDefList: param_var_def_list PCLOSE
COPEN lang_stmt_list CCLOSE]
def in_host_def
[opt_export type_ref id
POPEN ParamVarDefList: param_var_def_list PCLOSE
EQUALS HostFunc: id]
def struct_var_def
[var_def]
def struct_key
[STRUCT] | [CONTEXT]
def struct_def
[struct_key id ItemList: struct_item* END]
def literal_def
[LITERAL literal_list]
def literal_list
[literal_list literal_item] :Item
| [literal_item] :Base
def literal_item
[no_ignore_left backtick_lit no_ignore_right]
def no_ignore_left
[NI MINUS] :Ni
| []
def no_ignore_right
[MINUS NI] :Ni
| []
def namespace_def
[NAMESPACE id ItemList: namespace_item* END]
def namespace_item
[rl_def] :Rl commit
| [literal_def] :Literal commit
| [token_def] :Token commit
| [ic_def] :IgnoreCollector commit
| [ignore_def] :Ignore commit
| [cfl_def] :Cfl commit
| [region_def] :Region commit
| [struct_def] :Struct commit
| [namespace_def] :Namespace commit
| [function_def] :Function commit
| [in_host_def] :InHost commit
| [iter_def] :Iter commit
| [pre_eof_def] :PreEof commit
| [precedence_def] :Precedence commit
| [alias_def] :Alias commit
| [include] :Include commit
def obj_var_list
[]
def opt_reduce_first
[REDUCEFIRST]
| []
def cfl_def
[DEF id
VarDefList: var_def*
opt_reduce_first
prod_list]
def region_def
[LEX RootItemList: root_item* END]
def rl_def
[RL id LEX_FSLASH lex_expr LEX_FSLASH]
def opt_lex_expr
[lex_expr]
| []
def token_def
[TOKEN id VarDefList: var_def*
no_ignore_left
LEX_FSLASH opt_lex_expr LEX_FSLASH
no_ignore_right
opt_translate]
def ic_def
[TOKEN id MINUS]
def opt_translate
[COPEN lang_stmt_list CCLOSE] :Translate
| []
def opt_id
[id] :Id
| []
def ignore_def
[IGNORE opt_id LEX_FSLASH opt_lex_expr LEX_FSLASH]
def prod_el
[opt_prod_el_name region_qual id opt_repeat] :Id
| [opt_prod_el_name region_qual backtick_lit opt_repeat] :Lit
def opt_prod_el_name
[id COLON] :Name
| []
def prod_el_list
[prod_el_list prod_el] :List
| []
def opt_commit
[COMMIT] :Commit
| []
def opt_prod_name
[COLON id] :Name
| []
def prod
[SQOPEN prod_el_list SQCLOSE
opt_prod_name
opt_commit
opt_reduce]
def opt_reduce
[COPEN lang_stmt_list CCLOSE] :Reduce
| []
def prod_list
[prod_list BAR prod] :List
| [prod] :Base
def case_clause
[CASE pattern block_or_single]
def default_clause
[DEFAULT block_or_single]
def case_clause_list
[case_clause case_clause_list] :Recursive
| [case_clause] :BaseCase
| [default_clause] :BaseDefault
def statement
[print_stmt] :Print
| [expr_stmt] :Expr
| [var_def opt_def_init] :VarDef
| [FOR id COLON type_ref IN iter_call block_or_single] :For
| [IF code_expr block_or_single elsif_list] :If
| [SWITCH var_ref case_clause_list] :Switch
| [WHILE code_expr block_or_single] :While
| [var_ref EQUALS code_expr] :LhsVarRef
| [YIELD var_ref] :Yield
| [RETURN code_expr] :Return
| [BREAK] :Break
| [REJECT] :Reject
def elsif_list
[elsif_clause elsif_list] :Clause
| [optional_else] :OptElse
def elsif_clause
[ELSIF code_expr block_or_single]
def optional_else
[ELSE block_or_single] :Else
| []
def call_arg_seq
[code_expr COMMA call_arg_seq]
| [code_expr]
def call_arg_list
[call_arg_seq]
| []
def iter_call
[E1 var_ref POPEN call_arg_list PCLOSE] :Call
| [E2 id] :Id
| [E3 code_expr] :Expr
def block_or_single
[COPEN lang_stmt_list CCLOSE] :Block
| [statement] :Single
def require_pattern
[REQUIRE var_ref pattern]
def opt_require_stmt
[require_pattern lang_stmt_list] :Require
| [] :Base
def lang_stmt_list
[StmtList: statement* opt_require_stmt]
def opt_def_init
[EQUALS code_expr] :Init
| [] :Base
def var_def
[id COLON type_ref]
def print_stmt
[PRINT POPEN call_arg_list PCLOSE] :Tree
| [PRINTS POPEN call_arg_list PCLOSE] :PrintStream
| [PRINT_XML POPEN call_arg_list PCLOSE] :Xml
| [PRINT_XML_AC POPEN call_arg_list PCLOSE] :XmlAc
| [PRINT accumulate] :Accum
def expr_stmt
[code_expr]
def code_expr
[code_expr AMPAMP code_relational] :AmpAmp
| [code_expr BARBAR code_relational] :BarBar
| [code_relational] :Base
def code_relational
[code_relational EQEQ code_additive] :EqEq
| [code_relational NEQ code_additive] :Neq
| [code_relational LT code_additive] :Lt
| [code_relational GT code_additive] :Gt
| [code_relational LTEQ code_additive] :LtEq
| [code_relational GTEQ code_additive] :GtEq
| [code_additive] :Base
def code_additive
[code_additive PLUS code_multiplicitive] :Plus
| [code_additive MINUS code_multiplicitive] :Minus
| [code_multiplicitive] :Base
def code_multiplicitive
[code_multiplicitive STAR code_unary] :Star
| [code_multiplicitive FSLASH code_unary] :Fslash
| [code_unary] :Base
def code_unary
[BANG code_factor] :Bang
| [DOLLAR code_factor] :Dollar
| [CARET code_factor] :Caret
| [PERCENT code_factor] :Percent
| [code_factor] :Base
def opt_eos
[DOT] :Dot
| [EOS] :Eos
| []
def code_factor
[number] :Number
| [var_ref POPEN call_arg_list PCLOSE] :Call
| [var_ref] :VarRef
| [NIL] :Nil
| [TRUE] :True
| [FALSE] :False
| [POPEN code_expr PCLOSE] :Paren
| [SEND var_ref accumulate opt_eos] :Send
| [SEND_TREE var_ref accumulate opt_eos] :SendTree
| [PARSE opt_capture type_ref opt_field_init accumulate] :Parse
| [PARSE_TREE opt_capture type_ref opt_field_init accumulate] :ParseTree
| [PARSE_STOP opt_capture type_ref opt_field_init accumulate] :ParseStop
| [CONS opt_capture type_ref opt_field_init constructor] :Cons
| [MATCH var_ref pattern] :Match
| [string] :String
| [type_ref IN var_ref] :In
| [MAKE_TREE POPEN call_arg_list PCLOSE] :MakeTree
| [MAKE_TOKEN POPEN call_arg_list PCLOSE] :MakeToken
| [TYPEID LT type_ref GT] :TypeId
| [NEW opt_capture type_ref POPEN FieldInitList: field_init* PCLOSE] :New
| [CAST LT type_ref GT code_factor] :Cast
def type_ref
[region_qual id opt_repeat] :Id
| [INT] :Int
| [BOOL] :Bool
| [PARSER LT type_ref GT] :Parser
| [LIST LT type_ref GT] :List
| [MAP LT KeyType: type_ref COMMA ValType: type_ref GT] :Map
| [LIST_EL LT type_ref GT] :ListEl
| [MAP_EL LT KeyType: type_ref COMMA ValType: type_ref GT] :MapEl
def region_qual
[region_qual id DOUBLE_COLON] :Qual
| [] :Base
def opt_repeat
[STAR] :Star
| [PLUS] :Plus
| [QUESTION] :Question
| []
def opt_capture
[id COLON] :Id
| []
def opt_field_init
[POPEN FieldInitList: field_init* PCLOSE] :Init
| [] :Base
def field_init
[code_expr]
#
# Pattern
#
def opt_label
[id COLON] :Id
| []
def dq_lit_term
[CONS_DQ] | [CONS_DQ_NL]
def sq_lit_term
[CONS_SQ] | [CONS_SQ_NL]
def opt_tilde_data
[tilde_data]
| []
def pattern_el_lel
[region_qual id opt_repeat] :Id
| [region_qual backtick_lit opt_repeat] :Lit
def pattern_el
[opt_label pattern_el_lel] :PatternEl
| [DQ LitpatElList: litpat_el* dq_lit_term] :Dq
| [SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [TILDE opt_tilde_data TILDE_NL] :Tilde
def litpat_el
[dq_cons_data] :ConsData
| [CONS_SQOPEN PatternElList: pattern_el* CONS_SQCLOSE] :SubList
def pattern_top_el
[DQ LitpatElList: litpat_el* dq_lit_term] :Dq
| [SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [TILDE opt_tilde_data TILDE_NL] :Tilde
| [SQOPEN PatternElList: pattern_el* SQCLOSE] :SubList
def pattern_list
[pattern_list pattern_top_el] :List
| [pattern_top_el] :Base
def pattern
[pattern_list]
#
# Constructor List
#
def E1 []
def E2 []
def E3 []
def E4 []
def cons_el
[E1 region_qual backtick_lit] :Lit
| [E1 DQ LitConsElList: lit_cons_el* dq_lit_term] :Dq
| [E1 SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [E1 TILDE opt_tilde_data TILDE_NL] :Tilde
| [E2 code_expr] :CodeExpr
def lit_cons_el
[dq_cons_data] :ConsData
| [CONS_SQOPEN ConsElList: cons_el* CONS_SQCLOSE] :SubList
def cons_top_el
[DQ LitConsElList: lit_cons_el* dq_lit_term] :Dq
| [SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [TILDE opt_tilde_data TILDE_NL] :Tilde
| [SQOPEN ConsElList: cons_el* SQCLOSE] :SubList
def cons_list
[cons_top_el cons_list] :List
| [cons_top_el] :Base
def constructor
[cons_list]
#
# Accumulate
#
def accum_el
[E1 DQ LitAccumElList: lit_accum_el* dq_lit_term] :Dq
| [E1 SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [E1 TILDE opt_tilde_data TILDE_NL] :Tilde
| [E2 code_expr] :CodeExpr
def lit_accum_el
[dq_cons_data] :ConsData
| [CONS_SQOPEN AccumElList: accum_el* CONS_SQCLOSE] :SubList
def accum_top_el
[DQ LitAccumElList: lit_accum_el* dq_lit_term] :Dq
| [SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [TILDE opt_tilde_data TILDE_NL] :Tilde
| [SQOPEN AccumElList: accum_el* SQCLOSE] :SubList
def accum_list
[accum_top_el accum_list] :List
| [accum_top_el] :Base
def accumulate
[accum_list]
#
# String List
#
def string_el
[E1 DQ LitStringElList: lit_string_el* dq_lit_term] :Dq
| [E1 SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [E1 TILDE opt_tilde_data TILDE_NL] :Tilde
| [E2 code_expr] :CodeExpr
def lit_string_el
[dq_cons_data] :ConsData
| [CONS_SQOPEN StringElList: string_el* CONS_SQCLOSE] :SubList
def string_top_el
[DQ LitStringElList: lit_string_el* dq_lit_term] :Dq
| [SQ SqConsDataList: sq_cons_data* sq_lit_term] :Sq
| [TILDE opt_tilde_data TILDE_NL] :Tilde
| [SQOPEN StringElList: string_el* SQCLOSE] :SubList
def string_list
[string_top_el string_list] :List
| [string_top_el] :Base
def string
[string_list]
#
# Variable References
#
def var_ref
[qual id]
def qual
[qual id DOT] :Dot
| [qual id ARROW] :Arrow
| [] :Base
#
# Lexical analysis.
#
def lex_expr
[lex_expr LEX_BAR lex_term] :Bar
| [lex_expr LEX_AMP lex_term] :Amp
| [lex_expr LEX_DASH lex_term] :Dash
| [lex_expr LEX_DASHDASH lex_term] :DashDash
| [lex_term] :Base
def opt_lex_dot
[LEX_DOT]
| []
def lex_term
[lex_term opt_lex_dot lex_factor_rep] :Dot
| [lex_term LEX_COLON_GT lex_factor_rep] :ColonGt
| [lex_term LEX_COLON_GTGT lex_factor_rep] :ColonGtGt
| [lex_term LEX_LT_COLON lex_factor_rep] :LtColon
| [lex_factor_rep] :Base
def lex_factor_rep
[lex_factor_rep LEX_STAR] :Star
| [lex_factor_rep LEX_STARSTAR] :StarStar
| [lex_factor_rep LEX_PLUS] :Plus
| [lex_factor_rep LEX_QUESTION] :Question
| [lex_factor_rep COPEN lex_uint CCLOSE ] :Exact
| [lex_factor_rep COPEN COMMA lex_uint CCLOSE ] :Max
| [lex_factor_rep COPEN lex_uint COMMA CCLOSE ] :Min
| [lex_factor_rep COPEN Low: lex_uint COMMA High: lex_uint CCLOSE ] :Range
| [lex_factor_neg] :Base
def lex_factor_neg
[LEX_CARET lex_factor_neg] :Caret
| [lex_factor] :Base
def lex_range_lit
[lex_lit] :Lit
| [lex_num] :Number
def lex_num
[lex_uint]
| [lex_hex]
#| [LEX_DASH num]
def lex_factor
[lex_lit] :Literal
| [lex_id] :Id
| [lex_uint] :Number
| [lex_hex] :Hex
| [Low: lex_range_lit LEX_DOTDOT High: lex_range_lit] :Range
| [LEX_SQOPEN_POS reg_or_data RE_SQCLOSE] :PosOrBlock
| [LEX_SQOPEN_NEG reg_or_data RE_SQCLOSE] :NegOrBlock
| [LEX_POPEN lex_expr LEX_PCLOSE] :Paren
def reg_or_data
[reg_or_data reg_or_char] :Data
| [] :Base
def reg_or_char
[RE_CHAR] :Char
| [Low: RE_CHAR RE_DASH High: RE_CHAR] :Range
|