cddlc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9e4a9fe5e7434a8b5f5bea9b9194c988206f74e95aef1e4d2e46067968367727
4
+ data.tar.gz: de11c07b72815e2e6580ed35b36d4d0b56f39e282b3072f84d00e836b6bcd2aa
5
+ SHA512:
6
+ metadata.gz: 62ca200613f056851f397a41a57e64fd49fa0ff2196d0433d706760c05f11468ae3a6ed7652fc4ee5f4387476744e36f2f06f07f67efc14b68774460b55023cd
7
+ data.tar.gz: b1b7560dbfe6f712f31b415138f37bde551a095fcb7a42a7afc82268db416de5eca5f1dff0d3d9f8cf02b82b39b9880d3fb19e7dc405186ffba61acd6b2d029a
data/bin/cddlc ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pp'
3
+ require 'yaml'
4
+ require 'treetop'
5
+ require 'json'
6
+
7
+ require_relative '../lib/parser/cddl-util.rb'
8
+
9
+ Encoding.default_external = Encoding::UTF_8
10
+ require 'optparse'
11
+ require 'ostruct'
12
+
13
+ $options = OpenStruct.new
14
+ begin
15
+ op = OptionParser.new do |opts|
16
+ opts.banner = "Usage: cddlc.rb [options] file.cddl"
17
+
18
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
19
+ $options.verbose = v
20
+ end
21
+ opts.on("-tFMT", "--to=FMT", [:neat, :json, :yaml], "Target format") do |v|
22
+ $options.target = v
23
+ end
24
+ end
25
+ op.parse!
26
+ rescue Exception => e
27
+ warn e
28
+ exit 1
29
+ end
30
+
31
+ if ARGV == []
32
+ puts op
33
+ exit 1
34
+ end
35
+ cddl_file = ARGF.read
36
+
37
+ parser = CDDLParser.new
38
+ ast = parser.parse cddl_file
39
+ if ast
40
+ # puts ast.to_yaml
41
+ result = ast.ast
42
+ case $options.target
43
+ when :json, nil
44
+ pp result
45
+ when :neat
46
+ require 'neatjson'
47
+ puts JSON.neat_generate(result, after_comma: 1, after_colon: 1)
48
+ when :yaml
49
+ puts result.to_yaml
50
+ else
51
+ warn ["Unknown target format: ", $options.target].inspect
52
+ end
53
+ else
54
+ warn parser.failure_reason
55
+ parser.failure_reason =~ /^(Expected .+) after/m
56
+ warn "#{$1.gsub("\n", '<<<NEWLINE>>>')}:"
57
+ warn cddl_file.lines.to_a[parser.failure_line - 1]
58
+ warn "#{'~' * (parser.failure_column - 1)}^"
59
+ end
data/cddlc.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "cddlc"
3
+ s.version = "0.0.1"
4
+ s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
5
+ s.description = %q{cddlc implements converters and miscellaneous tools for CDDL, RFC 8610}
6
+ s.author = "Carsten Bormann"
7
+ s.email = "cabo@tzi.org"
8
+ s.license = "MIT"
9
+ s.homepage = "http://github.com/cabo/cddlc"
10
+ s.files = Dir['lib/**/*.rb'] + %w(cddlc.gemspec) + Dir['bin/**/*.rb']
11
+ s.executables = Dir['bin/*'].map {|x| File.basename(x)}
12
+ s.required_ruby_version = '>= 1.9.2'
13
+
14
+ s.require_paths = ["lib"]
15
+
16
+ s.add_development_dependency 'bundler', '~>1'
17
+ s.add_dependency 'treetop', '~>1'
18
+ s.add_dependency 'json'
19
+ s.add_dependency 'neatjson'
20
+ end
@@ -0,0 +1,51 @@
1
+
2
+ require_relative './cddl'
3
+
4
+ class Treetop::Runtime::SyntaxNode
5
+ def ast
6
+ fail "undefined_ast #{inspect}"
7
+ end
8
+ def ast1 # devhack
9
+ "#{inspect[10..20]}--#{text_value[0..15]}"
10
+ end
11
+ def mkgen(name, genparm)
12
+ nm = name.text_value
13
+ if el = genparm.elements
14
+ ["gen", nm, *genparm.ast] # XXX
15
+ else
16
+ ["name", nm]
17
+ end
18
+ end
19
+ def wrapop(op, first, rest)
20
+ a = first.ast
21
+ b = rest.map(&:ast)
22
+ if b.size != 0
23
+ [op, a, *b]
24
+ else
25
+ a
26
+ end
27
+ end
28
+ def wrapop0(op, all)
29
+ a = all.map(&:ast)
30
+ if a.size == 1
31
+ a[0]
32
+ else
33
+ [op, *a]
34
+ end
35
+ end
36
+ def tvtoi(el, default)
37
+ v = el.text_value
38
+ if v == ''
39
+ default
40
+ else
41
+ v.to_i
42
+ end
43
+ end
44
+ def repwrap(el, val)
45
+ if el.text_value == ''
46
+ val
47
+ else
48
+ ["rep", *el.ast, val]
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,4016 @@
1
+ # Encoding: UTF-8
2
+ # Autogenerated from a Treetop grammar. Edits may be lost.
3
+
4
+
5
+ module CDDL
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root ||= :cddl
10
+ end
11
+
12
+ module Cddl0
13
+ def r__rule
14
+ elements[0]
15
+ end
16
+
17
+ def S
18
+ elements[1]
19
+ end
20
+ end
21
+
22
+ module Cddl1
23
+ def S
24
+ elements[0]
25
+ end
26
+
27
+ end
28
+
29
+ module Cddl2
30
+ def ast
31
+ ["cddl", *elements[1].elements.map(&:r__rule).map(&:ast)]
32
+ end
33
+ end
34
+
35
+ def _nt_cddl
36
+ start_index = index
37
+ if node_cache[:cddl].has_key?(index)
38
+ cached = node_cache[:cddl][index]
39
+ if cached
40
+ node_cache[:cddl][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
41
+ @index = cached.interval.end
42
+ end
43
+ return cached
44
+ end
45
+
46
+ i0, s0 = index, []
47
+ r1 = _nt_S
48
+ s0 << r1
49
+ if r1
50
+ s2, i2 = [], index
51
+ loop do
52
+ i3, s3 = index, []
53
+ r4 = _nt_r__rule
54
+ s3 << r4
55
+ if r4
56
+ r5 = _nt_S
57
+ s3 << r5
58
+ end
59
+ if s3.last
60
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
61
+ r3.extend(Cddl0)
62
+ else
63
+ @index = i3
64
+ r3 = nil
65
+ end
66
+ if r3
67
+ s2 << r3
68
+ else
69
+ break
70
+ end
71
+ end
72
+ if s2.empty?
73
+ @index = i2
74
+ r2 = nil
75
+ else
76
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
77
+ end
78
+ s0 << r2
79
+ end
80
+ if s0.last
81
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
82
+ r0.extend(Cddl1)
83
+ r0.extend(Cddl2)
84
+ else
85
+ @index = i0
86
+ r0 = nil
87
+ end
88
+
89
+ node_cache[:cddl][start_index] = r0
90
+
91
+ r0
92
+ end
93
+
94
+ module R_rule0
95
+ def typename
96
+ elements[0]
97
+ end
98
+
99
+ def S1
100
+ elements[2]
101
+ end
102
+
103
+ def assignt
104
+ elements[3]
105
+ end
106
+
107
+ def S2
108
+ elements[4]
109
+ end
110
+
111
+ def type
112
+ elements[5]
113
+ end
114
+ end
115
+
116
+ module R_rule1
117
+ def ast
118
+ [assignt.text_value, mkgen(typename, elements[1]), type.ast]
119
+ end
120
+ end
121
+
122
+ module R_rule2
123
+ def groupname
124
+ elements[0]
125
+ end
126
+
127
+ def S1
128
+ elements[2]
129
+ end
130
+
131
+ def assigng
132
+ elements[3]
133
+ end
134
+
135
+ def S2
136
+ elements[4]
137
+ end
138
+
139
+ def grpent
140
+ elements[5]
141
+ end
142
+ end
143
+
144
+ module R_rule3
145
+ def ast
146
+ [assigng.text_value, mkgen(groupname, elements[1]), grpent.ast]
147
+ end
148
+ end
149
+
150
+ def _nt_r__rule
151
+ start_index = index
152
+ if node_cache[:r__rule].has_key?(index)
153
+ cached = node_cache[:r__rule][index]
154
+ if cached
155
+ node_cache[:r__rule][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
156
+ @index = cached.interval.end
157
+ end
158
+ return cached
159
+ end
160
+
161
+ i0 = index
162
+ i1, s1 = index, []
163
+ r2 = _nt_typename
164
+ s1 << r2
165
+ if r2
166
+ r4 = _nt_genericparm
167
+ if r4
168
+ r3 = r4
169
+ else
170
+ r3 = instantiate_node(SyntaxNode,input, index...index)
171
+ end
172
+ s1 << r3
173
+ if r3
174
+ r5 = _nt_S
175
+ s1 << r5
176
+ if r5
177
+ r6 = _nt_assignt
178
+ s1 << r6
179
+ if r6
180
+ r7 = _nt_S
181
+ s1 << r7
182
+ if r7
183
+ r8 = _nt_type
184
+ s1 << r8
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+ if s1.last
191
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
192
+ r1.extend(R_rule0)
193
+ r1.extend(R_rule1)
194
+ else
195
+ @index = i1
196
+ r1 = nil
197
+ end
198
+ if r1
199
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
200
+ r0 = r1
201
+ else
202
+ i9, s9 = index, []
203
+ r10 = _nt_groupname
204
+ s9 << r10
205
+ if r10
206
+ r12 = _nt_genericparm
207
+ if r12
208
+ r11 = r12
209
+ else
210
+ r11 = instantiate_node(SyntaxNode,input, index...index)
211
+ end
212
+ s9 << r11
213
+ if r11
214
+ r13 = _nt_S
215
+ s9 << r13
216
+ if r13
217
+ r14 = _nt_assigng
218
+ s9 << r14
219
+ if r14
220
+ r15 = _nt_S
221
+ s9 << r15
222
+ if r15
223
+ r16 = _nt_grpent
224
+ s9 << r16
225
+ end
226
+ end
227
+ end
228
+ end
229
+ end
230
+ if s9.last
231
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
232
+ r9.extend(R_rule2)
233
+ r9.extend(R_rule3)
234
+ else
235
+ @index = i9
236
+ r9 = nil
237
+ end
238
+ if r9
239
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
240
+ r0 = r9
241
+ else
242
+ @index = i0
243
+ r0 = nil
244
+ end
245
+ end
246
+
247
+ node_cache[:r__rule][start_index] = r0
248
+
249
+ r0
250
+ end
251
+
252
+ def _nt_typename
253
+ start_index = index
254
+ if node_cache[:typename].has_key?(index)
255
+ cached = node_cache[:typename][index]
256
+ if cached
257
+ node_cache[:typename][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
258
+ @index = cached.interval.end
259
+ end
260
+ return cached
261
+ end
262
+
263
+ r0 = _nt_id
264
+
265
+ node_cache[:typename][start_index] = r0
266
+
267
+ r0
268
+ end
269
+
270
+ def _nt_groupname
271
+ start_index = index
272
+ if node_cache[:groupname].has_key?(index)
273
+ cached = node_cache[:groupname][index]
274
+ if cached
275
+ node_cache[:groupname][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
276
+ @index = cached.interval.end
277
+ end
278
+ return cached
279
+ end
280
+
281
+ r0 = _nt_id
282
+
283
+ node_cache[:groupname][start_index] = r0
284
+
285
+ r0
286
+ end
287
+
288
+ def _nt_assignt
289
+ start_index = index
290
+ if node_cache[:assignt].has_key?(index)
291
+ cached = node_cache[:assignt][index]
292
+ if cached
293
+ node_cache[:assignt][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
294
+ @index = cached.interval.end
295
+ end
296
+ return cached
297
+ end
298
+
299
+ i0 = index
300
+ if (match_len = has_terminal?("=", false, index))
301
+ r1 = true
302
+ @index += match_len
303
+ else
304
+ terminal_parse_failure('"="')
305
+ r1 = nil
306
+ end
307
+ if r1
308
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
309
+ r0 = r1
310
+ else
311
+ if (match_len = has_terminal?("/=", false, index))
312
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
313
+ @index += match_len
314
+ else
315
+ terminal_parse_failure('"/="')
316
+ r2 = nil
317
+ end
318
+ if r2
319
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
320
+ r0 = r2
321
+ else
322
+ @index = i0
323
+ r0 = nil
324
+ end
325
+ end
326
+
327
+ node_cache[:assignt][start_index] = r0
328
+
329
+ r0
330
+ end
331
+
332
+ def _nt_assigng
333
+ start_index = index
334
+ if node_cache[:assigng].has_key?(index)
335
+ cached = node_cache[:assigng][index]
336
+ if cached
337
+ node_cache[:assigng][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
338
+ @index = cached.interval.end
339
+ end
340
+ return cached
341
+ end
342
+
343
+ i0 = index
344
+ if (match_len = has_terminal?("=", false, index))
345
+ r1 = true
346
+ @index += match_len
347
+ else
348
+ terminal_parse_failure('"="')
349
+ r1 = nil
350
+ end
351
+ if r1
352
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
353
+ r0 = r1
354
+ else
355
+ if (match_len = has_terminal?("//=", false, index))
356
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
357
+ @index += match_len
358
+ else
359
+ terminal_parse_failure('"//="')
360
+ r2 = nil
361
+ end
362
+ if r2
363
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
364
+ r0 = r2
365
+ else
366
+ @index = i0
367
+ r0 = nil
368
+ end
369
+ end
370
+
371
+ node_cache[:assigng][start_index] = r0
372
+
373
+ r0
374
+ end
375
+
376
+ module Genericparm0
377
+ def S1
378
+ elements[1]
379
+ end
380
+
381
+ def id
382
+ elements[2]
383
+ end
384
+
385
+ def S2
386
+ elements[3]
387
+ end
388
+ end
389
+
390
+ module Genericparm1
391
+ def S1
392
+ elements[1]
393
+ end
394
+
395
+ def id
396
+ elements[2]
397
+ end
398
+
399
+ def S2
400
+ elements[3]
401
+ end
402
+
403
+ end
404
+
405
+ module Genericparm2
406
+ def ast() [id.text_value, *elements[4].elements.map{|x| x.id.text_value}] end
407
+ end
408
+
409
+ def _nt_genericparm
410
+ start_index = index
411
+ if node_cache[:genericparm].has_key?(index)
412
+ cached = node_cache[:genericparm][index]
413
+ if cached
414
+ node_cache[:genericparm][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
415
+ @index = cached.interval.end
416
+ end
417
+ return cached
418
+ end
419
+
420
+ i0, s0 = index, []
421
+ if (match_len = has_terminal?("<", false, index))
422
+ r1 = true
423
+ @index += match_len
424
+ else
425
+ terminal_parse_failure('"<"')
426
+ r1 = nil
427
+ end
428
+ s0 << r1
429
+ if r1
430
+ r2 = _nt_S
431
+ s0 << r2
432
+ if r2
433
+ r3 = _nt_id
434
+ s0 << r3
435
+ if r3
436
+ r4 = _nt_S
437
+ s0 << r4
438
+ if r4
439
+ s5, i5 = [], index
440
+ loop do
441
+ i6, s6 = index, []
442
+ if (match_len = has_terminal?(",", false, index))
443
+ r7 = true
444
+ @index += match_len
445
+ else
446
+ terminal_parse_failure('","')
447
+ r7 = nil
448
+ end
449
+ s6 << r7
450
+ if r7
451
+ r8 = _nt_S
452
+ s6 << r8
453
+ if r8
454
+ r9 = _nt_id
455
+ s6 << r9
456
+ if r9
457
+ r10 = _nt_S
458
+ s6 << r10
459
+ end
460
+ end
461
+ end
462
+ if s6.last
463
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
464
+ r6.extend(Genericparm0)
465
+ else
466
+ @index = i6
467
+ r6 = nil
468
+ end
469
+ if r6
470
+ s5 << r6
471
+ else
472
+ break
473
+ end
474
+ end
475
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
476
+ s0 << r5
477
+ if r5
478
+ if (match_len = has_terminal?(">", false, index))
479
+ r11 = true
480
+ @index += match_len
481
+ else
482
+ terminal_parse_failure('">"')
483
+ r11 = nil
484
+ end
485
+ s0 << r11
486
+ end
487
+ end
488
+ end
489
+ end
490
+ end
491
+ if s0.last
492
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
493
+ r0.extend(Genericparm1)
494
+ r0.extend(Genericparm2)
495
+ else
496
+ @index = i0
497
+ r0 = nil
498
+ end
499
+
500
+ node_cache[:genericparm][start_index] = r0
501
+
502
+ r0
503
+ end
504
+
505
+ module Genericarg0
506
+ def S1
507
+ elements[1]
508
+ end
509
+
510
+ def type1
511
+ elements[2]
512
+ end
513
+
514
+ def S2
515
+ elements[3]
516
+ end
517
+ end
518
+
519
+ module Genericarg1
520
+ def S1
521
+ elements[1]
522
+ end
523
+
524
+ def type1
525
+ elements[2]
526
+ end
527
+
528
+ def S2
529
+ elements[3]
530
+ end
531
+
532
+ end
533
+
534
+ module Genericarg2
535
+ def ast() [type1.ast, *elements[4].elements.map{|x| x.type1.ast}] end
536
+ end
537
+
538
+ def _nt_genericarg
539
+ start_index = index
540
+ if node_cache[:genericarg].has_key?(index)
541
+ cached = node_cache[:genericarg][index]
542
+ if cached
543
+ node_cache[:genericarg][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
544
+ @index = cached.interval.end
545
+ end
546
+ return cached
547
+ end
548
+
549
+ i0, s0 = index, []
550
+ if (match_len = has_terminal?("<", false, index))
551
+ r1 = true
552
+ @index += match_len
553
+ else
554
+ terminal_parse_failure('"<"')
555
+ r1 = nil
556
+ end
557
+ s0 << r1
558
+ if r1
559
+ r2 = _nt_S
560
+ s0 << r2
561
+ if r2
562
+ r3 = _nt_type1
563
+ s0 << r3
564
+ if r3
565
+ r4 = _nt_S
566
+ s0 << r4
567
+ if r4
568
+ s5, i5 = [], index
569
+ loop do
570
+ i6, s6 = index, []
571
+ if (match_len = has_terminal?(",", false, index))
572
+ r7 = true
573
+ @index += match_len
574
+ else
575
+ terminal_parse_failure('","')
576
+ r7 = nil
577
+ end
578
+ s6 << r7
579
+ if r7
580
+ r8 = _nt_S
581
+ s6 << r8
582
+ if r8
583
+ r9 = _nt_type1
584
+ s6 << r9
585
+ if r9
586
+ r10 = _nt_S
587
+ s6 << r10
588
+ end
589
+ end
590
+ end
591
+ if s6.last
592
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
593
+ r6.extend(Genericarg0)
594
+ else
595
+ @index = i6
596
+ r6 = nil
597
+ end
598
+ if r6
599
+ s5 << r6
600
+ else
601
+ break
602
+ end
603
+ end
604
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
605
+ s0 << r5
606
+ if r5
607
+ if (match_len = has_terminal?(">", false, index))
608
+ r11 = true
609
+ @index += match_len
610
+ else
611
+ terminal_parse_failure('">"')
612
+ r11 = nil
613
+ end
614
+ s0 << r11
615
+ end
616
+ end
617
+ end
618
+ end
619
+ end
620
+ if s0.last
621
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
622
+ r0.extend(Genericarg1)
623
+ r0.extend(Genericarg2)
624
+ else
625
+ @index = i0
626
+ r0 = nil
627
+ end
628
+
629
+ node_cache[:genericarg][start_index] = r0
630
+
631
+ r0
632
+ end
633
+
634
+ module Type0
635
+ def S1
636
+ elements[0]
637
+ end
638
+
639
+ def S2
640
+ elements[2]
641
+ end
642
+
643
+ def type1
644
+ elements[3]
645
+ end
646
+ end
647
+
648
+ module Type1
649
+ def type1
650
+ elements[0]
651
+ end
652
+
653
+ end
654
+
655
+ module Type2
656
+ def ast
657
+ wrapop("tcho", type1, elements[1].elements.map(&:type1))
658
+ end
659
+ end
660
+
661
+ def _nt_type
662
+ start_index = index
663
+ if node_cache[:type].has_key?(index)
664
+ cached = node_cache[:type][index]
665
+ if cached
666
+ node_cache[:type][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
667
+ @index = cached.interval.end
668
+ end
669
+ return cached
670
+ end
671
+
672
+ i0, s0 = index, []
673
+ r1 = _nt_type1
674
+ s0 << r1
675
+ if r1
676
+ s2, i2 = [], index
677
+ loop do
678
+ i3, s3 = index, []
679
+ r4 = _nt_S
680
+ s3 << r4
681
+ if r4
682
+ if (match_len = has_terminal?("/", false, index))
683
+ r5 = true
684
+ @index += match_len
685
+ else
686
+ terminal_parse_failure('"/"')
687
+ r5 = nil
688
+ end
689
+ s3 << r5
690
+ if r5
691
+ r6 = _nt_S
692
+ s3 << r6
693
+ if r6
694
+ r7 = _nt_type1
695
+ s3 << r7
696
+ end
697
+ end
698
+ end
699
+ if s3.last
700
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
701
+ r3.extend(Type0)
702
+ else
703
+ @index = i3
704
+ r3 = nil
705
+ end
706
+ if r3
707
+ s2 << r3
708
+ else
709
+ break
710
+ end
711
+ end
712
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
713
+ s0 << r2
714
+ end
715
+ if s0.last
716
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
717
+ r0.extend(Type1)
718
+ r0.extend(Type2)
719
+ else
720
+ @index = i0
721
+ r0 = nil
722
+ end
723
+
724
+ node_cache[:type][start_index] = r0
725
+
726
+ r0
727
+ end
728
+
729
+ module Type10
730
+ def S1
731
+ elements[0]
732
+ end
733
+
734
+ def S2
735
+ elements[2]
736
+ end
737
+
738
+ def type2
739
+ elements[3]
740
+ end
741
+ end
742
+
743
+ module Type11
744
+ def type2
745
+ elements[0]
746
+ end
747
+
748
+ end
749
+
750
+ module Type12
751
+ def ast
752
+ a = type2.ast
753
+ if el = elements[1].elements
754
+ ["op", el[1].text_value, a, el[3].ast]
755
+ else
756
+ a
757
+ end
758
+ end
759
+ end
760
+
761
+ def _nt_type1
762
+ start_index = index
763
+ if node_cache[:type1].has_key?(index)
764
+ cached = node_cache[:type1][index]
765
+ if cached
766
+ node_cache[:type1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
767
+ @index = cached.interval.end
768
+ end
769
+ return cached
770
+ end
771
+
772
+ i0, s0 = index, []
773
+ r1 = _nt_type2
774
+ s0 << r1
775
+ if r1
776
+ i3, s3 = index, []
777
+ r4 = _nt_S
778
+ s3 << r4
779
+ if r4
780
+ i5 = index
781
+ r6 = _nt_rangeop
782
+ if r6
783
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
784
+ r5 = r6
785
+ else
786
+ r7 = _nt_ctlop
787
+ if r7
788
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
789
+ r5 = r7
790
+ else
791
+ @index = i5
792
+ r5 = nil
793
+ end
794
+ end
795
+ s3 << r5
796
+ if r5
797
+ r8 = _nt_S
798
+ s3 << r8
799
+ if r8
800
+ r9 = _nt_type2
801
+ s3 << r9
802
+ end
803
+ end
804
+ end
805
+ if s3.last
806
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
807
+ r3.extend(Type10)
808
+ else
809
+ @index = i3
810
+ r3 = nil
811
+ end
812
+ if r3
813
+ r2 = r3
814
+ else
815
+ r2 = instantiate_node(SyntaxNode,input, index...index)
816
+ end
817
+ s0 << r2
818
+ end
819
+ if s0.last
820
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
821
+ r0.extend(Type11)
822
+ r0.extend(Type12)
823
+ else
824
+ @index = i0
825
+ r0 = nil
826
+ end
827
+
828
+ node_cache[:type1][start_index] = r0
829
+
830
+ r0
831
+ end
832
+
833
+ module Type20
834
+ def typename
835
+ elements[0]
836
+ end
837
+
838
+ end
839
+
840
+ module Type21
841
+ def ast() mkgen(typename, elements[1]) end
842
+ end
843
+
844
+ module Type22
845
+ def S1
846
+ elements[1]
847
+ end
848
+
849
+ def type
850
+ elements[2]
851
+ end
852
+
853
+ def S2
854
+ elements[3]
855
+ end
856
+
857
+ end
858
+
859
+ module Type23
860
+ def ast() elements[2].ast end
861
+ end
862
+
863
+ module Type24
864
+ def S1
865
+ elements[1]
866
+ end
867
+
868
+ def group
869
+ elements[2]
870
+ end
871
+
872
+ def S2
873
+ elements[3]
874
+ end
875
+
876
+ end
877
+
878
+ module Type25
879
+ def ast() ["map", group.ast] end
880
+ end
881
+
882
+ module Type26
883
+ def S1
884
+ elements[1]
885
+ end
886
+
887
+ def group
888
+ elements[2]
889
+ end
890
+
891
+ def S2
892
+ elements[3]
893
+ end
894
+
895
+ end
896
+
897
+ module Type27
898
+ def ast() ["ary", group.ast] end
899
+ end
900
+
901
+ module Type28
902
+ def S
903
+ elements[1]
904
+ end
905
+
906
+ def typename
907
+ elements[2]
908
+ end
909
+
910
+ end
911
+
912
+ module Type29
913
+ def ast () ["unwrap", mkgen(typename, elements[3])] end
914
+ end
915
+
916
+ module Type210
917
+ def S1
918
+ elements[1]
919
+ end
920
+
921
+ def S2
922
+ elements[3]
923
+ end
924
+
925
+ def group
926
+ elements[4]
927
+ end
928
+
929
+ def S3
930
+ elements[5]
931
+ end
932
+
933
+ end
934
+
935
+ module Type211
936
+ def ast() ["enum", group.ast] end
937
+ end
938
+
939
+ module Type212
940
+ def S
941
+ elements[1]
942
+ end
943
+
944
+ def groupname
945
+ elements[2]
946
+ end
947
+
948
+ end
949
+
950
+ module Type213
951
+ def ast() ["enum", mkgen(groupname, elements[3])] end
952
+ end
953
+
954
+ module Type214
955
+ def uint
956
+ elements[1]
957
+ end
958
+ end
959
+
960
+ module Type215
961
+ def S1
962
+ elements[4]
963
+ end
964
+
965
+ def type
966
+ elements[5]
967
+ end
968
+
969
+ def S2
970
+ elements[6]
971
+ end
972
+
973
+ end
974
+
975
+ module Type216
976
+ def ast
977
+ el = elements[2].elements
978
+ ["prim", 6, el && el[1].text_value.to_i, elements[5].ast]
979
+ end
980
+ end
981
+
982
+ module Type217
983
+ def uint
984
+ elements[1]
985
+ end
986
+ end
987
+
988
+ module Type218
989
+ def DIGIT
990
+ elements[1]
991
+ end
992
+
993
+ end
994
+
995
+ module Type219
996
+ def ast
997
+ ["prim", elements[1].text_value.to_i,
998
+ *(el = elements[2].elements) ? [el[1].text_value.to_i] : []]
999
+ end
1000
+ end
1001
+
1002
+ module Type220
1003
+ def ast() ["prim"] end
1004
+ end
1005
+
1006
+ def _nt_type2
1007
+ start_index = index
1008
+ if node_cache[:type2].has_key?(index)
1009
+ cached = node_cache[:type2][index]
1010
+ if cached
1011
+ node_cache[:type2][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1012
+ @index = cached.interval.end
1013
+ end
1014
+ return cached
1015
+ end
1016
+
1017
+ i0 = index
1018
+ r1 = _nt_value
1019
+ if r1
1020
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1021
+ r0 = r1
1022
+ else
1023
+ i2, s2 = index, []
1024
+ r3 = _nt_typename
1025
+ s2 << r3
1026
+ if r3
1027
+ r5 = _nt_genericarg
1028
+ if r5
1029
+ r4 = r5
1030
+ else
1031
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1032
+ end
1033
+ s2 << r4
1034
+ end
1035
+ if s2.last
1036
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1037
+ r2.extend(Type20)
1038
+ r2.extend(Type21)
1039
+ else
1040
+ @index = i2
1041
+ r2 = nil
1042
+ end
1043
+ if r2
1044
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
1045
+ r0 = r2
1046
+ else
1047
+ i6, s6 = index, []
1048
+ if (match_len = has_terminal?("(", false, index))
1049
+ r7 = true
1050
+ @index += match_len
1051
+ else
1052
+ terminal_parse_failure('"("')
1053
+ r7 = nil
1054
+ end
1055
+ s6 << r7
1056
+ if r7
1057
+ r8 = _nt_S
1058
+ s6 << r8
1059
+ if r8
1060
+ r9 = _nt_type
1061
+ s6 << r9
1062
+ if r9
1063
+ r10 = _nt_S
1064
+ s6 << r10
1065
+ if r10
1066
+ if (match_len = has_terminal?(")", false, index))
1067
+ r11 = true
1068
+ @index += match_len
1069
+ else
1070
+ terminal_parse_failure('")"')
1071
+ r11 = nil
1072
+ end
1073
+ s6 << r11
1074
+ end
1075
+ end
1076
+ end
1077
+ end
1078
+ if s6.last
1079
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
1080
+ r6.extend(Type22)
1081
+ r6.extend(Type23)
1082
+ else
1083
+ @index = i6
1084
+ r6 = nil
1085
+ end
1086
+ if r6
1087
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
1088
+ r0 = r6
1089
+ else
1090
+ i12, s12 = index, []
1091
+ if (match_len = has_terminal?("{", false, index))
1092
+ r13 = true
1093
+ @index += match_len
1094
+ else
1095
+ terminal_parse_failure('"{"')
1096
+ r13 = nil
1097
+ end
1098
+ s12 << r13
1099
+ if r13
1100
+ r14 = _nt_S
1101
+ s12 << r14
1102
+ if r14
1103
+ r15 = _nt_group
1104
+ s12 << r15
1105
+ if r15
1106
+ r16 = _nt_S
1107
+ s12 << r16
1108
+ if r16
1109
+ if (match_len = has_terminal?("}", false, index))
1110
+ r17 = true
1111
+ @index += match_len
1112
+ else
1113
+ terminal_parse_failure('"}"')
1114
+ r17 = nil
1115
+ end
1116
+ s12 << r17
1117
+ end
1118
+ end
1119
+ end
1120
+ end
1121
+ if s12.last
1122
+ r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
1123
+ r12.extend(Type24)
1124
+ r12.extend(Type25)
1125
+ else
1126
+ @index = i12
1127
+ r12 = nil
1128
+ end
1129
+ if r12
1130
+ r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
1131
+ r0 = r12
1132
+ else
1133
+ i18, s18 = index, []
1134
+ if (match_len = has_terminal?("[", false, index))
1135
+ r19 = true
1136
+ @index += match_len
1137
+ else
1138
+ terminal_parse_failure('"["')
1139
+ r19 = nil
1140
+ end
1141
+ s18 << r19
1142
+ if r19
1143
+ r20 = _nt_S
1144
+ s18 << r20
1145
+ if r20
1146
+ r21 = _nt_group
1147
+ s18 << r21
1148
+ if r21
1149
+ r22 = _nt_S
1150
+ s18 << r22
1151
+ if r22
1152
+ if (match_len = has_terminal?("]", false, index))
1153
+ r23 = true
1154
+ @index += match_len
1155
+ else
1156
+ terminal_parse_failure('"]"')
1157
+ r23 = nil
1158
+ end
1159
+ s18 << r23
1160
+ end
1161
+ end
1162
+ end
1163
+ end
1164
+ if s18.last
1165
+ r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
1166
+ r18.extend(Type26)
1167
+ r18.extend(Type27)
1168
+ else
1169
+ @index = i18
1170
+ r18 = nil
1171
+ end
1172
+ if r18
1173
+ r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
1174
+ r0 = r18
1175
+ else
1176
+ i24, s24 = index, []
1177
+ if (match_len = has_terminal?("~", false, index))
1178
+ r25 = true
1179
+ @index += match_len
1180
+ else
1181
+ terminal_parse_failure('"~"')
1182
+ r25 = nil
1183
+ end
1184
+ s24 << r25
1185
+ if r25
1186
+ r26 = _nt_S
1187
+ s24 << r26
1188
+ if r26
1189
+ r27 = _nt_typename
1190
+ s24 << r27
1191
+ if r27
1192
+ r29 = _nt_genericarg
1193
+ if r29
1194
+ r28 = r29
1195
+ else
1196
+ r28 = instantiate_node(SyntaxNode,input, index...index)
1197
+ end
1198
+ s24 << r28
1199
+ end
1200
+ end
1201
+ end
1202
+ if s24.last
1203
+ r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
1204
+ r24.extend(Type28)
1205
+ r24.extend(Type29)
1206
+ else
1207
+ @index = i24
1208
+ r24 = nil
1209
+ end
1210
+ if r24
1211
+ r24 = SyntaxNode.new(input, (index-1)...index) if r24 == true
1212
+ r0 = r24
1213
+ else
1214
+ i30, s30 = index, []
1215
+ if (match_len = has_terminal?("&", false, index))
1216
+ r31 = true
1217
+ @index += match_len
1218
+ else
1219
+ terminal_parse_failure('"&"')
1220
+ r31 = nil
1221
+ end
1222
+ s30 << r31
1223
+ if r31
1224
+ r32 = _nt_S
1225
+ s30 << r32
1226
+ if r32
1227
+ if (match_len = has_terminal?("(", false, index))
1228
+ r33 = true
1229
+ @index += match_len
1230
+ else
1231
+ terminal_parse_failure('"("')
1232
+ r33 = nil
1233
+ end
1234
+ s30 << r33
1235
+ if r33
1236
+ r34 = _nt_S
1237
+ s30 << r34
1238
+ if r34
1239
+ r35 = _nt_group
1240
+ s30 << r35
1241
+ if r35
1242
+ r36 = _nt_S
1243
+ s30 << r36
1244
+ if r36
1245
+ if (match_len = has_terminal?(")", false, index))
1246
+ r37 = true
1247
+ @index += match_len
1248
+ else
1249
+ terminal_parse_failure('")"')
1250
+ r37 = nil
1251
+ end
1252
+ s30 << r37
1253
+ end
1254
+ end
1255
+ end
1256
+ end
1257
+ end
1258
+ end
1259
+ if s30.last
1260
+ r30 = instantiate_node(SyntaxNode,input, i30...index, s30)
1261
+ r30.extend(Type210)
1262
+ r30.extend(Type211)
1263
+ else
1264
+ @index = i30
1265
+ r30 = nil
1266
+ end
1267
+ if r30
1268
+ r30 = SyntaxNode.new(input, (index-1)...index) if r30 == true
1269
+ r0 = r30
1270
+ else
1271
+ i38, s38 = index, []
1272
+ if (match_len = has_terminal?("&", false, index))
1273
+ r39 = true
1274
+ @index += match_len
1275
+ else
1276
+ terminal_parse_failure('"&"')
1277
+ r39 = nil
1278
+ end
1279
+ s38 << r39
1280
+ if r39
1281
+ r40 = _nt_S
1282
+ s38 << r40
1283
+ if r40
1284
+ r41 = _nt_groupname
1285
+ s38 << r41
1286
+ if r41
1287
+ r43 = _nt_genericarg
1288
+ if r43
1289
+ r42 = r43
1290
+ else
1291
+ r42 = instantiate_node(SyntaxNode,input, index...index)
1292
+ end
1293
+ s38 << r42
1294
+ end
1295
+ end
1296
+ end
1297
+ if s38.last
1298
+ r38 = instantiate_node(SyntaxNode,input, i38...index, s38)
1299
+ r38.extend(Type212)
1300
+ r38.extend(Type213)
1301
+ else
1302
+ @index = i38
1303
+ r38 = nil
1304
+ end
1305
+ if r38
1306
+ r38 = SyntaxNode.new(input, (index-1)...index) if r38 == true
1307
+ r0 = r38
1308
+ else
1309
+ i44, s44 = index, []
1310
+ if (match_len = has_terminal?("#", false, index))
1311
+ r45 = true
1312
+ @index += match_len
1313
+ else
1314
+ terminal_parse_failure('"#"')
1315
+ r45 = nil
1316
+ end
1317
+ s44 << r45
1318
+ if r45
1319
+ if (match_len = has_terminal?("6", false, index))
1320
+ r46 = true
1321
+ @index += match_len
1322
+ else
1323
+ terminal_parse_failure('"6"')
1324
+ r46 = nil
1325
+ end
1326
+ s44 << r46
1327
+ if r46
1328
+ i48, s48 = index, []
1329
+ if (match_len = has_terminal?(".", false, index))
1330
+ r49 = true
1331
+ @index += match_len
1332
+ else
1333
+ terminal_parse_failure('"."')
1334
+ r49 = nil
1335
+ end
1336
+ s48 << r49
1337
+ if r49
1338
+ r50 = _nt_uint
1339
+ s48 << r50
1340
+ end
1341
+ if s48.last
1342
+ r48 = instantiate_node(SyntaxNode,input, i48...index, s48)
1343
+ r48.extend(Type214)
1344
+ else
1345
+ @index = i48
1346
+ r48 = nil
1347
+ end
1348
+ if r48
1349
+ r47 = r48
1350
+ else
1351
+ r47 = instantiate_node(SyntaxNode,input, index...index)
1352
+ end
1353
+ s44 << r47
1354
+ if r47
1355
+ if (match_len = has_terminal?("(", false, index))
1356
+ r51 = true
1357
+ @index += match_len
1358
+ else
1359
+ terminal_parse_failure('"("')
1360
+ r51 = nil
1361
+ end
1362
+ s44 << r51
1363
+ if r51
1364
+ r52 = _nt_S
1365
+ s44 << r52
1366
+ if r52
1367
+ r53 = _nt_type
1368
+ s44 << r53
1369
+ if r53
1370
+ r54 = _nt_S
1371
+ s44 << r54
1372
+ if r54
1373
+ if (match_len = has_terminal?(")", false, index))
1374
+ r55 = true
1375
+ @index += match_len
1376
+ else
1377
+ terminal_parse_failure('")"')
1378
+ r55 = nil
1379
+ end
1380
+ s44 << r55
1381
+ end
1382
+ end
1383
+ end
1384
+ end
1385
+ end
1386
+ end
1387
+ end
1388
+ if s44.last
1389
+ r44 = instantiate_node(SyntaxNode,input, i44...index, s44)
1390
+ r44.extend(Type215)
1391
+ r44.extend(Type216)
1392
+ else
1393
+ @index = i44
1394
+ r44 = nil
1395
+ end
1396
+ if r44
1397
+ r44 = SyntaxNode.new(input, (index-1)...index) if r44 == true
1398
+ r0 = r44
1399
+ else
1400
+ i56, s56 = index, []
1401
+ if (match_len = has_terminal?("#", false, index))
1402
+ r57 = true
1403
+ @index += match_len
1404
+ else
1405
+ terminal_parse_failure('"#"')
1406
+ r57 = nil
1407
+ end
1408
+ s56 << r57
1409
+ if r57
1410
+ r58 = _nt_DIGIT
1411
+ s56 << r58
1412
+ if r58
1413
+ i60, s60 = index, []
1414
+ if (match_len = has_terminal?(".", false, index))
1415
+ r61 = true
1416
+ @index += match_len
1417
+ else
1418
+ terminal_parse_failure('"."')
1419
+ r61 = nil
1420
+ end
1421
+ s60 << r61
1422
+ if r61
1423
+ r62 = _nt_uint
1424
+ s60 << r62
1425
+ end
1426
+ if s60.last
1427
+ r60 = instantiate_node(SyntaxNode,input, i60...index, s60)
1428
+ r60.extend(Type217)
1429
+ else
1430
+ @index = i60
1431
+ r60 = nil
1432
+ end
1433
+ if r60
1434
+ r59 = r60
1435
+ else
1436
+ r59 = instantiate_node(SyntaxNode,input, index...index)
1437
+ end
1438
+ s56 << r59
1439
+ end
1440
+ end
1441
+ if s56.last
1442
+ r56 = instantiate_node(SyntaxNode,input, i56...index, s56)
1443
+ r56.extend(Type218)
1444
+ r56.extend(Type219)
1445
+ else
1446
+ @index = i56
1447
+ r56 = nil
1448
+ end
1449
+ if r56
1450
+ r56 = SyntaxNode.new(input, (index-1)...index) if r56 == true
1451
+ r0 = r56
1452
+ else
1453
+ if (match_len = has_terminal?("#", false, index))
1454
+ r63 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1455
+ r63.extend(Type220)
1456
+ @index += match_len
1457
+ else
1458
+ terminal_parse_failure('"#"')
1459
+ r63 = nil
1460
+ end
1461
+ if r63
1462
+ r63 = SyntaxNode.new(input, (index-1)...index) if r63 == true
1463
+ r0 = r63
1464
+ else
1465
+ @index = i0
1466
+ r0 = nil
1467
+ end
1468
+ end
1469
+ end
1470
+ end
1471
+ end
1472
+ end
1473
+ end
1474
+ end
1475
+ end
1476
+ end
1477
+ end
1478
+
1479
+ node_cache[:type2][start_index] = r0
1480
+
1481
+ r0
1482
+ end
1483
+
1484
+ def _nt_rangeop
1485
+ start_index = index
1486
+ if node_cache[:rangeop].has_key?(index)
1487
+ cached = node_cache[:rangeop][index]
1488
+ if cached
1489
+ node_cache[:rangeop][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1490
+ @index = cached.interval.end
1491
+ end
1492
+ return cached
1493
+ end
1494
+
1495
+ i0 = index
1496
+ if (match_len = has_terminal?("...", false, index))
1497
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1498
+ @index += match_len
1499
+ else
1500
+ terminal_parse_failure('"..."')
1501
+ r1 = nil
1502
+ end
1503
+ if r1
1504
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1505
+ r0 = r1
1506
+ else
1507
+ if (match_len = has_terminal?("..", false, index))
1508
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1509
+ @index += match_len
1510
+ else
1511
+ terminal_parse_failure('".."')
1512
+ r2 = nil
1513
+ end
1514
+ if r2
1515
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
1516
+ r0 = r2
1517
+ else
1518
+ @index = i0
1519
+ r0 = nil
1520
+ end
1521
+ end
1522
+
1523
+ node_cache[:rangeop][start_index] = r0
1524
+
1525
+ r0
1526
+ end
1527
+
1528
+ module Ctlop0
1529
+ def id
1530
+ elements[1]
1531
+ end
1532
+ end
1533
+
1534
+ def _nt_ctlop
1535
+ start_index = index
1536
+ if node_cache[:ctlop].has_key?(index)
1537
+ cached = node_cache[:ctlop][index]
1538
+ if cached
1539
+ node_cache[:ctlop][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1540
+ @index = cached.interval.end
1541
+ end
1542
+ return cached
1543
+ end
1544
+
1545
+ i0, s0 = index, []
1546
+ if (match_len = has_terminal?(".", false, index))
1547
+ r1 = true
1548
+ @index += match_len
1549
+ else
1550
+ terminal_parse_failure('"."')
1551
+ r1 = nil
1552
+ end
1553
+ s0 << r1
1554
+ if r1
1555
+ r2 = _nt_id
1556
+ s0 << r2
1557
+ end
1558
+ if s0.last
1559
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1560
+ r0.extend(Ctlop0)
1561
+ else
1562
+ @index = i0
1563
+ r0 = nil
1564
+ end
1565
+
1566
+ node_cache[:ctlop][start_index] = r0
1567
+
1568
+ r0
1569
+ end
1570
+
1571
+ module Group0
1572
+ def S1
1573
+ elements[0]
1574
+ end
1575
+
1576
+ def S2
1577
+ elements[2]
1578
+ end
1579
+
1580
+ def grpchoice
1581
+ elements[3]
1582
+ end
1583
+ end
1584
+
1585
+ module Group1
1586
+ def grpchoice
1587
+ elements[0]
1588
+ end
1589
+
1590
+ end
1591
+
1592
+ module Group2
1593
+ def ast
1594
+ wrapop("gcho", grpchoice, elements[1].elements.map(&:grpchoice))
1595
+ end
1596
+ end
1597
+
1598
+ def _nt_group
1599
+ start_index = index
1600
+ if node_cache[:group].has_key?(index)
1601
+ cached = node_cache[:group][index]
1602
+ if cached
1603
+ node_cache[:group][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1604
+ @index = cached.interval.end
1605
+ end
1606
+ return cached
1607
+ end
1608
+
1609
+ i0, s0 = index, []
1610
+ r1 = _nt_grpchoice
1611
+ s0 << r1
1612
+ if r1
1613
+ s2, i2 = [], index
1614
+ loop do
1615
+ i3, s3 = index, []
1616
+ r4 = _nt_S
1617
+ s3 << r4
1618
+ if r4
1619
+ if (match_len = has_terminal?("//", false, index))
1620
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
1621
+ @index += match_len
1622
+ else
1623
+ terminal_parse_failure('"//"')
1624
+ r5 = nil
1625
+ end
1626
+ s3 << r5
1627
+ if r5
1628
+ r6 = _nt_S
1629
+ s3 << r6
1630
+ if r6
1631
+ r7 = _nt_grpchoice
1632
+ s3 << r7
1633
+ end
1634
+ end
1635
+ end
1636
+ if s3.last
1637
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
1638
+ r3.extend(Group0)
1639
+ else
1640
+ @index = i3
1641
+ r3 = nil
1642
+ end
1643
+ if r3
1644
+ s2 << r3
1645
+ else
1646
+ break
1647
+ end
1648
+ end
1649
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
1650
+ s0 << r2
1651
+ end
1652
+ if s0.last
1653
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1654
+ r0.extend(Group1)
1655
+ r0.extend(Group2)
1656
+ else
1657
+ @index = i0
1658
+ r0 = nil
1659
+ end
1660
+
1661
+ node_cache[:group][start_index] = r0
1662
+
1663
+ r0
1664
+ end
1665
+
1666
+ module Grpchoice0
1667
+ def grpent
1668
+ elements[0]
1669
+ end
1670
+
1671
+ def optcom
1672
+ elements[1]
1673
+ end
1674
+ end
1675
+
1676
+ module Grpchoice1
1677
+ def ast
1678
+ wrapop0("seq", elements.map(&:grpent)) #[0].elements)
1679
+ end
1680
+ end
1681
+
1682
+ def _nt_grpchoice
1683
+ start_index = index
1684
+ if node_cache[:grpchoice].has_key?(index)
1685
+ cached = node_cache[:grpchoice][index]
1686
+ if cached
1687
+ node_cache[:grpchoice][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1688
+ @index = cached.interval.end
1689
+ end
1690
+ return cached
1691
+ end
1692
+
1693
+ s0, i0 = [], index
1694
+ loop do
1695
+ i1, s1 = index, []
1696
+ r2 = _nt_grpent
1697
+ s1 << r2
1698
+ if r2
1699
+ r3 = _nt_optcom
1700
+ s1 << r3
1701
+ end
1702
+ if s1.last
1703
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1704
+ r1.extend(Grpchoice0)
1705
+ else
1706
+ @index = i1
1707
+ r1 = nil
1708
+ end
1709
+ if r1
1710
+ s0 << r1
1711
+ else
1712
+ break
1713
+ end
1714
+ end
1715
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
1716
+ r0.extend(Grpchoice1)
1717
+ r0.extend(Grpchoice1)
1718
+
1719
+ node_cache[:grpchoice][start_index] = r0
1720
+
1721
+ r0
1722
+ end
1723
+
1724
+ module Grpent0
1725
+ def memberkey
1726
+ elements[0]
1727
+ end
1728
+
1729
+ def S
1730
+ elements[1]
1731
+ end
1732
+ end
1733
+
1734
+ module Grpent1
1735
+ def type
1736
+ elements[2]
1737
+ end
1738
+ end
1739
+
1740
+ module Grpent2
1741
+ def ast() repwrap(elements[0], ["mem", elements[1].elements ? elements[1].memberkey.ast : nil, elements[2].ast]) end
1742
+ end
1743
+
1744
+ module Grpent3
1745
+ def groupname
1746
+ elements[1]
1747
+ end
1748
+
1749
+ end
1750
+
1751
+ module Grpent4
1752
+ def S1
1753
+ elements[2]
1754
+ end
1755
+
1756
+ def group
1757
+ elements[3]
1758
+ end
1759
+
1760
+ def S2
1761
+ elements[4]
1762
+ end
1763
+
1764
+ end
1765
+
1766
+ module Grpent5
1767
+ def ast() repwrap(elements[0], group.ast()) end
1768
+ end
1769
+
1770
+ def _nt_grpent
1771
+ start_index = index
1772
+ if node_cache[:grpent].has_key?(index)
1773
+ cached = node_cache[:grpent][index]
1774
+ if cached
1775
+ node_cache[:grpent][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1776
+ @index = cached.interval.end
1777
+ end
1778
+ return cached
1779
+ end
1780
+
1781
+ i0 = index
1782
+ i1, s1 = index, []
1783
+ r3 = _nt_occurs
1784
+ if r3
1785
+ r2 = r3
1786
+ else
1787
+ r2 = instantiate_node(SyntaxNode,input, index...index)
1788
+ end
1789
+ s1 << r2
1790
+ if r2
1791
+ i5, s5 = index, []
1792
+ r6 = _nt_memberkey
1793
+ s5 << r6
1794
+ if r6
1795
+ r7 = _nt_S
1796
+ s5 << r7
1797
+ end
1798
+ if s5.last
1799
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
1800
+ r5.extend(Grpent0)
1801
+ else
1802
+ @index = i5
1803
+ r5 = nil
1804
+ end
1805
+ if r5
1806
+ r4 = r5
1807
+ else
1808
+ r4 = instantiate_node(SyntaxNode,input, index...index)
1809
+ end
1810
+ s1 << r4
1811
+ if r4
1812
+ r8 = _nt_type
1813
+ s1 << r8
1814
+ end
1815
+ end
1816
+ if s1.last
1817
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
1818
+ r1.extend(Grpent1)
1819
+ r1.extend(Grpent2)
1820
+ else
1821
+ @index = i1
1822
+ r1 = nil
1823
+ end
1824
+ if r1
1825
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
1826
+ r0 = r1
1827
+ else
1828
+ i9, s9 = index, []
1829
+ r11 = _nt_occurs
1830
+ if r11
1831
+ r10 = r11
1832
+ else
1833
+ r10 = instantiate_node(SyntaxNode,input, index...index)
1834
+ end
1835
+ s9 << r10
1836
+ if r10
1837
+ r12 = _nt_groupname
1838
+ s9 << r12
1839
+ if r12
1840
+ r14 = _nt_genericarg
1841
+ if r14
1842
+ r13 = r14
1843
+ else
1844
+ r13 = instantiate_node(SyntaxNode,input, index...index)
1845
+ end
1846
+ s9 << r13
1847
+ end
1848
+ end
1849
+ if s9.last
1850
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
1851
+ r9.extend(Grpent3)
1852
+ else
1853
+ @index = i9
1854
+ r9 = nil
1855
+ end
1856
+ if r9
1857
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
1858
+ r0 = r9
1859
+ else
1860
+ i15, s15 = index, []
1861
+ r17 = _nt_occurs
1862
+ if r17
1863
+ r16 = r17
1864
+ else
1865
+ r16 = instantiate_node(SyntaxNode,input, index...index)
1866
+ end
1867
+ s15 << r16
1868
+ if r16
1869
+ if (match_len = has_terminal?("(", false, index))
1870
+ r18 = true
1871
+ @index += match_len
1872
+ else
1873
+ terminal_parse_failure('"("')
1874
+ r18 = nil
1875
+ end
1876
+ s15 << r18
1877
+ if r18
1878
+ r19 = _nt_S
1879
+ s15 << r19
1880
+ if r19
1881
+ r20 = _nt_group
1882
+ s15 << r20
1883
+ if r20
1884
+ r21 = _nt_S
1885
+ s15 << r21
1886
+ if r21
1887
+ if (match_len = has_terminal?(")", false, index))
1888
+ r22 = true
1889
+ @index += match_len
1890
+ else
1891
+ terminal_parse_failure('")"')
1892
+ r22 = nil
1893
+ end
1894
+ s15 << r22
1895
+ end
1896
+ end
1897
+ end
1898
+ end
1899
+ end
1900
+ if s15.last
1901
+ r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
1902
+ r15.extend(Grpent4)
1903
+ r15.extend(Grpent5)
1904
+ else
1905
+ @index = i15
1906
+ r15 = nil
1907
+ end
1908
+ if r15
1909
+ r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
1910
+ r0 = r15
1911
+ else
1912
+ @index = i0
1913
+ r0 = nil
1914
+ end
1915
+ end
1916
+ end
1917
+
1918
+ node_cache[:grpent][start_index] = r0
1919
+
1920
+ r0
1921
+ end
1922
+
1923
+ module Memberkey0
1924
+ def S
1925
+ elements[1]
1926
+ end
1927
+ end
1928
+
1929
+ module Memberkey1
1930
+ def type1
1931
+ elements[0]
1932
+ end
1933
+
1934
+ def S
1935
+ elements[1]
1936
+ end
1937
+
1938
+ end
1939
+
1940
+ module Memberkey2
1941
+ def ast() type1.ast end
1942
+ end
1943
+
1944
+ module Memberkey3
1945
+ def bareword
1946
+ elements[0]
1947
+ end
1948
+
1949
+ def S
1950
+ elements[1]
1951
+ end
1952
+
1953
+ end
1954
+
1955
+ module Memberkey4
1956
+ def ast() ["text", bareword.text_value] end
1957
+ end
1958
+
1959
+ module Memberkey5
1960
+ def value
1961
+ elements[0]
1962
+ end
1963
+
1964
+ def S
1965
+ elements[1]
1966
+ end
1967
+
1968
+ end
1969
+
1970
+ module Memberkey6
1971
+ def ast() value.ast end
1972
+ end
1973
+
1974
+ def _nt_memberkey
1975
+ start_index = index
1976
+ if node_cache[:memberkey].has_key?(index)
1977
+ cached = node_cache[:memberkey][index]
1978
+ if cached
1979
+ node_cache[:memberkey][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
1980
+ @index = cached.interval.end
1981
+ end
1982
+ return cached
1983
+ end
1984
+
1985
+ i0 = index
1986
+ i1, s1 = index, []
1987
+ r2 = _nt_type1
1988
+ s1 << r2
1989
+ if r2
1990
+ r3 = _nt_S
1991
+ s1 << r3
1992
+ if r3
1993
+ i5, s5 = index, []
1994
+ if (match_len = has_terminal?("^", false, index))
1995
+ r6 = true
1996
+ @index += match_len
1997
+ else
1998
+ terminal_parse_failure('"^"')
1999
+ r6 = nil
2000
+ end
2001
+ s5 << r6
2002
+ if r6
2003
+ r7 = _nt_S
2004
+ s5 << r7
2005
+ end
2006
+ if s5.last
2007
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2008
+ r5.extend(Memberkey0)
2009
+ else
2010
+ @index = i5
2011
+ r5 = nil
2012
+ end
2013
+ if r5
2014
+ r4 = r5
2015
+ else
2016
+ r4 = instantiate_node(SyntaxNode,input, index...index)
2017
+ end
2018
+ s1 << r4
2019
+ if r4
2020
+ if (match_len = has_terminal?("=>", false, index))
2021
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2022
+ @index += match_len
2023
+ else
2024
+ terminal_parse_failure('"=>"')
2025
+ r8 = nil
2026
+ end
2027
+ s1 << r8
2028
+ end
2029
+ end
2030
+ end
2031
+ if s1.last
2032
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2033
+ r1.extend(Memberkey1)
2034
+ r1.extend(Memberkey2)
2035
+ else
2036
+ @index = i1
2037
+ r1 = nil
2038
+ end
2039
+ if r1
2040
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2041
+ r0 = r1
2042
+ else
2043
+ i9, s9 = index, []
2044
+ r10 = _nt_bareword
2045
+ s9 << r10
2046
+ if r10
2047
+ r11 = _nt_S
2048
+ s9 << r11
2049
+ if r11
2050
+ if (match_len = has_terminal?(":", false, index))
2051
+ r12 = true
2052
+ @index += match_len
2053
+ else
2054
+ terminal_parse_failure('":"')
2055
+ r12 = nil
2056
+ end
2057
+ s9 << r12
2058
+ end
2059
+ end
2060
+ if s9.last
2061
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
2062
+ r9.extend(Memberkey3)
2063
+ r9.extend(Memberkey4)
2064
+ else
2065
+ @index = i9
2066
+ r9 = nil
2067
+ end
2068
+ if r9
2069
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
2070
+ r0 = r9
2071
+ else
2072
+ i13, s13 = index, []
2073
+ r14 = _nt_value
2074
+ s13 << r14
2075
+ if r14
2076
+ r15 = _nt_S
2077
+ s13 << r15
2078
+ if r15
2079
+ if (match_len = has_terminal?(":", false, index))
2080
+ r16 = true
2081
+ @index += match_len
2082
+ else
2083
+ terminal_parse_failure('":"')
2084
+ r16 = nil
2085
+ end
2086
+ s13 << r16
2087
+ end
2088
+ end
2089
+ if s13.last
2090
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
2091
+ r13.extend(Memberkey5)
2092
+ r13.extend(Memberkey6)
2093
+ else
2094
+ @index = i13
2095
+ r13 = nil
2096
+ end
2097
+ if r13
2098
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
2099
+ r0 = r13
2100
+ else
2101
+ @index = i0
2102
+ r0 = nil
2103
+ end
2104
+ end
2105
+ end
2106
+
2107
+ node_cache[:memberkey][start_index] = r0
2108
+
2109
+ r0
2110
+ end
2111
+
2112
+ def _nt_bareword
2113
+ start_index = index
2114
+ if node_cache[:bareword].has_key?(index)
2115
+ cached = node_cache[:bareword][index]
2116
+ if cached
2117
+ node_cache[:bareword][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2118
+ @index = cached.interval.end
2119
+ end
2120
+ return cached
2121
+ end
2122
+
2123
+ r0 = _nt_id
2124
+
2125
+ node_cache[:bareword][start_index] = r0
2126
+
2127
+ r0
2128
+ end
2129
+
2130
+ module Optcom0
2131
+ def S
2132
+ elements[1]
2133
+ end
2134
+ end
2135
+
2136
+ module Optcom1
2137
+ def S
2138
+ elements[0]
2139
+ end
2140
+
2141
+ end
2142
+
2143
+ def _nt_optcom
2144
+ start_index = index
2145
+ if node_cache[:optcom].has_key?(index)
2146
+ cached = node_cache[:optcom][index]
2147
+ if cached
2148
+ node_cache[:optcom][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2149
+ @index = cached.interval.end
2150
+ end
2151
+ return cached
2152
+ end
2153
+
2154
+ i0, s0 = index, []
2155
+ r1 = _nt_S
2156
+ s0 << r1
2157
+ if r1
2158
+ i3, s3 = index, []
2159
+ if (match_len = has_terminal?(",", false, index))
2160
+ r4 = true
2161
+ @index += match_len
2162
+ else
2163
+ terminal_parse_failure('","')
2164
+ r4 = nil
2165
+ end
2166
+ s3 << r4
2167
+ if r4
2168
+ r5 = _nt_S
2169
+ s3 << r5
2170
+ end
2171
+ if s3.last
2172
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2173
+ r3.extend(Optcom0)
2174
+ else
2175
+ @index = i3
2176
+ r3 = nil
2177
+ end
2178
+ if r3
2179
+ r2 = r3
2180
+ else
2181
+ r2 = instantiate_node(SyntaxNode,input, index...index)
2182
+ end
2183
+ s0 << r2
2184
+ end
2185
+ if s0.last
2186
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2187
+ r0.extend(Optcom1)
2188
+ else
2189
+ @index = i0
2190
+ r0 = nil
2191
+ end
2192
+
2193
+ node_cache[:optcom][start_index] = r0
2194
+
2195
+ r0
2196
+ end
2197
+
2198
+ module Occurs0
2199
+ def occur
2200
+ elements[0]
2201
+ end
2202
+
2203
+ def S
2204
+ elements[1]
2205
+ end
2206
+ end
2207
+
2208
+ module Occurs1
2209
+ def ast() elements[0].ast end
2210
+ end
2211
+
2212
+ def _nt_occurs
2213
+ start_index = index
2214
+ if node_cache[:occurs].has_key?(index)
2215
+ cached = node_cache[:occurs][index]
2216
+ if cached
2217
+ node_cache[:occurs][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2218
+ @index = cached.interval.end
2219
+ end
2220
+ return cached
2221
+ end
2222
+
2223
+ i0, s0 = index, []
2224
+ r1 = _nt_occur
2225
+ s0 << r1
2226
+ if r1
2227
+ r2 = _nt_S
2228
+ s0 << r2
2229
+ end
2230
+ if s0.last
2231
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2232
+ r0.extend(Occurs0)
2233
+ r0.extend(Occurs1)
2234
+ else
2235
+ @index = i0
2236
+ r0 = nil
2237
+ end
2238
+
2239
+ node_cache[:occurs][start_index] = r0
2240
+
2241
+ r0
2242
+ end
2243
+
2244
+ module Occur0
2245
+ end
2246
+
2247
+ module Occur1
2248
+ def ast() [tvtoi(elements[0], 0), tvtoi(elements[2], false)] end
2249
+ end
2250
+
2251
+ module Occur2
2252
+ def ast() [1, false] end
2253
+ end
2254
+
2255
+ module Occur3
2256
+ def ast() [0, 1] end
2257
+ end
2258
+
2259
+ def _nt_occur
2260
+ start_index = index
2261
+ if node_cache[:occur].has_key?(index)
2262
+ cached = node_cache[:occur][index]
2263
+ if cached
2264
+ node_cache[:occur][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2265
+ @index = cached.interval.end
2266
+ end
2267
+ return cached
2268
+ end
2269
+
2270
+ i0 = index
2271
+ i1, s1 = index, []
2272
+ r3 = _nt_uint
2273
+ if r3
2274
+ r2 = r3
2275
+ else
2276
+ r2 = instantiate_node(SyntaxNode,input, index...index)
2277
+ end
2278
+ s1 << r2
2279
+ if r2
2280
+ if (match_len = has_terminal?("*", false, index))
2281
+ r4 = true
2282
+ @index += match_len
2283
+ else
2284
+ terminal_parse_failure('"*"')
2285
+ r4 = nil
2286
+ end
2287
+ s1 << r4
2288
+ if r4
2289
+ r6 = _nt_uint
2290
+ if r6
2291
+ r5 = r6
2292
+ else
2293
+ r5 = instantiate_node(SyntaxNode,input, index...index)
2294
+ end
2295
+ s1 << r5
2296
+ end
2297
+ end
2298
+ if s1.last
2299
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2300
+ r1.extend(Occur0)
2301
+ r1.extend(Occur1)
2302
+ else
2303
+ @index = i1
2304
+ r1 = nil
2305
+ end
2306
+ if r1
2307
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2308
+ r0 = r1
2309
+ else
2310
+ if (match_len = has_terminal?("+", false, index))
2311
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2312
+ r7.extend(Occur2)
2313
+ @index += match_len
2314
+ else
2315
+ terminal_parse_failure('"+"')
2316
+ r7 = nil
2317
+ end
2318
+ if r7
2319
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
2320
+ r0 = r7
2321
+ else
2322
+ if (match_len = has_terminal?("?", false, index))
2323
+ r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2324
+ r8.extend(Occur3)
2325
+ @index += match_len
2326
+ else
2327
+ terminal_parse_failure('"?"')
2328
+ r8 = nil
2329
+ end
2330
+ if r8
2331
+ r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
2332
+ r0 = r8
2333
+ else
2334
+ @index = i0
2335
+ r0 = nil
2336
+ end
2337
+ end
2338
+ end
2339
+
2340
+ node_cache[:occur][start_index] = r0
2341
+
2342
+ r0
2343
+ end
2344
+
2345
+ module Uint0
2346
+ def DIGIT1
2347
+ elements[0]
2348
+ end
2349
+
2350
+ end
2351
+
2352
+ module Uint1
2353
+ end
2354
+
2355
+ module Uint2
2356
+ end
2357
+
2358
+ def _nt_uint
2359
+ start_index = index
2360
+ if node_cache[:uint].has_key?(index)
2361
+ cached = node_cache[:uint][index]
2362
+ if cached
2363
+ node_cache[:uint][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2364
+ @index = cached.interval.end
2365
+ end
2366
+ return cached
2367
+ end
2368
+
2369
+ i0 = index
2370
+ i1, s1 = index, []
2371
+ r2 = _nt_DIGIT1
2372
+ s1 << r2
2373
+ if r2
2374
+ s3, i3 = [], index
2375
+ loop do
2376
+ r4 = _nt_DIGIT
2377
+ if r4
2378
+ s3 << r4
2379
+ else
2380
+ break
2381
+ end
2382
+ end
2383
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2384
+ s1 << r3
2385
+ end
2386
+ if s1.last
2387
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
2388
+ r1.extend(Uint0)
2389
+ else
2390
+ @index = i1
2391
+ r1 = nil
2392
+ end
2393
+ if r1
2394
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2395
+ r0 = r1
2396
+ else
2397
+ i5, s5 = index, []
2398
+ if (match_len = has_terminal?("0x", :insens, index))
2399
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2400
+ @index += match_len
2401
+ else
2402
+ terminal_parse_failure('"0x"')
2403
+ r6 = nil
2404
+ end
2405
+ s5 << r6
2406
+ if r6
2407
+ s7, i7 = [], index
2408
+ loop do
2409
+ r8 = _nt_HEXDIG
2410
+ if r8
2411
+ s7 << r8
2412
+ else
2413
+ break
2414
+ end
2415
+ end
2416
+ if s7.empty?
2417
+ @index = i7
2418
+ r7 = nil
2419
+ else
2420
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
2421
+ end
2422
+ s5 << r7
2423
+ end
2424
+ if s5.last
2425
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2426
+ r5.extend(Uint1)
2427
+ else
2428
+ @index = i5
2429
+ r5 = nil
2430
+ end
2431
+ if r5
2432
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
2433
+ r0 = r5
2434
+ else
2435
+ i9, s9 = index, []
2436
+ if (match_len = has_terminal?("0b", :insens, index))
2437
+ r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2438
+ @index += match_len
2439
+ else
2440
+ terminal_parse_failure('"0b"')
2441
+ r10 = nil
2442
+ end
2443
+ s9 << r10
2444
+ if r10
2445
+ s11, i11 = [], index
2446
+ loop do
2447
+ r12 = _nt_BINDIG
2448
+ if r12
2449
+ s11 << r12
2450
+ else
2451
+ break
2452
+ end
2453
+ end
2454
+ if s11.empty?
2455
+ @index = i11
2456
+ r11 = nil
2457
+ else
2458
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
2459
+ end
2460
+ s9 << r11
2461
+ end
2462
+ if s9.last
2463
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
2464
+ r9.extend(Uint2)
2465
+ else
2466
+ @index = i9
2467
+ r9 = nil
2468
+ end
2469
+ if r9
2470
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
2471
+ r0 = r9
2472
+ else
2473
+ if (match_len = has_terminal?("0", false, index))
2474
+ r13 = true
2475
+ @index += match_len
2476
+ else
2477
+ terminal_parse_failure('"0"')
2478
+ r13 = nil
2479
+ end
2480
+ if r13
2481
+ r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
2482
+ r0 = r13
2483
+ else
2484
+ @index = i0
2485
+ r0 = nil
2486
+ end
2487
+ end
2488
+ end
2489
+ end
2490
+
2491
+ node_cache[:uint][start_index] = r0
2492
+
2493
+ r0
2494
+ end
2495
+
2496
+ module Value0
2497
+ def ast() ["number", text_value] end
2498
+ end
2499
+
2500
+ def _nt_value
2501
+ start_index = index
2502
+ if node_cache[:value].has_key?(index)
2503
+ cached = node_cache[:value][index]
2504
+ if cached
2505
+ node_cache[:value][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2506
+ @index = cached.interval.end
2507
+ end
2508
+ return cached
2509
+ end
2510
+
2511
+ i0 = index
2512
+ r1 = _nt_number
2513
+ r1.extend(Value0)
2514
+ r1.extend(Value0)
2515
+ if r1
2516
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2517
+ r0 = r1
2518
+ else
2519
+ r2 = _nt_text
2520
+ if r2
2521
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2522
+ r0 = r2
2523
+ else
2524
+ r3 = _nt_bytes
2525
+ if r3
2526
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2527
+ r0 = r3
2528
+ else
2529
+ @index = i0
2530
+ r0 = nil
2531
+ end
2532
+ end
2533
+ end
2534
+
2535
+ node_cache[:value][start_index] = r0
2536
+
2537
+ r0
2538
+ end
2539
+
2540
+ module Int0
2541
+ def uint
2542
+ elements[1]
2543
+ end
2544
+ end
2545
+
2546
+ def _nt_int
2547
+ start_index = index
2548
+ if node_cache[:int].has_key?(index)
2549
+ cached = node_cache[:int][index]
2550
+ if cached
2551
+ node_cache[:int][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2552
+ @index = cached.interval.end
2553
+ end
2554
+ return cached
2555
+ end
2556
+
2557
+ i0, s0 = index, []
2558
+ if (match_len = has_terminal?("-", false, index))
2559
+ r2 = true
2560
+ @index += match_len
2561
+ else
2562
+ terminal_parse_failure('"-"')
2563
+ r2 = nil
2564
+ end
2565
+ if r2
2566
+ r1 = r2
2567
+ else
2568
+ r1 = instantiate_node(SyntaxNode,input, index...index)
2569
+ end
2570
+ s0 << r1
2571
+ if r1
2572
+ r3 = _nt_uint
2573
+ s0 << r3
2574
+ end
2575
+ if s0.last
2576
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2577
+ r0.extend(Int0)
2578
+ else
2579
+ @index = i0
2580
+ r0 = nil
2581
+ end
2582
+
2583
+ node_cache[:int][start_index] = r0
2584
+
2585
+ r0
2586
+ end
2587
+
2588
+ module Number0
2589
+ def fraction
2590
+ elements[1]
2591
+ end
2592
+ end
2593
+
2594
+ module Number1
2595
+ def exponent
2596
+ elements[1]
2597
+ end
2598
+ end
2599
+
2600
+ module Number2
2601
+ def int
2602
+ elements[0]
2603
+ end
2604
+
2605
+ end
2606
+
2607
+ def _nt_number
2608
+ start_index = index
2609
+ if node_cache[:number].has_key?(index)
2610
+ cached = node_cache[:number][index]
2611
+ if cached
2612
+ node_cache[:number][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2613
+ @index = cached.interval.end
2614
+ end
2615
+ return cached
2616
+ end
2617
+
2618
+ i0 = index
2619
+ r1 = _nt_hexfloat
2620
+ if r1
2621
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
2622
+ r0 = r1
2623
+ else
2624
+ i2, s2 = index, []
2625
+ r3 = _nt_int
2626
+ s2 << r3
2627
+ if r3
2628
+ i5, s5 = index, []
2629
+ if (match_len = has_terminal?(".", false, index))
2630
+ r6 = true
2631
+ @index += match_len
2632
+ else
2633
+ terminal_parse_failure('"."')
2634
+ r6 = nil
2635
+ end
2636
+ s5 << r6
2637
+ if r6
2638
+ r7 = _nt_fraction
2639
+ s5 << r7
2640
+ end
2641
+ if s5.last
2642
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2643
+ r5.extend(Number0)
2644
+ else
2645
+ @index = i5
2646
+ r5 = nil
2647
+ end
2648
+ if r5
2649
+ r4 = r5
2650
+ else
2651
+ r4 = instantiate_node(SyntaxNode,input, index...index)
2652
+ end
2653
+ s2 << r4
2654
+ if r4
2655
+ i9, s9 = index, []
2656
+ if (match_len = has_terminal?("e", :insens, index))
2657
+ r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2658
+ @index += match_len
2659
+ else
2660
+ terminal_parse_failure('"e"')
2661
+ r10 = nil
2662
+ end
2663
+ s9 << r10
2664
+ if r10
2665
+ r11 = _nt_exponent
2666
+ s9 << r11
2667
+ end
2668
+ if s9.last
2669
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
2670
+ r9.extend(Number1)
2671
+ else
2672
+ @index = i9
2673
+ r9 = nil
2674
+ end
2675
+ if r9
2676
+ r8 = r9
2677
+ else
2678
+ r8 = instantiate_node(SyntaxNode,input, index...index)
2679
+ end
2680
+ s2 << r8
2681
+ end
2682
+ end
2683
+ if s2.last
2684
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2685
+ r2.extend(Number2)
2686
+ else
2687
+ @index = i2
2688
+ r2 = nil
2689
+ end
2690
+ if r2
2691
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2692
+ r0 = r2
2693
+ else
2694
+ @index = i0
2695
+ r0 = nil
2696
+ end
2697
+ end
2698
+
2699
+ node_cache[:number][start_index] = r0
2700
+
2701
+ r0
2702
+ end
2703
+
2704
+ module Hexfloat0
2705
+ end
2706
+
2707
+ module Hexfloat1
2708
+ def exponent
2709
+ elements[5]
2710
+ end
2711
+ end
2712
+
2713
+ def _nt_hexfloat
2714
+ start_index = index
2715
+ if node_cache[:hexfloat].has_key?(index)
2716
+ cached = node_cache[:hexfloat][index]
2717
+ if cached
2718
+ node_cache[:hexfloat][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2719
+ @index = cached.interval.end
2720
+ end
2721
+ return cached
2722
+ end
2723
+
2724
+ i0, s0 = index, []
2725
+ if (match_len = has_terminal?("-", false, index))
2726
+ r2 = true
2727
+ @index += match_len
2728
+ else
2729
+ terminal_parse_failure('"-"')
2730
+ r2 = nil
2731
+ end
2732
+ if r2
2733
+ r1 = r2
2734
+ else
2735
+ r1 = instantiate_node(SyntaxNode,input, index...index)
2736
+ end
2737
+ s0 << r1
2738
+ if r1
2739
+ if (match_len = has_terminal?("0x", :insens, index))
2740
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2741
+ @index += match_len
2742
+ else
2743
+ terminal_parse_failure('"0x"')
2744
+ r3 = nil
2745
+ end
2746
+ s0 << r3
2747
+ if r3
2748
+ s4, i4 = [], index
2749
+ loop do
2750
+ r5 = _nt_HEXDIG
2751
+ if r5
2752
+ s4 << r5
2753
+ else
2754
+ break
2755
+ end
2756
+ end
2757
+ if s4.empty?
2758
+ @index = i4
2759
+ r4 = nil
2760
+ else
2761
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
2762
+ end
2763
+ s0 << r4
2764
+ if r4
2765
+ i7, s7 = index, []
2766
+ if (match_len = has_terminal?(".", false, index))
2767
+ r8 = true
2768
+ @index += match_len
2769
+ else
2770
+ terminal_parse_failure('"."')
2771
+ r8 = nil
2772
+ end
2773
+ s7 << r8
2774
+ if r8
2775
+ s9, i9 = [], index
2776
+ loop do
2777
+ r10 = _nt_HEXDIG
2778
+ if r10
2779
+ s9 << r10
2780
+ else
2781
+ break
2782
+ end
2783
+ end
2784
+ if s9.empty?
2785
+ @index = i9
2786
+ r9 = nil
2787
+ else
2788
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
2789
+ end
2790
+ s7 << r9
2791
+ end
2792
+ if s7.last
2793
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
2794
+ r7.extend(Hexfloat0)
2795
+ else
2796
+ @index = i7
2797
+ r7 = nil
2798
+ end
2799
+ if r7
2800
+ r6 = r7
2801
+ else
2802
+ r6 = instantiate_node(SyntaxNode,input, index...index)
2803
+ end
2804
+ s0 << r6
2805
+ if r6
2806
+ if (match_len = has_terminal?("p", :insens, index))
2807
+ r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
2808
+ @index += match_len
2809
+ else
2810
+ terminal_parse_failure('"p"')
2811
+ r11 = nil
2812
+ end
2813
+ s0 << r11
2814
+ if r11
2815
+ r12 = _nt_exponent
2816
+ s0 << r12
2817
+ end
2818
+ end
2819
+ end
2820
+ end
2821
+ end
2822
+ if s0.last
2823
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2824
+ r0.extend(Hexfloat1)
2825
+ else
2826
+ @index = i0
2827
+ r0 = nil
2828
+ end
2829
+
2830
+ node_cache[:hexfloat][start_index] = r0
2831
+
2832
+ r0
2833
+ end
2834
+
2835
+ def _nt_fraction
2836
+ start_index = index
2837
+ if node_cache[:fraction].has_key?(index)
2838
+ cached = node_cache[:fraction][index]
2839
+ if cached
2840
+ node_cache[:fraction][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2841
+ @index = cached.interval.end
2842
+ end
2843
+ return cached
2844
+ end
2845
+
2846
+ s0, i0 = [], index
2847
+ loop do
2848
+ r1 = _nt_DIGIT
2849
+ if r1
2850
+ s0 << r1
2851
+ else
2852
+ break
2853
+ end
2854
+ end
2855
+ if s0.empty?
2856
+ @index = i0
2857
+ r0 = nil
2858
+ else
2859
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2860
+ end
2861
+
2862
+ node_cache[:fraction][start_index] = r0
2863
+
2864
+ r0
2865
+ end
2866
+
2867
+ module Exponent0
2868
+ end
2869
+
2870
+ def _nt_exponent
2871
+ start_index = index
2872
+ if node_cache[:exponent].has_key?(index)
2873
+ cached = node_cache[:exponent][index]
2874
+ if cached
2875
+ node_cache[:exponent][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2876
+ @index = cached.interval.end
2877
+ end
2878
+ return cached
2879
+ end
2880
+
2881
+ i0, s0 = index, []
2882
+ i2 = index
2883
+ if (match_len = has_terminal?("+", false, index))
2884
+ r3 = true
2885
+ @index += match_len
2886
+ else
2887
+ terminal_parse_failure('"+"')
2888
+ r3 = nil
2889
+ end
2890
+ if r3
2891
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2892
+ r2 = r3
2893
+ else
2894
+ if (match_len = has_terminal?("-", false, index))
2895
+ r4 = true
2896
+ @index += match_len
2897
+ else
2898
+ terminal_parse_failure('"-"')
2899
+ r4 = nil
2900
+ end
2901
+ if r4
2902
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
2903
+ r2 = r4
2904
+ else
2905
+ @index = i2
2906
+ r2 = nil
2907
+ end
2908
+ end
2909
+ if r2
2910
+ r1 = r2
2911
+ else
2912
+ r1 = instantiate_node(SyntaxNode,input, index...index)
2913
+ end
2914
+ s0 << r1
2915
+ if r1
2916
+ s5, i5 = [], index
2917
+ loop do
2918
+ r6 = _nt_DIGIT
2919
+ if r6
2920
+ s5 << r6
2921
+ else
2922
+ break
2923
+ end
2924
+ end
2925
+ if s5.empty?
2926
+ @index = i5
2927
+ r5 = nil
2928
+ else
2929
+ r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
2930
+ end
2931
+ s0 << r5
2932
+ end
2933
+ if s0.last
2934
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2935
+ r0.extend(Exponent0)
2936
+ else
2937
+ @index = i0
2938
+ r0 = nil
2939
+ end
2940
+
2941
+ node_cache[:exponent][start_index] = r0
2942
+
2943
+ r0
2944
+ end
2945
+
2946
+ module Text0
2947
+ end
2948
+
2949
+ module Text1
2950
+ def ast() ["text", elements[1].elements.map(&:ast).join] end
2951
+ end
2952
+
2953
+ def _nt_text
2954
+ start_index = index
2955
+ if node_cache[:text].has_key?(index)
2956
+ cached = node_cache[:text][index]
2957
+ if cached
2958
+ node_cache[:text][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2959
+ @index = cached.interval.end
2960
+ end
2961
+ return cached
2962
+ end
2963
+
2964
+ i0, s0 = index, []
2965
+ if (match_len = has_terminal?("\"", false, index))
2966
+ r1 = true
2967
+ @index += match_len
2968
+ else
2969
+ terminal_parse_failure('"\\""')
2970
+ r1 = nil
2971
+ end
2972
+ s0 << r1
2973
+ if r1
2974
+ s2, i2 = [], index
2975
+ loop do
2976
+ r3 = _nt_SCHAR
2977
+ if r3
2978
+ s2 << r3
2979
+ else
2980
+ break
2981
+ end
2982
+ end
2983
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
2984
+ s0 << r2
2985
+ if r2
2986
+ if (match_len = has_terminal?("\"", false, index))
2987
+ r4 = true
2988
+ @index += match_len
2989
+ else
2990
+ terminal_parse_failure('"\\""')
2991
+ r4 = nil
2992
+ end
2993
+ s0 << r4
2994
+ end
2995
+ end
2996
+ if s0.last
2997
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2998
+ r0.extend(Text0)
2999
+ r0.extend(Text1)
3000
+ else
3001
+ @index = i0
3002
+ r0 = nil
3003
+ end
3004
+
3005
+ node_cache[:text][start_index] = r0
3006
+
3007
+ r0
3008
+ end
3009
+
3010
+ module SCHAR0
3011
+ def ast() text_value end
3012
+ end
3013
+
3014
+ module SCHAR1
3015
+ def ast() text_value end
3016
+ end
3017
+
3018
+ module SCHAR2
3019
+ def ast() text_value end
3020
+ end
3021
+
3022
+ module SCHAR3
3023
+ def ast() text_value end
3024
+ end
3025
+
3026
+ def _nt_SCHAR
3027
+ start_index = index
3028
+ if node_cache[:SCHAR].has_key?(index)
3029
+ cached = node_cache[:SCHAR][index]
3030
+ if cached
3031
+ node_cache[:SCHAR][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3032
+ @index = cached.interval.end
3033
+ end
3034
+ return cached
3035
+ end
3036
+
3037
+ i0 = index
3038
+ if has_terminal?(@regexps[gr = '\A[\\ -!]'] ||= Regexp.new(gr), :regexp, index)
3039
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
3040
+ r1.extend(SCHAR0)
3041
+ r1.extend(SCHAR0)
3042
+ @index += 1
3043
+ else
3044
+ terminal_parse_failure('[\\ -!]')
3045
+ r1 = nil
3046
+ end
3047
+ if r1
3048
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3049
+ r0 = r1
3050
+ else
3051
+ if has_terminal?(@regexps[gr = '\A[\\#-\\[]'] ||= Regexp.new(gr), :regexp, index)
3052
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
3053
+ r2.extend(SCHAR1)
3054
+ r2.extend(SCHAR1)
3055
+ @index += 1
3056
+ else
3057
+ terminal_parse_failure('[\\#-\\[]')
3058
+ r2 = nil
3059
+ end
3060
+ if r2
3061
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3062
+ r0 = r2
3063
+ else
3064
+ if has_terminal?(@regexps[gr = '\A[\\]-~]'] ||= Regexp.new(gr), :regexp, index)
3065
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
3066
+ r3.extend(SCHAR2)
3067
+ r3.extend(SCHAR2)
3068
+ @index += 1
3069
+ else
3070
+ terminal_parse_failure('[\\]-~]')
3071
+ r3 = nil
3072
+ end
3073
+ if r3
3074
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3075
+ r0 = r3
3076
+ else
3077
+ if has_terminal?(@regexps[gr = '\A[€-􏿽]'] ||= Regexp.new(gr), :regexp, index)
3078
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
3079
+ r4.extend(SCHAR3)
3080
+ r4.extend(SCHAR3)
3081
+ @index += 1
3082
+ else
3083
+ terminal_parse_failure('[€-􏿽]')
3084
+ r4 = nil
3085
+ end
3086
+ if r4
3087
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3088
+ r0 = r4
3089
+ else
3090
+ r5 = _nt_SESC
3091
+ if r5
3092
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3093
+ r0 = r5
3094
+ else
3095
+ @index = i0
3096
+ r0 = nil
3097
+ end
3098
+ end
3099
+ end
3100
+ end
3101
+ end
3102
+
3103
+ node_cache[:SCHAR][start_index] = r0
3104
+
3105
+ r0
3106
+ end
3107
+
3108
+ module SESC0
3109
+ end
3110
+
3111
+ module SESC1
3112
+ def ast() JSON.load("\"\\#{elements[1].text_value}\"") end
3113
+ end
3114
+
3115
+ def _nt_SESC
3116
+ start_index = index
3117
+ if node_cache[:SESC].has_key?(index)
3118
+ cached = node_cache[:SESC][index]
3119
+ if cached
3120
+ node_cache[:SESC][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3121
+ @index = cached.interval.end
3122
+ end
3123
+ return cached
3124
+ end
3125
+
3126
+ i0, s0 = index, []
3127
+ if (match_len = has_terminal?("\\", false, index))
3128
+ r1 = true
3129
+ @index += match_len
3130
+ else
3131
+ terminal_parse_failure('"\\\\"')
3132
+ r1 = nil
3133
+ end
3134
+ s0 << r1
3135
+ if r1
3136
+ i2 = index
3137
+ if has_terminal?(@regexps[gr = '\A[\\ -~]'] ||= Regexp.new(gr), :regexp, index)
3138
+ r3 = true
3139
+ @index += 1
3140
+ else
3141
+ terminal_parse_failure('[\\ -~]')
3142
+ r3 = nil
3143
+ end
3144
+ if r3
3145
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3146
+ r2 = r3
3147
+ else
3148
+ if has_terminal?(@regexps[gr = '\A[€-􏿽]'] ||= Regexp.new(gr), :regexp, index)
3149
+ r4 = true
3150
+ @index += 1
3151
+ else
3152
+ terminal_parse_failure('[€-􏿽]')
3153
+ r4 = nil
3154
+ end
3155
+ if r4
3156
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3157
+ r2 = r4
3158
+ else
3159
+ @index = i2
3160
+ r2 = nil
3161
+ end
3162
+ end
3163
+ s0 << r2
3164
+ end
3165
+ if s0.last
3166
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3167
+ r0.extend(SESC0)
3168
+ r0.extend(SESC1)
3169
+ else
3170
+ @index = i0
3171
+ r0 = nil
3172
+ end
3173
+
3174
+ node_cache[:SESC][start_index] = r0
3175
+
3176
+ r0
3177
+ end
3178
+
3179
+ module Bytes0
3180
+ end
3181
+
3182
+ module Bytes1
3183
+ def ast() ["bytes", text_value] end
3184
+ end
3185
+
3186
+ def _nt_bytes
3187
+ start_index = index
3188
+ if node_cache[:bytes].has_key?(index)
3189
+ cached = node_cache[:bytes][index]
3190
+ if cached
3191
+ node_cache[:bytes][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3192
+ @index = cached.interval.end
3193
+ end
3194
+ return cached
3195
+ end
3196
+
3197
+ i0, s0 = index, []
3198
+ r2 = _nt_bsqual
3199
+ if r2
3200
+ r1 = r2
3201
+ else
3202
+ r1 = instantiate_node(SyntaxNode,input, index...index)
3203
+ end
3204
+ s0 << r1
3205
+ if r1
3206
+ if (match_len = has_terminal?("'", false, index))
3207
+ r3 = true
3208
+ @index += match_len
3209
+ else
3210
+ terminal_parse_failure('"\'"')
3211
+ r3 = nil
3212
+ end
3213
+ s0 << r3
3214
+ if r3
3215
+ s4, i4 = [], index
3216
+ loop do
3217
+ r5 = _nt_BCHAR
3218
+ if r5
3219
+ s4 << r5
3220
+ else
3221
+ break
3222
+ end
3223
+ end
3224
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
3225
+ s0 << r4
3226
+ if r4
3227
+ if (match_len = has_terminal?("'", false, index))
3228
+ r6 = true
3229
+ @index += match_len
3230
+ else
3231
+ terminal_parse_failure('"\'"')
3232
+ r6 = nil
3233
+ end
3234
+ s0 << r6
3235
+ end
3236
+ end
3237
+ end
3238
+ if s0.last
3239
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3240
+ r0.extend(Bytes0)
3241
+ r0.extend(Bytes1)
3242
+ else
3243
+ @index = i0
3244
+ r0 = nil
3245
+ end
3246
+
3247
+ node_cache[:bytes][start_index] = r0
3248
+
3249
+ r0
3250
+ end
3251
+
3252
+ def _nt_BCHAR
3253
+ start_index = index
3254
+ if node_cache[:BCHAR].has_key?(index)
3255
+ cached = node_cache[:BCHAR][index]
3256
+ if cached
3257
+ node_cache[:BCHAR][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3258
+ @index = cached.interval.end
3259
+ end
3260
+ return cached
3261
+ end
3262
+
3263
+ i0 = index
3264
+ if has_terminal?(@regexps[gr = '\A[\\ -&]'] ||= Regexp.new(gr), :regexp, index)
3265
+ r1 = true
3266
+ @index += 1
3267
+ else
3268
+ terminal_parse_failure('[\\ -&]')
3269
+ r1 = nil
3270
+ end
3271
+ if r1
3272
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3273
+ r0 = r1
3274
+ else
3275
+ if has_terminal?(@regexps[gr = '\A[\\(-\\[]'] ||= Regexp.new(gr), :regexp, index)
3276
+ r2 = true
3277
+ @index += 1
3278
+ else
3279
+ terminal_parse_failure('[\\(-\\[]')
3280
+ r2 = nil
3281
+ end
3282
+ if r2
3283
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3284
+ r0 = r2
3285
+ else
3286
+ if has_terminal?(@regexps[gr = '\A[\\]-􏿽]'] ||= Regexp.new(gr), :regexp, index)
3287
+ r3 = true
3288
+ @index += 1
3289
+ else
3290
+ terminal_parse_failure('[\\]-􏿽]')
3291
+ r3 = nil
3292
+ end
3293
+ if r3
3294
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3295
+ r0 = r3
3296
+ else
3297
+ r4 = _nt_SESC
3298
+ if r4
3299
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3300
+ r0 = r4
3301
+ else
3302
+ r5 = _nt_CRLF
3303
+ if r5
3304
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3305
+ r0 = r5
3306
+ else
3307
+ @index = i0
3308
+ r0 = nil
3309
+ end
3310
+ end
3311
+ end
3312
+ end
3313
+ end
3314
+
3315
+ node_cache[:BCHAR][start_index] = r0
3316
+
3317
+ r0
3318
+ end
3319
+
3320
+ def _nt_bsqual
3321
+ start_index = index
3322
+ if node_cache[:bsqual].has_key?(index)
3323
+ cached = node_cache[:bsqual][index]
3324
+ if cached
3325
+ node_cache[:bsqual][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3326
+ @index = cached.interval.end
3327
+ end
3328
+ return cached
3329
+ end
3330
+
3331
+ i0 = index
3332
+ if (match_len = has_terminal?("h", :insens, index))
3333
+ r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3334
+ @index += match_len
3335
+ else
3336
+ terminal_parse_failure('"h"')
3337
+ r1 = nil
3338
+ end
3339
+ if r1
3340
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3341
+ r0 = r1
3342
+ else
3343
+ if (match_len = has_terminal?("b64", :insens, index))
3344
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3345
+ @index += match_len
3346
+ else
3347
+ terminal_parse_failure('"b64"')
3348
+ r2 = nil
3349
+ end
3350
+ if r2
3351
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3352
+ r0 = r2
3353
+ else
3354
+ @index = i0
3355
+ r0 = nil
3356
+ end
3357
+ end
3358
+
3359
+ node_cache[:bsqual][start_index] = r0
3360
+
3361
+ r0
3362
+ end
3363
+
3364
+ module Id0
3365
+ end
3366
+
3367
+ module Id1
3368
+ def EALPHA
3369
+ elements[0]
3370
+ end
3371
+
3372
+ end
3373
+
3374
+ def _nt_id
3375
+ start_index = index
3376
+ if node_cache[:id].has_key?(index)
3377
+ cached = node_cache[:id][index]
3378
+ if cached
3379
+ node_cache[:id][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3380
+ @index = cached.interval.end
3381
+ end
3382
+ return cached
3383
+ end
3384
+
3385
+ i0, s0 = index, []
3386
+ r1 = _nt_EALPHA
3387
+ s0 << r1
3388
+ if r1
3389
+ s2, i2 = [], index
3390
+ loop do
3391
+ i3, s3 = index, []
3392
+ s4, i4 = [], index
3393
+ loop do
3394
+ i5 = index
3395
+ if (match_len = has_terminal?("-", false, index))
3396
+ r6 = true
3397
+ @index += match_len
3398
+ else
3399
+ terminal_parse_failure('"-"')
3400
+ r6 = nil
3401
+ end
3402
+ if r6
3403
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
3404
+ r5 = r6
3405
+ else
3406
+ if (match_len = has_terminal?(".", false, index))
3407
+ r7 = true
3408
+ @index += match_len
3409
+ else
3410
+ terminal_parse_failure('"."')
3411
+ r7 = nil
3412
+ end
3413
+ if r7
3414
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
3415
+ r5 = r7
3416
+ else
3417
+ @index = i5
3418
+ r5 = nil
3419
+ end
3420
+ end
3421
+ if r5
3422
+ s4 << r5
3423
+ else
3424
+ break
3425
+ end
3426
+ end
3427
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
3428
+ s3 << r4
3429
+ if r4
3430
+ i8 = index
3431
+ r9 = _nt_EALPHA
3432
+ if r9
3433
+ r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
3434
+ r8 = r9
3435
+ else
3436
+ r10 = _nt_DIGIT
3437
+ if r10
3438
+ r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
3439
+ r8 = r10
3440
+ else
3441
+ @index = i8
3442
+ r8 = nil
3443
+ end
3444
+ end
3445
+ s3 << r8
3446
+ end
3447
+ if s3.last
3448
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
3449
+ r3.extend(Id0)
3450
+ else
3451
+ @index = i3
3452
+ r3 = nil
3453
+ end
3454
+ if r3
3455
+ s2 << r3
3456
+ else
3457
+ break
3458
+ end
3459
+ end
3460
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3461
+ s0 << r2
3462
+ end
3463
+ if s0.last
3464
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3465
+ r0.extend(Id1)
3466
+ else
3467
+ @index = i0
3468
+ r0 = nil
3469
+ end
3470
+
3471
+ node_cache[:id][start_index] = r0
3472
+
3473
+ r0
3474
+ end
3475
+
3476
+ def _nt_ALPHA
3477
+ start_index = index
3478
+ if node_cache[:ALPHA].has_key?(index)
3479
+ cached = node_cache[:ALPHA][index]
3480
+ if cached
3481
+ node_cache[:ALPHA][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3482
+ @index = cached.interval.end
3483
+ end
3484
+ return cached
3485
+ end
3486
+
3487
+ i0 = index
3488
+ if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
3489
+ r1 = true
3490
+ @index += 1
3491
+ else
3492
+ terminal_parse_failure('[A-Z]')
3493
+ r1 = nil
3494
+ end
3495
+ if r1
3496
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3497
+ r0 = r1
3498
+ else
3499
+ if has_terminal?(@regexps[gr = '\A[a-z]'] ||= Regexp.new(gr), :regexp, index)
3500
+ r2 = true
3501
+ @index += 1
3502
+ else
3503
+ terminal_parse_failure('[a-z]')
3504
+ r2 = nil
3505
+ end
3506
+ if r2
3507
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3508
+ r0 = r2
3509
+ else
3510
+ @index = i0
3511
+ r0 = nil
3512
+ end
3513
+ end
3514
+
3515
+ node_cache[:ALPHA][start_index] = r0
3516
+
3517
+ r0
3518
+ end
3519
+
3520
+ def _nt_EALPHA
3521
+ start_index = index
3522
+ if node_cache[:EALPHA].has_key?(index)
3523
+ cached = node_cache[:EALPHA][index]
3524
+ if cached
3525
+ node_cache[:EALPHA][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3526
+ @index = cached.interval.end
3527
+ end
3528
+ return cached
3529
+ end
3530
+
3531
+ i0 = index
3532
+ r1 = _nt_ALPHA
3533
+ if r1
3534
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3535
+ r0 = r1
3536
+ else
3537
+ if (match_len = has_terminal?("@", false, index))
3538
+ r2 = true
3539
+ @index += match_len
3540
+ else
3541
+ terminal_parse_failure('"@"')
3542
+ r2 = nil
3543
+ end
3544
+ if r2
3545
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3546
+ r0 = r2
3547
+ else
3548
+ if (match_len = has_terminal?("_", false, index))
3549
+ r3 = true
3550
+ @index += match_len
3551
+ else
3552
+ terminal_parse_failure('"_"')
3553
+ r3 = nil
3554
+ end
3555
+ if r3
3556
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3557
+ r0 = r3
3558
+ else
3559
+ if (match_len = has_terminal?("$", false, index))
3560
+ r4 = true
3561
+ @index += match_len
3562
+ else
3563
+ terminal_parse_failure('"$"')
3564
+ r4 = nil
3565
+ end
3566
+ if r4
3567
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3568
+ r0 = r4
3569
+ else
3570
+ @index = i0
3571
+ r0 = nil
3572
+ end
3573
+ end
3574
+ end
3575
+ end
3576
+
3577
+ node_cache[:EALPHA][start_index] = r0
3578
+
3579
+ r0
3580
+ end
3581
+
3582
+ def _nt_DIGIT
3583
+ start_index = index
3584
+ if node_cache[:DIGIT].has_key?(index)
3585
+ cached = node_cache[:DIGIT][index]
3586
+ if cached
3587
+ node_cache[:DIGIT][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3588
+ @index = cached.interval.end
3589
+ end
3590
+ return cached
3591
+ end
3592
+
3593
+ if has_terminal?(@regexps[gr = '\A[0-9]'] ||= Regexp.new(gr), :regexp, index)
3594
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
3595
+ @index += 1
3596
+ else
3597
+ terminal_parse_failure('[0-9]')
3598
+ r0 = nil
3599
+ end
3600
+
3601
+ node_cache[:DIGIT][start_index] = r0
3602
+
3603
+ r0
3604
+ end
3605
+
3606
+ def _nt_DIGIT1
3607
+ start_index = index
3608
+ if node_cache[:DIGIT1].has_key?(index)
3609
+ cached = node_cache[:DIGIT1][index]
3610
+ if cached
3611
+ node_cache[:DIGIT1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3612
+ @index = cached.interval.end
3613
+ end
3614
+ return cached
3615
+ end
3616
+
3617
+ if has_terminal?(@regexps[gr = '\A[1-9]'] ||= Regexp.new(gr), :regexp, index)
3618
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
3619
+ @index += 1
3620
+ else
3621
+ terminal_parse_failure('[1-9]')
3622
+ r0 = nil
3623
+ end
3624
+
3625
+ node_cache[:DIGIT1][start_index] = r0
3626
+
3627
+ r0
3628
+ end
3629
+
3630
+ def _nt_HEXDIG
3631
+ start_index = index
3632
+ if node_cache[:HEXDIG].has_key?(index)
3633
+ cached = node_cache[:HEXDIG][index]
3634
+ if cached
3635
+ node_cache[:HEXDIG][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3636
+ @index = cached.interval.end
3637
+ end
3638
+ return cached
3639
+ end
3640
+
3641
+ i0 = index
3642
+ r1 = _nt_DIGIT
3643
+ if r1
3644
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3645
+ r0 = r1
3646
+ else
3647
+ if (match_len = has_terminal?("a", :insens, index))
3648
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3649
+ @index += match_len
3650
+ else
3651
+ terminal_parse_failure('"A"')
3652
+ r2 = nil
3653
+ end
3654
+ if r2
3655
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3656
+ r0 = r2
3657
+ else
3658
+ if (match_len = has_terminal?("b", :insens, index))
3659
+ r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3660
+ @index += match_len
3661
+ else
3662
+ terminal_parse_failure('"B"')
3663
+ r3 = nil
3664
+ end
3665
+ if r3
3666
+ r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
3667
+ r0 = r3
3668
+ else
3669
+ if (match_len = has_terminal?("c", :insens, index))
3670
+ r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3671
+ @index += match_len
3672
+ else
3673
+ terminal_parse_failure('"C"')
3674
+ r4 = nil
3675
+ end
3676
+ if r4
3677
+ r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
3678
+ r0 = r4
3679
+ else
3680
+ if (match_len = has_terminal?("d", :insens, index))
3681
+ r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3682
+ @index += match_len
3683
+ else
3684
+ terminal_parse_failure('"D"')
3685
+ r5 = nil
3686
+ end
3687
+ if r5
3688
+ r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
3689
+ r0 = r5
3690
+ else
3691
+ if (match_len = has_terminal?("e", :insens, index))
3692
+ r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3693
+ @index += match_len
3694
+ else
3695
+ terminal_parse_failure('"E"')
3696
+ r6 = nil
3697
+ end
3698
+ if r6
3699
+ r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
3700
+ r0 = r6
3701
+ else
3702
+ if (match_len = has_terminal?("f", :insens, index))
3703
+ r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3704
+ @index += match_len
3705
+ else
3706
+ terminal_parse_failure('"F"')
3707
+ r7 = nil
3708
+ end
3709
+ if r7
3710
+ r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
3711
+ r0 = r7
3712
+ else
3713
+ @index = i0
3714
+ r0 = nil
3715
+ end
3716
+ end
3717
+ end
3718
+ end
3719
+ end
3720
+ end
3721
+ end
3722
+
3723
+ node_cache[:HEXDIG][start_index] = r0
3724
+
3725
+ r0
3726
+ end
3727
+
3728
+ def _nt_BINDIG
3729
+ start_index = index
3730
+ if node_cache[:BINDIG].has_key?(index)
3731
+ cached = node_cache[:BINDIG][index]
3732
+ if cached
3733
+ node_cache[:BINDIG][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3734
+ @index = cached.interval.end
3735
+ end
3736
+ return cached
3737
+ end
3738
+
3739
+ if has_terminal?(@regexps[gr = '\A[0-1]'] ||= Regexp.new(gr), :regexp, index)
3740
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
3741
+ @index += 1
3742
+ else
3743
+ terminal_parse_failure('[0-1]')
3744
+ r0 = nil
3745
+ end
3746
+
3747
+ node_cache[:BINDIG][start_index] = r0
3748
+
3749
+ r0
3750
+ end
3751
+
3752
+ def _nt_S
3753
+ start_index = index
3754
+ if node_cache[:S].has_key?(index)
3755
+ cached = node_cache[:S][index]
3756
+ if cached
3757
+ node_cache[:S][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3758
+ @index = cached.interval.end
3759
+ end
3760
+ return cached
3761
+ end
3762
+
3763
+ s0, i0 = [], index
3764
+ loop do
3765
+ r1 = _nt_WS
3766
+ if r1
3767
+ s0 << r1
3768
+ else
3769
+ break
3770
+ end
3771
+ end
3772
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3773
+
3774
+ node_cache[:S][start_index] = r0
3775
+
3776
+ r0
3777
+ end
3778
+
3779
+ def _nt_WS
3780
+ start_index = index
3781
+ if node_cache[:WS].has_key?(index)
3782
+ cached = node_cache[:WS][index]
3783
+ if cached
3784
+ node_cache[:WS][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3785
+ @index = cached.interval.end
3786
+ end
3787
+ return cached
3788
+ end
3789
+
3790
+ i0 = index
3791
+ r1 = _nt_SP
3792
+ if r1
3793
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3794
+ r0 = r1
3795
+ else
3796
+ r2 = _nt_NL
3797
+ if r2
3798
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3799
+ r0 = r2
3800
+ else
3801
+ @index = i0
3802
+ r0 = nil
3803
+ end
3804
+ end
3805
+
3806
+ node_cache[:WS][start_index] = r0
3807
+
3808
+ r0
3809
+ end
3810
+
3811
+ def _nt_SP
3812
+ start_index = index
3813
+ if node_cache[:SP].has_key?(index)
3814
+ cached = node_cache[:SP][index]
3815
+ if cached
3816
+ node_cache[:SP][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3817
+ @index = cached.interval.end
3818
+ end
3819
+ return cached
3820
+ end
3821
+
3822
+ if (match_len = has_terminal?(" ", false, index))
3823
+ r0 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3824
+ @index += match_len
3825
+ else
3826
+ terminal_parse_failure('" "')
3827
+ r0 = nil
3828
+ end
3829
+
3830
+ node_cache[:SP][start_index] = r0
3831
+
3832
+ r0
3833
+ end
3834
+
3835
+ def _nt_NL
3836
+ start_index = index
3837
+ if node_cache[:NL].has_key?(index)
3838
+ cached = node_cache[:NL][index]
3839
+ if cached
3840
+ node_cache[:NL][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3841
+ @index = cached.interval.end
3842
+ end
3843
+ return cached
3844
+ end
3845
+
3846
+ i0 = index
3847
+ r1 = _nt_COMMENT
3848
+ if r1
3849
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3850
+ r0 = r1
3851
+ else
3852
+ r2 = _nt_CRLF
3853
+ if r2
3854
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3855
+ r0 = r2
3856
+ else
3857
+ @index = i0
3858
+ r0 = nil
3859
+ end
3860
+ end
3861
+
3862
+ node_cache[:NL][start_index] = r0
3863
+
3864
+ r0
3865
+ end
3866
+
3867
+ module COMMENT0
3868
+ def CRLF
3869
+ elements[2]
3870
+ end
3871
+ end
3872
+
3873
+ def _nt_COMMENT
3874
+ start_index = index
3875
+ if node_cache[:COMMENT].has_key?(index)
3876
+ cached = node_cache[:COMMENT][index]
3877
+ if cached
3878
+ node_cache[:COMMENT][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3879
+ @index = cached.interval.end
3880
+ end
3881
+ return cached
3882
+ end
3883
+
3884
+ i0, s0 = index, []
3885
+ if (match_len = has_terminal?(";", false, index))
3886
+ r1 = true
3887
+ @index += match_len
3888
+ else
3889
+ terminal_parse_failure('";"')
3890
+ r1 = nil
3891
+ end
3892
+ s0 << r1
3893
+ if r1
3894
+ s2, i2 = [], index
3895
+ loop do
3896
+ r3 = _nt_PCHAR
3897
+ if r3
3898
+ s2 << r3
3899
+ else
3900
+ break
3901
+ end
3902
+ end
3903
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
3904
+ s0 << r2
3905
+ if r2
3906
+ r4 = _nt_CRLF
3907
+ s0 << r4
3908
+ end
3909
+ end
3910
+ if s0.last
3911
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
3912
+ r0.extend(COMMENT0)
3913
+ else
3914
+ @index = i0
3915
+ r0 = nil
3916
+ end
3917
+
3918
+ node_cache[:COMMENT][start_index] = r0
3919
+
3920
+ r0
3921
+ end
3922
+
3923
+ def _nt_PCHAR
3924
+ start_index = index
3925
+ if node_cache[:PCHAR].has_key?(index)
3926
+ cached = node_cache[:PCHAR][index]
3927
+ if cached
3928
+ node_cache[:PCHAR][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3929
+ @index = cached.interval.end
3930
+ end
3931
+ return cached
3932
+ end
3933
+
3934
+ i0 = index
3935
+ if has_terminal?(@regexps[gr = '\A[\\ -~]'] ||= Regexp.new(gr), :regexp, index)
3936
+ r1 = true
3937
+ @index += 1
3938
+ else
3939
+ terminal_parse_failure('[\\ -~]')
3940
+ r1 = nil
3941
+ end
3942
+ if r1
3943
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3944
+ r0 = r1
3945
+ else
3946
+ if has_terminal?(@regexps[gr = '\A[€-􏿽]'] ||= Regexp.new(gr), :regexp, index)
3947
+ r2 = true
3948
+ @index += 1
3949
+ else
3950
+ terminal_parse_failure('[€-􏿽]')
3951
+ r2 = nil
3952
+ end
3953
+ if r2
3954
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3955
+ r0 = r2
3956
+ else
3957
+ @index = i0
3958
+ r0 = nil
3959
+ end
3960
+ end
3961
+
3962
+ node_cache[:PCHAR][start_index] = r0
3963
+
3964
+ r0
3965
+ end
3966
+
3967
+ def _nt_CRLF
3968
+ start_index = index
3969
+ if node_cache[:CRLF].has_key?(index)
3970
+ cached = node_cache[:CRLF][index]
3971
+ if cached
3972
+ node_cache[:CRLF][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
3973
+ @index = cached.interval.end
3974
+ end
3975
+ return cached
3976
+ end
3977
+
3978
+ i0 = index
3979
+ if (match_len = has_terminal?("\n", false, index))
3980
+ r1 = true
3981
+ @index += match_len
3982
+ else
3983
+ terminal_parse_failure('"\\n"')
3984
+ r1 = nil
3985
+ end
3986
+ if r1
3987
+ r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
3988
+ r0 = r1
3989
+ else
3990
+ if (match_len = has_terminal?("\r\n", false, index))
3991
+ r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
3992
+ @index += match_len
3993
+ else
3994
+ terminal_parse_failure('"\\r\\n"')
3995
+ r2 = nil
3996
+ end
3997
+ if r2
3998
+ r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
3999
+ r0 = r2
4000
+ else
4001
+ @index = i0
4002
+ r0 = nil
4003
+ end
4004
+ end
4005
+
4006
+ node_cache[:CRLF][start_index] = r0
4007
+
4008
+ r0
4009
+ end
4010
+
4011
+ end
4012
+
4013
+ class CDDLParser < Treetop::Runtime::CompiledParser
4014
+ include CDDL
4015
+ end
4016
+