edn-abnf 0.5.32 → 0.6.1pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/edn-abnf +6 -7
- data/edn-abnf.gemspec +1 -1
- data/lib/cbor-diagnostic-app/hgrammar.rb +75 -434
- data/lib/parser/edngrammar.rb +3364 -5435
- metadata +2 -3
- data/lib/cbor-diagnostic-app/zzz.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35b0986f4a0d059f1223e057a2cd2ea5c6852e2a682ad5fa1a3c1e135b2446c7
|
|
4
|
+
data.tar.gz: 98f4bdb66e78f3b3c85edd88bcd18dbb3a832dd9153d178a79f89baf911ac109
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e7ce39d92102381078c9d3da002dd2362808fd9c7faaca0676fbdc532d430ffeb85c6c6f770b34466571814529c66aaa172b26a179e26d8b081bea9cb08b5af
|
|
7
|
+
data.tar.gz: 62c3946d702aec9897e4149021e3798459abbe93927e87942faec2df9373190b4d86877e9dfd01ff5f8b40c3635fafd0203f18e2f4244dc22b8d713bc4c5361b
|
data/bin/edn-abnf
CHANGED
|
@@ -115,12 +115,11 @@ if $options.lines
|
|
|
115
115
|
exit 1
|
|
116
116
|
end
|
|
117
117
|
CSV.parse(edn_file) do |ok, ednin, out|
|
|
118
|
-
if
|
|
118
|
+
if ok[0] == "#"
|
|
119
119
|
puts "# #{ok}, #{ednin.inspect}, #{out}" if $options.verbose
|
|
120
120
|
next
|
|
121
121
|
end
|
|
122
122
|
if ok[0] == "x"
|
|
123
|
-
warn "#{[ok, ednin, out].inspect}" unless ednin
|
|
124
123
|
result = tree_from_edn_possibly_hex(ednin)
|
|
125
124
|
result_hex = result.to_cbor.hexi
|
|
126
125
|
result_diag = result.cbor_diagnostic
|
|
@@ -137,8 +136,8 @@ if $options.lines
|
|
|
137
136
|
end
|
|
138
137
|
begin
|
|
139
138
|
ok = ok == "="
|
|
140
|
-
puts "➔ #{ok
|
|
141
|
-
result = tree_from_edn_possibly_hex(ednin
|
|
139
|
+
puts "➔ #{ok}, #{ednin}, #{out}" if $options.verbose
|
|
140
|
+
result = tree_from_edn_possibly_hex(ednin)
|
|
142
141
|
diag = result.cbor_diagnostic
|
|
143
142
|
if out == diag && !ok
|
|
144
143
|
puts "** ≠ / #{diag.inspect} / #{out.inspect}"
|
|
@@ -152,7 +151,7 @@ if $options.lines
|
|
|
152
151
|
end
|
|
153
152
|
puts "reparsed / #{diag.inspect} / #{out.inspect}" if $options.verbose
|
|
154
153
|
end
|
|
155
|
-
rescue
|
|
154
|
+
rescue ArgumentError => e
|
|
156
155
|
if ok
|
|
157
156
|
puts "** #{e} / #{result.inspect} / #{out.inspect}"
|
|
158
157
|
$error += 1
|
|
@@ -181,10 +180,10 @@ begin
|
|
|
181
180
|
result = edn.tree # XXX .tree?
|
|
182
181
|
end
|
|
183
182
|
rescue CBOR_DIAG::AppParseError, ArgumentError => e
|
|
184
|
-
|
|
183
|
+
puts "** #{e}"
|
|
185
184
|
exit 1
|
|
186
185
|
rescue CBOR::OutOfBytesError, RuntimeError, JSON::GeneratorError => e
|
|
187
|
-
|
|
186
|
+
puts "** (encoded CBOR input:) #{e}"
|
|
188
187
|
exit 1
|
|
189
188
|
end
|
|
190
189
|
|
data/edn-abnf.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "edn-abnf"
|
|
3
|
-
s.version = "0.
|
|
3
|
+
s.version = "0.6.1pre"
|
|
4
4
|
s.summary = "CBOR Extended Diagnostic Notation (EDN) implemented in ABNF"
|
|
5
5
|
s.description = %q{edn-abnf implements converters and miscellaneous tools for CBOR EDN's ABNF}
|
|
6
6
|
s.author = "Carsten Bormann"
|
|
@@ -48,10 +48,6 @@ module HGRAMMAR
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
module AppStringH4
|
|
51
|
-
def eol_comment
|
|
52
|
-
elements[0]
|
|
53
|
-
end
|
|
54
|
-
|
|
55
51
|
end
|
|
56
52
|
|
|
57
53
|
module AppStringH5
|
|
@@ -170,7 +166,13 @@ module HGRAMMAR
|
|
|
170
166
|
s0 << r2
|
|
171
167
|
if r2
|
|
172
168
|
i13, s13 = index, []
|
|
173
|
-
|
|
169
|
+
if (match_len = has_terminal?("#", false, index))
|
|
170
|
+
r14 = true
|
|
171
|
+
@index += match_len
|
|
172
|
+
else
|
|
173
|
+
terminal_parse_failure('"#"')
|
|
174
|
+
r14 = nil
|
|
175
|
+
end
|
|
174
176
|
s13 << r14
|
|
175
177
|
if r14
|
|
176
178
|
s15, i15 = [], index
|
|
@@ -448,50 +450,6 @@ module HGRAMMAR
|
|
|
448
450
|
r0
|
|
449
451
|
end
|
|
450
452
|
|
|
451
|
-
def _nt_NONASCII
|
|
452
|
-
start_index = index
|
|
453
|
-
if node_cache[:NONASCII].has_key?(index)
|
|
454
|
-
cached = node_cache[:NONASCII][index]
|
|
455
|
-
if cached
|
|
456
|
-
node_cache[:NONASCII][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
457
|
-
@index = cached.interval.end
|
|
458
|
-
end
|
|
459
|
-
return cached
|
|
460
|
-
end
|
|
461
|
-
|
|
462
|
-
i0 = index
|
|
463
|
-
if has_terminal?(@regexps[gr = '\A[-]'] ||= Regexp.new(gr), :regexp, index)
|
|
464
|
-
r1 = true
|
|
465
|
-
@index += 1
|
|
466
|
-
else
|
|
467
|
-
terminal_parse_failure('[-]')
|
|
468
|
-
r1 = nil
|
|
469
|
-
end
|
|
470
|
-
if r1
|
|
471
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
472
|
-
r0 = r1
|
|
473
|
-
else
|
|
474
|
-
if has_terminal?(@regexps[gr = '\A[-]'] ||= Regexp.new(gr), :regexp, index)
|
|
475
|
-
r2 = true
|
|
476
|
-
@index += 1
|
|
477
|
-
else
|
|
478
|
-
terminal_parse_failure('[-]')
|
|
479
|
-
r2 = nil
|
|
480
|
-
end
|
|
481
|
-
if r2
|
|
482
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
483
|
-
r0 = r2
|
|
484
|
-
else
|
|
485
|
-
@index = i0
|
|
486
|
-
r0 = nil
|
|
487
|
-
end
|
|
488
|
-
end
|
|
489
|
-
|
|
490
|
-
node_cache[:NONASCII][start_index] = r0
|
|
491
|
-
|
|
492
|
-
r0
|
|
493
|
-
end
|
|
494
|
-
|
|
495
453
|
def _nt_non_slash
|
|
496
454
|
start_index = index
|
|
497
455
|
if node_cache[:non_slash].has_key?(index)
|
|
@@ -520,25 +478,19 @@ module HGRAMMAR
|
|
|
520
478
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
521
479
|
r0 = r2
|
|
522
480
|
else
|
|
523
|
-
if has_terminal?(@regexps[gr = '\A[0
|
|
481
|
+
if has_terminal?(@regexps[gr = '\A[0-]'] ||= Regexp.new(gr), :regexp, index)
|
|
524
482
|
r3 = true
|
|
525
483
|
@index += 1
|
|
526
484
|
else
|
|
527
|
-
terminal_parse_failure('[0
|
|
485
|
+
terminal_parse_failure('[0-]')
|
|
528
486
|
r3 = nil
|
|
529
487
|
end
|
|
530
488
|
if r3
|
|
531
489
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
532
490
|
r0 = r3
|
|
533
491
|
else
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
537
|
-
r0 = r4
|
|
538
|
-
else
|
|
539
|
-
@index = i0
|
|
540
|
-
r0 = nil
|
|
541
|
-
end
|
|
492
|
+
@index = i0
|
|
493
|
+
r0 = nil
|
|
542
494
|
end
|
|
543
495
|
end
|
|
544
496
|
end
|
|
@@ -548,193 +500,6 @@ module HGRAMMAR
|
|
|
548
500
|
r0
|
|
549
501
|
end
|
|
550
502
|
|
|
551
|
-
def _nt_non_slash_star
|
|
552
|
-
start_index = index
|
|
553
|
-
if node_cache[:non_slash_star].has_key?(index)
|
|
554
|
-
cached = node_cache[:non_slash_star][index]
|
|
555
|
-
if cached
|
|
556
|
-
node_cache[:non_slash_star][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
557
|
-
@index = cached.interval.end
|
|
558
|
-
end
|
|
559
|
-
return cached
|
|
560
|
-
end
|
|
561
|
-
|
|
562
|
-
i0 = index
|
|
563
|
-
r1 = _nt_blank
|
|
564
|
-
if r1
|
|
565
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
566
|
-
r0 = r1
|
|
567
|
-
else
|
|
568
|
-
if has_terminal?(@regexps[gr = '\A[!-\\)]'] ||= Regexp.new(gr), :regexp, index)
|
|
569
|
-
r2 = true
|
|
570
|
-
@index += 1
|
|
571
|
-
else
|
|
572
|
-
terminal_parse_failure('[!-\\)]')
|
|
573
|
-
r2 = nil
|
|
574
|
-
end
|
|
575
|
-
if r2
|
|
576
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
577
|
-
r0 = r2
|
|
578
|
-
else
|
|
579
|
-
if has_terminal?(@regexps[gr = '\A[\\+-\\.]'] ||= Regexp.new(gr), :regexp, index)
|
|
580
|
-
r3 = true
|
|
581
|
-
@index += 1
|
|
582
|
-
else
|
|
583
|
-
terminal_parse_failure('[\\+-\\.]')
|
|
584
|
-
r3 = nil
|
|
585
|
-
end
|
|
586
|
-
if r3
|
|
587
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
588
|
-
r0 = r3
|
|
589
|
-
else
|
|
590
|
-
if has_terminal?(@regexps[gr = '\A[0-]'] ||= Regexp.new(gr), :regexp, index)
|
|
591
|
-
r4 = true
|
|
592
|
-
@index += 1
|
|
593
|
-
else
|
|
594
|
-
terminal_parse_failure('[0-]')
|
|
595
|
-
r4 = nil
|
|
596
|
-
end
|
|
597
|
-
if r4
|
|
598
|
-
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
599
|
-
r0 = r4
|
|
600
|
-
else
|
|
601
|
-
r5 = _nt_NONASCII
|
|
602
|
-
if r5
|
|
603
|
-
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
|
604
|
-
r0 = r5
|
|
605
|
-
else
|
|
606
|
-
@index = i0
|
|
607
|
-
r0 = nil
|
|
608
|
-
end
|
|
609
|
-
end
|
|
610
|
-
end
|
|
611
|
-
end
|
|
612
|
-
end
|
|
613
|
-
|
|
614
|
-
node_cache[:non_slash_star][start_index] = r0
|
|
615
|
-
|
|
616
|
-
r0
|
|
617
|
-
end
|
|
618
|
-
|
|
619
|
-
def _nt_non_star
|
|
620
|
-
start_index = index
|
|
621
|
-
if node_cache[:non_star].has_key?(index)
|
|
622
|
-
cached = node_cache[:non_star][index]
|
|
623
|
-
if cached
|
|
624
|
-
node_cache[:non_star][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
625
|
-
@index = cached.interval.end
|
|
626
|
-
end
|
|
627
|
-
return cached
|
|
628
|
-
end
|
|
629
|
-
|
|
630
|
-
i0 = index
|
|
631
|
-
r1 = _nt_blank
|
|
632
|
-
if r1
|
|
633
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
634
|
-
r0 = r1
|
|
635
|
-
else
|
|
636
|
-
if has_terminal?(@regexps[gr = '\A[!-\\)]'] ||= Regexp.new(gr), :regexp, index)
|
|
637
|
-
r2 = true
|
|
638
|
-
@index += 1
|
|
639
|
-
else
|
|
640
|
-
terminal_parse_failure('[!-\\)]')
|
|
641
|
-
r2 = nil
|
|
642
|
-
end
|
|
643
|
-
if r2
|
|
644
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
645
|
-
r0 = r2
|
|
646
|
-
else
|
|
647
|
-
if has_terminal?(@regexps[gr = '\A[\\+-]'] ||= Regexp.new(gr), :regexp, index)
|
|
648
|
-
r3 = true
|
|
649
|
-
@index += 1
|
|
650
|
-
else
|
|
651
|
-
terminal_parse_failure('[\\+-]')
|
|
652
|
-
r3 = nil
|
|
653
|
-
end
|
|
654
|
-
if r3
|
|
655
|
-
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
656
|
-
r0 = r3
|
|
657
|
-
else
|
|
658
|
-
r4 = _nt_NONASCII
|
|
659
|
-
if r4
|
|
660
|
-
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
661
|
-
r0 = r4
|
|
662
|
-
else
|
|
663
|
-
@index = i0
|
|
664
|
-
r0 = nil
|
|
665
|
-
end
|
|
666
|
-
end
|
|
667
|
-
end
|
|
668
|
-
end
|
|
669
|
-
|
|
670
|
-
node_cache[:non_star][start_index] = r0
|
|
671
|
-
|
|
672
|
-
r0
|
|
673
|
-
end
|
|
674
|
-
|
|
675
|
-
module EndStar0
|
|
676
|
-
end
|
|
677
|
-
|
|
678
|
-
def _nt_end_star
|
|
679
|
-
start_index = index
|
|
680
|
-
if node_cache[:end_star].has_key?(index)
|
|
681
|
-
cached = node_cache[:end_star][index]
|
|
682
|
-
if cached
|
|
683
|
-
node_cache[:end_star][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
684
|
-
@index = cached.interval.end
|
|
685
|
-
end
|
|
686
|
-
return cached
|
|
687
|
-
end
|
|
688
|
-
|
|
689
|
-
i0, s0 = index, []
|
|
690
|
-
s1, i1 = [], index
|
|
691
|
-
loop do
|
|
692
|
-
r2 = _nt_non_star
|
|
693
|
-
if r2
|
|
694
|
-
s1 << r2
|
|
695
|
-
else
|
|
696
|
-
break
|
|
697
|
-
end
|
|
698
|
-
end
|
|
699
|
-
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
|
700
|
-
s0 << r1
|
|
701
|
-
if r1
|
|
702
|
-
s3, i3 = [], index
|
|
703
|
-
loop do
|
|
704
|
-
if (match_len = has_terminal?("*", false, index))
|
|
705
|
-
r4 = true
|
|
706
|
-
@index += match_len
|
|
707
|
-
else
|
|
708
|
-
terminal_parse_failure('"*"')
|
|
709
|
-
r4 = nil
|
|
710
|
-
end
|
|
711
|
-
if r4
|
|
712
|
-
s3 << r4
|
|
713
|
-
else
|
|
714
|
-
break
|
|
715
|
-
end
|
|
716
|
-
end
|
|
717
|
-
if s3.empty?
|
|
718
|
-
@index = i3
|
|
719
|
-
r3 = nil
|
|
720
|
-
else
|
|
721
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
722
|
-
end
|
|
723
|
-
s0 << r3
|
|
724
|
-
end
|
|
725
|
-
if s0.last
|
|
726
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
727
|
-
r0.extend(EndStar0)
|
|
728
|
-
else
|
|
729
|
-
@index = i0
|
|
730
|
-
r0 = nil
|
|
731
|
-
end
|
|
732
|
-
|
|
733
|
-
node_cache[:end_star][start_index] = r0
|
|
734
|
-
|
|
735
|
-
r0
|
|
736
|
-
end
|
|
737
|
-
|
|
738
503
|
def _nt_non_lf
|
|
739
504
|
start_index = index
|
|
740
505
|
if node_cache[:non_lf].has_key?(index)
|
|
@@ -769,18 +534,24 @@ module HGRAMMAR
|
|
|
769
534
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
770
535
|
r0 = r2
|
|
771
536
|
else
|
|
772
|
-
if has_terminal?(@regexps[gr = '\A[\\
|
|
537
|
+
if has_terminal?(@regexps[gr = '\A[\\ -]'] ||= Regexp.new(gr), :regexp, index)
|
|
773
538
|
r3 = true
|
|
774
539
|
@index += 1
|
|
775
540
|
else
|
|
776
|
-
terminal_parse_failure('[\\
|
|
541
|
+
terminal_parse_failure('[\\ -]')
|
|
777
542
|
r3 = nil
|
|
778
543
|
end
|
|
779
544
|
if r3
|
|
780
545
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
781
546
|
r0 = r3
|
|
782
547
|
else
|
|
783
|
-
|
|
548
|
+
if has_terminal?(@regexps[gr = '\A[-]'] ||= Regexp.new(gr), :regexp, index)
|
|
549
|
+
r4 = true
|
|
550
|
+
@index += 1
|
|
551
|
+
else
|
|
552
|
+
terminal_parse_failure('[-]')
|
|
553
|
+
r4 = nil
|
|
554
|
+
end
|
|
784
555
|
if r4
|
|
785
556
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
786
557
|
r0 = r4
|
|
@@ -797,50 +568,6 @@ module HGRAMMAR
|
|
|
797
568
|
r0
|
|
798
569
|
end
|
|
799
570
|
|
|
800
|
-
def _nt_eol_comment
|
|
801
|
-
start_index = index
|
|
802
|
-
if node_cache[:eol_comment].has_key?(index)
|
|
803
|
-
cached = node_cache[:eol_comment][index]
|
|
804
|
-
if cached
|
|
805
|
-
node_cache[:eol_comment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
806
|
-
@index = cached.interval.end
|
|
807
|
-
end
|
|
808
|
-
return cached
|
|
809
|
-
end
|
|
810
|
-
|
|
811
|
-
i0 = index
|
|
812
|
-
if (match_len = has_terminal?("#", false, index))
|
|
813
|
-
r1 = true
|
|
814
|
-
@index += match_len
|
|
815
|
-
else
|
|
816
|
-
terminal_parse_failure('"#"')
|
|
817
|
-
r1 = nil
|
|
818
|
-
end
|
|
819
|
-
if r1
|
|
820
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
821
|
-
r0 = r1
|
|
822
|
-
else
|
|
823
|
-
if (match_len = has_terminal?("//", false, index))
|
|
824
|
-
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
|
825
|
-
@index += match_len
|
|
826
|
-
else
|
|
827
|
-
terminal_parse_failure('"//"')
|
|
828
|
-
r2 = nil
|
|
829
|
-
end
|
|
830
|
-
if r2
|
|
831
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
832
|
-
r0 = r2
|
|
833
|
-
else
|
|
834
|
-
@index = i0
|
|
835
|
-
r0 = nil
|
|
836
|
-
end
|
|
837
|
-
end
|
|
838
|
-
|
|
839
|
-
node_cache[:eol_comment][start_index] = r0
|
|
840
|
-
|
|
841
|
-
r0
|
|
842
|
-
end
|
|
843
|
-
|
|
844
571
|
module S0
|
|
845
572
|
def comment
|
|
846
573
|
elements[0]
|
|
@@ -923,34 +650,9 @@ module HGRAMMAR
|
|
|
923
650
|
end
|
|
924
651
|
|
|
925
652
|
module Comment0
|
|
926
|
-
def non_slash_star
|
|
927
|
-
elements[1]
|
|
928
|
-
end
|
|
929
|
-
|
|
930
653
|
end
|
|
931
654
|
|
|
932
655
|
module Comment1
|
|
933
|
-
def non_slash_star
|
|
934
|
-
elements[0]
|
|
935
|
-
end
|
|
936
|
-
|
|
937
|
-
def end_star
|
|
938
|
-
elements[1]
|
|
939
|
-
end
|
|
940
|
-
end
|
|
941
|
-
|
|
942
|
-
module Comment2
|
|
943
|
-
def end_star
|
|
944
|
-
elements[1]
|
|
945
|
-
end
|
|
946
|
-
|
|
947
|
-
end
|
|
948
|
-
|
|
949
|
-
module Comment3
|
|
950
|
-
def eol_comment
|
|
951
|
-
elements[0]
|
|
952
|
-
end
|
|
953
|
-
|
|
954
656
|
end
|
|
955
657
|
|
|
956
658
|
def _nt_comment
|
|
@@ -975,30 +677,26 @@ module HGRAMMAR
|
|
|
975
677
|
end
|
|
976
678
|
s1 << r2
|
|
977
679
|
if r2
|
|
978
|
-
|
|
680
|
+
s3, i3 = [], index
|
|
681
|
+
loop do
|
|
682
|
+
r4 = _nt_non_slash
|
|
683
|
+
if r4
|
|
684
|
+
s3 << r4
|
|
685
|
+
else
|
|
686
|
+
break
|
|
687
|
+
end
|
|
688
|
+
end
|
|
689
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
979
690
|
s1 << r3
|
|
980
691
|
if r3
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
break
|
|
988
|
-
end
|
|
989
|
-
end
|
|
990
|
-
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
|
991
|
-
s1 << r4
|
|
992
|
-
if r4
|
|
993
|
-
if (match_len = has_terminal?("/", false, index))
|
|
994
|
-
r6 = true
|
|
995
|
-
@index += match_len
|
|
996
|
-
else
|
|
997
|
-
terminal_parse_failure('"/"')
|
|
998
|
-
r6 = nil
|
|
999
|
-
end
|
|
1000
|
-
s1 << r6
|
|
692
|
+
if (match_len = has_terminal?("/", false, index))
|
|
693
|
+
r5 = true
|
|
694
|
+
@index += match_len
|
|
695
|
+
else
|
|
696
|
+
terminal_parse_failure('"/"')
|
|
697
|
+
r5 = nil
|
|
1001
698
|
end
|
|
699
|
+
s1 << r5
|
|
1002
700
|
end
|
|
1003
701
|
end
|
|
1004
702
|
if s1.last
|
|
@@ -1012,106 +710,51 @@ module HGRAMMAR
|
|
|
1012
710
|
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
|
1013
711
|
r0 = r1
|
|
1014
712
|
else
|
|
1015
|
-
|
|
1016
|
-
if (match_len = has_terminal?("
|
|
1017
|
-
|
|
713
|
+
i6, s6 = index, []
|
|
714
|
+
if (match_len = has_terminal?("#", false, index))
|
|
715
|
+
r7 = true
|
|
1018
716
|
@index += match_len
|
|
1019
717
|
else
|
|
1020
|
-
terminal_parse_failure('"
|
|
1021
|
-
|
|
718
|
+
terminal_parse_failure('"#"')
|
|
719
|
+
r7 = nil
|
|
1022
720
|
end
|
|
1023
|
-
|
|
1024
|
-
if
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
s11 << r12
|
|
1033
|
-
if r12
|
|
1034
|
-
r13 = _nt_end_star
|
|
1035
|
-
s11 << r13
|
|
1036
|
-
end
|
|
1037
|
-
if s11.last
|
|
1038
|
-
r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
|
|
1039
|
-
r11.extend(Comment1)
|
|
1040
|
-
else
|
|
1041
|
-
@index = i11
|
|
1042
|
-
r11 = nil
|
|
1043
|
-
end
|
|
1044
|
-
if r11
|
|
1045
|
-
s10 << r11
|
|
1046
|
-
else
|
|
1047
|
-
break
|
|
1048
|
-
end
|
|
721
|
+
s6 << r7
|
|
722
|
+
if r7
|
|
723
|
+
s8, i8 = [], index
|
|
724
|
+
loop do
|
|
725
|
+
r9 = _nt_non_lf
|
|
726
|
+
if r9
|
|
727
|
+
s8 << r9
|
|
728
|
+
else
|
|
729
|
+
break
|
|
1049
730
|
end
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
s7 << r14
|
|
731
|
+
end
|
|
732
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
|
733
|
+
s6 << r8
|
|
734
|
+
if r8
|
|
735
|
+
if (match_len = has_terminal?("\n", false, index))
|
|
736
|
+
r10 = true
|
|
737
|
+
@index += match_len
|
|
738
|
+
else
|
|
739
|
+
terminal_parse_failure('"\\n"')
|
|
740
|
+
r10 = nil
|
|
1061
741
|
end
|
|
742
|
+
s6 << r10
|
|
1062
743
|
end
|
|
1063
744
|
end
|
|
1064
|
-
if
|
|
1065
|
-
|
|
1066
|
-
|
|
745
|
+
if s6.last
|
|
746
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
|
747
|
+
r6.extend(Comment1)
|
|
1067
748
|
else
|
|
1068
|
-
@index =
|
|
1069
|
-
|
|
749
|
+
@index = i6
|
|
750
|
+
r6 = nil
|
|
1070
751
|
end
|
|
1071
|
-
if
|
|
1072
|
-
|
|
1073
|
-
r0 =
|
|
752
|
+
if r6
|
|
753
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
754
|
+
r0 = r6
|
|
1074
755
|
else
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
s15 << r16
|
|
1078
|
-
if r16
|
|
1079
|
-
s17, i17 = [], index
|
|
1080
|
-
loop do
|
|
1081
|
-
r18 = _nt_non_lf
|
|
1082
|
-
if r18
|
|
1083
|
-
s17 << r18
|
|
1084
|
-
else
|
|
1085
|
-
break
|
|
1086
|
-
end
|
|
1087
|
-
end
|
|
1088
|
-
r17 = instantiate_node(SyntaxNode,input, i17...index, s17)
|
|
1089
|
-
s15 << r17
|
|
1090
|
-
if r17
|
|
1091
|
-
if (match_len = has_terminal?("\n", false, index))
|
|
1092
|
-
r19 = true
|
|
1093
|
-
@index += match_len
|
|
1094
|
-
else
|
|
1095
|
-
terminal_parse_failure('"\\n"')
|
|
1096
|
-
r19 = nil
|
|
1097
|
-
end
|
|
1098
|
-
s15 << r19
|
|
1099
|
-
end
|
|
1100
|
-
end
|
|
1101
|
-
if s15.last
|
|
1102
|
-
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
|
1103
|
-
r15.extend(Comment3)
|
|
1104
|
-
else
|
|
1105
|
-
@index = i15
|
|
1106
|
-
r15 = nil
|
|
1107
|
-
end
|
|
1108
|
-
if r15
|
|
1109
|
-
r15 = SyntaxNode.new(input, (index-1)...index) if r15 == true
|
|
1110
|
-
r0 = r15
|
|
1111
|
-
else
|
|
1112
|
-
@index = i0
|
|
1113
|
-
r0 = nil
|
|
1114
|
-
end
|
|
756
|
+
@index = i0
|
|
757
|
+
r0 = nil
|
|
1115
758
|
end
|
|
1116
759
|
end
|
|
1117
760
|
|
|
@@ -1120,11 +763,9 @@ module HGRAMMAR
|
|
|
1120
763
|
r0
|
|
1121
764
|
end
|
|
1122
765
|
|
|
1123
|
-
|
|
1124
|
-
class Parser < Treetop::Runtime::CompiledParser
|
|
1125
|
-
include HGRAMMAR
|
|
1126
|
-
end
|
|
1127
766
|
end
|
|
1128
767
|
|
|
1129
|
-
|
|
768
|
+
class HGRAMMARParser < Treetop::Runtime::CompiledParser
|
|
769
|
+
include HGRAMMAR
|
|
770
|
+
end
|
|
1130
771
|
|