anweiss / cddl

Concise data definition language (RFC 8610) implementation and JSON and CBOR validator in Rust
https://cddl.anweiss.tech
MIT License
90 stars 12 forks source link

Basic group incremental parse erorr in 0.9.4. Works in 0.9.1 and prior #222

Open rooooooooob opened 3 months ago

rooooooooob commented 3 months ago

Repro code (on 0.9.4):

let cddl = cddl::parser::cddl_from_str(
    r#"basic = (d: #6.23(uint), e: bytes)
    outer = [a: uint, b: basic, c: "some text"]"#,
    true
)?;

Error:

error: parser errors
  ┌─ input:2:22
  │
2 │ outer = [a: uint, b: basic, c: "some text"]
  │                      ^^^^^ missing definition for rule basic

This parses fine on 0.9.1 and various previous versions (we've had this in a test case for a long time in cddl-codegen).

rooooooooob commented 3 months ago

Note: it seems to be able to be used in other contexts, for example:

group_choice = [ foo // 0, x: uint // basic ]

does not complain about basic having a missing definition on 0.9.4