cddl 0.9.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/cddl.gemspec +1 -1
  3. data/data/cddl.abnf +1 -1
  4. data/lib/cddl.rb +10 -9
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c5fe473658f795abcc5e1599dd18ea3e62525c2f595a8e6c36d4fc9fa7654e8
4
- data.tar.gz: 1d3789efc876946703170afb3aca08e458ad19c18ef8c8a5477852ab02fcc78d
3
+ metadata.gz: 53440c040b2f038a19f13930772e0c274d40c2074818c333883f571048b094f1
4
+ data.tar.gz: 606acb287909e0abbf9fe6c038bd1a29649a966a4feab28fa3ffaa20090e3531
5
5
  SHA512:
6
- metadata.gz: f108776ab78dd95aa075e3450bcf121c8374508cbe9df27a539090af5faa4f9e70d378b39318bdd0b47ef97b29228ec4796e32b0229084942ee7106cdcb567c4
7
- data.tar.gz: b642fe30b4c4aef6ee12fc42a7f1caab6b94ef3797789c5d7b8f190b447fdc4133669ddfa9ba923b91ce31760cfb41da6859b1e1c2d0d5b976f8133c2e742dc9
6
+ metadata.gz: 7ede3ed88ccb5dba90731fa47da28ed2bd68a05b207fdd4c10cbf495c3fea7da31a65b25aa9d24000276ba1a7518d3d11d6c5a156239e7901b105646bfec6b1f
7
+ data.tar.gz: 5003a424b4e7edaca09bff529acc1349006dcfba8d3b645b1e3b084aacaf3a0b146f0e371a77427dfbedeb978ff12a10896cc87e1ef44854f6bae94f0b614031
data/cddl.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'cddl'
3
- s.version = '0.9.1'
3
+ s.version = '0.9.3'
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')
data/data/cddl.abnf CHANGED
@@ -71,7 +71,7 @@ SCHAR = %x20-21 / %x23-7E / SESC
71
71
  SESC = "\" %x20-7E
72
72
 
73
73
  bytes = [bsqual] %x27 *BCHAR %x27
74
- BCHAR = %x20-26 / %x28-7E / SESC / CRLF
74
+ BCHAR = %x20-26 / %x28-5B / %x5D-7E / SESC / CRLF
75
75
  bsqual = %x68 ; "h"
76
76
  / %x62.36.34 ; "b64"
77
77
 
data/lib/cddl.rb CHANGED
@@ -255,7 +255,7 @@ module CDDL
255
255
  # Memoize a bit here
256
256
 
257
257
  REGEXP_FOR_STRING = Hash.new {|h, k|
258
- h[k] = Regexp.new("\\A#{k}\\z")
258
+ h[k] = Regexp.new("\\A(?:#{k})\\z")
259
259
  }
260
260
 
261
261
  ABNF_PARSER_FOR_STRING = Hash.new {|h, k|
@@ -1119,20 +1119,21 @@ module CDDL
1119
1119
  # warn n
1120
1120
  s = n.to_s
1121
1121
  if s[-1] == "'"
1122
- parts = s.split("'", 3)
1123
- if parts[2] != "" || parts[1] =~ /\\/
1124
- warn "*** Can't handle backslashes in #{s.inspect} yet"
1122
+ bsqual, *parts = s.split("'", -1)
1123
+ if parts[-1] != ""
1124
+ warn "*** Problem decoding byte string #{s.inspect}"
1125
1125
  end
1126
+ bsval = parts[0...-1].join("'").gsub(/\\(.)/){$1}
1126
1127
  [:bytes,
1127
- case parts[0]
1128
+ case bsqual
1128
1129
  when ""
1129
- parts[1].b
1130
+ bsval.b
1130
1131
  when "h"
1131
- parts[1].gsub(/\s/, "").chars.each_slice(2).map{ |x| Integer(x.join, 16).chr("BINARY") }.join.b
1132
+ bsval.gsub(/\s/, "").chars.each_slice(2).map{ |x| Integer(x.join, 16).chr("BINARY") }.join.b
1132
1133
  when "b64"
1133
- Base64.urlsafe_decode64(parts[1])
1134
+ Base64.urlsafe_decode64(bsval)
1134
1135
  else
1135
- warn "*** Can't handle byte string type #{parts[0].inspect} yet"
1136
+ warn "*** Can't handle byte string type #{bsqual.inspect} yet"
1136
1137
  end
1137
1138
  ]
1138
1139
  else
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.9.1
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-05 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cbor-diag