-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Limit nested filters to avoid stack overflow #979
base: main
Are you sure you want to change the base?
Conversation
Can you add a ui test to see the error output too please? |
I think you forgot the ui stderr file. ;) |
I haven't actually used the ui tests before... I finally figured out how to work the system, but not sure how to get a better error message. |
Like I did in #954: by providing your own. :) |
That's providing a separate error, but not inspecting the nom error to refine the error. Made an attempt which doesn't seem to work. Not sure how much more time I want to spend on this. |
Can you try fn filtered(i: &'a str, mut level: Level) -> ParseResult<'a, Self> {
#[allow(clippy::type_complexity)]
fn filter<'a>(
i: &'a str,
level: &mut Level,
) -> ParseResult<'a, (&'a str, Option<Vec<Expr<'a>>>)> {
let (i, _) = char('|')(i)?;
*level = level.nest(i)?.1;
pair(ws(identifier), opt(|i| Expr::arguments(i, *level, false)))(i)
}
let (mut i, mut res) = Self::prefix(i, level)?;
while let (j, Some((fname, args))) = opt(|i| filter(i, &mut level))(i)? {
i = j;
res = Self::Filter(fname, {
let mut args = match args {
Some(inner) => inner,
None => Vec::new(),
};
args.insert(0, res);
args
})
}
Ok((i, res))
} |
If it becomes too much of a hassle for you, I can take over this PR. ;) |
@Kijewski that worked well, thanks! I don't trust that the new ui test is actually working well? Feels like it shouldn't be triggering here (since the |
No description provided.