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

Redundant X | X rules are allowed and mismanaged. #126

Open
eddyb opened this issue Jul 20, 2019 · 3 comments
Open

Redundant X | X rules are allowed and mismanaged. #126

eddyb opened this issue Jul 20, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@eddyb
Copy link
Member

eddyb commented Jul 20, 2019

This is a testcase that demonstrates the problem (in tests/basic.rs):

    multiple {
        A = X:"x" | Y:"x";
    }:
    A("x") => "\
1:1-1:2 => A::X(
    1:1-1:2,
)";

The output is the current one and is incorrect: both sides are "x" and should match or the situation should be statically denied. But only the first one is observed.

@eddyb eddyb added the bug Something isn't working label Jul 20, 2019
@eddyb
Copy link
Member Author

eddyb commented Jul 23, 2019

I think a reasonable thing to do might be to use IndexSet instead of Vec in Or and make it an error to have duplicate rules (unless they have identical fields?).

@CAD97
Copy link
Contributor

CAD97 commented Jul 23, 2019

I also think it would be reasonable to prohibit identically matching rules in a single Or disjunction.

@eternaleye
Copy link

One problem with prohibiting identically matching rules is that it reduces to grammar equality, which is undecidable for basically anything with the complexity of CFG or higher.

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

3 participants