edn-abnf 0.0.6 → 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 +224 -43
- metadata +1 -1
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
@@ -1931,19 +1931,31 @@ module EDNGRAMMAR
|
|
1931
1931
|
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
1932
1932
|
r0 = r2
|
1933
1933
|
else
|
1934
|
-
if has_terminal?(@regexps[gr = '\A[0
|
1934
|
+
if has_terminal?(@regexps[gr = '\A[0-]'] ||= Regexp.new(gr), :regexp, index)
|
1935
1935
|
r3 = true
|
1936
1936
|
@index += 1
|
1937
1937
|
else
|
1938
|
-
terminal_parse_failure('[0
|
1938
|
+
terminal_parse_failure('[0-]')
|
1939
1939
|
r3 = nil
|
1940
1940
|
end
|
1941
1941
|
if r3
|
1942
1942
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
1943
1943
|
r0 = r3
|
1944
1944
|
else
|
1945
|
-
@
|
1946
|
-
|
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
|
1947
1959
|
end
|
1948
1960
|
end
|
1949
1961
|
end
|
@@ -1953,7 +1965,79 @@ module EDNGRAMMAR
|
|
1953
1965
|
r0
|
1954
1966
|
end
|
1955
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
|
+
|
1956
2036
|
module S0
|
2037
|
+
def comment
|
2038
|
+
elements[0]
|
2039
|
+
end
|
2040
|
+
|
1957
2041
|
end
|
1958
2042
|
|
1959
2043
|
module S1
|
@@ -1986,18 +2070,12 @@ module EDNGRAMMAR
|
|
1986
2070
|
s3, i3 = [], index
|
1987
2071
|
loop do
|
1988
2072
|
i4, s4 = index, []
|
1989
|
-
|
1990
|
-
r5 = true
|
1991
|
-
@index += match_len
|
1992
|
-
else
|
1993
|
-
terminal_parse_failure('"/"')
|
1994
|
-
r5 = nil
|
1995
|
-
end
|
2073
|
+
r5 = _nt_comment
|
1996
2074
|
s4 << r5
|
1997
2075
|
if r5
|
1998
2076
|
s6, i6 = [], index
|
1999
2077
|
loop do
|
2000
|
-
r7 =
|
2078
|
+
r7 = _nt_blank
|
2001
2079
|
if r7
|
2002
2080
|
s6 << r7
|
2003
2081
|
else
|
@@ -2006,29 +2084,6 @@ module EDNGRAMMAR
|
|
2006
2084
|
end
|
2007
2085
|
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
2008
2086
|
s4 << r6
|
2009
|
-
if r6
|
2010
|
-
if (match_len = has_terminal?("/", false, index))
|
2011
|
-
r8 = true
|
2012
|
-
@index += match_len
|
2013
|
-
else
|
2014
|
-
terminal_parse_failure('"/"')
|
2015
|
-
r8 = nil
|
2016
|
-
end
|
2017
|
-
s4 << r8
|
2018
|
-
if r8
|
2019
|
-
s9, i9 = [], index
|
2020
|
-
loop do
|
2021
|
-
r10 = _nt_blank
|
2022
|
-
if r10
|
2023
|
-
s9 << r10
|
2024
|
-
else
|
2025
|
-
break
|
2026
|
-
end
|
2027
|
-
end
|
2028
|
-
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
2029
|
-
s4 << r9
|
2030
|
-
end
|
2031
|
-
end
|
2032
2087
|
end
|
2033
2088
|
if s4.last
|
2034
2089
|
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
@@ -2059,6 +2114,120 @@ module EDNGRAMMAR
|
|
2059
2114
|
r0
|
2060
2115
|
end
|
2061
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
|
+
|
2062
2231
|
module OC0
|
2063
2232
|
def S
|
2064
2233
|
elements[1]
|
@@ -2145,7 +2314,7 @@ module EDNGRAMMAR
|
|
2145
2314
|
elements[1]
|
2146
2315
|
end
|
2147
2316
|
|
2148
|
-
def
|
2317
|
+
def bstr
|
2149
2318
|
elements[2]
|
2150
2319
|
end
|
2151
2320
|
|
@@ -2159,7 +2328,7 @@ module EDNGRAMMAR
|
|
2159
2328
|
elements[1]
|
2160
2329
|
end
|
2161
2330
|
|
2162
|
-
def
|
2331
|
+
def bstr
|
2163
2332
|
elements[2]
|
2164
2333
|
end
|
2165
2334
|
|
@@ -2284,7 +2453,7 @@ module EDNGRAMMAR
|
|
2284
2453
|
r16 = _nt_spec1
|
2285
2454
|
s14 << r16
|
2286
2455
|
if r16
|
2287
|
-
r17 =
|
2456
|
+
r17 = _nt_bstr
|
2288
2457
|
s14 << r17
|
2289
2458
|
if r17
|
2290
2459
|
r18 = _nt_S
|
@@ -2305,7 +2474,7 @@ module EDNGRAMMAR
|
|
2305
2474
|
r22 = _nt_S
|
2306
2475
|
s20 << r22
|
2307
2476
|
if r22
|
2308
|
-
r23 =
|
2477
|
+
r23 = _nt_bstr
|
2309
2478
|
s20 << r23
|
2310
2479
|
if r23
|
2311
2480
|
r24 = _nt_S
|
@@ -3485,19 +3654,31 @@ module EDNGRAMMAR
|
|
3485
3654
|
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
3486
3655
|
r0 = r5
|
3487
3656
|
else
|
3488
|
-
if has_terminal?(@regexps[gr = '\A[\\]
|
3657
|
+
if has_terminal?(@regexps[gr = '\A[\\]-]'] ||= Regexp.new(gr), :regexp, index)
|
3489
3658
|
r6 = true
|
3490
3659
|
@index += 1
|
3491
3660
|
else
|
3492
|
-
terminal_parse_failure('[\\]
|
3661
|
+
terminal_parse_failure('[\\]-]')
|
3493
3662
|
r6 = nil
|
3494
3663
|
end
|
3495
3664
|
if r6
|
3496
3665
|
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
3497
3666
|
r0 = r6
|
3498
3667
|
else
|
3499
|
-
@
|
3500
|
-
|
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
|
3501
3682
|
end
|
3502
3683
|
end
|
3503
3684
|
end
|