-
Notifications
You must be signed in to change notification settings - Fork 120
/
peg.peg.go
2957 lines (2894 loc) · 66.8 KB
/
peg.peg.go
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
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by ./peg -inline -switch peg.peg. DO NOT EDIT.
package main
import (
"bytes"
"fmt"
"github.com/pointlander/peg/tree"
"io"
"os"
"sort"
"strconv"
)
const endSymbol rune = 1114112
/* The rule types inferred from the grammar are below. */
type pegRule uint8
const (
ruleUnknown pegRule = iota
ruleGrammar
ruleImport
ruleSingleImport
ruleMultiImport
ruleImportName
ruleDefinition
ruleExpression
ruleSequence
rulePrefix
ruleSuffix
rulePrimary
ruleIdentifier
ruleIdentStart
ruleIdentCont
ruleLiteral
ruleClass
ruleRanges
ruleDoubleRanges
ruleRange
ruleDoubleRange
ruleChar
ruleDoubleChar
ruleEscape
ruleLeftArrow
ruleSlash
ruleAnd
ruleNot
ruleQuestion
ruleStar
rulePlus
ruleOpen
ruleClose
ruleDot
ruleSpaceComment
ruleSpacing
ruleMustSpacing
ruleComment
ruleSpace
ruleEndOfLine
ruleEndOfFile
ruleAction
ruleActionBody
ruleBegin
ruleEnd
ruleAction0
ruleAction1
ruleAction2
rulePegText
ruleAction3
ruleAction4
ruleAction5
ruleAction6
ruleAction7
ruleAction8
ruleAction9
ruleAction10
ruleAction11
ruleAction12
ruleAction13
ruleAction14
ruleAction15
ruleAction16
ruleAction17
ruleAction18
ruleAction19
ruleAction20
ruleAction21
ruleAction22
ruleAction23
ruleAction24
ruleAction25
ruleAction26
ruleAction27
ruleAction28
ruleAction29
ruleAction30
ruleAction31
ruleAction32
ruleAction33
ruleAction34
ruleAction35
ruleAction36
ruleAction37
ruleAction38
ruleAction39
ruleAction40
ruleAction41
ruleAction42
ruleAction43
ruleAction44
ruleAction45
ruleAction46
ruleAction47
ruleAction48
)
var rul3s = [...]string{
"Unknown",
"Grammar",
"Import",
"SingleImport",
"MultiImport",
"ImportName",
"Definition",
"Expression",
"Sequence",
"Prefix",
"Suffix",
"Primary",
"Identifier",
"IdentStart",
"IdentCont",
"Literal",
"Class",
"Ranges",
"DoubleRanges",
"Range",
"DoubleRange",
"Char",
"DoubleChar",
"Escape",
"LeftArrow",
"Slash",
"And",
"Not",
"Question",
"Star",
"Plus",
"Open",
"Close",
"Dot",
"SpaceComment",
"Spacing",
"MustSpacing",
"Comment",
"Space",
"EndOfLine",
"EndOfFile",
"Action",
"ActionBody",
"Begin",
"End",
"Action0",
"Action1",
"Action2",
"PegText",
"Action3",
"Action4",
"Action5",
"Action6",
"Action7",
"Action8",
"Action9",
"Action10",
"Action11",
"Action12",
"Action13",
"Action14",
"Action15",
"Action16",
"Action17",
"Action18",
"Action19",
"Action20",
"Action21",
"Action22",
"Action23",
"Action24",
"Action25",
"Action26",
"Action27",
"Action28",
"Action29",
"Action30",
"Action31",
"Action32",
"Action33",
"Action34",
"Action35",
"Action36",
"Action37",
"Action38",
"Action39",
"Action40",
"Action41",
"Action42",
"Action43",
"Action44",
"Action45",
"Action46",
"Action47",
"Action48",
}
type token32 struct {
pegRule
begin, end uint32
}
func (t *token32) String() string {
return fmt.Sprintf("\x1B[34m%v\x1B[m %v %v", rul3s[t.pegRule], t.begin, t.end)
}
type node32 struct {
token32
up, next *node32
}
func (node *node32) print(w io.Writer, pretty bool, buffer string) {
var print func(node *node32, depth int)
print = func(node *node32, depth int) {
for node != nil {
for c := 0; c < depth; c++ {
fmt.Fprintf(w, " ")
}
rule := rul3s[node.pegRule]
quote := strconv.Quote(string(([]rune(buffer)[node.begin:node.end])))
if !pretty {
fmt.Fprintf(w, "%v %v\n", rule, quote)
} else {
fmt.Fprintf(w, "\x1B[36m%v\x1B[m %v\n", rule, quote)
}
if node.up != nil {
print(node.up, depth+1)
}
node = node.next
}
}
print(node, 0)
}
func (node *node32) Print(w io.Writer, buffer string) {
node.print(w, false, buffer)
}
func (node *node32) PrettyPrint(w io.Writer, buffer string) {
node.print(w, true, buffer)
}
type tokens32 struct {
tree []token32
}
func (t *tokens32) Trim(length uint32) {
t.tree = t.tree[:length]
}
func (t *tokens32) Print() {
for _, token := range t.tree {
fmt.Println(token.String())
}
}
func (t *tokens32) AST() *node32 {
type element struct {
node *node32
down *element
}
tokens := t.Tokens()
var stack *element
for _, token := range tokens {
if token.begin == token.end {
continue
}
node := &node32{token32: token}
for stack != nil && stack.node.begin >= token.begin && stack.node.end <= token.end {
stack.node.next = node.up
node.up = stack.node
stack = stack.down
}
stack = &element{node: node, down: stack}
}
if stack != nil {
return stack.node
}
return nil
}
func (t *tokens32) PrintSyntaxTree(buffer string) {
t.AST().Print(os.Stdout, buffer)
}
func (t *tokens32) WriteSyntaxTree(w io.Writer, buffer string) {
t.AST().Print(w, buffer)
}
func (t *tokens32) PrettyPrintSyntaxTree(buffer string) {
t.AST().PrettyPrint(os.Stdout, buffer)
}
func (t *tokens32) Add(rule pegRule, begin, end, index uint32) {
tree, i := t.tree, int(index)
if i >= len(tree) {
t.tree = append(tree, token32{pegRule: rule, begin: begin, end: end})
return
}
tree[i] = token32{pegRule: rule, begin: begin, end: end}
}
func (t *tokens32) Tokens() []token32 {
return t.tree
}
type Peg struct {
*tree.Tree
Buffer string
buffer []rune
rules [95]func() bool
parse func(rule ...int) error
reset func()
Pretty bool
disableMemoize bool
tokens32
}
func (p *Peg) Parse(rule ...int) error {
return p.parse(rule...)
}
func (p *Peg) Reset() {
p.reset()
}
type textPosition struct {
line, symbol int
}
type textPositionMap map[int]textPosition
func translatePositions(buffer []rune, positions []int) textPositionMap {
length, translations, j, line, symbol := len(positions), make(textPositionMap, len(positions)), 0, 1, 0
sort.Ints(positions)
search:
for i, c := range buffer {
if c == '\n' {
line, symbol = line+1, 0
} else {
symbol++
}
if i == positions[j] {
translations[positions[j]] = textPosition{line, symbol}
for j++; j < length; j++ {
if i != positions[j] {
continue search
}
}
break search
}
}
return translations
}
type parseError struct {
p *Peg
max token32
}
func (e *parseError) Error() string {
tokens, err := []token32{e.max}, "\n"
positions, p := make([]int, 2*len(tokens)), 0
for _, token := range tokens {
positions[p], p = int(token.begin), p+1
positions[p], p = int(token.end), p+1
}
translations := translatePositions(e.p.buffer, positions)
format := "parse error near %v (line %v symbol %v - line %v symbol %v):\n%v\n"
if e.p.Pretty {
format = "parse error near \x1B[34m%v\x1B[m (line %v symbol %v - line %v symbol %v):\n%v\n"
}
for _, token := range tokens {
begin, end := int(token.begin), int(token.end)
err += fmt.Sprintf(format,
rul3s[token.pegRule],
translations[begin].line, translations[begin].symbol,
translations[end].line, translations[end].symbol,
strconv.Quote(string(e.p.buffer[begin:end])))
}
return err
}
func (p *Peg) PrintSyntaxTree() {
if p.Pretty {
p.tokens32.PrettyPrintSyntaxTree(p.Buffer)
} else {
p.tokens32.PrintSyntaxTree(p.Buffer)
}
}
func (p *Peg) WriteSyntaxTree(w io.Writer) {
p.tokens32.WriteSyntaxTree(w, p.Buffer)
}
func (p *Peg) SprintSyntaxTree() string {
var b bytes.Buffer
p.WriteSyntaxTree(&b)
return b.String()
}
func (p *Peg) Execute() {
buffer, _buffer, text, begin, end := p.Buffer, p.buffer, "", 0, 0
for _, token := range p.Tokens() {
switch token.pegRule {
case rulePegText:
begin, end = int(token.begin), int(token.end)
text = string(_buffer[begin:end])
case ruleAction0:
p.AddPackage(text)
case ruleAction1:
p.AddPeg(text)
case ruleAction2:
p.AddState(text)
case ruleAction3:
p.AddImport(text)
case ruleAction4:
p.AddRule(text)
case ruleAction5:
p.AddExpression()
case ruleAction6:
p.AddAlternate()
case ruleAction7:
p.AddNil()
p.AddAlternate()
case ruleAction8:
p.AddNil()
case ruleAction9:
p.AddSequence()
case ruleAction10:
p.AddPredicate(text)
case ruleAction11:
p.AddStateChange(text)
case ruleAction12:
p.AddPeekFor()
case ruleAction13:
p.AddPeekNot()
case ruleAction14:
p.AddQuery()
case ruleAction15:
p.AddStar()
case ruleAction16:
p.AddPlus()
case ruleAction17:
p.AddName(text)
case ruleAction18:
p.AddDot()
case ruleAction19:
p.AddAction(text)
case ruleAction20:
p.AddPush()
case ruleAction21:
p.AddSequence()
case ruleAction22:
p.AddSequence()
case ruleAction23:
p.AddPeekNot()
p.AddDot()
p.AddSequence()
case ruleAction24:
p.AddPeekNot()
p.AddDot()
p.AddSequence()
case ruleAction25:
p.AddAlternate()
case ruleAction26:
p.AddAlternate()
case ruleAction27:
p.AddRange()
case ruleAction28:
p.AddDoubleRange()
case ruleAction29:
p.AddCharacter(text)
case ruleAction30:
p.AddDoubleCharacter(text)
case ruleAction31:
p.AddCharacter(text)
case ruleAction32:
p.AddCharacter("\a")
case ruleAction33:
p.AddCharacter("\b")
case ruleAction34:
p.AddCharacter("\x1B")
case ruleAction35:
p.AddCharacter("\f")
case ruleAction36:
p.AddCharacter("\n")
case ruleAction37:
p.AddCharacter("\r")
case ruleAction38:
p.AddCharacter("\t")
case ruleAction39:
p.AddCharacter("\v")
case ruleAction40:
p.AddCharacter("'")
case ruleAction41:
p.AddCharacter("\"")
case ruleAction42:
p.AddCharacter("[")
case ruleAction43:
p.AddCharacter("]")
case ruleAction44:
p.AddCharacter("-")
case ruleAction45:
p.AddHexaCharacter(text)
case ruleAction46:
p.AddOctalCharacter(text)
case ruleAction47:
p.AddOctalCharacter(text)
case ruleAction48:
p.AddCharacter("\\")
}
}
_, _, _, _, _ = buffer, _buffer, text, begin, end
}
func Pretty(pretty bool) func(*Peg) error {
return func(p *Peg) error {
p.Pretty = pretty
return nil
}
}
func Size(size int) func(*Peg) error {
return func(p *Peg) error {
p.tokens32 = tokens32{tree: make([]token32, 0, size)}
return nil
}
}
func DisableMemoize() func(*Peg) error {
return func(p *Peg) error {
p.disableMemoize = true
return nil
}
}
type memo struct {
Matched bool
Partial []token32
}
type memoKey struct {
Rule uint32
Position uint32
}
func (p *Peg) Init(options ...func(*Peg) error) error {
var (
max token32
position, tokenIndex uint32
buffer []rune
memoization map[memoKey]memo
)
for _, option := range options {
err := option(p)
if err != nil {
return err
}
}
p.reset = func() {
max = token32{}
position, tokenIndex = 0, 0
memoization = make(map[memoKey]memo)
p.buffer = []rune(p.Buffer)
if len(p.buffer) == 0 || p.buffer[len(p.buffer)-1] != endSymbol {
p.buffer = append(p.buffer, endSymbol)
}
buffer = p.buffer
}
p.reset()
_rules := p.rules
tree := p.tokens32
p.parse = func(rule ...int) error {
r := 1
if len(rule) > 0 {
r = rule[0]
}
matches := p.rules[r]()
p.tokens32 = tree
if matches {
p.Trim(tokenIndex)
return nil
}
return &parseError{p, max}
}
add := func(rule pegRule, begin uint32) {
tree.Add(rule, begin, position, tokenIndex)
tokenIndex++
if begin != position && position > max.end {
max = token32{rule, begin, position}
}
}
memoize := func(rule uint32, begin uint32, tokenIndexStart uint32, matched bool) {
if p.disableMemoize {
return
}
key := memoKey{rule, begin}
if !matched {
memoization[key] = memo{Matched: false}
} else {
t := tree.tree[tokenIndexStart:tokenIndex]
tokenCopy := make([]token32, len(t))
copy(tokenCopy, t)
memoization[key] = memo{Matched: true, Partial: tokenCopy}
}
}
memoizedResult := func(m memo) bool {
if !m.Matched {
return false
}
tree.tree = append(tree.tree[:tokenIndex], m.Partial...)
tokenIndex += uint32(len(m.Partial))
position = m.Partial[len(m.Partial)-1].end
if tree.tree[tokenIndex-1].begin != position && position > max.end {
max = tree.tree[tokenIndex-1]
}
return true
}
matchDot := func() bool {
if buffer[position] != endSymbol {
position++
return true
}
return false
}
/*matchChar := func(c byte) bool {
if buffer[position] == c {
position++
return true
}
return false
}*/
/*matchRange := func(lower byte, upper byte) bool {
if c := buffer[position]; c >= lower && c <= upper {
position++
return true
}
return false
}*/
_rules = [...]func() bool{
nil,
/* 0 Grammar <- <(Spacing ('p' 'a' 'c' 'k' 'a' 'g' 'e') MustSpacing Identifier Action0 Import* ('t' 'y' 'p' 'e') MustSpacing Identifier Action1 ('P' 'e' 'g') Spacing Action Action2 Definition+ EndOfFile)> */
func() bool {
if memoized, ok := memoization[memoKey{0, position}]; ok {
return memoizedResult(memoized)
}
position0, tokenIndex0 := position, tokenIndex
{
position1 := position
if !_rules[ruleSpacing]() {
goto l0
}
if buffer[position] != rune('p') {
goto l0
}
position++
if buffer[position] != rune('a') {
goto l0
}
position++
if buffer[position] != rune('c') {
goto l0
}
position++
if buffer[position] != rune('k') {
goto l0
}
position++
if buffer[position] != rune('a') {
goto l0
}
position++
if buffer[position] != rune('g') {
goto l0
}
position++
if buffer[position] != rune('e') {
goto l0
}
position++
if !_rules[ruleMustSpacing]() {
goto l0
}
if !_rules[ruleIdentifier]() {
goto l0
}
{
add(ruleAction0, position)
}
l3:
{
position4, tokenIndex4 := position, tokenIndex
{
position5 := position
if buffer[position] != rune('i') {
goto l4
}
position++
if buffer[position] != rune('m') {
goto l4
}
position++
if buffer[position] != rune('p') {
goto l4
}
position++
if buffer[position] != rune('o') {
goto l4
}
position++
if buffer[position] != rune('r') {
goto l4
}
position++
if buffer[position] != rune('t') {
goto l4
}
position++
if !_rules[ruleSpacing]() {
goto l4
}
{
position6, tokenIndex6 := position, tokenIndex
{
position8 := position
if buffer[position] != rune('(') {
goto l7
}
position++
if !_rules[ruleSpacing]() {
goto l7
}
l9:
{
position10, tokenIndex10 := position, tokenIndex
if !_rules[ruleImportName]() {
goto l10
}
if buffer[position] != rune('\n') {
goto l10
}
position++
if !_rules[ruleSpacing]() {
goto l10
}
goto l9
l10:
position, tokenIndex = position10, tokenIndex10
}
if !_rules[ruleSpacing]() {
goto l7
}
if buffer[position] != rune(')') {
goto l7
}
position++
add(ruleMultiImport, position8)
}
goto l6
l7:
position, tokenIndex = position6, tokenIndex6
{
position11 := position
if !_rules[ruleImportName]() {
goto l4
}
add(ruleSingleImport, position11)
}
}
l6:
if !_rules[ruleSpacing]() {
goto l4
}
add(ruleImport, position5)
}
goto l3
l4:
position, tokenIndex = position4, tokenIndex4
}
if buffer[position] != rune('t') {
goto l0
}
position++
if buffer[position] != rune('y') {
goto l0
}
position++
if buffer[position] != rune('p') {
goto l0
}
position++
if buffer[position] != rune('e') {
goto l0
}
position++
if !_rules[ruleMustSpacing]() {
goto l0
}
if !_rules[ruleIdentifier]() {
goto l0
}
{
add(ruleAction1, position)
}
if buffer[position] != rune('P') {
goto l0
}
position++
if buffer[position] != rune('e') {
goto l0
}
position++
if buffer[position] != rune('g') {
goto l0
}
position++
if !_rules[ruleSpacing]() {
goto l0
}
if !_rules[ruleAction]() {
goto l0
}
{
add(ruleAction2, position)
}
{
position16 := position
if !_rules[ruleIdentifier]() {
goto l0
}
{
add(ruleAction4, position)
}
if !_rules[ruleLeftArrow]() {
goto l0
}
if !_rules[ruleExpression]() {
goto l0
}
{
add(ruleAction5, position)
}
{
position19, tokenIndex19 := position, tokenIndex
{
position20, tokenIndex20 := position, tokenIndex
if !_rules[ruleIdentifier]() {
goto l21
}
if !_rules[ruleLeftArrow]() {
goto l21
}
goto l20
l21:
position, tokenIndex = position20, tokenIndex20
{
position22, tokenIndex22 := position, tokenIndex
if !matchDot() {
goto l22
}
goto l0
l22:
position, tokenIndex = position22, tokenIndex22
}
}
l20:
position, tokenIndex = position19, tokenIndex19
}
add(ruleDefinition, position16)
}
l14:
{
position15, tokenIndex15 := position, tokenIndex
{
position23 := position
if !_rules[ruleIdentifier]() {
goto l15
}
{
add(ruleAction4, position)
}
if !_rules[ruleLeftArrow]() {
goto l15
}
if !_rules[ruleExpression]() {
goto l15
}
{
add(ruleAction5, position)
}
{
position26, tokenIndex26 := position, tokenIndex
{
position27, tokenIndex27 := position, tokenIndex
if !_rules[ruleIdentifier]() {
goto l28
}
if !_rules[ruleLeftArrow]() {
goto l28
}
goto l27
l28:
position, tokenIndex = position27, tokenIndex27
{
position29, tokenIndex29 := position, tokenIndex
if !matchDot() {
goto l29
}
goto l15
l29:
position, tokenIndex = position29, tokenIndex29
}
}
l27:
position, tokenIndex = position26, tokenIndex26
}
add(ruleDefinition, position23)
}
goto l14
l15:
position, tokenIndex = position15, tokenIndex15
}
{
position30 := position
{
position31, tokenIndex31 := position, tokenIndex
if !matchDot() {
goto l31
}
goto l0
l31:
position, tokenIndex = position31, tokenIndex31
}
add(ruleEndOfFile, position30)
}
add(ruleGrammar, position1)
}
memoize(0, position0, tokenIndex0, true)
return true
l0:
memoize(0, position0, tokenIndex0, false)
position, tokenIndex = position0, tokenIndex0
return false
},
/* 1 Import <- <('i' 'm' 'p' 'o' 'r' 't' Spacing (MultiImport / SingleImport) Spacing)> */
nil,
/* 2 SingleImport <- <ImportName> */
nil,
/* 3 MultiImport <- <('(' Spacing (ImportName '\n' Spacing)* Spacing ')')> */
nil,
/* 4 ImportName <- <('"' <((&('-') '-') | (&('.') '.') | (&('/') '/') | (&('_') '_') | (&('A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z') [A-Z]) | (&('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9') [0-9]) | (&('a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') [a-z]))+> '"' Action3)> */
func() bool {
if memoized, ok := memoization[memoKey{4, position}]; ok {
return memoizedResult(memoized)
}
position35, tokenIndex35 := position, tokenIndex
{
position36 := position
if buffer[position] != rune('"') {
goto l35
}
position++
{
position37 := position
{
switch buffer[position] {