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

inlining not properly enumerating all options #55

Closed
nikomatsakis opened this issue Jan 22, 2016 · 1 comment
Closed

inlining not properly enumerating all options #55

nikomatsakis opened this issue Jan 22, 2016 · 1 comment

Comments

@nikomatsakis
Copy link
Collaborator

In this grammar:

grammar;

pub E: () = {
    "X" "{" <a:AT*> <e:ET> <b:AT*> "}" => (),
};

AT: () = {
    "type" ";"
};

ET: () = {
    "enum" "{" "}"
};

inlining produces a state like this, which is wrong:

    // State 3
    //   AT = (*) "type" ";" ["enum"]
    //   AT = (*) "type" ";" ["type"]
    //   AT+ = (*) AT ["enum"]
    //   AT+ = (*) AT ["type"]
    //   AT+ = (*) AT+ AT ["enum"]
    //   AT+ = (*) AT+ AT ["type"]
    //   E = "X" "{" (*) AT+ ET AT+ "}" [EOF] <---- ???
    //   E = "X" "{" (*) ET "}" [EOF]
    //   ET = (*) "enum" "{" "}" ["}"]
    //
    //   "enum" -> Shift(S7)
    //   "type" -> Shift(S8)
    //
    //   AT -> S4
    //   AT+ -> S5
    //   ET -> S6

In particular, we are missing "X" "{" AT+ ET "}", which will cause parse failures.

@nikomatsakis
Copy link
Collaborator Author

Ah, I see the problem. The problem is that AT+ appears twice, and we inline it the same way both times.

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