edn-abnf 0.5.39 → 0.5.40

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17c5fde6eec17c35da2e94196c5eb582ef05e8586c997c38b989f044460c9a03
4
- data.tar.gz: 964e47d82a247a6b17a0b479a8b2ac1dacf284baa5068a4458938726980de944
3
+ metadata.gz: de28a614a741d47c75211e7ce766b896eebba945650b50064c1396113ebedab5
4
+ data.tar.gz: d41d07de68ab73180ce660292ec6de440611f77053606a4d9288decd833b0190
5
5
  SHA512:
6
- metadata.gz: 1d1b16c8fcc99e5cad651830b0ddb515b1321b2f177951376128fc26fc62fd5afbf1848a119876ad54557042192dea72a679bffc3b4d1bd515bc41b2520c4558
7
- data.tar.gz: 8bc3c115e0b0576c4796d65846064747a7254fd9e9082ca4a99048d3130f485134a8fdd5a40d677a2239b50acb7b3a9d69c69c0a0c52609f43ecbc8a71881a4e
6
+ metadata.gz: 584bd20fd1b50db4a40e8cef5200ad70957e4420cb2c593ea228e309102c4ae25c00632246f411c0bb9046571206239b1360180b5b7d467f9ef0f6eee9ad14f4
7
+ data.tar.gz: e8bdb98fcf3be1ef80d67738154cc4428e8420964e3f3492dcf478c4a95f46fe16663780a1ba6f4065e2caaac66d76c9c8b559e4ef9431f41a080faf346f13b3
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.39"
3
+ s.version = "0.5.40"
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"
@@ -252,12 +252,12 @@ module EDNGRAMMAR
252
252
  r0
253
253
  end
254
254
 
255
- def _nt_string1e
255
+ def _nt_string
256
256
  start_index = index
257
- if node_cache[:string1e].has_key?(index)
258
- cached = node_cache[:string1e][index]
257
+ if node_cache[:string].has_key?(index)
258
+ cached = node_cache[:string][index]
259
259
  if cached
