-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Merging 2 reserved nodes: This is a bug: Report it #336
Comments
Hello! Thanks for reporting this bug! Could you try reducing the number of enum variants, until you identify the variant that causes this issue? And report a MWE here. |
I will do that tonight :) |
use logos::Logos;
#[derive(Logos)]
pub enum Token {
#[regex("(0+)*x?.0+", |_| ())]
Float,
}
fn main() {} Minimized this. Couldn't get the regex to be any smaller than it is now, but trimmed down the enum variants. |
Interesting, thanks for your help @5225225! I managed to reduce it even further: #[derive(Logos)]
pub enum Token {
#[regex("(0+)*.0+")]
Float,
} Quite interestingly, this pattern fails to compile, but its equivalent (because Logos does not capture groups) succeeds: #[derive(Logos)]
pub enum Token {
#[regex("0*.0+")]
Float,
} Here are their respective Hir (used internally by Logos): fn main() {
let hir = regex_syntax::Parser::new().parse("(0+)*.0+").unwrap();
println!("{:#?}", hir);
}
fn main() {
let hir = regex_syntax::Parser::new().parse("0*.0+").unwrap();
println!("{:#?}", hir);
}
But to me, this is weird that the capture is not in the first repetition, but in the second... |
This is the code that generates the bug. System: macOS M1. Ventura Version 13.0.
Context. I was getting some stack stack overflow exceptions before this error was thrown.
neofetch
Error:
The text was updated successfully, but these errors were encountered: