From c4edcb8c244a7d78dacfb269d1bb43d2cc5ca5ad Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 11 Oct 2023 19:07:47 -0400 Subject: [PATCH] Fix parsing the optional value. --- src/parser/affiliated_keyword.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/parser/affiliated_keyword.rs b/src/parser/affiliated_keyword.rs index 88cdabd..498033f 100644 --- a/src/parser/affiliated_keyword.rs +++ b/src/parser/affiliated_keyword.rs @@ -15,6 +15,7 @@ use nom::multi::many_till; use nom::sequence::tuple; use super::object_parser::standard_set_object; +use super::util::confine_context; use crate::context::parser_with_context; use crate::context::Context; use crate::context::ContextElement; @@ -62,9 +63,11 @@ pub(crate) fn parse_affiliated_keywords<'g, 's>( tag("["), map_parser( recognize(many_till(anychar, peek(tuple((tag("]"), eof))))), - all_consuming(many0(parser_with_context!(standard_set_object)( - &initial_context, - ))), + confine_context(|i| { + all_consuming(many0(parser_with_context!(standard_set_object)( + &initial_context, + )))(i) + }), ), tag("]"), eof,