edn-abnf 0.5.35 → 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/parser/edngrammar.rb +284 -34
- 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/parser/edngrammar.rb
CHANGED
|
@@ -2109,7 +2109,7 @@ module EDNGRAMMAR
|
|
|
2109
2109
|
begin
|
|
2110
2110
|
::EDNGRAMMAR::APPS[app].decode(app, data)
|
|
2111
2111
|
rescue CBOR_DIAG::AppParseError => e
|
|
2112
|
-
app_parser_level1_raw_diagnostics(e,
|
|
2112
|
+
app_parser_level1_raw_diagnostics(e, elements[1].elements[1])
|
|
2113
2113
|
raise e
|
|
2114
2114
|
end
|
|
2115
2115
|
end
|
|
@@ -2148,25 +2148,30 @@ module EDNGRAMMAR
|
|
|
2148
2148
|
end
|
|
2149
2149
|
|
|
2150
2150
|
module Rawstring0
|
|
2151
|
-
def
|
|
2152
|
-
elements[
|
|
2151
|
+
def rawcontent0
|
|
2152
|
+
elements[1]
|
|
2153
2153
|
end
|
|
2154
2154
|
|
|
2155
|
+
end
|
|
2156
|
+
|
|
2157
|
+
module Rawstring1
|
|
2155
2158
|
def rawcontent
|
|
2156
|
-
elements[
|
|
2159
|
+
elements[1]
|
|
2157
2160
|
end
|
|
2161
|
+
end
|
|
2158
2162
|
|
|
2159
|
-
|
|
2160
|
-
|
|
2163
|
+
module Rawstring2
|
|
2164
|
+
def startrawdelim
|
|
2165
|
+
elements[0]
|
|
2166
|
+
end
|
|
2167
|
+
|
|
2168
|
+
def alikerawdelim
|
|
2169
|
+
elements[2]
|
|
2161
2170
|
end
|
|
2162
2171
|
end
|
|
2163
2172
|
|
|
2164
|
-
module
|
|
2165
|
-
def ast
|
|
2166
|
-
rawcontent.text_value.gsub("\r", "") + (
|
|
2167
|
-
tv = matchrawdelim.text_value
|
|
2168
|
-
dv = startrawdelim.text_value.length
|
|
2169
|
-
tv[dv..]) end
|
|
2173
|
+
module Rawstring3
|
|
2174
|
+
def ast; elements[1].elements[1].text_value.gsub("\r", "") end
|
|
2170
2175
|
end
|
|
2171
2176
|
|
|
2172
2177
|
def _nt_rawstring
|
|
@@ -2184,26 +2189,78 @@ module EDNGRAMMAR
|
|
|
2184
2189
|
r1 = _nt_startrawdelim
|
|
2185
2190
|
s0 << r1
|
|
2186
2191
|
if r1
|
|
2187
|
-
|
|
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
|
|
2188
2223
|
if r3
|
|
2224
|
+
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
|
2189
2225
|
r2 = r3
|
|
2190
2226
|
else
|
|
2191
|
-
|
|
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
|
|
2192
2253
|
end
|
|
2193
2254
|
s0 << r2
|
|
2194
2255
|
if r2
|
|
2195
|
-
|
|
2196
|
-
s0 <<
|
|
2197
|
-
if r4
|
|
2198
|
-
r5 = _nt_matchrawdelim
|
|
2199
|
-
s0 << r5
|
|
2200
|
-
end
|
|
2256
|
+
r11 = _nt_alikerawdelim
|
|
2257
|
+
s0 << r11
|
|
2201
2258
|
end
|
|
2202
2259
|
end
|
|
2203
2260
|
if s0.last
|
|
2204
2261
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2205
|
-
r0.extend(
|
|
2206
|
-
r0.extend(
|
|
2262
|
+
r0.extend(Rawstring2)
|
|
2263
|
+
r0.extend(Rawstring3)
|
|
2207
2264
|
else
|
|
2208
2265
|
@index = i0
|
|
2209
2266
|
r0 = nil
|
|
@@ -2301,19 +2358,19 @@ module EDNGRAMMAR
|
|
|
2301
2358
|
r0
|
|
2302
2359
|
end
|
|
2303
2360
|
|
|
2304
|
-
module
|
|
2361
|
+
module Alikerawdelim0
|
|
2305
2362
|
def rawdelim
|
|
2306
2363
|
elements[0]
|
|
2307
2364
|
end
|
|
2308
2365
|
|
|
2309
2366
|
end
|
|
2310
2367
|
|
|
2311
|
-
def
|
|
2368
|
+
def _nt_alikerawdelim
|
|
2312
2369
|
start_index = index
|
|
2313
|
-
if node_cache[:
|
|
2314
|
-
cached = node_cache[:
|
|
2370
|
+
if node_cache[:alikerawdelim].has_key?(index)
|
|
2371
|
+
cached = node_cache[:alikerawdelim][index]
|
|
2315
2372
|
if cached
|
|
2316
|
-
node_cache[:
|
|
2373
|
+
node_cache[:alikerawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
|
2317
2374
|
@index = cached.interval.end
|
|
2318
2375
|
end
|
|
2319
2376
|
return cached
|
|
@@ -2324,7 +2381,7 @@ module EDNGRAMMAR
|
|
|
2324
2381
|
s0 << r1
|
|
2325
2382
|
if r1
|
|
2326
2383
|
i2 = index
|
|
2327
|
-
r3 = lambda {|(rd)|rd.text_value.length
|
|
2384
|
+
r3 = lambda {|(rd)|rd.text_value.length == @rawdelimlength}.call(s0)
|
|
2328
2385
|
if !r3
|
|
2329
2386
|
terminal_parse_failure("<semantic predicate>")
|
|
2330
2387
|
end
|
|
@@ -2339,13 +2396,13 @@ module EDNGRAMMAR
|
|
|
2339
2396
|
end
|
|
2340
2397
|
if s0.last
|
|
2341
2398
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
|
2342
|
-
r0.extend(
|
|
2399
|
+
r0.extend(Alikerawdelim0)
|
|
2343
2400
|
else
|
|
2344
2401
|
@index = i0
|
|
2345
2402
|
r0 = nil
|
|
2346
2403
|
end
|
|
2347
2404
|
|
|
2348
|
-
node_cache[:
|
|
2405
|
+
node_cache[:alikerawdelim][start_index] = r0
|
|
2349
2406
|
|
|
2350
2407
|
r0
|
|
2351
2408
|
end
|
|
@@ -2487,6 +2544,94 @@ module EDNGRAMMAR
|
|
|
2487
2544
|
r0
|
|
2488
2545
|
end
|
|
2489
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
|
+
|
|
2490
2635
|
def _nt_rawcontent
|
|
2491
2636
|
start_index = index
|
|
2492
2637
|
if node_cache[:rawcontent].has_key?(index)
|
|
@@ -2533,6 +2678,111 @@ module EDNGRAMMAR
|
|
|
2533
2678
|
r0
|
|
2534
2679
|
end
|
|
2535
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
|
+
|
|
2536
2786
|
module Sqstr0
|
|
2537
2787
|
def SQUOTE1
|
|
2538
2788
|
elements[0]
|
|
@@ -10423,7 +10673,7 @@ module EDNGRAMMAR
|
|
|
10423
10673
|
elements[0]
|
|
10424
10674
|
end
|
|
10425
10675
|
|
|
10426
|
-
def
|
|
10676
|
+
def alikerawdelim
|
|
10427
10677
|
elements[2]
|
|
10428
10678
|
end
|
|
10429
10679
|
end
|
|
@@ -10560,7 +10810,7 @@ module EDNGRAMMAR
|
|
|
10560
10810
|
r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
|
|
10561
10811
|
s13 << r15
|
|
10562
10812
|
if r15
|
|
10563
|
-
r17 =
|
|
10813
|
+
r17 = _nt_alikerawdelim
|
|
10564
10814
|
s13 << r17
|
|
10565
10815
|
end
|
|
10566
10816
|
end
|
|
@@ -11287,7 +11537,7 @@ module EDNGRAMMAR
|
|
|
11287
11537
|
end
|
|
11288
11538
|
|
|
11289
11539
|
module RAppStringB644
|
|
11290
|
-
def
|
|
11540
|
+
def alikerawdelim
|
|
11291
11541
|
elements[2]
|
|
11292
11542
|
end
|
|
11293
11543
|
end
|
|
@@ -11511,7 +11761,7 @@ module EDNGRAMMAR
|
|
|
11511
11761
|
r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
|
|
11512
11762
|
s26 << r28
|
|
11513
11763
|
if r28
|
|
11514
|
-
r30 =
|
|
11764
|
+
r30 = _nt_alikerawdelim
|
|
11515
11765
|
s26 << r30
|
|
11516
11766
|
end
|
|
11517
11767
|
end
|