Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zcbor test cases failing #199

Open
nslowell opened this issue Jul 26, 2023 · 2 comments
Open

zcbor test cases failing #199

nslowell opened this issue Jul 26, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nslowell
Copy link

I have successfully used https://github.com/NordicSemiconductor/zcbor for generating C code from CDDLs, but my CDDLs and their provided test cases are getting error messages when I try to run them through this tool or the website.

Can you provide some clarification on why the errors are occurring? Is this tool missing support?

Example for https://github.com/NordicSemiconductor/zcbor/blob/main/tests/cases/corner_cases.cddl:

    -
 14 -     onetofourbytes: uint .size 0b1..0o4, ; Testing binary and octal
    -                                 ^^^^^^^ missing definition for rule b1..0o4
    -
 34 - TaggedUnion = #6.4321(bool) // #6.2345(uint)
    -                             ^^ expected rule identifier followed by an assignment token '=', '/=' or '//='
    -
 46 -     #6.0(tentothirtybytetstr: tstr .size 10..30),
    -          ^^^^^^^^^^^^^^^^^^^ invalid tag syntax
    -
 64 -     #6.10(boolval: bool),
    -           ^^^^^^^ invalid tag syntax
    -
 73 - Union = Group / MultiGroup / (3,4) / "\"hello\""
    -                                 ^ expected rule identifier followed by an assignment token '=', '/=' or '//='
    -
 77 -     union: (7=>uint) / (-8=>uint),
    -                    ^ missing closing delimiter
    -
 86 - Level1 = [Level2]
    -           ^^^^^^ missing definition for rule Level2
 87 - Level2 = [2**3Level3] ; Use ** here to test backwards compatibility.
    -             ^ invalid group entry syntax
    -
116 -     unabstractedunion1: (choice1: 1 // choice2: 2),
    -                                     ^^ invalid group entry syntax
    -
121 -     upto4nils: 0*0x04nil,
    -                       ^^ missing definition for rule il
    -
140 -     floats: *float,
    -             ^ invalid group entry syntax
    -
196 -     "r" : (result:result_code),
    -                              ^ missing closing delimiter

@anweiss anweiss self-assigned this Aug 2, 2023
@anweiss anweiss added the bug Something isn't working label Aug 2, 2023
@anweiss
Copy link
Owner

anweiss commented Aug 2, 2023

Thanks for reporting this @nslowell. I need to add support for hex, octal and binary numbers which is why 0b1..0o4 isn't parsing correctly.

Some of your CDDL looks a bit wonky too. You're using a lot of (key: value) syntax that is confusing the parser. Anything in the form of key: value is a group entry but you're trying to use that syntax to describe types. For example, the #6.10(boolval: bool) is invalid CDDL because the boolval: bool tag type you've specified is not actually a type but rather a group entry.

@nslowell
Copy link
Author

nslowell commented Aug 4, 2023

Thanks for responding. I will highlight again that this is CDDL from the creators of zcbor, it's not my direct CDDL. My actual CDDL is simpler--though perhaps still a little "wonky"--but it runs through zcbor without error, so I assumed it was acceptable CDDL. Perhaps there is some interpretation confusion with the RFC.

I will ask NordicSemiconductor for their input, but in the meantime, I welcome any updates. Thanks, again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants