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

conflicts between _ and named tokens not detected #729

Open
nikomatsakis opened this issue Mar 25, 2023 · 0 comments
Open

conflicts between _ and named tokens not detected #729

nikomatsakis opened this issue Mar 25, 2023 · 0 comments
Milestone

Comments

@nikomatsakis
Copy link
Collaborator

The following grammar has a conflict between two regexs that is flagged:

Test = {
    r"[a-z]*",
    r"[a-z]*"
};

which is flagged

  processing file `/home/nmatsakis/versioned/duchess/src/class_info/javap_parser.lalrpop`
  /home/nmatsakis/versioned/duchess/src/class_info/javap_parser.lalrpop:140:5: 140:13 error: ambiguity detected between the terminal `r#"[a-z]*"#` and the terminal `r#"[a-zA-Z][a-zA-Z0-9]*"#`

  --- stderr
        r"[a-z]*",
        ~~~~~~~~~

but if I use a match with _...


Test = {
    r"[a-z]*",
    ID
};

match {
    r"[a-z]*" => ID,
    _
}

...then I get no errors. This can produce some really confusing failures at parse time.

@nikomatsakis nikomatsakis added this to the 1.0 milestone Mar 25, 2023
@nikomatsakis nikomatsakis changed the title tokenizer doesn't detect conflict conflicts between _ and named tokens not detected Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant