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
Parsing files: ./test.cddl, .local/lib/python3.10/site-packages/zcbor/cddl/prelude.cddl
Traceback (most recent call last):
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 847, in get_value
handler(match_str)
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 724, in<lambda>
lambda map_str: self.type_and_value("MAP", lambda: self.parse(map_str))),
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 490, in type_and_value
self.set_value(value_generator)
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 493, in set_value
value = value_generator()
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 724, in<lambda>
lambda map_str: self.type_and_value("MAP", lambda: self.parse(map_str))),
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 934, in parse
instr = value.get_value(instr)
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 858, in get_value
raise TypeError("Could not parse this: '%s'" % instr)
TypeError: Could not parse this: '&(version: 0) => text ? &(version-scheme: 1) => $version-scheme'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File ".local/bin/zcbor", line 8, in<module>sys.exit(main())
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 3081, in main
args.process(args)
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 2940, in process_code
cddl_res[mode] = CodeGenerator.from_cddl(
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 1699, in from_cddl
cddl_res = super(CodeGenerator, cddl_class).from_cddl(*args, **kwargs)
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 269, in from_cddl
parsed.get_value(cddl_string.replace("\n", "").lstrip("&"))
File ".local/lib/python3.10/site-packages/zcbor/zcbor.py", line 849, in get_value
raise Exception("Failed while parsing this: '%s'" % match_str) from e
Exception: Failed while parsing this: ' &(version: 0) => text ? &(version-scheme: 1) => $version-scheme '
The text was updated successfully, but these errors were encountered:
Thanks for the report. This is not supported, and there are currently no plans to support it, since AFAIU you can acheive the same thing quite easily with '/'. I will track this internally though.
As the RFC hints at in 2.2.2.2., there is value in this feature in the situation where many values are given semantic names in a group but then someone has a desire to create a choice. It would be much more tedious to accumulate the names into a choice using '/' than just simply using the group that already exists and using '&'.
This tripped me up today as well. I find that the & operator makes the CDDL more readable and maintainable, and would very much appreciate support being added into zcbor.
zcbor is unable to parse the
&
(choice) operatorFor example when running
on:
The following exception occurs
The text was updated successfully, but these errors were encountered: