cddlc 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2ac8a4458103e760994cda656a70d934555d3b3a5f86416c53b6c3be353fd38
4
- data.tar.gz: 7f8d5cd6a43fb98f3d201fb218d30b865f47cc0b8b0714db6ce68e2770b130bc
3
+ metadata.gz: ee5782e163037658b00ecdca15da1a80d779406426f98a25e2d88888f713fd3b
4
+ data.tar.gz: fa784df9fbf17c6ed73108f6dc139771edb46d21fae1276d935deba15580a2dc
5
5
  SHA512:
6
- metadata.gz: 82ef745cc5ccae3bfb100227f9713bc923b535d9f7c6087c7b091a0570be012236f2756280319163574d145745370f8193467c0824e2a66b3e48cf67621c69c6
7
- data.tar.gz: 369473fb2b9ed8b88c6f42f627af9fa41a5a0fe3c0600a0574bd7a2815284b4c68fc9d33cfcd8a1f8fad107c7aba0282063d8a2e34be6677fc2b1d9bc9f78885
6
+ metadata.gz: d146016f0cc89d76678b737920898f599346bfe342b01e42af79f6a2f20c7dd986ed22b4239097f54f80e685e60de1d4735342315b99fbd014a632af82ff70e4
7
+ data.tar.gz: 05cfab1f81f76fda3882ec8b10d2952df94c41bba86de4f9fbc3285b20a2bf01a45dc6a6641c478a8dbcf91a0c2d90adee2669fa7717469e42318ce380e320c7
data/cddlc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cddlc"
3
- s.version = "0.2.2"
3
+ s.version = "0.2.4"
4
4
  s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
5
5
  s.description = %q{cddlc implements converters and miscellaneous tools for CDDL, RFC 8610}
6
6
  s.author = "Carsten Bormann"
data/lib/cddlc.rb CHANGED
@@ -162,8 +162,12 @@ class CDDL
162
162
  end
163
163
  end
164
164
  break unless got_more
165
+ recently_imported = to_be_imported
165
166
  to_be_imported = cddl_undefined # XXX square...
166
167
  warn "TO IMPORT #{to_be_imported.inspect}" if $options.verbose
168
+ if to_be_imported == recently_imported
169
+ fail "No progress importing #{to_be_imported.inspect} from #{fn} (generics issue?)"
170
+ end
167
171
  must_be_found = false
168
172
  end
169
173
  if preferred_tag
@@ -2,6 +2,16 @@ require_relative "../cddlc.rb"
2
2
  require_relative "./cddl-visitor.rb"
3
3
 
4
4
  class CDDL
5
+
6
+ class MissingGenericError < StandardError
7
+ attr_reader :name, :args
8
+ def initialize(name_, args_)
9
+ @name = name_
10
+ @args = args_
11
+ super("** no generic for #{name}<#{args}>")
12
+ end
13
+ end
14
+
5
15
  def substitute(prod, parms, subs, &block)
6
16
  visit(prod) do |p, &block1|
7
17
  case p
@@ -18,7 +28,9 @@ class CDDL
18
28
  end
19
29
  def gen_apply(gen_name, gen_args, &block)
20
30
  gen_parms, gen_prod = @gen[gen_name]
21
- fail "** no generic for #{gen_name}<#{gen_args}>" unless gen_parms
31
+ unless gen_parms
32
+ fail MissingGenericError.new(gen_name, gen_args)
33
+ end
22
34
  substitute(gen_prod, gen_parms, gen_args, &block)
23
35
  end
24
36
  def expand_prod(prod)
@@ -27,7 +27,11 @@ class CDDL
27
27
  def cddl_undefined
28
28
  # currently only works on expanded...
29
29
  cddl2 = self.deep_clone # needs deep-clone
30
- cddl2.expand_generics
30
+ begin
31
+ cddl2.expand_generics
32
+ rescue CDDL::MissingGenericError => e
33
+ return [e.name] # make this expandable first by pulling missing generic
34
+ end
31
35
  used = {}
32
36
  cddl2.rules.each do |k, v|
33
37
  fail unless String === k
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cddlc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
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-01-12 00:00:00.000000000 Z
11
+ date: 2024-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler