You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CDDL RFC 8610 section 3.7. Unwrapping defines the use of the tilde (~) character operator for unwrapping a map. When zcbor encounters a tilda in the CDDL it throws an exception.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 903, in get_value
handler(self, match_str)
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 775, in
lambda m_self, map_str: m_self.type_and_value(
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 530, in type_and_value
self.set_value(value_generator)
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 533, in set_value
value = value_generator()
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 776, in
"MAP", lambda: m_self.parse(map_str))),
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 990, in parse
instr = value.get_value(instr)
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 914, in get_value
raise TypeError("Could not parse this: '%s'" % instr)
TypeError: Could not parse this: '~ first_type, param3: uint,'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 281, in from_cddl
parsed.get_value(cddl_string.replace("\n", " ").lstrip("&"))
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 905, in get_value
raise Exception("Failed while parsing this: '%s'" % match_str) from e
Exception: Failed while parsing this: ' ~ first_type, param3: uint, '
The text was updated successfully, but these errors were encountered:
Thanks for reporting. Unwrapping is one of the features mentioned as unsupported in the release notes. I will note this down as a request so I'm more likely to implement it.
CDDL RFC 8610 section 3.7. Unwrapping defines the use of the tilde (~) character operator for unwrapping a map. When zcbor encounters a tilda in the CDDL it throws an exception.
import zcbor
cddl_str = """
second_type = {
~ first_type,
param3: uint,
}
first_type = {
param1: tstr,
param2: uint
}
"""
cddl_res = zcbor.zcbor.zcbor.DataTranslator.from_cddl(cddl_str, 100)
yields:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 903, in get_value
handler(self, match_str)
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 775, in
lambda m_self, map_str: m_self.type_and_value(
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 530, in type_and_value
self.set_value(value_generator)
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 533, in set_value
value = value_generator()
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 776, in
"MAP", lambda: m_self.parse(map_str))),
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 990, in parse
instr = value.get_value(instr)
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 914, in get_value
raise TypeError("Could not parse this: '%s'" % instr)
TypeError: Could not parse this: '~ first_type, param3: uint,'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 281, in from_cddl
parsed.get_value(cddl_string.replace("\n", " ").lstrip("&"))
File "/usr/local/lib/python3.8/dist-packages/zcbor/zcbor/zcbor.py", line 905, in get_value
raise Exception("Failed while parsing this: '%s'" % match_str) from e
Exception: Failed while parsing this: ' ~ first_type, param3: uint, '
The text was updated successfully, but these errors were encountered: