diff options
Diffstat (limited to 'vendor/toml_edit/src/parser/array.rs')
-rw-r--r-- | vendor/toml_edit/src/parser/array.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/vendor/toml_edit/src/parser/array.rs b/vendor/toml_edit/src/parser/array.rs index a99bb8241..e3b1f3f52 100644 --- a/vendor/toml_edit/src/parser/array.rs +++ b/vendor/toml_edit/src/parser/array.rs @@ -2,6 +2,7 @@ use winnow::combinator::cut_err; use winnow::combinator::delimited; use winnow::combinator::opt; use winnow::combinator::separated1; +use winnow::trace::trace; use crate::parser::trivia::ws_comment_newline; use crate::parser::value::value; @@ -12,19 +13,17 @@ use crate::parser::prelude::*; // ;; Array // array = array-open array-values array-close -pub(crate) fn array( - check: RecursionCheck, -) -> impl FnMut(Input<'_>) -> IResult<Input<'_>, Array, ParserError<'_>> { - move |input| { +pub(crate) fn array<'i>(check: RecursionCheck) -> impl Parser<Input<'i>, Array, ContextError> { + trace("array", move |input: &mut Input<'i>| { delimited( ARRAY_OPEN, cut_err(array_values(check)), cut_err(ARRAY_CLOSE) - .context(Context::Expression("array")) - .context(Context::Expected(ParserValue::CharLiteral(']'))), + .context(StrContext::Label("array")) + .context(StrContext::Expected(StrContextValue::CharLiteral(']'))), ) .parse_next(input) - } + }) } // note: we're omitting ws and newlines here, because @@ -39,10 +38,10 @@ const ARRAY_SEP: u8 = b','; // note: this rule is modified // array-values = [ ( array-value array-sep array-values ) / // array-value / ws-comment-newline ] -pub(crate) fn array_values( +pub(crate) fn array_values<'i>( check: RecursionCheck, -) -> impl FnMut(Input<'_>) -> IResult<Input<'_>, Array, ParserError<'_>> { - move |input| { +) -> impl Parser<Input<'i>, Array, ContextError> { + move |input: &mut Input<'i>| { let check = check.recursing(input)?; ( opt( @@ -67,10 +66,10 @@ pub(crate) fn array_values( } } -pub(crate) fn array_value( +pub(crate) fn array_value<'i>( check: RecursionCheck, -) -> impl FnMut(Input<'_>) -> IResult<Input<'_>, Value, ParserError<'_>> { - move |input| { +) -> impl Parser<Input<'i>, Value, ContextError> { + move |input: &mut Input<'i>| { ( ws_comment_newline.span(), value(check), |