cddl 0.8.10 → 0.8.11

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: 3c83003981d07eae336683b02bebaa0340f56941724ed6f91d89c6b8baf8f234
4
- data.tar.gz: bf5e14489fd50c0b14bd27a99f11c3a35c046ed8113764094d8fc6a7ef4ff0d8
3
+ metadata.gz: 77b28f069a663ccb82301ec6db8cf42db6b00127b36272020baf874416029a2b
4
+ data.tar.gz: c37387e5d6b1009d054cb9a345d337e43fbc2a9bcc826d009aa0b1cdfeded437
5
5
  SHA512:
6
- metadata.gz: 74f3d9b8cb2f1c188aff29fe9e8dcc3496cb978063e67e7a84932cbe7045163529586547836747237f8f5451b2ffaeaf550165df5aea3003ee9a31c882408488
7
- data.tar.gz: b021259524e95100b668a5b335adf85c714f73fbf4b22fd2cd7a84dcc9ea35c227401339c8a40a06f8e46e77d77fa19d2d0240fef60f89703eb66cff0f31ebf1
6
+ metadata.gz: b7818289a708b07c08a58c8b114730777d70a4dbfb43ec94f10fbcacfae21cdbdcd72b11dd225e52471963e1570d30cb5703790f424b470015ab67064cc48ae8
7
+ data.tar.gz: 301eb0733448db7eae4dff9404d51b436c018ede13ed9a2288a6285d783e58d479186e80193e90e38ed075bd24b33fccf1ed2055eb57fd99cd99594621aa1df7
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'cddl'
3
- s.version = '0.8.10'
3
+ s.version = '0.8.11'
4
4
  s.summary = "CDDL generator and validator."
5
5
  s.description = %{A parser, generator, and validator for CDDL}
6
6
  s.add_dependency('cbor-diag')
@@ -439,6 +439,8 @@ module CDDL
439
439
  $default_warned = true
440
440
  end
441
441
  generate1(target, inmap)
442
+ when :feature
443
+ generate1(target, inmap)
442
444
  when :eq
443
445
  content = generate1(control)
444
446
  if validate1(content, where)
@@ -551,9 +553,14 @@ module CDDL
551
553
 
552
554
  def validate(d, warn=true)
553
555
  @recursion = 0
556
+ $features = Hash.new {|h, k| h[k] = {}}
554
557
  result = validate1a(d, rules)
555
- unless result
556
- if warn
558
+ if warn
559
+ if result
560
+ if $features != {}
561
+ warn "** Features potentially used: #{$features.map {|k, v| "#{k}: #{v.keys}"}.join(", ")}"
562
+ end
563
+ else
557
564
  warn "CDDL validation failure (#{result.inspect} for #{d.inspect}):"
558
565
  PP::pp(validate_diag, STDERR)
559
566
  puts(validate_diag.cbor_diagnostic)
@@ -797,6 +804,10 @@ module CDDL
797
804
  $default_warned = true
798
805
  end
799
806
  ann
807
+ when :feature
808
+ ok, v, vt = extract_value(control)
809
+ $features[v][d] = true
810
+ ann
800
811
  when :lt, :le, :gt, :ge, :eq, :ne
801
812
  op = OPERATORS[where[1]]
802
813
  ok, v, _vt = extract_value(control)
@@ -1168,7 +1179,7 @@ module CDDL
1168
1179
  BRACE = {"{" => :map, "[" => :array}
1169
1180
  RANGE_EXCLUDE_END = {".." => false, "..." => true}
1170
1181
  SUPPORTED_ANNOTATIONS = [:bits, :size, :regexp, :cbor, :cborseq, :within, :and,
1171
- :default, :lt, :le, :gt, :ge, :eq, :ne]
1182
+ :default, :lt, :le, :gt, :ge, :eq, :ne, :feature]
1172
1183
 
1173
1184
  def type1(n, canbegroup = false)
1174
1185
  # puts "NVALUE #{n.value.inspect}"
@@ -0,0 +1,4 @@
1
+ foo = {
2
+ a: int
3
+ ? ("b" .feature "foo") => float
4
+ }
@@ -0,0 +1,3 @@
1
+ foo = arr<mapa<arr<int>, arr<text>>>
2
+ arr<X> = [* X]
3
+ mapa<X, Y> = {a: X, b: Y}
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.8.10
4
+ version: 0.8.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-10 00:00:00.000000000 Z
11
+ date: 2020-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cbor-diag
@@ -117,6 +117,7 @@ files:
117
117
  - test-data/dcaf1.cddl
118
118
  - test-data/dotsize.cddl
119
119
  - test-data/extractor-demo.cddl
120
+ - test-data/feat1.cddl
120
121
  - test-data/foo.cddl
121
122
  - test-data/grasp-01-extract.cddl
122
123
  - test-data/grasp-01-test.cddl
@@ -149,6 +150,7 @@ files:
149
150
  - test-data/patch1.cddl
150
151
  - test-data/reused_named_group.cddl
151
152
  - test-data/structure.cddl
153
+ - test-data/test-gen.cddl
152
154
  - test-data/toerless0.cddl
153
155
  - test-data/toerless1.cddl
154
156
  - test-data/two_anonymous_groups.cddl
@@ -162,7 +164,7 @@ homepage: http://github.com/cabo/cddl
162
164
  licenses:
163
165
  - MIT
164
166
  metadata: {}
165
- post_install_message:
167
+ post_install_message:
166
168
  rdoc_options: []
167
169
  require_paths:
168
170
  - lib
@@ -177,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  - !ruby/object:Gem::Version
178
180
  version: '0'
179
181
  requirements: []
180
- rubygems_version: 3.0.6
181
- signing_key:
182
+ rubygems_version: 3.1.2
183
+ signing_key:
182
184
  specification_version: 4
183
185
  summary: CDDL generator and validator.
184
186
  test_files: []