Fix inf loop in parser (#4803)

This commit is contained in:
Mees Delzenne 2024-09-17 19:33:22 +02:00 committed by GitHub
parent c382fa158d
commit fd0fbc7934
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -185,6 +185,8 @@ impl Parser<'_> {
if let Some(x) = self.parse_graph_idiom(ctx, &mut res, Dir::Both).await? {
return Ok(x);
}
} else {
break;
}
}
t!("..") => {

View file

@ -47,6 +47,16 @@ fn glued_identifiers() {
assert_eq!(res, expected);
}
#[test]
fn less_then_idiom() {
let src = r#"
if ($param.foo < 2){
return 1
}
"#;
test_parse!(parse_query, src).unwrap();
}
#[test]
fn escaped_params() {
let src = r#"LET $⟨R-_fYU8Wa31kg7tz0JI6Kme⟩ = 5;