edn-abnf 0.5.33 → 0.5.36pre1
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-diag-support.rb +51 -15
- data/lib/parser/edngrammar.rb +297 -41
- 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: f549feee42c4a286feacc2cc626e56139e091e7a65dd3f2826f501ff07da6029
|
|
4
|
+
data.tar.gz: bb13aa04a7262d1a6663cd0d97f634606f9110b4dff40aaf1b79ed766e885ce4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4141b3a4ee8d0237b54a8b5c19633b9e9bc821d05b38a68ed8d24253a00366a86d7aba1a6cc154d514d4bdfd60aa20cee997493bf0dbac0d82eab65645ee783
|
|
7
|
+
data.tar.gz: 7f182c39e9d865c23ed0fd4d204dfef437d3ab1a357fcb220536d5cef80ccf1f33f3cb1188e6dbe993151ee4681f14db2fd0ca88ac7a7963617340b996ff4acc
|
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.36pre1"
|
|
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"
|
data/lib/cbor-diag-support.rb
CHANGED
|
@@ -12,7 +12,7 @@ module CBOR
|
|
|
12
12
|
def inspect
|
|
13
13
|
"#<CBOR::Box #{self.class} value=#{value.inspect}, options=#{options.inspect}>"
|
|
14
14
|
end
|
|
15
|
-
def self.
|
|
15
|
+
def self.from_instance(n, options={})
|
|
16
16
|
case n
|
|
17
17
|
when Box
|
|
18
18
|
n.class.new(n.value, n.options.merge(options))
|
|
@@ -20,23 +20,13 @@ module CBOR
|
|
|
20
20
|
Ibox.new(n, options.dup)
|
|
21
21
|
when ::Float
|
|
22
22
|
Fbox.new(n, options.dup)
|
|
23
|
+
when ::String, ::Array, ::Hash, ::CBOR::Tagged
|
|
24
|
+
Xbox.new(n, options.dup)
|
|
23
25
|
else
|
|
24
26
|
raise ArgumentError, "cbor-diagnostic: can't box number from #{n.inspect}':\n"
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
|
-
def to_cbor
|
|
28
|
-
CBOR.encode(value)
|
|
29
|
-
end
|
|
30
|
-
def cbor_diagnostic(opts = {})
|
|
31
|
-
ret = value.cbor_diagnostic(opts)
|
|
32
|
-
if ei = options[:ei]
|
|
33
|
-
ret << "_#{ei}"
|
|
34
|
-
end
|
|
35
|
-
ret
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
29
|
|
|
39
|
-
class Ibox < Box
|
|
40
30
|
INTEGER_EI = {
|
|
41
31
|
"i" => [23, 0],
|
|
42
32
|
"0" => [0xFF, 1],
|
|
@@ -44,7 +34,7 @@ module CBOR
|
|
|
44
34
|
"2" => [0xFFFFFFFF, 4],
|
|
45
35
|
"3" => [0xFFFFFFFFFFFFFFFF, 8]
|
|
46
36
|
}
|
|
47
|
-
def make_head(ib, plusbytes, d)
|
|
37
|
+
def self.make_head(ib, plusbytes, d)
|
|
48
38
|
case plusbytes
|
|
49
39
|
when 0
|
|
50
40
|
[ib + d].pack("C")
|
|
@@ -61,6 +51,52 @@ module CBOR
|
|
|
61
51
|
end
|
|
62
52
|
end
|
|
63
53
|
|
|
54
|
+
def to_cbor
|
|
55
|
+
CBOR.encode(value)
|
|
56
|
+
end
|
|
57
|
+
def cbor_diagnostic(opts = {})
|
|
58
|
+
ret = value.cbor_diagnostic(opts)
|
|
59
|
+
if ei = options[:ei]
|
|
60
|
+
ret << "_#{ei}"
|
|
61
|
+
end
|
|
62
|
+
ret
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class Xbox < Box
|
|
67
|
+
def to_cbor
|
|
68
|
+
enc = CBOR.encode(value)
|
|
69
|
+
if ei = options[:ei]
|
|
70
|
+
maxval, plusbytes = INTEGER_EI[ei]
|
|
71
|
+
if maxval
|
|
72
|
+
ib = enc.getbyte(0) & 0xE0
|
|
73
|
+
ai = enc.getbyte(0) & 0x1F
|
|
74
|
+
d, replacement = case ai
|
|
75
|
+
when 0...24; [ai, 0]
|
|
76
|
+
when 24; [enc[1..1].ord, 1]
|
|
77
|
+
when 25; [enc[1..2].unpack1("n"), 2]
|
|
78
|
+
when 26; [enc[1..4].unpack1("N"), 4]
|
|
79
|
+
when 27; [enc[1..8].unpack1("Q>"), 8]
|
|
80
|
+
# when 31; XXX conflicting EI information
|
|
81
|
+
else raise "unknown additional information #{ai} in ib #{ib}"
|
|
82
|
+
end
|
|
83
|
+
raise ArgumentError, "cbor-diagnostic: #{value} doesn't fit into encoding indicator _#{ei}':\n" unless d <= maxval
|
|
84
|
+
ib = enc.getbyte(0) & 0xE0
|
|
85
|
+
new_head = CBOR::Ibox.make_head(ib, plusbytes, d)
|
|
86
|
+
enc[0..replacement] = new_head
|
|
87
|
+
else
|
|
88
|
+
if ei == "" && value == ""
|
|
89
|
+
enc = CBOR.encode(value.cbor_stream!([]))
|
|
90
|
+
else
|
|
91
|
+
warn "*** cbor-diagnostic: ignoring unsupported encoding indicator _#{ei} for #{value.inspect}"
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
enc
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
class Ibox < Box
|
|
64
100
|
def to_cbor
|
|
65
101
|
if ei = options[:ei]
|
|
66
102
|
maxval, plusbytes = INTEGER_EI[ei]
|
|
@@ -74,7 +110,7 @@ module CBOR
|
|
|
74
110
|
end
|
|
75
111
|
raise ArgumentError, "cbor-diagnostic: #{value} doesn't fit into encoding indicator _#{ei}':\n" unless d <= maxval
|
|
76
112
|
|
|
77
|
-
make_head(ib, plusbytes, d)
|
|
113
|
+
CBOR::Ibox.make_head(ib, plusbytes, d)
|
|
78
114
|
|
|
79
115
|
# s = bignum_to_bytes(d)
|
|
80
116
|
# head(0xc0, TAG_BIGNUM_BASE + (ib >> 5))
|
data/lib/parser/edngrammar.rb
CHANGED
|
@@ -197,10 +197,12 @@ module EDNGRAMMAR
|
|
|
197
197
|
|
|
198
198
|
module String11
|
|
199
199
|
def ast
|
|
200
|
+
val = elements[0].ast
|
|
200
201
|
if ei = spec.text_value[1..-1]
|
|
201
|
-
warn "***
|
|
202
|
+
# warn "*** implementing encoding indicator #{ei.inspect} for #{elements[0].text_value}"
|
|
203
|
+
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
202
204
|
end
|
|
203
|
-
|
|
205
|
+
val
|
|
204
206
|
end
|
|
205
207
|
end
|
|
206
208
|
|
|
@@ -452,7 +454,7 @@ module EDNGRAMMAR
|
|
|
452
454
|
|
|
453
455
|
if ei = spec.text_value[1..-1]
|
|
454
456
|
# warn "*** implementing encoding indicator #{ei.inspect} for #{elements[0].text_value}"
|
|
455
|
-
val = CBOR::Box.
|
|
457
|
+
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
456
458
|
end
|
|
457
459
|
val
|
|
458
460
|
end
|
|
@@ -1800,10 +1802,12 @@ module EDNGRAMMAR
|
|
|
1800
1802
|
|
|
1801
1803
|
module Tagged1
|
|
1802
1804
|
def ast
|
|
1805
|
+
val = CBOR::Tagged.new(uint.text_value.to_i, item.ast)
|
|
1803
1806
|
if ei = spec.text_value[1..-1]
|
|
1804
|
-
|
|
1807
|
+
val = CBOR::Box.from_instance(val, {ei: ei})
|
|
1808
|
+
# warn "*** implementing encoding indicator #{ei.inspect} after tag number #{uint.text_value}"
|
|
1805
1809
|
end
|
|
1806
|
-
|
|
1810
|
+
val
|
|
1807
1811
|
end
|
|
1808
1812
|
end
|
|
1809
1813
|
|
|
@@ -2105,7 +2109,7 @@ module EDNGRAMMAR
|
|
|
2105
2109
|
begin
|
|
2106
2110
|
::EDNGRAMMAR::APPS[app].decode(app, data)
|
|
2107
2111
|
rescue CBOR_DIAG::AppParseError => e
|
|
2108
|
-
app_parser_level1_raw_diagnostics(e,
|
|
2112
|
+
app_parser_level1_raw_diagnostics(e, elements[1].elements[1])
|
|
2109
2113
|
raise e
|
|
2110
2114
|
end
|
|
2111
2115
|
end
|
|
@@ -2144,25 +2148,30 @@ module EDNGRAMMAR
|
|
|
2144
2148
|
end
|
|
2145
2149
|
|
|
2146
2150
|
module Rawstring0
|
|
2147
|
-
def
|
|
2148
|
-
elements[
|
|
2151
|
+
def rawcontent0
|
|
2152
|
+
elements[1]
|
|
2149
2153
|
end
|
|
2150
2154
|
|
|
2155
|
+
end
|
|
2156
|
+
|
|
2157
|
+
module Rawstring1
|
|
2151
2158
|
def rawcontent
|
|
2152
|
-
elements[
|
|
2159
|
+
elements[1]
|
|
2153
2160
|
end
|
|
2161
|
+
end
|
|
2154
2162
|
|
|
2155
|
-
|
|
2156
|
-
|
|
2163
|
+
module Rawstring2
|
|
2164
|
+
def startrawdelim
|
|
2165
|
+
elements[0]
|
|
2166
|
+
end
|
|
2167
|
+
|
|
2168
|
+
def alikerawdelim
|
|
2169
|
+
elements[2]
|
|
2157
2170
|
end
|
|
2158
2171
|
end
|
|
2159
2172
|
|
|
2160
|
-
module
|
|
2161
|
-
def ast
|
|
2162
|
-
rawcontent.text_value.gsub("\r", "") + (
|
|
2163
|
-
tv = matchrawdelim.text_value
|
|
2164
|
-
dv = startrawdelim.text_value.length
|
|
2165
|
-
tv[dv..]) end
|
|
2173
|
+
module Rawstring3
|
|
2174
|
+
def ast; elements[1].elements[1].text_value.gsub("\r", "") end
|
|
2166
2175
|
end
|
|
2167
2176
|
|
|
2168
2177
|
def _nt_rawstring
|
|
@@ -2180,26 +2189,78 @@ module EDNGRAMMAR
|
|
|
2180
2189
|
r1 = _nt_startrawdelim
|
|
2181
2190
|
s0 << r1
|
|
2182
2191
|
if r1
|
|
2183
|
-
|
|
2192
|
+
i2 = index
|
|
2193
|
+
i3, s3 = index, []
|
|
2194
|
+
if (match_len = has_terminal?(" ", false, index))
|
|
2195
|
+
r4 = true
|
|
2196
|
+
@index += match_len
|
|
2197
|
+
else
|
|
2198
|
+
terminal_parse_failure('" "')
|
|
2199
|
+
r4 = nil
|
|
2200
|
+
end
|
|
2201
|
+
s3 << r4
|
|
2202
|
+
if r4
|
|
2203
|
+
r5 = _nt_rawcontent0
|
|
2204
|
+
s3 << r5
|
|
2205
|
+
if r5
|
|
2206
|
+
if (match_len = has_terminal?(" ", false, index))
|
|
2207
|
+
r6 = true
|
|
2208
|
+
@index += match_len
|
|
2209
|
+
else
|
|
2210
|
+
terminal_parse_failure('" "')
|
|
2211
|
+
r6 = nil
|
|
2212
|
+
end
|
|
2213
|
+
s3 << r6
|
|
2214
|
+
end
|
|
2215
|
+
end
|
|
2216
|
+
if s3.last
|
|
2217
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
2218
|
+
r3.extend(Rawstring0)
|
|
2219
|
+
else
|
|
2220
|
+
@index = i3
|
|
2221
|
+
r3 = nil
|
|
2222
|
+
end
|
|
2184
2223
|
if r3
|
|
2224
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2185
2225
|
r2 = r3
|
|
2186
2226
|
else
|
|
2187
|
-
|
|
2227
|
+
i7, s7 = index, []
|
|
2228
|
+
r9 = _nt_newline
|
|
2229
|
+
if r9
|
|
2230
|
+
r8 = r9
|
|
2231
|
+
else
|
|
2232
|
+
r8 = instantiate_node(SyntaxNode,input, index...index)
|
|
2233
|
+
end
|
|
2234
|
+
s7 << r8
|
|
2235
|
+
if r8
|
|
2236
|
+
r10 = _nt_rawcontent
|
|
2237
|
+
s7 << r10
|
|
2238
|
+
end
|
|
2239
|
+
if s7.last
|
|
2240
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
|
2241
|
+
r7.extend(Rawstring1)
|
|
2242
|
+
else
|
|
2243
|
+
@index = i7
|
|
2244
|
+
r7 = nil
|
|
2245
|
+
end
|
|
2246
|
+
if r7
|
|
2247
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
2248
|
+
r2 = r7
|
|
2249
|
+
else
|
|
2250
|
+
@index = i2
|
|
2251
|
+
r2 = nil
|
|
2252
|
+
end
|
|
2188
2253
|
end
|
|
2189
2254
|
s0 << r2
|
|
2190
2255
|
if r2
|
|
2191
|
-
|
|
2192
|
-
s0 <<
|
|
2193
|
-
if r4
|
|
2194
|
-
r5 = _nt_matchrawdelim
|
|
2195
|
-
s0 << r5
|
|
2196
|
-
end
|
|
2256
|
+
r11 = _nt_alikerawdelim
|
|
2257
|
+
s0 << r11
|
|
2197
2258
|
end
|
|
2198
2259
|
end
|
|
2199
2260
|
if s0.last
|
|
2200
2261
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2201
|
-
r0.extend(
|
|
2202
|
-
r0.extend(
|
|
2262
|
+
r0.extend(Rawstring2)
|
|
2263
|
+
r0.extend(Rawstring3)
|
|
2203
2264
|
else
|
|
2204
2265
|
@index = i0
|
|
2205
2266
|
r0 = nil
|
|
@@ -2297,19 +2358,19 @@ module EDNGRAMMAR
|
|
|
2297
2358
|
r0
|
|
2298
2359
|
end
|
|
2299
2360
|
|
|
2300
|
-
module
|
|
2361
|
+
module Alikerawdelim0
|
|
2301
2362
|
def rawdelim
|
|
2302
2363
|
elements[0]
|
|
2303
2364
|
end
|
|
2304
2365
|
|
|
2305
2366
|
end
|
|
2306
2367
|
|
|
2307
|
-
def
|
|
2368
|
+
def _nt_alikerawdelim
|
|
2308
2369
|
start_index = index
|
|
2309
|
-
if node_cache[:
|
|
2310
|
-
cached = node_cache[:
|
|
2370
|
+
if node_cache[:alikerawdelim].has_key?(index)
|
|
2371
|
+
cached = node_cache[:alikerawdelim][index]
|
|
2311
2372
|
if cached
|
|
2312
|
-
node_cache[:
|
|
2373
|
+
node_cache[:alikerawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2313
2374
|
@index = cached.interval.end
|
|
2314
2375
|
end
|
|
2315
2376
|
return cached
|
|
@@ -2320,7 +2381,7 @@ module EDNGRAMMAR
|
|
|
2320
2381
|
s0 << r1
|
|
2321
2382
|
if r1
|
|
2322
2383
|
i2 = index
|
|
2323
|
-
r3 = lambda {|(rd)|rd.text_value.length
|
|
2384
|
+
r3 = lambda {|(rd)|rd.text_value.length == @rawdelimlength}.call(s0)
|
|
2324
2385
|
if !r3
|
|
2325
2386
|
terminal_parse_failure("<semantic predicate>")
|
|
2326
2387
|
end
|
|
@@ -2335,13 +2396,13 @@ module EDNGRAMMAR
|
|
|
2335
2396
|
end
|
|
2336
2397
|
if s0.last
|
|
2337
2398
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2338
|
-
r0.extend(
|
|
2399
|
+
r0.extend(Alikerawdelim0)
|
|
2339
2400
|
else
|
|
2340
2401
|
@index = i0
|
|
2341
2402
|
r0 = nil
|
|
2342
2403
|
end
|
|
2343
2404
|
|
|
2344
|
-
node_cache[:
|
|
2405
|
+
node_cache[:alikerawdelim][start_index] = r0
|
|
2345
2406
|
|
|
2346
2407
|
r0
|
|
2347
2408
|
end
|
|
@@ -2483,6 +2544,94 @@ module EDNGRAMMAR
|
|
|
2483
2544
|
r0
|
|
2484
2545
|
end
|
|
2485
2546
|
|
|
2547
|
+
def _nt_rawchars0
|
|
2548
|
+
start_index = index
|
|
2549
|
+
if node_cache[:rawchars0].has_key?(index)
|
|
2550
|
+
cached = node_cache[:rawchars0][index]
|
|
2551
|
+
if cached
|
|
2552
|
+
node_cache[:rawchars0][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2553
|
+
@index = cached.interval.end
|
|
2554
|
+
end
|
|
2555
|
+
return cached
|
|
2556
|
+
end
|
|
2557
|
+
|
|
2558
|
+
s0, i0 = [], index
|
|
2559
|
+
loop do
|
|
2560
|
+
i1 = index
|
|
2561
|
+
if (match_len = has_terminal?("\n", false, index))
|
|
2562
|
+
r2 = true
|
|
2563
|
+
@index += match_len
|
|
2564
|
+
else
|
|
2565
|
+
terminal_parse_failure('"\\n"')
|
|
2566
|
+
r2 = nil
|
|
2567
|
+
end
|
|
2568
|
+
if r2
|
|
2569
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
2570
|
+
r1 = r2
|
|
2571
|
+
else
|
|
2572
|
+
if (match_len = has_terminal?("\r", false, index))
|
|
2573
|
+
r3 = true
|
|
2574
|
+
@index += match_len
|
|
2575
|
+
else
|
|
2576
|
+
terminal_parse_failure('"\\r"')
|
|
2577
|
+
r3 = nil
|
|
2578
|
+
end
|
|
2579
|
+
if r3
|
|
2580
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2581
|
+
r1 = r3
|
|
2582
|
+
else
|
|
2583
|
+
if has_terminal?(@regexps[gr = '\A[!-_]'] ||= Regexp.new(gr), :regexp, index)
|
|
2584
|
+
r4 = true
|
|
2585
|
+
@index += 1
|
|
2586
|
+
else
|
|
2587
|
+
terminal_parse_failure('[!-_]')
|
|
2588
|
+
r4 = nil
|
|
2589
|
+
end
|
|
2590
|
+
if r4
|
|
2591
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
|
2592
|
+
r1 = r4
|
|
2593
|
+
else
|
|
2594
|
+
if has_terminal?(@regexps[gr = '\A[a-~]'] ||= Regexp.new(gr), :regexp, index)
|
|
2595
|
+
r5 = true
|
|
2596
|
+
@index += 1
|
|
2597
|
+
else
|
|
2598
|
+
terminal_parse_failure('[a-~]')
|
|
2599
|
+
r5 = nil
|
|
2600
|
+
end
|
|
2601
|
+
if r5
|
|
2602
|
+
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
|
2603
|
+
r1 = r5
|
|
2604
|
+
else
|
|
2605
|
+
r6 = _nt_NONASCII
|
|
2606
|
+
if r6
|
|
2607
|
+
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
|
2608
|
+
r1 = r6
|
|
2609
|
+
else
|
|
2610
|
+
@index = i1
|
|
2611
|
+
r1 = nil
|
|
2612
|
+
end
|
|
2613
|
+
end
|
|
2614
|
+
end
|
|
2615
|
+
end
|
|
2616
|
+
end
|
|
2617
|
+
if r1
|
|
2618
|
+
s0 << r1
|
|
2619
|
+
else
|
|
2620
|
+
break
|
|
2621
|
+
end
|
|
2622
|
+
end
|
|
2623
|
+
if s0.empty?
|
|
2624
|
+
@index = i0
|
|
2625
|
+
r0 = nil
|
|
2626
|
+
else
|
|
2627
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2628
|
+
end
|
|
2629
|
+
|
|
2630
|
+
node_cache[:rawchars0][start_index] = r0
|
|
2631
|
+
|
|
2632
|
+
r0
|
|
2633
|
+
end
|
|
2634
|
+
|
|
2486
2635
|
def _nt_rawcontent
|
|
2487
2636
|
start_index = index
|
|
2488
2637
|
if node_cache[:rawcontent].has_key?(index)
|
|
@@ -2529,6 +2678,111 @@ module EDNGRAMMAR
|
|
|
2529
2678
|
r0
|
|
2530
2679
|
end
|
|
2531
2680
|
|
|
2681
|
+
module Rawcontent00
|
|
2682
|
+
def shortrawdelim
|
|
2683
|
+
elements[1]
|
|
2684
|
+
end
|
|
2685
|
+
end
|
|
2686
|
+
|
|
2687
|
+
module Rawcontent01
|
|
2688
|
+
end
|
|
2689
|
+
|
|
2690
|
+
def _nt_rawcontent0
|
|
2691
|
+
start_index = index
|
|
2692
|
+
if node_cache[:rawcontent0].has_key?(index)
|
|
2693
|
+
cached = node_cache[:rawcontent0][index]
|
|
2694
|
+
if cached
|
|
2695
|
+
node_cache[:rawcontent0][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2696
|
+
@index = cached.interval.end
|
|
2697
|
+
end
|
|
2698
|
+
return cached
|
|
2699
|
+
end
|
|
2700
|
+
|
|
2701
|
+
s0, i0 = [], index
|
|
2702
|
+
loop do
|
|
2703
|
+
i1 = index
|
|
2704
|
+
r2 = _nt_rawchars0
|
|
2705
|
+
if r2
|
|
2706
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
|
2707
|
+
r1 = r2
|
|
2708
|
+
else
|
|
2709
|
+
i3, s3 = index, []
|
|
2710
|
+
s4, i4 = [], index
|
|
2711
|
+
loop do
|
|
2712
|
+
r5 = _nt_rawchars
|
|
2713
|
+
if r5
|
|
2714
|
+
s4 << r5
|
|
2715
|
+
else
|
|
2716
|
+
break
|
|
2717
|
+
end
|
|
2718
|
+
end
|
|
2719
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
|
2720
|
+
s3 << r4
|
|
2721
|
+
if r4
|
|
2722
|
+
r6 = _nt_shortrawdelim
|
|
2723
|
+
s3 << r6
|
|
2724
|
+
end
|
|
2725
|
+
if s3.last
|
|
2726
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
|
2727
|
+
r3.extend(Rawcontent00)
|
|
2728
|
+
else
|
|
2729
|
+
@index = i3
|
|
2730
|
+
r3 = nil
|
|
2731
|
+
end
|
|
2732
|
+
if r3
|
|
2733
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2734
|
+
r1 = r3
|
|
2735
|
+
else
|
|
2736
|
+
i7, s7 = index, []
|
|
2737
|
+
if (match_len = has_terminal?(" ", false, index))
|
|
2738
|
+
r8 = true
|
|
2739
|
+
@index += match_len
|
|
2740
|
+
else
|
|
2741
|
+
terminal_parse_failure('" "')
|
|
2742
|
+
r8 = nil
|
|
2743
|
+
end
|
|
2744
|
+
s7 << r8
|
|
2745
|
+
if r8
|
|
2746
|
+
i9 = index
|
|
2747
|
+
r10 = _nt_alikerawdelim
|
|
2748
|
+
if r10
|
|
2749
|
+
@index = i9
|
|
2750
|
+
r9 = nil
|
|
2751
|
+
else
|
|
2752
|
+
@index = i9
|
|
2753
|
+
r9 = instantiate_node(SyntaxNode,input, index...index)
|
|
2754
|
+
end
|
|
2755
|
+
s7 << r9
|
|
2756
|
+
end
|
|
2757
|
+
if s7.last
|
|
2758
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
|
2759
|
+
r7.extend(Rawcontent01)
|
|
2760
|
+
else
|
|
2761
|
+
@index = i7
|
|
2762
|
+
r7 = nil
|
|
2763
|
+
end
|
|
2764
|
+
if r7
|
|
2765
|
+
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
|
2766
|
+
r1 = r7
|
|
2767
|
+
else
|
|
2768
|
+
@index = i1
|
|
2769
|
+
r1 = nil
|
|
2770
|
+
end
|
|
2771
|
+
end
|
|
2772
|
+
end
|
|
2773
|
+
if r1
|
|
2774
|
+
s0 << r1
|
|
2775
|
+
else
|
|
2776
|
+
break
|
|
2777
|
+
end
|
|
2778
|
+
end
|
|
2779
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2780
|
+
|
|
2781
|
+
node_cache[:rawcontent0][start_index] = r0
|
|
2782
|
+
|
|
2783
|
+
r0
|
|
2784
|
+
end
|
|
2785
|
+
|
|
2532
2786
|
module Sqstr0
|
|
2533
2787
|
def SQUOTE1
|
|
2534
2788
|
elements[0]
|
|
@@ -3084,7 +3338,8 @@ module EDNGRAMMAR
|
|
|
3084
3338
|
if ei == ""
|
|
3085
3339
|
r.cbor_stream!
|
|
3086
3340
|
elsif ei
|
|
3087
|
-
|
|
3341
|
+
r = CBOR::Box.from_instance(r, {ei: ei})
|
|
3342
|
+
# warn "*** implementing XXX encoding indicator #{ei.inspect} after ["
|
|
3088
3343
|
end
|
|
3089
3344
|
r
|
|
3090
3345
|
end
|
|
@@ -3271,7 +3526,8 @@ module EDNGRAMMAR
|
|
|
3271
3526
|
if ei == ""
|
|
3272
3527
|
r.cbor_stream!
|
|
3273
3528
|
elsif ei
|
|
3274
|
-
|
|
3529
|
+
r = CBOR::Box.from_instance(r, {ei: ei})
|
|
3530
|
+
# warn "*** implementing encoding indicator #{ei.inspect} after {" # }
|
|
3275
3531
|
end
|
|
3276
3532
|
r
|
|
3277
3533
|
end
|
|
@@ -10417,7 +10673,7 @@ module EDNGRAMMAR
|
|
|
10417
10673
|
elements[0]
|
|
10418
10674
|
end
|
|
10419
10675
|
|
|
10420
|
-
def
|
|
10676
|
+
def alikerawdelim
|
|
10421
10677
|
elements[2]
|
|
10422
10678
|
end
|
|
10423
10679
|
end
|
|
@@ -10554,7 +10810,7 @@ module EDNGRAMMAR
|
|
|
10554
10810
|
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
|
10555
10811
|
s13 << r15
|
|
10556
10812
|
if r15
|
|
10557
|
-
r17 =
|
|
10813
|
+
r17 = _nt_alikerawdelim
|
|
10558
10814
|
s13 << r17
|
|
10559
10815
|
end
|
|
10560
10816
|
end
|
|
@@ -11281,7 +11537,7 @@ module EDNGRAMMAR
|
|
|
11281
11537
|
end
|
|
11282
11538
|
|
|
11283
11539
|
module RAppStringB644
|
|
11284
|
-
def
|
|
11540
|
+
def alikerawdelim
|
|
11285
11541
|
elements[2]
|
|
11286
11542
|
end
|
|
11287
11543
|
end
|
|
@@ -11505,7 +11761,7 @@ module EDNGRAMMAR
|
|
|
11505
11761
|
r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
|
|
11506
11762
|
s26 << r28
|
|
11507
11763
|
if r28
|
|
11508
|
-
r30 =
|
|
11764
|
+
r30 = _nt_alikerawdelim
|
|
11509
11765
|
s26 << r30
|
|
11510
11766
|
end
|
|
11511
11767
|
end
|