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 +4 -4
- data/cddlc.gemspec +1 -1
- data/lib/cddlc.rb +4 -0
- data/lib/processor/cddl-expander.rb +13 -1
- data/lib/processor/cddl-undefined.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee5782e163037658b00ecdca15da1a80d779406426f98a25e2d88888f713fd3b
|
4
|
+
data.tar.gz: fa784df9fbf17c6ed73108f6dc139771edb46d21fae1276d935deba15580a2dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2024-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|