260
- node_cache[:string1e][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
260
+ node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
261
261
  @index = cached.interval.end
262
262
  end
263
263
  return cached
@@ -279,7 +279,7 @@ module EDNGRAMMAR
279
279
  end
280
280
  end
281
281
 
282
- node_cache[:string1e][start_index] = r0
282
+ node_cache[:string][start_index] = r0
283
283
 
284
284
  r0
285
285
  end
@@ -328,120 +328,6 @@ module EDNGRAMMAR
328
328
  r0
329
329
  end
330
330
 
331
- module String0
332
- def S1
333
- elements[0]
334
- end
335
-
336
- def S2
337
- elements[2]
338
- end
339
-
340
- def string1e
341
- elements[3]
342
- end
343
- end
344
-
345
- module String1
346
- def string1e
347
- elements[0]
348
- end
349
-
350
- end
351
-
352
- module String2
353
- def join1(s)
354
- s.join # XXX -- look at encoding and ei
355
- end
356
- def unpack_chunk(c, s)
357
- if c == String
358
- join1(s)
359
- else
360
- unless c == CBOR::Tagged && s.first.tag == 888 && s.first.value == nil # XXX check all values?
361
- raise ArgumentError, "*** unjoinable chunks #{c.inspect} #{s.inspect}" if s.size != 1
362
- end
363
- s.first
364
- end
365
- end
366
- def ast
367
- arr = [elements[0].ast] + elements[1].elements.map {|x| x.elements[3].ast}
368
- charr = arr.chunk(&:class).to_a
369
- if charr.size == 1
370
- unpack_chunk(*charr.first)
371
- else
372
- CBOR::Tagged.new(888, charr.map {|x| unpack_chunk(*x)})
373
- end
374
- end
375
- end
376
-
377
- def _nt_string
378
- start_index = index
379
- if node_cache[:string].has_key?(index)
380
- cached = node_cache[:string][index]
381
- if cached
382
- node_cache[:string][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
383
- @index = cached.interval.end
384
- end
385
- return cached
386
- end
387
-
388
- i0, s0 = index, []
389
- r1 = _nt_string1e
390
- s0 << r1
391
- if r1
392
- s2, i2 = [], index
393
- loop do
394
- i3, s3 = index, []
395
- r4 = _nt_S
396
- s3 << r4
397
- if r4
398
- if (match_len = has_terminal?("+", false, index))
399
- r5 = true
400
- @index += match_len
401
- else
402
- terminal_parse_failure('"+"')
403
- r5 = nil
404
- end
405
- s3 << r5
406
- if r5
407
- r6 = _nt_S
408
- s3 << r6
409
- if r6
410
- r7 = _nt_string1e
411
- s3 << r7
412
- end
413
- end
414
- end
415
- if s3.last
416
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
417
- r3.extend(String0)
418
- else
419
- @index = i3
420
- r3 = nil
421
- end
422
- if r3
423
- s2 << r3
424
- else
425
- break
426
- end
427
- end
428
- r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
429
- s0 << r2
430
- end
431
- if s0.last
432
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
433
- r0.extend(String1)
434
- r0.extend(String2)
435
- else
436
- @index = i0
437
- r0 = nil
438
- end
439
-
440
- node_cache[:string][start_index] = r0
441
-
442
- r0
443
- end
444
-
445
331
  module Number0
446
332
  def spec
447
333
  elements[1]
@@ -2214,30 +2100,30 @@ module EDNGRAMMAR
2214
2100
  end
2215
2101
 
2216
2102
  module Rawstring0
2217
- def rawcontent0
2218
- elements[1]
2103
+ def startrawdelim
2104
+ elements[0]
2219
2105
  end
2220
2106
 
2221
- end
2222
-
2223
- module Rawstring1
2224
- def rawcontent
2107
+ def raw_inner
2225
2108
  elements[1]
2226
2109
  end
2227
- end
2228
-
2229
- module Rawstring2
2230
- def startrawdelim
2231
- elements[0]
2232
- end
2233
2110
 
2234
2111
  def alikerawdelim
2235
2112
  elements[2]
2236
2113
  end
2237
2114
  end
2238
2115
 
2239
- module Rawstring3
2240
- def ast; elements[1].elements[1].text_value.gsub("\r", "") end
2116
+ module Rawstring1
2117
+ def ast
2118
+ val = raw_inner.text_value.gsub("\r", "")
2119
+ if val[0] == ' ' && val[-1] == ' '
2120
+ val[1...-1]
2121
+ elsif val[0] == "\n"
2122
+ val[1..-1]
2123
+ else
2124
+ val
2125
+ end
2126
+ end
2241
2127
  end
2242
2128
 
2243
2129
  def _nt_rawstring
@@ -2255,78 +2141,17 @@ module EDNGRAMMAR
2255
2141
  r1 = _nt_startrawdelim
2256
2142
  s0 << r1
2257
2143
  if r1
2258
- i2 = index
2259
- i3, s3 = index, []
2260
- if (match_len = has_terminal?(" ", false, index))
2261
- r4 = true
2262
- @index += match_len
2263
- else
2264
- terminal_parse_failure('" "')
2265
- r4 = nil
2266
- end
2267
- s3 << r4
2268
- if r4
2269
- r5 = _nt_rawcontent0
2270
- s3 << r5
2271
- if r5
2272
- if (match_len = has_terminal?(" ", false, index))
2273
- r6 = true
2274
- @index += match_len
2275
- else
2276
- terminal_parse_failure('" "')
2277
- r6 = nil
2278
- end
2279
- s3 << r6
2280
- end
2281
- end
2282
- if s3.last
2283
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2284
- r3.extend(Rawstring0)
2285
- else
2286
- @index = i3
2287
- r3 = nil
2288
- end
2289
- if r3
2290
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2291
- r2 = r3
2292
- else
2293
- i7, s7 = index, []
2294
- r9 = _nt_newline
2295
- if r9
2296
- r8 = r9
2297
- else
2298
- r8 = instantiate_node(SyntaxNode,input, index...index)
2299
- end
2300
- s7 << r8
2301
- if r8
2302
- r10 = _nt_rawcontent
2303
- s7 << r10
2304
- end
2305
- if s7.last
2306
- r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
2307
- r7.extend(Rawstring1)
2308
- else
2309
- @index = i7
2310
- r7 = nil
2311
- end
2312
- if r7
2313
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
2314
- r2 = r7
2315
- else
2316
- @index = i2
2317
- r2 = nil
2318
- end
2319
- end
2144
+ r2 = _nt_raw_inner
2320
2145
  s0 << r2
2321
2146
  if r2
2322
- r11 = _nt_alikerawdelim
2323
- s0 << r11
2147
+ r3 = _nt_alikerawdelim
2148
+ s0 << r3
2324
2149
  end
2325
2150
  end
2326
2151
  if s0.last
2327
2152
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2328
- r0.extend(Rawstring2)
2329
- r0.extend(Rawstring3)
2153
+ r0.extend(Rawstring0)
2154
+ r0.extend(Rawstring1)
2330
2155
  else
2331
2156
  @index = i0
2332
2157
  r0 = nil
@@ -2610,100 +2435,12 @@ module EDNGRAMMAR
2610
2435
  r0
2611
2436
  end
2612
2437
 
2613
- def _nt_rawchars0
2614
- start_index = index
2615
- if node_cache[:rawchars0].has_key?(index)
2616
- cached = node_cache[:rawchars0][index]
2617
- if cached
2618
- node_cache[:rawchars0][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2619
- @index = cached.interval.end
2620
- end
2621
- return cached
2622
- end
2623
-
2624
- s0, i0 = [], index
2625
- loop do
2626
- i1 = index
2627
- if (match_len = has_terminal?("\n", false, index))
2628
- r2 = true
2629
- @index += match_len
2630
- else
2631
- terminal_parse_failure('"\\n"')
2632
- r2 = nil
2633
- end
2634
- if r2
2635
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2636
- r1 = r2
2637
- else
2638
- if (match_len = has_terminal?("\r", false, index))
2639
- r3 = true
2640
- @index += match_len
2641
- else
2642
- terminal_parse_failure('"\\r"')
2643
- r3 = nil
2644
- end
2645
- if r3
2646
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2647
- r1 = r3
2648
- else
2649
- if has_terminal?(@regexps[gr = '\A[!-_]'] ||= Regexp.new(gr), :regexp, index)
2650
- r4 = true
2651
- @index += 1
2652
- else
2653
- terminal_parse_failure('[!-_]')
2654
- r4 = nil
2655
- end
2656
- if r4
2657
- r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
2658
- r1 = r4
2659
- else
2660
- if has_terminal?(@regexps[gr = '\A[a-~]'] ||= Regexp.new(gr), :regexp, index)
2661
- r5 = true
2662
- @index += 1
2663
- else
2664
- terminal_parse_failure('[a-~]')
2665
- r5 = nil
2666
- end
2667
- if r5
2668
- r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
2669
- r1 = r5
2670
- else
2671
- r6 = _nt_NONASCII
2672
- if r6
2673
- r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
2674
- r1 = r6
2675
- else
2676
- @index = i1
2677
- r1 = nil
2678
- end
2679
- end
2680
- end
2681
- end
2682
- end
2683
- if r1
2684
- s0 << r1
2685
- else
2686
- break
2687
- end
2688
- end
2689
- if s0.empty?
2690
- @index = i0
2691
- r0 = nil
2692
- else
2693
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2694
- end
2695
-
2696
- node_cache[:rawchars0][start_index] = r0
2697
-
2698
- r0
2699
- end
2700
-
2701
- def _nt_rawcontent
2438
+ def _nt_raw_inner
2702
2439
  start_index = index
2703
- if node_cache[:rawcontent].has_key?(index)
2704
- cached = node_cache[:rawcontent][index]
2440
+ if node_cache[:raw_inner].has_key?(index)
2441
+ cached = node_cache[:raw_inner][index]
2705
2442
  if cached
2706
- node_cache[:rawcontent][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2443
+ node_cache[:raw_inner][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2707
2444
  @index = cached.interval.end
2708
2445
  end
2709
2446
  return cached
@@ -2739,112 +2476,7 @@ module EDNGRAMMAR
2739
2476
  r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2740
2477
  end
2741
2478
 
2742
- node_cache[:rawcontent][start_index] = r0
2743
-
2744
- r0
2745
- end
2746
-
2747
- module Rawcontent00
2748
- def shortrawdelim
2749
- elements[1]
2750
- end
2751
- end
2752
-
2753
- module Rawcontent01
2754
- end
2755
-
2756
- def _nt_rawcontent0
2757
- start_index = index
2758
- if node_cache[:rawcontent0].has_key?(index)
2759
- cached = node_cache[:rawcontent0][index]
2760
- if cached
2761
- node_cache[:rawcontent0][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
2762
- @index = cached.interval.end
2763
- end
2764
- return cached
2765
- end
2766
-
2767
- s0, i0 = [], index
2768
- loop do
2769
- i1 = index
2770
- r2 = _nt_rawchars0
2771
- if r2
2772
- r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
2773
- r1 = r2
2774
- else
2775
- i3, s3 = index, []
2776
- s4, i4 = [], index
2777
- loop do
2778
- r5 = _nt_rawchars
2779
- if r5
2780
- s4 << r5
2781
- else
2782
- break
2783
- end
2784
- end
2785
- r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
2786
- s3 << r4
2787
- if r4
2788
- r6 = _nt_shortrawdelim
2789
- s3 << r6
2790
- end
2791
- if s3.last
2792
- r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
2793
- r3.extend(Rawcontent00)
2794
- else
2795
- @index = i3
2796
- r3 = nil
2797
- end
2798
- if r3
2799
- r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
2800
- r1 = r3
2801
- else
2802
- i7, s7 = index, []
2803
- if (match_len = has_terminal?(" ", false, index))
2804
- r8 = true
2805
- @index += match_len
2806
- else
2807
- terminal_parse_failure('" "')
2808
- r8 = nil
2809
- end
2810
- s7 << r8
2811
- if r8
2812
- i9 = index
2813
- r10 = _nt_alikerawdelim
2814
- if r10
2815
- @index = i9
2816
- r9 = nil
2817
- else
2818
- @index = i9
2819
- r9 = instantiate_node(SyntaxNode,input, index...index)
2820
- end
2821
- s7 << r9
2822
- end
2823
- if s7.last
2824
- r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
2825
- r7.extend(Rawcontent01)
2826
- else
2827
- @index = i7
2828
- r7 = nil
2829
- end
2830
- if r7
2831
- r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
2832
- r1 = r7
2833
- else
2834
- @index = i1
2835
- r1 = nil
2836
- end
2837
- end
2838
- end
2839
- if r1
2840
- s0 << r1
2841
- else
2842
- break
2843
- end
2844
- end
2845
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
2846
-
2847
- node_cache[:rawcontent0][start_index] = r0
2479
+ node_cache[:raw_inner][start_index] = r0
2848
2480
 
2849
2481
  r0
2850
2482
  end
@@ -10030,55 +9662,6 @@ module EDNGRAMMAR
10030
9662
  r0
10031
9663
  end
10032
9664
 
10033
- module Fitrawdelim0
10034
- def rawdelim
10035
- elements[0]
10036
- end
10037
-
10038
- end
10039
-
10040
- def _nt_fitrawdelim
10041
- start_index = index
10042
- if node_cache[:fitrawdelim].has_key?(index)
10043
- cached = node_cache[:fitrawdelim][index]
10044
- if cached
10045
- node_cache[:fitrawdelim][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
10046
- @index = cached.interval.end
10047
- end
10048
- return cached
10049
- end
10050
-
10051
- i0, s0 = index, []
10052
- r1 = _nt_rawdelim
10053
- s0 << r1
10054
- if r1
10055
- i2 = index
10056
- r3 = lambda {|(rd)|rd.text_value.length == @rawdelimlength}.call(s0)
10057
- if !r3
10058
- terminal_parse_failure("<semantic predicate>")
10059
- end
10060
- if r3
10061
- @index = i2
10062
- r2 = instantiate_node(SyntaxNode,input, index...index)
10063
- else
10064
- @index = i2
10065
- r2 = nil
10066
- end
10067
- s0 << r2
10068
- end
10069
- if s0.last
10070
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
10071
- r0.extend(Fitrawdelim0)
10072
- else
10073
- @index = i0
10074
- r0 = nil
10075
- end
10076
-
10077
- node_cache[:fitrawdelim][start_index] = r0
10078
-
10079
- r0
10080
- end
10081
-
10082
9665
  module RhS0
10083
9666
  def rh_comment
10084
9667
  elements[0]
@@ -10744,9 +10327,6 @@ module EDNGRAMMAR
10744
10327
  elements[0]
10745
10328
  end
10746
10329
 
10747
- def alikerawdelim
10748
- elements[2]
10749
- end
10750
10330
  end
10751
10331
 
10752
10332
  module RAppStringH5
@@ -10754,6 +10334,9 @@ module EDNGRAMMAR
10754
10334
  elements[0]
10755
10335
  end
10756
10336
 
10337
+ def alikerawdelim
10338
+ elements[3]
10339
+ end
10757
10340
  end
10758
10341
 
10759
10342
  module RAppStringH6
@@ -10864,7 +10447,6 @@ module EDNGRAMMAR
10864
10447
  r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
10865
10448
  s0 << r2
10866
10449
  if r2
10867
- i12 = index
10868
10450
  i13, s13 = index, []
10869
10451
  r14 = _nt_eol_comment
10870
10452
  s13 << r14
@@ -10880,10 +10462,6 @@ module EDNGRAMMAR
10880
10462
  end
10881
10463
  r15 = instantiate_node(SyntaxNode,input, i15...index, s15)
10882
10464
  s13 << r15
10883
- if r15
10884
- r17 = _nt_alikerawdelim
10885
- s13 << r17
10886
- end
10887
10465
  end
10888
10466
  if s13.last
10889
10467
  r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
@@ -10893,19 +10471,15 @@ module EDNGRAMMAR
10893
10471
  r13 = nil
10894
10472
  end
10895
10473
  if r13
10896
- r13 = SyntaxNode.new(input, (index-1)...index) if r13 == true
10897
10474
  r12 = r13
10898
10475
  else
10899
- r18 = _nt_fitrawdelim
10900
- if r18
10901
- r18 = SyntaxNode.new(input, (index-1)...index) if r18 == true
10902
- r12 = r18
10903
- else
10904
- @index = i12
10905
- r12 = nil
10906
- end
10476
+ r12 = instantiate_node(SyntaxNode,input, index...index)
10907
10477
  end
10908
10478
  s0 << r12
10479
+ if r12
10480
+ r17 = _nt_alikerawdelim
10481
+ s0 << r17
10482
+ end
10909
10483
  end
10910
10484
  end
10911
10485
  if s0.last
@@ -11608,9 +11182,6 @@ module EDNGRAMMAR
11608
11182
  end
11609
11183
 
11610
11184
  module RAppStringB644
11611
- def alikerawdelim
11612
- elements[2]
11613
- end
11614
11185
  end
11615
11186
 
11616
11187
  module RAppStringB645
@@ -11618,9 +11189,13 @@ module EDNGRAMMAR
11618
11189
  elements[0]
11619
11190
  end
11620
11191
 
11192
+ def alikerawdelim
11193
+ elements[4]
11194
+ end
11621
11195
  end
11622
11196
 
11623
11197
  module RAppStringB646
11198
+
11624
11199
  def ast
11625
11200
  v = elements[0..2].map {|part| part.text_value}.join
11626
11201
  t = v.gsub(/\s|#[^\n]*(?:\n|\z)/, '').chars.each_slice(4).map(&:join)
@@ -11809,7 +11384,6 @@ module EDNGRAMMAR
11809
11384
  end
11810
11385
  s0 << r7
11811
11386
  if r7
11812
- i25 = index
11813
11387
  i26, s26 = index, []
11814
11388
  if (match_len = has_terminal?("#", false, index))
11815
11389
  r27 = true
@@ -11831,10 +11405,6 @@ module EDNGRAMMAR
11831
11405
  end
11832
11406
  r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
11833
11407
  s26 << r28
11834
- if r28
11835
- r30 = _nt_alikerawdelim
11836
- s26 << r30
11837
- end
11838
11408
  end
11839
11409
  if s26.last
11840
11410
  r26 = instantiate_node(SyntaxNode,input, i26...index, s26)
@@ -11844,19 +11414,15 @@ module EDNGRAMMAR
11844
11414
  r26 = nil
11845
11415
  end
11846
11416
  if r26
11847
- r26 = SyntaxNode.new(input, (index-1)...index) if r26 == true
11848
11417
  r25 = r26
11849
11418
  else
11850
- r31 = _nt_fitrawdelim
11851
- if r31
11852
- r31 = SyntaxNode.new(input, (index-1)...index) if r31 == true
11853
- r25 = r31
11854
- else
11855
- @index = i25
11856
- r25 = nil
11857
- end
11419
+ r25 = instantiate_node(SyntaxNode,input, index...index)
11858
11420
  end
11859
11421
  s0 << r25
11422
+ if r25
11423
+ r30 = _nt_alikerawdelim
11424
+ s0 << r30
11425
+ end
11860
11426
  end
11861
11427
  end
11862
11428
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edn-abnf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.39
4
+ version: 0.5.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann