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
Don't require lexer and parser errors to be the same type #707
Comments
I'm kinda curious about this, do you have a full example? I'm wondering why this wouldn't be supported with something like |
I don't have a simple example but this is the code I was messing with. My Parser crate depends on my Lexer crate, so the Lexer crate can't access Sooo, to make this work, my parser error is actually declared in my lexer's lib.rs. But even with this, So yeah, ignoring the multi-crate issue, I also think it would be cool if the error enum had a variant to tell us where the error was found by the parser.
Perhaps:
|
Maybe your code you linked is private? I couldn't follow the link. |
@Pat-Lafon :O oops, can you try again? (this comment will self-destruct soon) |
Ah, thanks for sharing. I'm a bit shaky on this usage of lalrpop but it's interesting to poke around. I see what your saying, I wonder if there is a more "principled" approach here in that I think |
Fallible actions allow for returning a custom error.
However, if you use a custom lexer, LALRPOP requires that the error returned by your Lexer is the same as the one returned by your fallible actions.
I believe this requirement is unnecessary.
Fixing this would probably require changing https://docs.rs/lalrpop-util/0.19.8/lalrpop_util/enum.ParseError.html.
The text was updated successfully, but these errors were encountered: