cddl 0.1.8 → 0.1.9
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/cddl.gemspec +1 -1
- data/data/cddl.abnf +3 -3
- data/lib/cddl.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe3ed839df42c1fd6b07c8b4ddb8e89173d7aad7
|
4
|
+
data.tar.gz: 181bc6679b13f2d6d3bb1e83956ce319d7e78b0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df738339807fd13719e6fe7ba06a382b8179eace4f9f21a7a1956800ac7004a47f52d79b93055a409a7e205f6d3b5d3b99a1cf05bfef1eda6b5b96b41cd340f
|
7
|
+
data.tar.gz: 960d722af0ad43719aff06482a6b795f9b958379aa918a243ac2b52e94c46cfb0299a041d8b85e1d92fadc7ae9c15bbb02e03e3b37dc6656c0ba5b4ce499b419
|
data/cddl.gemspec
CHANGED
data/data/cddl.abnf
CHANGED
@@ -7,7 +7,7 @@ groupname = id
|
|
7
7
|
|
8
8
|
type = type1 S *("/" S type1 S)
|
9
9
|
|
10
|
-
type1 = type2 [S (rangeop /
|
10
|
+
type1 = type2 [S (rangeop / annotator) S type2]
|
11
11
|
/ "#" "6" ["." uint] "(" S type S ")" ; note no space!
|
12
12
|
/ "#" DIGIT ["." uint] ; major/ai
|
13
13
|
/ "#" ; any
|
@@ -22,13 +22,13 @@ type2 = value
|
|
22
22
|
|
23
23
|
rangeop = "..." / ".."
|
24
24
|
|
25
|
-
|
25
|
+
annotator = "." id
|
26
26
|
|
27
27
|
group = "(" S *grpent S ")"
|
28
28
|
/ *grpent
|
29
29
|
|
30
30
|
grpent = [occur S] [memberkey S] type1 optcom
|
31
|
-
/ [occur S] groupname optcom
|
31
|
+
/ [occur S] groupname optcom ; always preempted by previous...
|
32
32
|
|
33
33
|
memberkey = membername S ":"
|
34
34
|
membername = bareword ; note that this can be a typename
|
data/lib/cddl.rb
CHANGED
@@ -157,7 +157,7 @@ module CDDL
|
|
157
157
|
Random.new.bytes(should_be_int)
|
158
158
|
when :bits
|
159
159
|
set_of_bits = Array.new(10) { generate(control) } # XXX: ten?
|
160
|
-
p set_of_bits
|
160
|
+
# p set_of_bits
|
161
161
|
unless target == [:prim, 2] && set_of_bits.all? {|x| Integer === x && x >= 0 }
|
162
162
|
fail "Don't know yet how to generate #{where}"
|
163
163
|
end
|
@@ -168,7 +168,7 @@ module CDDL
|
|
168
168
|
if v = s.getbyte(n)
|
169
169
|
s.setbyte(n, v | bit)
|
170
170
|
else
|
171
|
-
s << "\0" * (s.size
|
171
|
+
s << "\0" * (n - s.size) << bit.chr(Encoding::BINARY)
|
172
172
|
end
|
173
173
|
end
|
174
174
|
s
|
@@ -326,7 +326,7 @@ module CDDL
|
|
326
326
|
ok, v, vt = extract_value(control)
|
327
327
|
if ok && vt == String
|
328
328
|
re = Regexp.new("\\A#{v}\\z")
|
329
|
-
pp re
|
329
|
+
# pp re
|
330
330
|
d.match(re)
|
331
331
|
end
|
332
332
|
end
|
@@ -524,7 +524,7 @@ module CDDL
|
|
524
524
|
val
|
525
525
|
}, RANGE_EXCLUDE_END[ro.to_s]),
|
526
526
|
cats[0] == cats[1] ? cats[0] : fail("Incompatible range #{cats}")]
|
527
|
-
elsif anno = n.
|
527
|
+
elsif anno = n.annotator
|
528
528
|
annotyp = anno.id.to_s.intern
|
529
529
|
unless SUPPORTED_ANNOTATIONS.include?(annotyp)
|
530
530
|
fail "Unsupported annotation .#{annotyp}"
|