Skip to content

Mixing non-unused and unused parsers in a parent parser with a non-unused exposed attribute leads to incomplete parse result at runtime #48

@saki7

Description

@saki7

Defining a parser that has a child parser with a semantic action AND mixing it with another plain child parser that has no semantic action will result in an incomplete parse result, where the former is correctly parsed (thanks to the semantic action's side effect) but latter being empty.

It's because the attribute deduction is implicitly inhibited by using the semantic action, so that the latter parser becomes "invoked but result discarded" component. In this case the lack of the semantic action on the latter child is almost always the user's mistake, simply forgetting to associate the desired semantic action.

Above kind of situation is very common in real-world grammar. We should detect it statically and emit an assertion failure. (Note that users are advised to use omit[...] when the child attribute is truly not needed.)

This is literally not a bug but it should be considered a design failure on the public interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions