Skip to content

dust_dds_gen: confusing error messages when missing semicolonsΒ #493

@Notgnoshi

Description

@Notgnoshi

I've spent too long writing Rust that I missed that structs, enums, et al, are terminated with semicolons, so my first draft of the IDL I'm working on was missing them entirely. It turns out they're not required by our internal C++ code generator, so we didn't find the issue early πŸ˜….

The following

struct SomeStruct {}

enum SomeEnum {}

fails to parse with

thread 'enum_annotation' (1792741) panicked at dds_gen/tests/enum_annotation.rs:17:57:
called `Result::unwrap()` on an `Err` value: "Error parsing IDL string:  --> 2:15\n  |\n2 | enum SomeEnum {}\n  |               ^---\n  |\n  = expected fixed_array_size"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

which is quite confusing, and doesn't point out that the issue is a missing semicolon.

I expect this is quite challenging to address, but I thought I'd at least report my experience. I suspect the answer will be "We're at the mercy of Pest's generated parser" or "There's more value in having our Pest grammar match the OMG grammar than there is in customizing it for better error reporting", both of which I believe are acceptable responses.

I consider this a low priority issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions