-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for repeat expressions that infinite-loop without consuming input
Fixes #210
- Loading branch information
1 parent
b1c5438
commit 25e19d2
Showing
5 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
peg::parser!(grammar e() for str { | ||
rule nested() = ("a"*)* //~ ERROR | ||
|
||
rule nested_ok() = ("a"+)* | ||
|
||
rule nullable() = "x"? | ||
|
||
rule call() = "foo" nullable()* //~ ERROR | ||
|
||
rule more_complex() = ("x" / "a"? "b"?)*<2,> //~ ERROR | ||
}); | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error: loops infinitely because loop body can match without consuming input | ||
--> $DIR/nullable_loop.rs:2:27 | ||
| | ||
2 | rule nested() = ("a"*)* //~ ERROR | ||
| ^ | ||
|
||
error: loops infinitely because loop body can match without consuming input | ||
--> $DIR/nullable_loop.rs:8:35 | ||
| | ||
8 | rule call() = "foo" nullable()* //~ ERROR | ||
| ^ | ||
|
||
error: loops infinitely because loop body can match without consuming input | ||
--> $DIR/nullable_loop.rs:10:44 | ||
| | ||
10 | rule more_complex() = ("x" / "a"? "b"?)*<2,> //~ ERROR | ||
| ^ |