Check for whitespace eof in exit matcher.

This commit is contained in:
Tom Alexander 2023-04-10 10:50:42 -04:00
parent 137815dbaf
commit 54b0ff5036
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,8 @@ use std::rc::Rc;
use nom::combinator::eof;
use nom::IResult;
use crate::parser::util::whitespace_eof;
use super::error::CustomError;
use super::error::MyError;
use super::error::Res;
@ -66,7 +68,7 @@ impl<'r, 's> ContextTree<'r, 's> {
i: &'s str,
) -> IResult<&'s str, &'s str, CustomError<&'s str>> {
// Special check for EOF. We don't just make this a document-level exit matcher since the IgnoreParent ChainBehavior could cause early exit matchers to not run.
let at_end_of_file = eof(i);
let at_end_of_file = whitespace_eof(i);
if at_end_of_file.is_ok() {
return at_end_of_file;
}