Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upConsider adding ambiguity check for regexes #16
Comments
This comment has been minimized.
This comment has been minimized.
matklad
commented
Nov 22, 2018
|
For the reference, here’s the relevant bit from LALRPOP: The precedence thing is what determines if ambiguity is an errror or not. |
This comment has been minimized.
This comment has been minimized.
|
Logos currently errors if two patterns can resolve to the same token. Adding precedence markers to make it resolve those situations should be possible, will need to think about how to reflect it on the API surface without adding too much bloat to the attributes. |
maciejhirsz
added
the
enhancement
label
Nov 22, 2018
This was referenced Dec 4, 2018
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
matklad commentedNov 22, 2018
Hi! LALRPOP’s lexer has a very cool feature: if two tokens have regexes with non-empty intersection language, then an error is reported, unless there’s an explicit precedence annotation as well. This helps a lot with producing correct lexers: after implementing a TOML lexer with LALRPOP, I’ve found an ambiguity in the lexer I’ve implemented for IntelliJ Rust:
https://github.com/intellij-rust/intellij-rust/pull/2426/files
It would be cool if logos had this feature as well!