cddlc 0.2.2 → 0.2.3
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/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: f35079da2cf258708ed948eb0c9b11bddff20f5a37c5967f0eed5bbc24d37821
|
4
|
+
data.tar.gz: cb4a9ac9618a27734cb1ab088b493f852e323227e19362b7012ab7b16c48b714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7edb8b482557190e6b7a79f0646183f7b32308fc5574931ae9d6e281af11cfa66640395057e6611c308ac713aac2958dde5d0f609bc405c6467ff86db64f47a2
|
7
|
+
data.tar.gz: c51b2735ae93b9ba9ca3671bec546e46345498829c14c0ed338fa782e8d95d7999ac0afcf97c7eabc5a11f564108cf816e975a1ee72c66f9244685f2eb82fa95
|
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.3"
|
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"
|
@@ -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.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: 2024-01-
|
11
|
+
date: 2024-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|