-
Notifications
You must be signed in to change notification settings - Fork 106
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
Repeat expression that doesn't consume input should be a compile time error #210
Comments
The 0.6 adds compile-time checks for other patterns like left recursion that infinite loop in PEG, so repeating an expression that matches without consuming input should similarly be made an error. |
Also, I meant to find a new syntax for inverted character sets that would be compatible with token trees and the new expansion into For now, I added an example inverted character set to the upgrade steps in the 0.6 release notes that hopefully helps clarify this for others. |
Thanks ! |
Hi - I'm using use peg;
pub fn main() {
test_parser::top("test").unwrap()
}
peg::parser!{
grammar test_parser() for str {
rule _() = " "*
rule nl() = _* "\n" _*
pub rule top() = nl()
}
} It would be nice if this was spotted by the compiler. It was quite hard to find this in my (larger) codebase; is there a way to set a maximum recursion depth or parse time or something, to aid debugging? |
Yeah, this issue is still open. As of 0.6, Your best bet for debugging issues like this would be the |
OK, thanks. |
Great, thanks! |
I found this issue porting from 0.5.0 to 0.6.0.
When I run my parser test, it get stuck in an infinite loop (ie it never terminate).
This is the reduced test case:
Expected:
Instead it just get stuck when I
cargo run
.The text was updated successfully, but these errors were encountered: