cddl
cddl copied to clipboard
cddl tool group choice error
The below cddl spec will throw an error when run with the cddl tool. Maybe I am using the language wrong but I cannot work out from the error message where my mistake lies.
What confuses me is that if b is an anonymous group this works fine.
a = {
b
}
b = (
(x: int // y: int), z: int
)
The command and its output:
λ cddl test.cddl generate
/Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1031:in `grpent': [[:grpchoice, [[:member, 1, 1, [:text, "x"], [:type1, [:prim, 0], [:prim, 1]]]], [[:member, 1, 1, [:text, "y"], [:type1, [:prim, 0], [:prim, 1]]]]], [:member, 1, 1, [:text, "z"], [:type1, [:prim, 0], [:prim, 1]]]] (RuntimeError)
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1239:in `block (2 levels) in group'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1239:in `each'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1239:in `flat_map'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1239:in `block in group'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1238:in `map'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1238:in `group'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1189:in `block in type1'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1189:in `each'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1189:in `flat_map'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:1189:in `type1'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:933:in `block in r_process'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:922:in `map'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:922:in `r_process'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:225:in `rules'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/lib/cddl.rb:254:in `generate'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/bin/cddl:68:in `block in <top (required)>'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/bin/cddl:67:in `times'
from /Library/Ruby/Gems/2.3.0/gems/cddl-0.8.5/bin/cddl:67:in `<top (required)>'
from /usr/local/bin/cddl:22:in `load'
from /usr/local/bin/cddl:22:in `<main>'