cddl 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cddl +16 -6
- data/cddl.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b6553d8156f74c2c630f22f6069c537e53b4f34a3d436df02ce73f99e648cb5
|
4
|
+
data.tar.gz: 175ddf07c82ef984d40c932eb80f8a8d7cdab54823777d8e9482239251756edc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357a054cb881ab89c00befe26adfcbf9999b8cbd19f400bdd31eccc39a0eb690e50f4552fc446dfa364086987e1187638983e3579e1a3e06084eb874e1311509
|
7
|
+
data.tar.gz: bf8e429cf02926f4c078e7911d73ccffb47ee3c96520f627e33673333061cd85b472e3795a122362fe615c7b73f8ac2ad6ac02290c5f9a0a9ba19ebe3b15fae6
|
data/bin/cddl
CHANGED
@@ -22,6 +22,13 @@ def usage
|
|
22
22
|
exit EX_USAGE
|
23
23
|
end
|
24
24
|
|
25
|
+
def utfify(s)
|
26
|
+
s.force_encoding(Encoding::UTF_8).scrub { |c|
|
27
|
+
warn "*** replaced invalid UTF-8 byte sequence #{c.inspect} by U+FFFD REPLACEMENT CHARACTER"
|
28
|
+
0xFFFD.chr(Encoding::UTF_8)
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
25
32
|
def read_arg(arg, remember_fn = true)
|
26
33
|
if arg == "-"
|
27
34
|
$fn = "(stdin)" if remember_fn
|
@@ -29,15 +36,12 @@ def read_arg(arg, remember_fn = true)
|
|
29
36
|
else
|
30
37
|
usage unless arg
|
31
38
|
$fn = arg if remember_fn
|
32
|
-
File.read(arg, mode: "rb")
|
33
|
-
warn "*** replaced invalid UTF-8 byte sequence #{c.inspect} by U+FFFD REPLACEMENT CHARACTER"
|
34
|
-
0xFFFD.chr(Encoding::UTF_8)
|
35
|
-
}
|
39
|
+
File.read(arg, mode: "rb")
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def parser
|
40
|
-
@parser ||= CDDL::Parser.new(read_arg(ARGV[0], false))
|
44
|
+
@parser ||= CDDL::Parser.new(utfify(read_arg(ARGV[0], false)))
|
41
45
|
end
|
42
46
|
|
43
47
|
def my_pp(v)
|
@@ -102,7 +106,12 @@ begin
|
|
102
106
|
instance = if $sequence
|
103
107
|
CBOR.decode("\x9f".b << instance.b << "\xff".b)
|
104
108
|
else
|
105
|
-
|
109
|
+
begin
|
110
|
+
CBOR.decode(instance.b)
|
111
|
+
rescue => e
|
112
|
+
warn e.inspect if verbose
|
113
|
+
JSON.load(utfify(instance))
|
114
|
+
end
|
106
115
|
end
|
107
116
|
instance = instance.cbor_clone if $annotate && ENV["EXPERIMENTAL_ANNOTATE"]
|
108
117
|
warn "#{fn}:" if verbose
|
@@ -110,6 +119,7 @@ begin
|
|
110
119
|
# my_pp ann
|
111
120
|
instance.cbor_add_annotations_from(ann) rescue nil
|
112
121
|
my_diag(instance) if $annotate
|
122
|
+
warn "ann: #{!!ann}" if verbose
|
113
123
|
unless ann
|
114
124
|
retcode = 1
|
115
125
|
end
|
data/cddl.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cbor-diag
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
- !ruby/object:Gem::Version
|
291
291
|
version: '0'
|
292
292
|
requirements: []
|
293
|
-
rubygems_version: 3.5.
|
293
|
+
rubygems_version: 3.5.11
|
294
294
|
signing_key:
|
295
295
|
specification_version: 4
|
296
296
|
summary: CDDL generator and validator.
|