cbor-diag 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-diag-parser.rb +70 -112
- data/lib/cbor-pure.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b9e87624d0c6106d5a65be87ee3189f401f65064e938e0400456245bcb15e9
|
4
|
+
data.tar.gz: 987e5878c4106c5d3165e493313291588feaa7c9ed45a6496eca29f4a77ad768
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ddabdc1262691e8d13bbe1e08a391592454bb5d05d6b475053a7a4f5f8b9a8e0351552f1fe08c3911d4deab7322b4dee80e44d21d163924872eca439b20f6ef
|
7
|
+
data.tar.gz: 92ec952d61e7ade12ddb663040fabab0826e4d47f51ecf1a20f72521e33d2929cc1fb7d8c4827849ef578a5a76d4bba11da8353c8e115acbe9780ae8119e328d
|
data/cbor-diag.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cbor-diag"
|
3
|
-
s.version = "0.8.
|
3
|
+
s.version = "0.8.6"
|
4
4
|
s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
|
5
5
|
s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742}
|
6
6
|
s.author = "Carsten Bormann"
|
data/lib/cbor-diag-parser.rb
CHANGED
@@ -2146,23 +2146,21 @@ module CBOR_DIAG
|
|
2146
2146
|
end
|
2147
2147
|
|
2148
2148
|
module Embedded0
|
2149
|
-
def text
|
2150
|
-
elements[0]
|
2151
|
-
end
|
2152
|
-
|
2153
|
-
end
|
2154
|
-
|
2155
|
-
module Embedded1
|
2156
2149
|
def s
|
2157
2150
|
elements[1]
|
2158
2151
|
end
|
2159
2152
|
|
2160
2153
|
end
|
2161
2154
|
|
2162
|
-
module
|
2155
|
+
module Embedded1
|
2163
2156
|
def to_rb
|
2164
|
-
if se = s
|
2165
|
-
|
2157
|
+
if se = s
|
2158
|
+
sn = se.to_rb
|
2159
|
+
if CBOR::Sequence === sn
|
2160
|
+
sn.to_cborseq
|
2161
|
+
else
|
2162
|
+
CBOR.encode(sn)
|
2163
|
+
end
|
2166
2164
|
else
|
2167
2165
|
"".b
|
2168
2166
|
end
|
@@ -2190,29 +2188,7 @@ module CBOR_DIAG
|
|
2190
2188
|
end
|
2191
2189
|
s0 << r1
|
2192
2190
|
if r1
|
2193
|
-
|
2194
|
-
r4 = _nt_text
|
2195
|
-
s3 << r4
|
2196
|
-
if r4
|
2197
|
-
s5, i5 = [], index
|
2198
|
-
loop do
|
2199
|
-
r6 = _nt_emb1
|
2200
|
-
if r6
|
2201
|
-
s5 << r6
|
2202
|
-
else
|
2203
|
-
break
|
2204
|
-
end
|
2205
|
-
end
|
2206
|
-
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
2207
|
-
s3 << r5
|
2208
|
-
end
|
2209
|
-
if s3.last
|
2210
|
-
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
2211
|
-
r3.extend(Embedded0)
|
2212
|
-
else
|
2213
|
-
@index = i3
|
2214
|
-
r3 = nil
|
2215
|
-
end
|
2191
|
+
r3 = _nt_text
|
2216
2192
|
if r3
|
2217
2193
|
r2 = r3
|
2218
2194
|
else
|
@@ -2221,19 +2197,19 @@ module CBOR_DIAG
|
|
2221
2197
|
s0 << r2
|
2222
2198
|
if r2
|
2223
2199
|
if (match_len = has_terminal?(">>", false, index))
|
2224
|
-
|
2200
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
2225
2201
|
@index += match_len
|
2226
2202
|
else
|
2227
2203
|
terminal_parse_failure('">>"')
|
2228
|
-
|
2204
|
+
r4 = nil
|
2229
2205
|
end
|
2230
|
-
s0 <<
|
2206
|
+
s0 << r4
|
2231
2207
|
end
|
2232
2208
|
end
|
2233
2209
|
if s0.last
|
2234
2210
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2211
|
+
r0.extend(Embedded0)
|
2235
2212
|
r0.extend(Embedded1)
|
2236
|
-
r0.extend(Embedded2)
|
2237
2213
|
else
|
2238
2214
|
@index = i0
|
2239
2215
|
r0 = nil
|
@@ -2244,56 +2220,6 @@ module CBOR_DIAG
|
|
2244
2220
|
r0
|
2245
2221
|
end
|
2246
2222
|
|
2247
|
-
module Emb10
|
2248
|
-
def s
|
2249
|
-
elements[1]
|
2250
|
-
end
|
2251
|
-
end
|
2252
|
-
|
2253
|
-
module Emb11
|
2254
|
-
def to_rb
|
2255
|
-
s.to_rb
|
2256
|
-
end
|
2257
|
-
end
|
2258
|
-
|
2259
|
-
def _nt_emb1
|
2260
|
-
start_index = index
|
2261
|
-
if node_cache[:emb1].has_key?(index)
|
2262
|
-
cached = node_cache[:emb1][index]
|
2263
|
-
if cached
|
2264
|
-
node_cache[:emb1][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2265
|
-
@index = cached.interval.end
|
2266
|
-
end
|
2267
|
-
return cached
|
2268
|
-
end
|
2269
|
-
|
2270
|
-
i0, s0 = index, []
|
2271
|
-
if (match_len = has_terminal?(",", false, index))
|
2272
|
-
r1 = true
|
2273
|
-
@index += match_len
|
2274
|
-
else
|
2275
|
-
terminal_parse_failure('","')
|
2276
|
-
r1 = nil
|
2277
|
-
end
|
2278
|
-
s0 << r1
|
2279
|
-
if r1
|
2280
|
-
r2 = _nt_text
|
2281
|
-
s0 << r2
|
2282
|
-
end
|
2283
|
-
if s0.last
|
2284
|
-
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
2285
|
-
r0.extend(Emb10)
|
2286
|
-
r0.extend(Emb11)
|
2287
|
-
else
|
2288
|
-
@index = i0
|
2289
|
-
r0 = nil
|
2290
|
-
end
|
2291
|
-
|
2292
|
-
node_cache[:emb1][start_index] = r0
|
2293
|
-
|
2294
|
-
r0
|
2295
|
-
end
|
2296
|
-
|
2297
2223
|
module Hexdigit0
|
2298
2224
|
def dig
|
2299
2225
|
elements[0]
|
@@ -2479,6 +2405,38 @@ module CBOR_DIAG
|
|
2479
2405
|
r0
|
2480
2406
|
end
|
2481
2407
|
|
2408
|
+
def _nt_hbstring
|
2409
|
+
start_index = index
|
2410
|
+
if node_cache[:hbstring].has_key?(index)
|
2411
|
+
cached = node_cache[:hbstring][index]
|
2412
|
+
if cached
|
2413
|
+
node_cache[:hbstring][index] = cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
2414
|
+
@index = cached.interval.end
|
2415
|
+
end
|
2416
|
+
return cached
|
2417
|
+
end
|
2418
|
+
|
2419
|
+
i0 = index
|
2420
|
+
r1 = _nt_hstring
|
2421
|
+
if r1
|
2422
|
+
r1 = SyntaxNode.new(input, (index-1)...index) if r1 == true
|
2423
|
+
r0 = r1
|
2424
|
+
else
|
2425
|
+
r2 = _nt_bstring
|
2426
|
+
if r2
|
2427
|
+
r2 = SyntaxNode.new(input, (index-1)...index) if r2 == true
|
2428
|
+
r0 = r2
|
2429
|
+
else
|
2430
|
+
@index = i0
|
2431
|
+
r0 = nil
|
2432
|
+
end
|
2433
|
+
end
|
2434
|
+
|
2435
|
+
node_cache[:hbstring][start_index] = r0
|
2436
|
+
|
2437
|
+
r0
|
2438
|
+
end
|
2439
|
+
|
2482
2440
|
module B64string0
|
2483
2441
|
end
|
2484
2442
|
|
@@ -3141,13 +3099,17 @@ module CBOR_DIAG
|
|
3141
3099
|
end
|
3142
3100
|
|
3143
3101
|
module Streamstring0
|
3144
|
-
def
|
3102
|
+
def ows1
|
3145
3103
|
elements[1]
|
3146
3104
|
end
|
3147
3105
|
|
3148
3106
|
def string
|
3149
3107
|
elements[2]
|
3150
3108
|
end
|
3109
|
+
|
3110
|
+
def ows2
|
3111
|
+
elements[3]
|
3112
|
+
end
|
3151
3113
|
end
|
3152
3114
|
|
3153
3115
|
module Streamstring1
|
@@ -3155,17 +3117,13 @@ module CBOR_DIAG
|
|
3155
3117
|
elements[0]
|
3156
3118
|
end
|
3157
3119
|
|
3158
|
-
def
|
3120
|
+
def ows
|
3159
3121
|
elements[1]
|
3160
3122
|
end
|
3161
3123
|
|
3162
3124
|
def an
|
3163
3125
|
elements[2]
|
3164
3126
|
end
|
3165
|
-
|
3166
|
-
def ows2
|
3167
|
-
elements[3]
|
3168
|
-
end
|
3169
3127
|
end
|
3170
3128
|
|
3171
3129
|
module Streamstring2
|
@@ -3195,31 +3153,31 @@ module CBOR_DIAG
|
|
3195
3153
|
end
|
3196
3154
|
|
3197
3155
|
module Streamstring4
|
3198
|
-
def
|
3156
|
+
def ows1
|
3199
3157
|
elements[1]
|
3200
3158
|
end
|
3201
3159
|
|
3202
|
-
def
|
3160
|
+
def hbstring
|
3203
3161
|
elements[2]
|
3204
3162
|
end
|
3163
|
+
|
3164
|
+
def ows2
|
3165
|
+
elements[3]
|
3166
|
+
end
|
3205
3167
|
end
|
3206
3168
|
|
3207
3169
|
module Streamstring5
|
3208
|
-
def
|
3170
|
+
def hbstring
|
3209
3171
|
elements[0]
|
3210
3172
|
end
|
3211
3173
|
|
3212
|
-
def
|
3174
|
+
def ows
|
3213
3175
|
elements[1]
|
3214
3176
|
end
|
3215
3177
|
|
3216
3178
|
def an
|
3217
3179
|
elements[2]
|
3218
3180
|
end
|
3219
|
-
|
3220
|
-
def ows2
|
3221
|
-
elements[3]
|
3222
|
-
end
|
3223
3181
|
end
|
3224
3182
|
|
3225
3183
|
module Streamstring6
|
@@ -3240,7 +3198,7 @@ module CBOR_DIAG
|
|
3240
3198
|
module Streamstring7
|
3241
3199
|
def to_rb
|
3242
3200
|
r = if e = a1.elements
|
3243
|
-
[e[0].to_rb] + e[2].elements.map {|x| x.
|
3201
|
+
[e[0].to_rb] + e[2].elements.map {|x| x.hbstring.to_rb }
|
3244
3202
|
else
|
3245
3203
|
[]
|
3246
3204
|
end
|
@@ -3309,6 +3267,10 @@ module CBOR_DIAG
|
|
3309
3267
|
if r12
|
3310
3268
|
r13 = _nt_string
|
3311
3269
|
s10 << r13
|
3270
|
+
if r13
|
3271
|
+
r14 = _nt_ows
|
3272
|
+
s10 << r14
|
3273
|
+
end
|
3312
3274
|
end
|
3313
3275
|
end
|
3314
3276
|
if s10.last
|
@@ -3326,10 +3288,6 @@ module CBOR_DIAG
|
|
3326
3288
|
end
|
3327
3289
|
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
3328
3290
|
s6 << r9
|
3329
|
-
if r9
|
3330
|
-
r14 = _nt_ows
|
3331
|
-
s6 << r14
|
3332
|
-
end
|
3333
3291
|
end
|
3334
3292
|
end
|
3335
3293
|
if s6.last
|
@@ -3392,7 +3350,7 @@ module CBOR_DIAG
|
|
3392
3350
|
s16 << r20
|
3393
3351
|
if r20
|
3394
3352
|
i21, s21 = index, []
|
3395
|
-
r22 =
|
3353
|
+
r22 = _nt_hbstring
|
3396
3354
|
s21 << r22
|
3397
3355
|
if r22
|
3398
3356
|
r23 = _nt_ows
|
@@ -3413,8 +3371,12 @@ module CBOR_DIAG
|
|
3413
3371
|
r27 = _nt_ows
|
3414
3372
|
s25 << r27
|
3415
3373
|
if r27
|
3416
|
-
r28 =
|
3374
|
+
r28 = _nt_hbstring
|
3417
3375
|
s25 << r28
|
3376
|
+
if r28
|
3377
|
+
r29 = _nt_ows
|
3378
|
+
s25 << r29
|
3379
|
+
end
|
3418
3380
|
end
|
3419
3381
|
end
|
3420
3382
|
if s25.last
|
@@ -3432,10 +3394,6 @@ module CBOR_DIAG
|
|
3432
3394
|
end
|
3433
3395
|
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
3434
3396
|
s21 << r24
|
3435
|
-
if r24
|
3436
|
-
r29 = _nt_ows
|
3437
|
-
s21 << r29
|
3438
|
-
end
|
3439
3397
|
end
|
3440
3398
|
end
|
3441
3399
|
if s21.last
|
data/lib/cbor-pure.rb
CHANGED
@@ -70,7 +70,7 @@ module CBOR
|
|
70
70
|
end
|
71
71
|
alias_method :inspect, :to_s
|
72
72
|
def to_cborseq
|
73
|
-
CBOR.encode_seq(
|
73
|
+
CBOR.encode_seq(elements)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -212,7 +212,7 @@ module CBOR
|
|
212
212
|
d.each {|k, v| add(k); add(v)}
|
213
213
|
end
|
214
214
|
else
|
215
|
-
raise("Don't know how to encode
|
215
|
+
raise("Don't know how to encode »#{d.inspect}« (#{d.class})")
|
216
216
|
end
|
217
217
|
self
|
218
218
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbor-diag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|