Skip to content

Commit

Permalink
Added test for validating left recursion in the case of a sequence st…
Browse files Browse the repository at this point in the history
…arting by a non progressing expression.
  • Loading branch information
Tartasprint committed Oct 18, 2024
1 parent c93aae8 commit 3ae5eba
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions meta/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,22 @@ mod tests {
#[test]
#[should_panic(expected = "grammar error
--> 1:14
|
1 | a = { !\"a\" ~ a }
| ^
|
= rule a is left-recursive (a -> a); pest::pratt_parser might be useful in this case")]
fn non_progressing_left_recursion() {
let input = "a = { !\"a\" ~ a }";
unwrap_or_report(consume_rules(
PestParser::parse(Rule::grammar_rules, input).unwrap(),
));
}

#[test]
#[should_panic(expected = "grammar error
--> 1:7
|
1 | a = { \"a\"* | \"a\" | \"b\" }
Expand Down

0 comments on commit 3ae5eba

Please sign in to comment.