edn-abnf 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/edn-abnf.gemspec +1 -1
- data/lib/parser/edngrammar.rb +366 -129
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65315f840b92a39b734580ff2050ff4e92329048046c9d24ed1d1246858ae8fd
|
4
|
+
data.tar.gz: 1949f58b8fe44914999cc91a78c14f87d28865cd753d749c0752333448d676a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a559663ff8b81dcccecb561c8226dc5184276f119e08b23195578ead701a92fc1068e7067416a352c41596bbe733f503df7c554dbcb13ba36541da2661f4fd9
|
7
|
+
data.tar.gz: 6429e1496befd64f71a17e933132c39bfb960e342d40d8616ee4f272d47feafef1f9d5323e075a02007a854990c23e1881e691851cca8545a51a069d10cde171
|
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.0.
|
3
|
+
s.version = "0.0.7"
|
4
4
|
s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
|
5
5
|
s.description = %q{edn-abnf implements converters and miscellaneous tools for CBOR EDN's ABNF}
|
6
6
|
s.author = "Carsten Bormann"
|
data/lib/parser/edngrammar.rb
CHANGED
@@ -469,7 +469,13 @@ module EDNGRAMMAR
|
|
469
469
|
end
|
470
470
|
|
471
471
|
module Basenumber4
|
472
|
-
|
472
|
+
end
|
473
|
+
|
474
|
+
module Basenumber5
|
475
|
+
end
|
476
|
+
|
477
|
+
module Basenumber6
|
478
|
+
def ast; /p/i =~ text_value ? Float(text_value) : Integer(text_value) end
|
473
479
|
end
|
474
480
|
|
475
481
|
def _nt_basenumber
|
@@ -528,10 +534,98 @@ module EDNGRAMMAR
|
|
528
534
|
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
529
535
|
end
|
530
536
|
s5 << r7
|
537
|
+
if r7
|
538
|
+
i10, s10 = index, []
|
539
|
+
i12, s12 = index, []
|
540
|
+
if (match_len = has_terminal?(".", false, index))
|
541
|
+
r13 = true
|
542
|
+
@index += match_len
|
543
|
+
else
|
544
|
+
terminal_parse_failure('"."')
|
545
|
+
r13 = nil
|
546
|
+
end
|
547
|
+
s12 << r13
|
548
|
+
if r13
|
549
|
+
s14, i14 = [], index
|
550
|
+
loop do
|
551
|
+
r15 = _nt_HEXDIG
|
552
|
+
if r15
|
553
|
+
s14 << r15
|
554
|
+
else
|
555
|
+
break
|
556
|
+
end
|
557
|
+
end
|
558
|
+
if s14.empty?
|
559
|
+
@index = i14
|
560
|
+
r14 = nil
|
561
|
+
else
|
562
|
+
r14 = instantiate_node(SyntaxNode,input, i14...index, s14)
|
563
|
+
end
|
564
|
+
s12 << r14
|
565
|
+
end
|
566
|
+
if s12.last
|
567
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
568
|
+
r12.extend(Basenumber0)
|
569
|
+
else
|
570
|
+
@index = i12
|
571
|
+
r12 = nil
|
572
|
+
end
|
573
|
+
if r12
|
574
|
+
r11 = r12
|
575
|
+
else
|
576
|
+
r11 = instantiate_node(SyntaxNode,input, index...index)
|
577
|
+
end
|
578
|
+
s10 << r11
|
579
|
+
if r11
|
580
|
+
if (match_len = has_terminal?("p", :insens, index))
|
581
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
582
|
+
@index += match_len
|
583
|
+
else
|
584
|
+
terminal_parse_failure('"p"')
|
585
|
+
r16 = nil
|
586
|
+
end
|
587
|
+
s10 << r16
|
588
|
+
if r16
|
589
|
+
r18 = _nt_sign
|
590
|
+
if r18
|
591
|
+
r17 = r18
|
592
|
+
else
|
593
|
+
r17 = instantiate_node(SyntaxNode,input, index...index)
|
594
|
+
end
|
595
|
+
s10 << r17
|
596
|
+
if r17
|
597
|
+
s19, i19 = [], index
|
598
|
+
loop do
|
599
|
+
r20 = _nt_DIGIT
|
600
|
+
if r20
|
601
|
+
s19 << r20
|
602
|
+
else
|
603
|
+
break
|
604
|
+
end
|
605
|
+
end
|
606
|
+
r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
|
607
|
+
s10 << r19
|
608
|
+
end
|
609
|
+
end
|
610
|
+
end
|
611
|
+
if s10.last
|
612
|
+
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
|
613
|
+
r10.extend(Basenumber1)
|
614
|
+
else
|
615
|
+
@index = i10
|
616
|
+
r10 = nil
|
617
|
+
end
|
618
|
+
if r10
|
619
|
+
r9 = r10
|
620
|
+
else
|
621
|
+
r9 = instantiate_node(SyntaxNode,input, index...index)
|
622
|
+
end
|
623
|
+
s5 << r9
|
624
|
+
end
|
531
625
|
end
|
532
626
|
if s5.last
|
533
627
|
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
534
|
-
r5.extend(
|
628
|
+
r5.extend(Basenumber2)
|
535
629
|
else
|
536
630
|
@index = i5
|
537
631
|
r5 = nil
|
@@ -540,81 +634,81 @@ module EDNGRAMMAR
|
|
540
634
|
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
541
635
|
r4 = r5
|
542
636
|
else
|
543
|
-
|
637
|
+
i21, s21 = index, []
|
544
638
|
if (match_len = has_terminal?("o", :insens, index))
|
545
|
-
|
639
|
+
r22 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
546
640
|
@index += match_len
|
547
641
|
else
|
548
642
|
terminal_parse_failure('"o"')
|
549
|
-
|
643
|
+
r22 = nil
|
550
644
|
end
|
551
|
-
|
552
|
-
if
|
553
|
-
|
645
|
+
s21 << r22
|
646
|
+
if r22
|
647
|
+
s23, i23 = [], index
|
554
648
|
loop do
|
555
|
-
|
556
|
-
if
|
557
|
-
|
649
|
+
r24 = _nt_ODIGIT
|
650
|
+
if r24
|
651
|
+
s23 << r24
|
558
652
|
else
|
559
653
|
break
|
560
654
|
end
|
561
655
|
end
|
562
|
-
if
|
563
|
-
@index =
|
564
|
-
|
656
|
+
if s23.empty?
|
657
|
+
@index = i23
|
658
|
+
r23 = nil
|
565
659
|
else
|
566
|
-
|
660
|
+
r23 = instantiate_node(SyntaxNode,input, i23...index, s23)
|
567
661
|
end
|
568
|
-
|
662
|
+
s21 << r23
|
569
663
|
end
|
570
|
-
if
|
571
|
-
|
572
|
-
|
664
|
+
if s21.last
|
665
|
+
r21 = instantiate_node(SyntaxNode,input, i21...index, s21)
|
666
|
+
r21.extend(Basenumber3)
|
573
667
|
else
|
574
|
-
@index =
|
575
|
-
|
668
|
+
@index = i21
|
669
|
+
r21 = nil
|
576
670
|
end
|
577
|
-
if
|
578
|
-
|
579
|
-
r4 =
|
671
|
+
if r21
|
672
|
+
r21 = SyntaxNode.new(input, (index-1)...index) if r21 == true
|
673
|
+
r4 = r21
|
580
674
|
else
|
581
|
-
|
675
|
+
i25, s25 = index, []
|
582
676
|
if (match_len = has_terminal?("b", :insens, index))
|
583
|
-
|
677
|
+
r26 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
584
678
|
@index += match_len
|
585
679
|
else
|
586
680
|
terminal_parse_failure('"b"')
|
587
|
-
|
681
|
+
r26 = nil
|
588
682
|
end
|
589
|
-
|
590
|
-
if
|
591
|
-
|
683
|
+
s25 << r26
|
684
|
+
if r26
|
685
|
+
s27, i27 = [], index
|
592
686
|
loop do
|
593
|
-
|
594
|
-
if
|
595
|
-
|
687
|
+
r28 = _nt_BDIGIT
|
688
|
+
if r28
|
689
|
+
s27 << r28
|
596
690
|
else
|
597
691
|
break
|
598
692
|
end
|
599
693
|
end
|
600
|
-
if
|
601
|
-
@index =
|
602
|
-
|
694
|
+
if s27.empty?
|
695
|
+
@index = i27
|
696
|
+
r27 = nil
|
603
697
|
else
|
604
|
-
|
698
|
+
r27 = instantiate_node(SyntaxNode,input, i27...index, s27)
|
605
699
|
end
|
606
|
-
|
700
|
+
s25 << r27
|
607
701
|
end
|
608
|
-
if
|
609
|
-
|
610
|
-
|
702
|
+
if s25.last
|
703
|
+
r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
|
704
|
+
r25.extend(Basenumber4)
|
611
705
|
else
|
612
|
-
@index =
|
613
|
-
|
706
|
+
@index = i25
|
707
|
+
r25 = nil
|
614
708
|
end
|
615
|
-
if
|
616
|
-
|
617
|
-
r4 =
|
709
|
+
if r25
|
710
|
+
r25 = SyntaxNode.new(input, (index-1)...index) if r25 == true
|
711
|
+
r4 = r25
|
618
712
|
else
|
619
713
|
@index = i4
|
620
714
|
r4 = nil
|
@@ -626,8 +720,8 @@ module EDNGRAMMAR
|
|
626
720
|
end
|
627
721
|
if s0.last
|
628
722
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
629
|
-
r0.extend(
|
630
|
-
r0.extend(
|
723
|
+
r0.extend(Basenumber5)
|
724
|
+
r0.extend(Basenumber6)
|
631
725
|
else
|
632
726
|
@index = i0
|
633
727
|
r0 = nil
|
@@ -1837,19 +1931,31 @@ module EDNGRAMMAR
|
|
1837
1931
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1838
1932
|
r0 = r2
|
1839
1933
|
else
|
1840
|
-
if has_terminal?(@regexps[gr = '\A[0
|
1934
|
+
if has_terminal?(@regexps[gr = '\A[0-]'] ||= Regexp.new(gr), :regexp, index)
|
1841
1935
|
r3 = true
|
1842
1936
|
@index += 1
|
1843
1937
|
else
|
1844
|
-
terminal_parse_failure('[0
|
1938
|
+
terminal_parse_failure('[0-]')
|
1845
1939
|
r3 = nil
|
1846
1940
|
end
|
1847
1941
|
if r3
|
1848
1942
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
1849
1943
|
r0 = r3
|
1850
1944
|
else
|
1851
|
-
@
|
1852
|
-
|
1945
|
+
if has_terminal?(@regexps[gr = '\A[-]'] ||= Regexp.new(gr), :regexp, index)
|
1946
|
+
r4 = true
|
1947
|
+
@index += 1
|
1948
|
+
else
|
1949
|
+
terminal_parse_failure('[-]')
|
1950
|
+
r4 = nil
|
1951
|
+
end
|
1952
|
+
if r4
|
1953
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
1954
|
+
r0 = r4
|
1955
|
+
else
|
1956
|
+
@index = i0
|
1957
|
+
r0 = nil
|
1958
|
+
end
|
1853
1959
|
end
|
1854
1960
|
end
|
1855
1961
|
end
|
@@ -1859,7 +1965,79 @@ module EDNGRAMMAR
|
|
1859
1965
|
r0
|
1860
1966
|
end
|
1861
1967
|
|
1968
|
+
def _nt_non_lf
|
1969
|
+
start_index = index
|
1970
|
+
if node_cache[:non_lf].has_key?(index)
|
1971
|
+
cached = node_cache[:non_lf][index]
|
1972
|
+
if cached
|
1973
|
+
node_cache[:non_lf][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1974
|
+
@index = cached.interval.end
|
1975
|
+
end
|
1976
|
+
return cached
|
1977
|
+
end
|
1978
|
+
|
1979
|
+
i0 = index
|
1980
|
+
if (match_len = has_terminal?("\t", false, index))
|
1981
|
+
r1 = true
|
1982
|
+
@index += match_len
|
1983
|
+
else
|
1984
|
+
terminal_parse_failure('"\\t"')
|
1985
|
+
r1 = nil
|
1986
|
+
end
|
1987
|
+
if r1
|
1988
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
1989
|
+
r0 = r1
|
1990
|
+
else
|
1991
|
+
if (match_len = has_terminal?("\r", false, index))
|
1992
|
+
r2 = true
|
1993
|
+
@index += match_len
|
1994
|
+
else
|
1995
|
+
terminal_parse_failure('"\\r"')
|
1996
|
+
r2 = nil
|
1997
|
+
end
|
1998
|
+
if r2
|
1999
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2000
|
+
r0 = r2
|
2001
|
+
else
|
2002
|
+
if has_terminal?(@regexps[gr = '\A[\\ -]'] ||= Regexp.new(gr), :regexp, index)
|
2003
|
+
r3 = true
|
2004
|
+
@index += 1
|
2005
|
+
else
|
2006
|
+
terminal_parse_failure('[\\ -]')
|
2007
|
+
r3 = nil
|
2008
|
+
end
|
2009
|
+
if r3
|
2010
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2011
|
+
r0 = r3
|
2012
|
+
else
|
2013
|
+
if has_terminal?(@regexps[gr = '\A[-]'] ||= Regexp.new(gr), :regexp, index)
|
2014
|
+
r4 = true
|
2015
|
+
@index += 1
|
2016
|
+
else
|
2017
|
+
terminal_parse_failure('[-]')
|
2018
|
+
r4 = nil
|
2019
|
+
end
|
2020
|
+
if r4
|
2021
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2022
|
+
r0 = r4
|
2023
|
+
else
|
2024
|
+
@index = i0
|
2025
|
+
r0 = nil
|
2026
|
+
end
|
2027
|
+
end
|
2028
|
+
end
|
2029
|
+
end
|
2030
|
+
|
2031
|
+
node_cache[:non_lf][start_index] = r0
|
2032
|
+
|
2033
|
+
r0
|
2034
|
+
end
|
2035
|
+
|
1862
2036
|
module S0
|
2037
|
+
def comment
|
2038
|
+
elements[0]
|
2039
|
+
end
|
2040
|
+
|
1863
2041
|
end
|
1864
2042
|
|
1865
2043
|
module S1
|
@@ -1892,18 +2070,12 @@ module EDNGRAMMAR
|
|
1892
2070
|
s3, i3 = [], index
|
1893
2071
|
loop do
|
1894
2072
|
i4, s4 = index, []
|
1895
|
-
|
1896
|
-
r5 = true
|
1897
|
-
@index += match_len
|
1898
|
-
else
|
1899
|
-
terminal_parse_failure('"/"')
|
1900
|
-
r5 = nil
|
1901
|
-
end
|
2073
|
+
r5 = _nt_comment
|
1902
2074
|
s4 << r5
|
1903
2075
|
if r5
|
1904
2076
|
s6, i6 = [], index
|
1905
2077
|
loop do
|
1906
|
-
r7 =
|
2078
|
+
r7 = _nt_blank
|
1907
2079
|
if r7
|
1908
2080
|
s6 << r7
|
1909
2081
|
else
|
@@ -1912,29 +2084,6 @@ module EDNGRAMMAR
|
|
1912
2084
|
end
|
1913
2085
|
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
1914
2086
|
s4 << r6
|
1915
|
-
if r6
|
1916
|
-
if (match_len = has_terminal?("/", false, index))
|
1917
|
-
r8 = true
|
1918
|
-
@index += match_len
|
1919
|
-
else
|
1920
|
-
terminal_parse_failure('"/"')
|
1921
|
-
r8 = nil
|
1922
|
-
end
|
1923
|
-
s4 << r8
|
1924
|
-
if r8
|
1925
|
-
s9, i9 = [], index
|
1926
|
-
loop do
|
1927
|
-
r10 = _nt_blank
|
1928
|
-
if r10
|
1929
|
-
s9 << r10
|
1930
|
-
else
|
1931
|
-
break
|
1932
|
-
end
|
1933
|
-
end
|
1934
|
-
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
1935
|
-
s4 << r9
|
1936
|
-
end
|
1937
|
-
end
|
1938
2087
|
end
|
1939
2088
|
if s4.last
|
1940
2089
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
@@ -1965,6 +2114,120 @@ module EDNGRAMMAR
|
|
1965
2114
|
r0
|
1966
2115
|
end
|
1967
2116
|
|
2117
|
+
module Comment0
|
2118
|
+
end
|
2119
|
+
|
2120
|
+
module Comment1
|
2121
|
+
end
|
2122
|
+
|
2123
|
+
def _nt_comment
|
2124
|
+
start_index = index
|
2125
|
+
if node_cache[:comment].has_key?(index)
|
2126
|
+
cached = node_cache[:comment][index]
|
2127
|
+
if cached
|
2128
|
+
node_cache[:comment][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2129
|
+
@index = cached.interval.end
|
2130
|
+
end
|
2131
|
+
return cached
|
2132
|
+
end
|
2133
|
+
|
2134
|
+
i0 = index
|
2135
|
+
i1, s1 = index, []
|
2136
|
+
if (match_len = has_terminal?("/", false, index))
|
2137
|
+
r2 = true
|
2138
|
+
@index += match_len
|
2139
|
+
else
|
2140
|
+
terminal_parse_failure('"/"')
|
2141
|
+
r2 = nil
|
2142
|
+
end
|
2143
|
+
s1 << r2
|
2144
|
+
if r2
|
2145
|
+
s3, i3 = [], index
|
2146
|
+
loop do
|
2147
|
+
r4 = _nt_non_slash
|
2148
|
+
if r4
|
2149
|
+
s3 << r4
|
2150
|
+
else
|
2151
|
+
break
|
2152
|
+
end
|
2153
|
+
end
|
2154
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2155
|
+
s1 << r3
|
2156
|
+
if r3
|
2157
|
+
if (match_len = has_terminal?("/", false, index))
|
2158
|
+
r5 = true
|
2159
|
+
@index += match_len
|
2160
|
+
else
|
2161
|
+
terminal_parse_failure('"/"')
|
2162
|
+
r5 = nil
|
2163
|
+
end
|
2164
|
+
s1 << r5
|
2165
|
+
end
|
2166
|
+
end
|
2167
|
+
if s1.last
|
2168
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
2169
|
+
r1.extend(Comment0)
|
2170
|
+
else
|
2171
|
+
@index = i1
|
2172
|
+
r1 = nil
|
2173
|
+
end
|
2174
|
+
if r1
|
2175
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2176
|
+
r0 = r1
|
2177
|
+
else
|
2178
|
+
i6, s6 = index, []
|
2179
|
+
if (match_len = has_terminal?("#", false, index))
|
2180
|
+
r7 = true
|
2181
|
+
@index += match_len
|
2182
|
+
else
|
2183
|
+
terminal_parse_failure('"#"')
|
2184
|
+
r7 = nil
|
2185
|
+
end
|
2186
|
+
s6 << r7
|
2187
|
+
if r7
|
2188
|
+
s8, i8 = [], index
|
2189
|
+
loop do
|
2190
|
+
r9 = _nt_non_lf
|
2191
|
+
if r9
|
2192
|
+
s8 << r9
|
2193
|
+
else
|
2194
|
+
break
|
2195
|
+
end
|
2196
|
+
end
|
2197
|
+
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
|
2198
|
+
s6 << r8
|
2199
|
+
if r8
|
2200
|
+
if (match_len = has_terminal?("\n", false, index))
|
2201
|
+
r10 = true
|
2202
|
+
@index += match_len
|
2203
|
+
else
|
2204
|
+
terminal_parse_failure('"\\n"')
|
2205
|
+
r10 = nil
|
2206
|
+
end
|
2207
|
+
s6 << r10
|
2208
|
+
end
|
2209
|
+
end
|
2210
|
+
if s6.last
|
2211
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
2212
|
+
r6.extend(Comment1)
|
2213
|
+
else
|
2214
|
+
@index = i6
|
2215
|
+
r6 = nil
|
2216
|
+
end
|
2217
|
+
if r6
|
2218
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2219
|
+
r0 = r6
|
2220
|
+
else
|
2221
|
+
@index = i0
|
2222
|
+
r0 = nil
|
2223
|
+
end
|
2224
|
+
end
|
2225
|
+
|
2226
|
+
node_cache[:comment][start_index] = r0
|
2227
|
+
|
2228
|
+
r0
|
2229
|
+
end
|
2230
|
+
|
1968
2231
|
module OC0
|
1969
2232
|
def S
|
1970
2233
|
elements[1]
|
@@ -2051,7 +2314,7 @@ module EDNGRAMMAR
|
|
2051
2314
|
elements[1]
|
2052
2315
|
end
|
2053
2316
|
|
2054
|
-
def
|
2317
|
+
def bstr
|
2055
2318
|
elements[2]
|
2056
2319
|
end
|
2057
2320
|
|
@@ -2065,7 +2328,7 @@ module EDNGRAMMAR
|
|
2065
2328
|
elements[1]
|
2066
2329
|
end
|
2067
2330
|
|
2068
|
-
def
|
2331
|
+
def bstr
|
2069
2332
|
elements[2]
|
2070
2333
|
end
|
2071
2334
|
|
@@ -2190,7 +2453,7 @@ module EDNGRAMMAR
|
|
2190
2453
|
r16 = _nt_spec1
|
2191
2454
|
s14 << r16
|
2192
2455
|
if r16
|
2193
|
-
r17 =
|
2456
|
+
r17 = _nt_bstr
|
2194
2457
|
s14 << r17
|
2195
2458
|
if r17
|
2196
2459
|
r18 = _nt_S
|
@@ -2211,7 +2474,7 @@ module EDNGRAMMAR
|
|
2211
2474
|
r22 = _nt_S
|
2212
2475
|
s20 << r22
|
2213
2476
|
if r22
|
2214
|
-
r23 =
|
2477
|
+
r23 = _nt_bstr
|
2215
2478
|
s20 << r23
|
2216
2479
|
if r23
|
2217
2480
|
r24 = _nt_S
|
@@ -3391,19 +3654,31 @@ module EDNGRAMMAR
|
|
3391
3654
|
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
3392
3655
|
r0 = r5
|
3393
3656
|
else
|
3394
|
-
if has_terminal?(@regexps[gr = '\A[\\]
|
3657
|
+
if has_terminal?(@regexps[gr = '\A[\\]-]'] ||= Regexp.new(gr), :regexp, index)
|
3395
3658
|
r6 = true
|
3396
3659
|
@index += 1
|
3397
3660
|
else
|
3398
|
-
terminal_parse_failure('[\\]
|
3661
|
+
terminal_parse_failure('[\\]-]')
|
3399
3662
|
r6 = nil
|
3400
3663
|
end
|
3401
3664
|
if r6
|
3402
3665
|
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
3403
3666
|
r0 = r6
|
3404
3667
|
else
|
3405
|
-
@
|
3406
|
-
|
3668
|
+
if has_terminal?(@regexps[gr = '\A[-]'] ||= Regexp.new(gr), :regexp, index)
|
3669
|
+
r7 = true
|
3670
|
+
@index += 1
|
3671
|
+
else
|
3672
|
+
terminal_parse_failure('[-]')
|
3673
|
+
r7 = nil
|
3674
|
+
end
|
3675
|
+
if r7
|
3676
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
3677
|
+
r0 = r7
|
3678
|
+
else
|
3679
|
+
@index = i0
|
3680
|
+
r0 = nil
|
3681
|
+
end
|
3407
3682
|
end
|
3408
3683
|
end
|
3409
3684
|
end
|
@@ -3690,44 +3965,6 @@ module EDNGRAMMAR
|
|
3690
3965
|
r0
|
3691
3966
|
end
|
3692
3967
|
|
3693
|
-
def _nt_ALPHA
|
3694
|
-
start_index = index
|
3695
|
-
if node_cache[:ALPHA].has_key?(index)
|
3696
|
-
cached = node_cache[:ALPHA][index]
|
3697
|
-
if cached
|
3698
|
-
node_cache[:ALPHA][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
3699
|
-
@index = cached.interval.end
|
3700
|
-
end
|
3701
|
-
return cached
|
3702
|
-
end
|
3703
|
-
|
3704
|
-
i0 = index
|
3705
|
-
if has_terminal?(@regexps[gr = '\A[A-Z]'] ||= Regexp.new(gr), :regexp, index)
|
3706
|
-
r1 = true
|
3707
|
-
@index += 1
|
3708
|
-
else
|
3709
|
-
terminal_parse_failure('[A-Z]')
|
3710
|
-
r1 = nil
|
3711
|
-
end
|
3712
|
-
if r1
|
3713
|
-
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
3714
|
-
r0 = r1
|
3715
|
-
else
|
3716
|
-
r2 = _nt_lcalpha
|
3717
|
-
if r2
|
3718
|
-
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
3719
|
-
r0 = r2
|
3720
|
-
else
|
3721
|
-
@index = i0
|
3722
|
-
r0 = nil
|
3723
|
-
end
|
3724
|
-
end
|
3725
|
-
|
3726
|
-
node_cache[:ALPHA][start_index] = r0
|
3727
|
-
|
3728
|
-
r0
|
3729
|
-
end
|
3730
|
-
|
3731
3968
|
end
|
3732
3969
|
|
3733
3970
|
class EDNGRAMMARParser < Treetop::Runtime::CompiledParser
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edn-abnf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|