edn-abnf 0.5.9 → 0.5.11
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/edn-abnf.gemspec +1 -1
- data/lib/cbor-diagnostic-app/b64grammar.rb +5 -3
- data/lib/cbor-diagnostic-app/dtgrammar.rb +5 -3
- data/lib/cbor-diagnostic-app/hgrammar.rb +5 -3
- data/lib/cbor-diagnostic-app/ipgrammar.rb +5 -3
- data/lib/parser/edn-util.rb +26 -2
- data/lib/parser/edngrammar.rb +533 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0256ffcfa25350ebaec7f12b1e7453022cb598d940e277f1802372517af2f010
|
4
|
+
data.tar.gz: 63d04404a325565ef62008b5df88eb4396e0851b68527f104108b2e8e1b7f4b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e91c759504595744b197f522fdd6de6ba1a07add5f994e9adf40899d5e0281fe5ab53d184b841b13f27a9e1ae4cc81786ef3767b6d32cb659125bf9bc1ed56a1
|
7
|
+
data.tar.gz: 4cd259259f9c11a5ff2acdad7da471b98087e5053529b56ec7e144eb207c3caab547041e8fa3eefbcb7a72e17a961152e6e0ff77fab3a983f72ef8a0083ac6d0
|
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.5.
|
3
|
+
s.version = "0.5.11"
|
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"
|
@@ -669,9 +669,11 @@ module B64GRAMMAR
|
|
669
669
|
r0
|
670
670
|
end
|
671
671
|
|
672
|
-
end
|
673
672
|
|
674
|
-
class
|
675
|
-
|
673
|
+
class Parser < Treetop::Runtime::CompiledParser
|
674
|
+
include B64GRAMMAR
|
675
|
+
end
|
676
676
|
end
|
677
677
|
|
678
|
+
B64GRAMMARParser = B64GRAMMAR::Parser
|
679
|
+
|
@@ -707,9 +707,11 @@ module DTGRAMMAR
|
|
707
707
|
r0
|
708
708
|
end
|
709
709
|
|
710
|
-
end
|
711
710
|
|
712
|
-
class
|
713
|
-
|
711
|
+
class Parser < Treetop::Runtime::CompiledParser
|
712
|
+
include DTGRAMMAR
|
713
|
+
end
|
714
714
|
end
|
715
715
|
|
716
|
+
DTGRAMMARParser = DTGRAMMAR::Parser
|
717
|
+
|
@@ -763,9 +763,11 @@ module HGRAMMAR
|
|
763
763
|
r0
|
764
764
|
end
|
765
765
|
|
766
|
-
end
|
767
766
|
|
768
|
-
class
|
769
|
-
|
767
|
+
class Parser < Treetop::Runtime::CompiledParser
|
768
|
+
include HGRAMMAR
|
769
|
+
end
|
770
770
|
end
|
771
771
|
|
772
|
+
HGRAMMARParser = HGRAMMAR::Parser
|
773
|
+
|
@@ -1690,9 +1690,11 @@ module IPGRAMMAR
|
|
1690
1690
|
r0
|
1691
1691
|
end
|
1692
1692
|
|
1693
|
-
end
|
1694
1693
|
|
1695
|
-
class
|
1696
|
-
|
1694
|
+
class Parser < Treetop::Runtime::CompiledParser
|
1695
|
+
include IPGRAMMAR
|
1696
|
+
end
|
1697
1697
|
end
|
1698
1698
|
|
1699
|
+
IPGRAMMARParser = IPGRAMMAR::Parser
|
1700
|
+
|
data/lib/parser/edn-util.rb
CHANGED
@@ -42,8 +42,8 @@ class Treetop::Runtime::SyntaxNode
|
|
42
42
|
def app_parser_level1_diagnostics(e, node)
|
43
43
|
outbytes = 0
|
44
44
|
if $options.level # do manual level-shifting
|
45
|
-
input = node.input
|
46
|
-
ol1pos = l1pos = node.interval.begin
|
45
|
+
input = node.input # l1 string
|
46
|
+
ol1pos = l1pos = node.interval.begin # start position
|
47
47
|
while outbytes <= e.position
|
48
48
|
outbytes += 1
|
49
49
|
ol1pos = l1pos
|
@@ -85,6 +85,30 @@ class Treetop::Runtime::SyntaxNode
|
|
85
85
|
end
|
86
86
|
warn reason
|
87
87
|
end
|
88
|
+
def app_parser_level1_raw_diagnostics(e, node)
|
89
|
+
outbytes = 0
|
90
|
+
# do manual level-shifting
|
91
|
+
input = node.input # l1 string
|
92
|
+
ol1pos = l1pos = node.interval.begin # start position
|
93
|
+
while outbytes <= e.position
|
94
|
+
ol1pos = l1pos
|
95
|
+
c1 = input[l1pos]
|
96
|
+
if c1 != "\r" # Ignored CR doesn't generate output
|
97
|
+
outbytes += 1
|
98
|
+
end
|
99
|
+
l1pos += 1
|
100
|
+
end
|
101
|
+
intv = ol1pos...l1pos
|
102
|
+
failure_index = intv.begin
|
103
|
+
failure_line = node.input.line_of(failure_index)
|
104
|
+
failure_column = node.input.column_of(failure_index)
|
105
|
+
reason = "** Line #{failure_line}, column #{failure_column}:\n"
|
106
|
+
if line = node.input.lines.to_a[failure_line - 1]
|
107
|
+
reason << line
|
108
|
+
reason << "\n#{'~' * (failure_column - 1)}#{'^' * intv.size}"
|
109
|
+
end
|
110
|
+
warn reason
|
111
|
+
end
|
88
112
|
end
|
89
113
|
|
90
114
|
|
data/lib/parser/edngrammar.rb
CHANGED
@@ -1809,6 +1809,458 @@ module EDNGRAMMAR
|
|
1809
1809
|
r0
|
1810
1810
|
end
|
1811
1811
|
|
1812
|
+
module AppRstring0
|
1813
|
+
def app_prefix
|
1814
|
+
elements[0]
|
1815
|
+
end
|
1816
|
+
|
1817
|
+
def rawstring
|
1818
|
+
elements[1]
|
1819
|
+
end
|
1820
|
+
end
|
1821
|
+
|
1822
|
+
module AppRstring1
|
1823
|
+
def ast # XXX ignoring h and b64
|
1824
|
+
data = rawstring.ast.force_encoding(Encoding::UTF_8) # XXX undo .b
|
1825
|
+
app = app_prefix.text_value
|
1826
|
+
begin
|
1827
|
+
::EDNGRAMMAR::APPS[app].decode(app, data)
|
1828
|
+
rescue CBOR_DIAG::AppParseError => e
|
1829
|
+
app_parser_level1_raw_diagnostics(e, rawstring.rawcontent)
|
1830
|
+
raise e
|
1831
|
+
end
|
1832
|
+
end
|
1833
|
+
end
|
1834
|
+
|
1835
|
+
def _nt_app_rstring
|
1836
|
+
start_index = index
|
1837
|
+
if node_cache[:app_rstring].has_key?(index)
|
1838
|
+
cached = node_cache[:app_rstring][index]
|
1839
|
+
if cached
|
1840
|
+
node_cache[:app_rstring][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1841
|
+
@index = cached.interval.end
|
1842
|
+
end
|
1843
|
+
return cached
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
i0, s0 = index, []
|
1847
|
+
r1 = _nt_app_prefix
|
1848
|
+
s0 << r1
|
1849
|
+
if r1
|
1850
|
+
r2 = _nt_rawstring
|
1851
|
+
s0 << r2
|
1852
|
+
end
|
1853
|
+
if s0.last
|
1854
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1855
|
+
r0.extend(AppRstring0)
|
1856
|
+
r0.extend(AppRstring1)
|
1857
|
+
else
|
1858
|
+
@index = i0
|
1859
|
+
r0 = nil
|
1860
|
+
end
|
1861
|
+
|
1862
|
+
node_cache[:app_rstring][start_index] = r0
|
1863
|
+
|
1864
|
+
r0
|
1865
|
+
end
|
1866
|
+
|
1867
|
+
module Rawstring0
|
1868
|
+
def startrawdelim
|
1869
|
+
elements[0]
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
def rawcontent
|
1873
|
+
elements[2]
|
1874
|
+
end
|
1875
|
+
|
1876
|
+
def matchrawdelim
|
1877
|
+
elements[3]
|
1878
|
+
end
|
1879
|
+
end
|
1880
|
+
|
1881
|
+
module Rawstring1
|
1882
|
+
def ast; rawcontent.text_value.gsub("\r", "") + (
|
1883
|
+
tv = matchrawdelim.text_value
|
1884
|
+
dv = startrawdelim.text_value.length
|
1885
|
+
tv[dv..]) end
|
1886
|
+
end
|
1887
|
+
|
1888
|
+
def _nt_rawstring
|
1889
|
+
start_index = index
|
1890
|
+
if node_cache[:rawstring].has_key?(index)
|
1891
|
+
cached = node_cache[:rawstring][index]
|
1892
|
+
if cached
|
1893
|
+
node_cache[:rawstring][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1894
|
+
@index = cached.interval.end
|
1895
|
+
end
|
1896
|
+
return cached
|
1897
|
+
end
|
1898
|
+
|
1899
|
+
i0, s0 = index, []
|
1900
|
+
r1 = _nt_startrawdelim
|
1901
|
+
s0 << r1
|
1902
|
+
if r1
|
1903
|
+
r3 = _nt_newline
|
1904
|
+
if r3
|
1905
|
+
r2 = r3
|
1906
|
+
else
|
1907
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
1908
|
+
end
|
1909
|
+
s0 << r2
|
1910
|
+
if r2
|
1911
|
+
r4 = _nt_rawcontent
|
1912
|
+
s0 << r4
|
1913
|
+
if r4
|
1914
|
+
r5 = _nt_matchrawdelim
|
1915
|
+
s0 << r5
|
1916
|
+
end
|
1917
|
+
end
|
1918
|
+
end
|
1919
|
+
if s0.last
|
1920
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1921
|
+
r0.extend(Rawstring0)
|
1922
|
+
r0.extend(Rawstring1)
|
1923
|
+
else
|
1924
|
+
@index = i0
|
1925
|
+
r0 = nil
|
1926
|
+
end
|
1927
|
+
|
1928
|
+
node_cache[:rawstring][start_index] = r0
|
1929
|
+
|
1930
|
+
r0
|
1931
|
+
end
|
1932
|
+
|
1933
|
+
def _nt_rawdelim
|
1934
|
+
start_index = index
|
1935
|
+
if node_cache[:rawdelim].has_key?(index)
|
1936
|
+
cached = node_cache[:rawdelim][index]
|
1937
|
+
if cached
|
1938
|
+
node_cache[:rawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1939
|
+
@index = cached.interval.end
|
1940
|
+
end
|
1941
|
+
return cached
|
1942
|
+
end
|
1943
|
+
|
1944
|
+
s0, i0 = [], index
|
1945
|
+
loop do
|
1946
|
+
if (match_len = has_terminal?("`", false, index))
|
1947
|
+
r1 = true
|
1948
|
+
@index += match_len
|
1949
|
+
else
|
1950
|
+
terminal_parse_failure('"`"')
|
1951
|
+
r1 = nil
|
1952
|
+
end
|
1953
|
+
if r1
|
1954
|
+
s0 << r1
|
1955
|
+
else
|
1956
|
+
break
|
1957
|
+
end
|
1958
|
+
end
|
1959
|
+
if s0.empty?
|
1960
|
+
@index = i0
|
1961
|
+
r0 = nil
|
1962
|
+
else
|
1963
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1964
|
+
end
|
1965
|
+
|
1966
|
+
node_cache[:rawdelim][start_index] = r0
|
1967
|
+
|
1968
|
+
r0
|
1969
|
+
end
|
1970
|
+
|
1971
|
+
module Startrawdelim0
|
1972
|
+
def rawdelim
|
1973
|
+
elements[0]
|
1974
|
+
end
|
1975
|
+
|
1976
|
+
end
|
1977
|
+
|
1978
|
+
def _nt_startrawdelim
|
1979
|
+
start_index = index
|
1980
|
+
if node_cache[:startrawdelim].has_key?(index)
|
1981
|
+
cached = node_cache[:startrawdelim][index]
|
1982
|
+
if cached
|
1983
|
+
node_cache[:startrawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
1984
|
+
@index = cached.interval.end
|
1985
|
+
end
|
1986
|
+
return cached
|
1987
|
+
end
|
1988
|
+
|
1989
|
+
i0, s0 = index, []
|
1990
|
+
r1 = _nt_rawdelim
|
1991
|
+
s0 << r1
|
1992
|
+
if r1
|
1993
|
+
i2 = index
|
1994
|
+
r3 = lambda {|(rd)|@rawdelim = rd.text_value}.call(s0)
|
1995
|
+
if !r3
|
1996
|
+
terminal_parse_failure("<semantic predicate>")
|
1997
|
+
end
|
1998
|
+
if r3
|
1999
|
+
@index = i2
|
2000
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
2001
|
+
else
|
2002
|
+
@index = i2
|
2003
|
+
r2 = nil
|
2004
|
+
end
|
2005
|
+
s0 << r2
|
2006
|
+
end
|
2007
|
+
if s0.last
|
2008
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2009
|
+
r0.extend(Startrawdelim0)
|
2010
|
+
else
|
2011
|
+
@index = i0
|
2012
|
+
r0 = nil
|
2013
|
+
end
|
2014
|
+
|
2015
|
+
node_cache[:startrawdelim][start_index] = r0
|
2016
|
+
|
2017
|
+
r0
|
2018
|
+
end
|
2019
|
+
|
2020
|
+
module Matchrawdelim0
|
2021
|
+
def rawdelim
|
2022
|
+
elements[0]
|
2023
|
+
end
|
2024
|
+
|
2025
|
+
end
|
2026
|
+
|
2027
|
+
def _nt_matchrawdelim
|
2028
|
+
start_index = index
|
2029
|
+
if node_cache[:matchrawdelim].has_key?(index)
|
2030
|
+
cached = node_cache[:matchrawdelim][index]
|
2031
|
+
if cached
|
2032
|
+
node_cache[:matchrawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2033
|
+
@index = cached.interval.end
|
2034
|
+
end
|
2035
|
+
return cached
|
2036
|
+
end
|
2037
|
+
|
2038
|
+
i0, s0 = index, []
|
2039
|
+
r1 = _nt_rawdelim
|
2040
|
+
s0 << r1
|
2041
|
+
if r1
|
2042
|
+
i2 = index
|
2043
|
+
r3 = lambda {|(rd)|rd.text_value.length >= @rawdelim.length}.call(s0)
|
2044
|
+
if !r3
|
2045
|
+
terminal_parse_failure("<semantic predicate>")
|
2046
|
+
end
|
2047
|
+
if r3
|
2048
|
+
@index = i2
|
2049
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
2050
|
+
else
|
2051
|
+
@index = i2
|
2052
|
+
r2 = nil
|
2053
|
+
end
|
2054
|
+
s0 << r2
|
2055
|
+
end
|
2056
|
+
if s0.last
|
2057
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2058
|
+
r0.extend(Matchrawdelim0)
|
2059
|
+
else
|
2060
|
+
@index = i0
|
2061
|
+
r0 = nil
|
2062
|
+
end
|
2063
|
+
|
2064
|
+
node_cache[:matchrawdelim][start_index] = r0
|
2065
|
+
|
2066
|
+
r0
|
2067
|
+
end
|
2068
|
+
|
2069
|
+
module Shortrawdelim0
|
2070
|
+
def rawdelim
|
2071
|
+
elements[0]
|
2072
|
+
end
|
2073
|
+
|
2074
|
+
end
|
2075
|
+
|
2076
|
+
def _nt_shortrawdelim
|
2077
|
+
start_index = index
|
2078
|
+
if node_cache[:shortrawdelim].has_key?(index)
|
2079
|
+
cached = node_cache[:shortrawdelim][index]
|
2080
|
+
if cached
|
2081
|
+
node_cache[:shortrawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2082
|
+
@index = cached.interval.end
|
2083
|
+
end
|
2084
|
+
return cached
|
2085
|
+
end
|
2086
|
+
|
2087
|
+
i0, s0 = index, []
|
2088
|
+
r1 = _nt_rawdelim
|
2089
|
+
s0 << r1
|
2090
|
+
if r1
|
2091
|
+
i2 = index
|
2092
|
+
r3 = lambda {|(rd)|rd.text_value.length < @rawdelim.length}.call(s0)
|
2093
|
+
if !r3
|
2094
|
+
terminal_parse_failure("<semantic predicate>")
|
2095
|
+
end
|
2096
|
+
if r3
|
2097
|
+
@index = i2
|
2098
|
+
r2 = instantiate_node(SyntaxNode,input, index...index)
|
2099
|
+
else
|
2100
|
+
@index = i2
|
2101
|
+
r2 = nil
|
2102
|
+
end
|
2103
|
+
s0 << r2
|
2104
|
+
end
|
2105
|
+
if s0.last
|
2106
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2107
|
+
r0.extend(Shortrawdelim0)
|
2108
|
+
else
|
2109
|
+
@index = i0
|
2110
|
+
r0 = nil
|
2111
|
+
end
|
2112
|
+
|
2113
|
+
node_cache[:shortrawdelim][start_index] = r0
|
2114
|
+
|
2115
|
+
r0
|
2116
|
+
end
|
2117
|
+
|
2118
|
+
def _nt_rawchars
|
2119
|
+
start_index = index
|
2120
|
+
if node_cache[:rawchars].has_key?(index)
|
2121
|
+
cached = node_cache[:rawchars][index]
|
2122
|
+
if cached
|
2123
|
+
node_cache[:rawchars][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2124
|
+
@index = cached.interval.end
|
2125
|
+
end
|
2126
|
+
return cached
|
2127
|
+
end
|
2128
|
+
|
2129
|
+
s0, i0 = [], index
|
2130
|
+
loop do
|
2131
|
+
i1 = index
|
2132
|
+
if (match_len = has_terminal?("\t", false, index))
|
2133
|
+
r2 = true
|
2134
|
+
@index += match_len
|
2135
|
+
else
|
2136
|
+
terminal_parse_failure('"\\t"')
|
2137
|
+
r2 = nil
|
2138
|
+
end
|
2139
|
+
if r2
|
2140
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2141
|
+
r1 = r2
|
2142
|
+
else
|
2143
|
+
if (match_len = has_terminal?("\n", false, index))
|
2144
|
+
r3 = true
|
2145
|
+
@index += match_len
|
2146
|
+
else
|
2147
|
+
terminal_parse_failure('"\\n"')
|
2148
|
+
r3 = nil
|
2149
|
+
end
|
2150
|
+
if r3
|
2151
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2152
|
+
r1 = r3
|
2153
|
+
else
|
2154
|
+
if (match_len = has_terminal?("\r", false, index))
|
2155
|
+
r4 = true
|
2156
|
+
@index += match_len
|
2157
|
+
else
|
2158
|
+
terminal_parse_failure('"\\r"')
|
2159
|
+
r4 = nil
|
2160
|
+
end
|
2161
|
+
if r4
|
2162
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
2163
|
+
r1 = r4
|
2164
|
+
else
|
2165
|
+
if has_terminal?(@regexps[gr = '\A[\\ -_]'] ||= Regexp.new(gr), :regexp, index)
|
2166
|
+
r5 = true
|
2167
|
+
@index += 1
|
2168
|
+
else
|
2169
|
+
terminal_parse_failure('[\\ -_]')
|
2170
|
+
r5 = nil
|
2171
|
+
end
|
2172
|
+
if r5
|
2173
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
2174
|
+
r1 = r5
|
2175
|
+
else
|
2176
|
+
if has_terminal?(@regexps[gr = '\A[a-~]'] ||= Regexp.new(gr), :regexp, index)
|
2177
|
+
r6 = true
|
2178
|
+
@index += 1
|
2179
|
+
else
|
2180
|
+
terminal_parse_failure('[a-~]')
|
2181
|
+
r6 = nil
|
2182
|
+
end
|
2183
|
+
if r6
|
2184
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
2185
|
+
r1 = r6
|
2186
|
+
else
|
2187
|
+
r7 = _nt_NONASCII
|
2188
|
+
if r7
|
2189
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
2190
|
+
r1 = r7
|
2191
|
+
else
|
2192
|
+
@index = i1
|
2193
|
+
r1 = nil
|
2194
|
+
end
|
2195
|
+
end
|
2196
|
+
end
|
2197
|
+
end
|
2198
|
+
end
|
2199
|
+
end
|
2200
|
+
if r1
|
2201
|
+
s0 << r1
|
2202
|
+
else
|
2203
|
+
break
|
2204
|
+
end
|
2205
|
+
end
|
2206
|
+
if s0.empty?
|
2207
|
+
@index = i0
|
2208
|
+
r0 = nil
|
2209
|
+
else
|
2210
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2211
|
+
end
|
2212
|
+
|
2213
|
+
node_cache[:rawchars][start_index] = r0
|
2214
|
+
|
2215
|
+
r0
|
2216
|
+
end
|
2217
|
+
|
2218
|
+
def _nt_rawcontent
|
2219
|
+
start_index = index
|
2220
|
+
if node_cache[:rawcontent].has_key?(index)
|
2221
|
+
cached = node_cache[:rawcontent][index]
|
2222
|
+
if cached
|
2223
|
+
node_cache[:rawcontent][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2224
|
+
@index = cached.interval.end
|
2225
|
+
end
|
2226
|
+
return cached
|
2227
|
+
end
|
2228
|
+
|
2229
|
+
s0, i0 = [], index
|
2230
|
+
loop do
|
2231
|
+
i1 = index
|
2232
|
+
r2 = _nt_rawchars
|
2233
|
+
if r2
|
2234
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2235
|
+
r1 = r2
|
2236
|
+
else
|
2237
|
+
r3 = _nt_shortrawdelim
|
2238
|
+
if r3
|
2239
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
2240
|
+
r1 = r3
|
2241
|
+
else
|
2242
|
+
@index = i1
|
2243
|
+
r1 = nil
|
2244
|
+
end
|
2245
|
+
end
|
2246
|
+
if r1
|
2247
|
+
s0 << r1
|
2248
|
+
else
|
2249
|
+
break
|
2250
|
+
end
|
2251
|
+
end
|
2252
|
+
if s0.empty?
|
2253
|
+
@index = i0
|
2254
|
+
r0 = nil
|
2255
|
+
else
|
2256
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2257
|
+
end
|
2258
|
+
|
2259
|
+
node_cache[:rawcontent][start_index] = r0
|
2260
|
+
|
2261
|
+
r0
|
2262
|
+
end
|
2263
|
+
|
1812
2264
|
module Sqstr0
|
1813
2265
|
def SQUOTE1
|
1814
2266
|
elements[0]
|
@@ -1974,18 +2426,30 @@ module EDNGRAMMAR
|
|
1974
2426
|
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
1975
2427
|
r0 = r10
|
1976
2428
|
else
|
1977
|
-
r11 =
|
2429
|
+
r11 = _nt_app_rstring
|
1978
2430
|
if r11
|
1979
2431
|
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
1980
2432
|
r0 = r11
|
1981
2433
|
else
|
1982
|
-
r12 =
|
2434
|
+
r12 = _nt_rawstring
|
1983
2435
|
if r12
|
1984
2436
|
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
1985
2437
|
r0 = r12
|
1986
2438
|
else
|
1987
|
-
|
1988
|
-
|
2439
|
+
r13 = _nt_app_sequence
|
2440
|
+
if r13
|
2441
|
+
r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
|
2442
|
+
r0 = r13
|
2443
|
+
else
|
2444
|
+
r14 = _nt_embedded
|
2445
|
+
if r14
|
2446
|
+
r14 = SyntaxNode.new(input, (index-1)...index) if r14 == true
|
2447
|
+
r0 = r14
|
2448
|
+
else
|
2449
|
+
@index = i0
|
2450
|
+
r0 = nil
|
2451
|
+
end
|
2452
|
+
end
|
1989
2453
|
end
|
1990
2454
|
end
|
1991
2455
|
end
|
@@ -3604,6 +4068,10 @@ module EDNGRAMMAR
|
|
3604
4068
|
def ast; text_value end
|
3605
4069
|
end
|
3606
4070
|
|
4071
|
+
module Escapable16
|
4072
|
+
def ast; "" end
|
4073
|
+
end
|
4074
|
+
|
3607
4075
|
def _nt_escapable1
|
3608
4076
|
start_index = index
|
3609
4077
|
if node_cache[:escapable1].has_key?(index)
|
@@ -3688,8 +4156,16 @@ module EDNGRAMMAR
|
|
3688
4156
|
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
3689
4157
|
r0 = r6
|
3690
4158
|
else
|
3691
|
-
|
3692
|
-
|
4159
|
+
r7 = _nt_newline
|
4160
|
+
r7.extend(Escapable16)
|
4161
|
+
r7.extend(Escapable16)
|
4162
|
+
if r7
|
4163
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
4164
|
+
r0 = r7
|
4165
|
+
else
|
4166
|
+
@index = i0
|
4167
|
+
r0 = nil
|
4168
|
+
end
|
3693
4169
|
end
|
3694
4170
|
end
|
3695
4171
|
end
|
@@ -5499,6 +5975,57 @@ module EDNGRAMMAR
|
|
5499
5975
|
r0
|
5500
5976
|
end
|
5501
5977
|
|
5978
|
+
module Newline0
|
5979
|
+
end
|
5980
|
+
|
5981
|
+
def _nt_newline
|
5982
|
+
start_index = index
|
5983
|
+
if node_cache[:newline].has_key?(index)
|
5984
|
+
cached = node_cache[:newline][index]
|
5985
|
+
if cached
|
5986
|
+
node_cache[:newline][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
5987
|
+
@index = cached.interval.end
|
5988
|
+
end
|
5989
|
+
return cached
|
5990
|
+
end
|
5991
|
+
|
5992
|
+
i0, s0 = index, []
|
5993
|
+
if (match_len = has_terminal?("\r", false, index))
|
5994
|
+
r2 = true
|
5995
|
+
@index += match_len
|
5996
|
+
else
|
5997
|
+
terminal_parse_failure('"\\r"')
|
5998
|
+
r2 = nil
|
5999
|
+
end
|
6000
|
+
if r2
|
6001
|
+
r1 = r2
|
6002
|
+
else
|
6003
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
6004
|
+
end
|
6005
|
+
s0 << r1
|
6006
|
+
if r1
|
6007
|
+
if (match_len = has_terminal?("\n", false, index))
|
6008
|
+
r3 = true
|
6009
|
+
@index += match_len
|
6010
|
+
else
|
6011
|
+
terminal_parse_failure('"\\n"')
|
6012
|
+
r3 = nil
|
6013
|
+
end
|
6014
|
+
s0 << r3
|
6015
|
+
end
|
6016
|
+
if s0.last
|
6017
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
6018
|
+
r0.extend(Newline0)
|
6019
|
+
else
|
6020
|
+
@index = i0
|
6021
|
+
r0 = nil
|
6022
|
+
end
|
6023
|
+
|
6024
|
+
node_cache[:newline][start_index] = r0
|
6025
|
+
|
6026
|
+
r0
|
6027
|
+
end
|
6028
|
+
|
5502
6029
|
def _nt_DQUOTE
|
5503
6030
|
start_index = index
|
5504
6031
|
if node_cache[:DQUOTE].has_key?(index)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edn-abnf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.6.
|
136
|
+
rubygems_version: 3.6.9
|
137
137
|
specification_version: 4
|
138
138
|
summary: CBOR Extended Diagnostic Notation (EDN) implemented in ABNF
|
139
139
|
test_files: []
|