cbor-diag 0.5.7 → 0.5.12
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/bin/cbor2diag.rb +6 -4
- data/bin/cborseq2diag.rb +22 -0
- data/bin/cborseq2pretty.rb +11 -0
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-diag-parser.rb +5 -5
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3528a462928a5e354625093ab38377abd4591b29b8d9c1b999ec8dc46c4b71ce
|
4
|
+
data.tar.gz: 727c825e585e16487d995a4d501726bbe383f26221a2747e6a1b0945fa8ef1dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46c6dbc28aaf1c2dc8938206ff90b66ab9920b6822dbf47ddbcdb32d465d76c5233400d4401625df25e1c4b99d1afd335b30277c2aee253940abf471ac7c1eee
|
7
|
+
data.tar.gz: '029468920932c7d281d03c11030611c363a275db28386e4db273f57e729841cc822ef18bfd704a5f6f825ce7ff8a1e184095127f4721b828b35dea7f859d584e'
|
data/bin/cbor2diag.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'cbor-diagnostic'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
options = ''
|
5
|
+
while /\A-([etu]+)\z/ === ARGV[0]
|
6
|
+
options << $1
|
7
7
|
ARGV.shift
|
8
8
|
end
|
9
9
|
|
10
10
|
ARGF.binmode
|
11
11
|
i = ARGF.read
|
12
12
|
o = CBOR.decode(i)
|
13
|
-
puts o.cbor_diagnostic(try_decode_embedded:
|
13
|
+
puts o.cbor_diagnostic(try_decode_embedded: /e/ === options,
|
14
|
+
bytes_as_text: /t/ === options,
|
15
|
+
utf8: /u/ === options)
|
data/bin/cborseq2diag.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'cbor-diagnostic'
|
3
|
+
|
4
|
+
options = ''
|
5
|
+
while /\A-([etu]+)\z/ === ARGV[0]
|
6
|
+
options << $1
|
7
|
+
ARGV.shift
|
8
|
+
end
|
9
|
+
|
10
|
+
ARGF.binmode
|
11
|
+
i = ARGF.read
|
12
|
+
while !i.empty?
|
13
|
+
o, i = CBOR.decode_with_rest(i)
|
14
|
+
out = o.cbor_diagnostic(try_decode_embedded: /e/ === options,
|
15
|
+
bytes_as_text: /t/ === options,
|
16
|
+
utf8: /u/ === options)
|
17
|
+
if i.empty?
|
18
|
+
puts out
|
19
|
+
else
|
20
|
+
print out << ', '
|
21
|
+
end
|
22
|
+
end
|
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.5.
|
3
|
+
s.version = "0.5.12"
|
4
4
|
s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
|
5
5
|
s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 7049}
|
6
6
|
s.author = "Carsten Bormann"
|
data/lib/cbor-diag-parser.rb
CHANGED
@@ -2265,7 +2265,7 @@ module CBOR_DIAG
|
|
2265
2265
|
module B64string2
|
2266
2266
|
#"
|
2267
2267
|
def to_rb;
|
2268
|
-
t = s.text_value.chars.each_slice(4).map(&:join)
|
2268
|
+
t = s.text_value.gsub(/\s/, '').chars.each_slice(4).map(&:join)
|
2269
2269
|
if last = t[-1]
|
2270
2270
|
last << "=" * (4 - last.size)
|
2271
2271
|
end
|
@@ -2297,11 +2297,11 @@ module CBOR_DIAG
|
|
2297
2297
|
i2, s2 = index, []
|
2298
2298
|
s3, i3 = [], index
|
2299
2299
|
loop do
|
2300
|
-
if has_terminal?(@regexps[gr = '\A[0-9a-zA-Z_
|
2300
|
+
if has_terminal?(@regexps[gr = '\A[0-9a-zA-Z_\\-+/\\s]'] ||= Regexp.new(gr), :regexp, index)
|
2301
2301
|
r4 = true
|
2302
2302
|
@index += 1
|
2303
2303
|
else
|
2304
|
-
terminal_parse_failure('[0-9a-zA-Z_
|
2304
|
+
terminal_parse_failure('[0-9a-zA-Z_\\-+/\\s]')
|
2305
2305
|
r4 = nil
|
2306
2306
|
end
|
2307
2307
|
if r4
|
@@ -2315,11 +2315,11 @@ module CBOR_DIAG
|
|
2315
2315
|
if r3
|
2316
2316
|
s5, i5 = [], index
|
2317
2317
|
loop do
|
2318
|
-
if has_terminal?(@regexps[gr = '\A[
|
2318
|
+
if has_terminal?(@regexps[gr = '\A[=\\s]'] ||= Regexp.new(gr), :regexp, index)
|
2319
2319
|
r6 = true
|
2320
2320
|
@index += 1
|
2321
2321
|
else
|
2322
|
-
terminal_parse_failure('[
|
2322
|
+
terminal_parse_failure('[=\\s]')
|
2323
2323
|
r6 = nil
|
2324
2324
|
end
|
2325
2325
|
if r6
|
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.5.
|
4
|
+
version: 0.5.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,8 +74,10 @@ executables:
|
|
74
74
|
- cbor2pretty.rb
|
75
75
|
- cbor2yaml.rb
|
76
76
|
- cborleader2diag.rb
|
77
|
+
- cborseq2diag.rb
|
77
78
|
- cborseq2json.rb
|
78
79
|
- cborseq2neatjson.rb
|
80
|
+
- cborseq2pretty.rb
|
79
81
|
- cborseq2yaml.rb
|
80
82
|
- diag2cbor.rb
|
81
83
|
- diag2pretty.rb
|
@@ -92,8 +94,10 @@ files:
|
|
92
94
|
- bin/cbor2pretty.rb
|
93
95
|
- bin/cbor2yaml.rb
|
94
96
|
- bin/cborleader2diag.rb
|
97
|
+
- bin/cborseq2diag.rb
|
95
98
|
- bin/cborseq2json.rb
|
96
99
|
- bin/cborseq2neatjson.rb
|
100
|
+
- bin/cborseq2pretty.rb
|
97
101
|
- bin/cborseq2yaml.rb
|
98
102
|
- bin/diag2cbor.rb
|
99
103
|
- bin/diag2pretty.rb
|
@@ -127,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
131
|
- !ruby/object:Gem::Version
|
128
132
|
version: '0'
|
129
133
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.2.3
|
131
135
|
signing_key:
|
132
136
|
specification_version: 4
|
133
137
|
summary: CBOR (Concise Binary Object Representation) diagnostic notation
|