I seem to have solved the infinite loop issue by moving the exit check into the plain list parser.

This commit is contained in:
Tom Alexander
2023-03-27 12:52:49 -04:00
parent e7397f818d
commit 81a9a754de
3 changed files with 49 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ use nom::character::complete::none_of;
use nom::character::complete::space0;
use nom::combinator::eof;
use nom::combinator::not;
use nom::combinator::peek;
use nom::combinator::recognize;
use nom::multi::many0;
use nom::sequence::tuple;
@@ -106,6 +107,14 @@ pub fn non_whitespace_character(input: &str) -> Res<&str, char> {
none_of(" \t\r\n")(input)
}
/// Check that we are at the start of a line
pub fn exit_matcher_parser<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, &'s str> {
peek(|i| context.check_exit_matcher(i))(input)
}
#[cfg(test)]
mod tests {
use super::*;