diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/toml_edit/src/parser/array.rs | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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), |