summaryrefslogtreecommitdiffstats
path: root/vendor/toml_edit/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/toml_edit/src')
-rw-r--r--vendor/toml_edit/src/encode.rs53
-rw-r--r--vendor/toml_edit/src/parser/array.rs42
-rw-r--r--vendor/toml_edit/src/parser/datetime.rs57
-rw-r--r--vendor/toml_edit/src/parser/document.rs45
-rw-r--r--vendor/toml_edit/src/parser/errors.rs58
-rw-r--r--vendor/toml_edit/src/parser/inline_table.rs30
-rw-r--r--vendor/toml_edit/src/parser/key.rs26
-rw-r--r--vendor/toml_edit/src/parser/macros.rs4
-rw-r--r--vendor/toml_edit/src/parser/mod.rs37
-rw-r--r--vendor/toml_edit/src/parser/numbers.rs127
-rw-r--r--vendor/toml_edit/src/parser/strings.rs156
-rw-r--r--vendor/toml_edit/src/parser/table.rs26
-rw-r--r--vendor/toml_edit/src/parser/trivia.rs50
-rw-r--r--vendor/toml_edit/src/parser/value.rs12
14 files changed, 387 insertions, 336 deletions
diff --git a/vendor/toml_edit/src/encode.rs b/vendor/toml_edit/src/encode.rs
index 4747bd523..9940f282b 100644
--- a/vendor/toml_edit/src/encode.rs
+++ b/vendor/toml_edit/src/encode.rs
@@ -48,6 +48,37 @@ impl Encode for Key {
}
}
+impl<'k> Encode for &'k [Key] {
+ fn encode(
+ &self,
+ buf: &mut dyn Write,
+ input: Option<&str>,
+ default_decor: (&str, &str),
+ ) -> Result {
+ for (i, key) in self.iter().enumerate() {
+ let first = i == 0;
+ let last = i + 1 == self.len();
+
+ let prefix = if first {
+ default_decor.0
+ } else {
+ DEFAULT_KEY_PATH_DECOR.0
+ };
+ let suffix = if last {
+ default_decor.1
+ } else {
+ DEFAULT_KEY_PATH_DECOR.1
+ };
+
+ if !first {
+ write!(buf, ".")?;
+ }
+ key.encode(buf, input, (prefix, suffix))?;
+ }
+ Ok(())
+ }
+}
+
impl<'k> Encode for &'k [&'k Key] {
fn encode(
&self,
@@ -230,25 +261,33 @@ impl Display for Document {
fn visit_nested_tables<'t, F>(
table: &'t Table,
- path: &mut Vec<&'t Key>,
+ path: &mut Vec<Key>,
is_array_of_tables: bool,
callback: &mut F,
) -> Result
where
- F: FnMut(&'t Table, &Vec<&'t Key>, bool) -> Result,
+ F: FnMut(&'t Table, &Vec<Key>, bool) -> Result,
{
- callback(table, path, is_array_of_tables)?;
+ if !table.is_dotted() {
+ callback(table, path, is_array_of_tables)?;
+ }
for kv in table.items.values() {
match kv.value {
- Item::Table(ref t) if !t.is_dotted() => {
- path.push(&kv.key);
+ Item::Table(ref t) => {
+ let mut key = kv.key.clone();
+ if t.is_dotted() {
+ // May have newlines and generally isn't written for standard tables
+ key.decor_mut().clear();
+ }
+ path.push(key);
visit_nested_tables(t, path, false, callback)?;
path.pop();
}
Item::ArrayOfTables(ref a) => {
for t in a.iter() {
- path.push(&kv.key);
+ let key = kv.key.clone();
+ path.push(key);
visit_nested_tables(t, path, true, callback)?;
path.pop();
}
@@ -263,7 +302,7 @@ fn visit_table(
buf: &mut dyn Write,
input: Option<&str>,
table: &Table,
- path: &[&Key],
+ path: &[Key],
is_array_of_tables: bool,
first_table: &mut bool,
) -> Result {
diff --git a/vendor/toml_edit/src/parser/array.rs b/vendor/toml_edit/src/parser/array.rs
index 93d7873ec..ad6687232 100644
--- a/vendor/toml_edit/src/parser/array.rs
+++ b/vendor/toml_edit/src/parser/array.rs
@@ -1,7 +1,7 @@
-use nom8::combinator::cut;
-use nom8::combinator::opt;
-use nom8::multi::separated_list1;
-use nom8::sequence::delimited;
+use winnow::combinator::cut_err;
+use winnow::combinator::opt;
+use winnow::multi::separated1;
+use winnow::sequence::delimited;
use crate::parser::trivia::ws_comment_newline;
use crate::parser::value::value;
@@ -18,12 +18,12 @@ pub(crate) fn array(
move |input| {
delimited(
ARRAY_OPEN,
- cut(array_values(check)),
- cut(ARRAY_CLOSE)
+ cut_err(array_values(check)),
+ cut_err(ARRAY_CLOSE)
.context(Context::Expression("array"))
.context(Context::Expected(ParserValue::CharLiteral(']'))),
)
- .parse(input)
+ .parse_next(input)
}
}
@@ -45,16 +45,16 @@ pub(crate) fn array_values(
move |input| {
let check = check.recursing(input)?;
(
- opt((
- separated_list1(ARRAY_SEP, array_value(check)),
- opt(ARRAY_SEP),
- )
- .map(|(v, trailing): (Vec<Value>, Option<u8>)| {
- (
- Array::with_vec(v.into_iter().map(Item::Value).collect()),
- trailing.is_some(),
- )
- })),
+ opt(
+ (separated1(array_value(check), ARRAY_SEP), opt(ARRAY_SEP)).map(
+ |(v, trailing): (Vec<Value>, Option<u8>)| {
+ (
+ Array::with_vec(v.into_iter().map(Item::Value).collect()),
+ trailing.is_some(),
+ )
+ },
+ ),
+ ),
ws_comment_newline.span(),
)
.map_res::<_, _, std::str::Utf8Error>(|(array, trailing)| {
@@ -63,7 +63,7 @@ pub(crate) fn array_values(
array.set_trailing(RawString::with_span(trailing));
Ok(array)
})
- .parse(input)
+ .parse_next(input)
}
}
@@ -77,7 +77,7 @@ pub(crate) fn array_value(
ws_comment_newline.span(),
)
.map(|(ws1, v, ws2)| v.decorated(RawString::with_span(ws1), RawString::with_span(ws2)))
- .parse(input)
+ .parse_next(input)
}
}
@@ -124,7 +124,7 @@ mod test {
];
for input in inputs {
dbg!(input);
- let mut parsed = array(Default::default()).parse(new_input(input)).finish();
+ let mut parsed = array(Default::default()).parse(new_input(input));
if let Ok(parsed) = &mut parsed {
parsed.despan(input);
}
@@ -137,7 +137,7 @@ mod test {
let invalid_inputs = [r#"["#, r#"[,]"#, r#"[,2]"#, r#"[1e165,,]"#];
for input in invalid_inputs {
dbg!(input);
- let mut parsed = array(Default::default()).parse(new_input(input)).finish();
+ let mut parsed = array(Default::default()).parse(new_input(input));
if let Ok(parsed) = &mut parsed {
parsed.despan(input);
}
diff --git a/vendor/toml_edit/src/parser/datetime.rs b/vendor/toml_edit/src/parser/datetime.rs
index 63a761655..89fd483a8 100644
--- a/vendor/toml_edit/src/parser/datetime.rs
+++ b/vendor/toml_edit/src/parser/datetime.rs
@@ -4,13 +4,13 @@ use crate::parser::errors::CustomError;
use crate::parser::prelude::*;
use crate::parser::trivia::from_utf8_unchecked;
-use nom8::branch::alt;
-use nom8::bytes::one_of;
-use nom8::bytes::take_while_m_n;
-use nom8::combinator::cut;
-use nom8::combinator::opt;
-use nom8::sequence::preceded;
use toml_datetime::*;
+use winnow::branch::alt;
+use winnow::bytes::one_of;
+use winnow::bytes::take_while_m_n;
+use winnow::combinator::cut_err;
+use winnow::combinator::opt;
+use winnow::sequence::preceded;
// ;; Date and Time (as defined in RFC 3339)
@@ -44,14 +44,14 @@ pub(crate) fn date_time(input: Input<'_>) -> IResult<Input<'_>, Datetime, Parser
.map(|t| t.into())
.context(Context::Expression("time")),
))
- .parse(input)
+ .parse_next(input)
}
// full-date = date-fullyear "-" date-month "-" date-mday
pub(crate) fn full_date(input: Input<'_>) -> IResult<Input<'_>, Date, ParserError<'_>> {
- (date_fullyear, b'-', cut((date_month, b'-', date_mday)))
+ (date_fullyear, b'-', cut_err((date_month, b'-', date_mday)))
.map(|(year, _, (month, _, day))| Date { year, month, day })
- .parse(input)
+ .parse_next(input)
}
// partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
@@ -59,7 +59,7 @@ pub(crate) fn partial_time(input: Input<'_>) -> IResult<Input<'_>, Time, ParserE
(
time_hour,
b':',
- cut((time_minute, b':', time_second, opt(time_secfrac))),
+ cut_err((time_minute, b':', time_second, opt(time_secfrac))),
)
.map(|(hour, _, (minute, _, second, nanosecond))| Time {
hour,
@@ -67,7 +67,7 @@ pub(crate) fn partial_time(input: Input<'_>) -> IResult<Input<'_>, Time, ParserE
second,
nanosecond: nanosecond.unwrap_or_default(),
})
- .parse(input)
+ .parse_next(input)
}
// time-offset = "Z" / time-numoffset
@@ -75,7 +75,10 @@ pub(crate) fn partial_time(input: Input<'_>) -> IResult<Input<'_>, Time, ParserE
pub(crate) fn time_offset(input: Input<'_>) -> IResult<Input<'_>, Offset, ParserError<'_>> {
alt((
one_of((b'Z', b'z')).value(Offset::Z),
- (one_of((b'+', b'-')), cut((time_hour, b':', time_minute)))
+ (
+ one_of((b'+', b'-')),
+ cut_err((time_hour, b':', time_minute)),
+ )
.map(|(sign, (hours, _, minutes))| {
let sign = match sign {
b'+' => 1,
@@ -88,14 +91,14 @@ pub(crate) fn time_offset(input: Input<'_>) -> IResult<Input<'_>, Offset, Parser
.map(|minutes| Offset::Custom { minutes }),
))
.context(Context::Expression("time offset"))
- .parse(input)
+ .parse_next(input)
}
// date-fullyear = 4DIGIT
pub(crate) fn date_fullyear(input: Input<'_>) -> IResult<Input<'_>, u16, ParserError<'_>> {
unsigned_digits::<4, 4>
.map(|s: &str| s.parse::<u16>().expect("4DIGIT should match u8"))
- .parse(input)
+ .parse_next(input)
}
// date-month = 2DIGIT ; 01-12
@@ -109,7 +112,7 @@ pub(crate) fn date_month(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError
Err(CustomError::OutOfRange)
}
})
- .parse(input)
+ .parse_next(input)
}
// date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
@@ -123,12 +126,12 @@ pub(crate) fn date_mday(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<
Err(CustomError::OutOfRange)
}
})
- .parse(input)
+ .parse_next(input)
}
// time-delim = "T" / %x20 ; T, t, or space
pub(crate) fn time_delim(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<'_>> {
- one_of(TIME_DELIM).parse(input)
+ one_of(TIME_DELIM).parse_next(input)
}
const TIME_DELIM: (u8, u8, u8) = (b'T', b't', b' ');
@@ -144,7 +147,7 @@ pub(crate) fn time_hour(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<
Err(CustomError::OutOfRange)
}
})
- .parse(input)
+ .parse_next(input)
}
// time-minute = 2DIGIT ; 00-59
@@ -158,7 +161,7 @@ pub(crate) fn time_minute(input: Input<'_>) -> IResult<Input<'_>, u8, ParserErro
Err(CustomError::OutOfRange)
}
})
- .parse(input)
+ .parse_next(input)
}
// time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
@@ -172,7 +175,7 @@ pub(crate) fn time_second(input: Input<'_>) -> IResult<Input<'_>, u8, ParserErro
Err(CustomError::OutOfRange)
}
})
- .parse(input)
+ .parse_next(input)
}
// time-secfrac = "." 1*DIGIT
@@ -208,7 +211,7 @@ pub(crate) fn time_secfrac(input: Input<'_>) -> IResult<Input<'_>, u32, ParserEr
let v = v.checked_mul(*scale).ok_or(CustomError::OutOfRange)?;
Ok(v)
})
- .parse(input)
+ .parse_next(input)
}
pub(crate) fn unsigned_digits<const MIN: usize, const MAX: usize>(
@@ -216,7 +219,7 @@ pub(crate) fn unsigned_digits<const MIN: usize, const MAX: usize>(
) -> IResult<Input<'_>, &str, ParserError<'_>> {
take_while_m_n(MIN, MAX, DIGIT)
.map(|b: &[u8]| unsafe { from_utf8_unchecked(b, "`is_ascii_digit` filters out on-ASCII") })
- .parse(input)
+ .parse_next(input)
}
// DIGIT = %x30-39 ; 0-9
@@ -300,7 +303,7 @@ mod test {
];
for (input, expected) in inputs {
dbg!(input);
- let actual = date_time.parse(new_input(input)).finish().unwrap();
+ let actual = date_time.parse(new_input(input)).unwrap();
assert_eq!(expected, actual);
}
}
@@ -345,7 +348,7 @@ mod test {
];
for (input, expected) in inputs {
dbg!(input);
- let actual = date_time.parse(new_input(input)).finish().unwrap();
+ let actual = date_time.parse(new_input(input)).unwrap();
assert_eq!(expected, actual);
}
}
@@ -380,7 +383,7 @@ mod test {
];
for (input, expected) in inputs {
dbg!(input);
- let actual = date_time.parse(new_input(input)).finish().unwrap();
+ let actual = date_time.parse(new_input(input)).unwrap();
assert_eq!(expected, actual);
}
}
@@ -417,7 +420,7 @@ mod test {
];
for (input, expected) in inputs {
dbg!(input);
- let actual = date_time.parse(new_input(input)).finish().unwrap();
+ let actual = date_time.parse(new_input(input)).unwrap();
assert_eq!(expected, actual);
}
}
@@ -425,6 +428,6 @@ mod test {
#[test]
fn time_fraction_truncated() {
let input = "1987-07-05T17:45:00.123456789012345Z";
- date_time.parse(new_input(input)).finish().unwrap();
+ date_time.parse(new_input(input)).unwrap();
}
}
diff --git a/vendor/toml_edit/src/parser/document.rs b/vendor/toml_edit/src/parser/document.rs
index 38e9e0eee..3ff75361c 100644
--- a/vendor/toml_edit/src/parser/document.rs
+++ b/vendor/toml_edit/src/parser/document.rs
@@ -1,13 +1,13 @@
use std::cell::RefCell;
-use nom8::bytes::any;
-use nom8::bytes::one_of;
-use nom8::combinator::cut;
-use nom8::combinator::eof;
-use nom8::combinator::opt;
-use nom8::combinator::peek;
-use nom8::error::FromExternalError;
-use nom8::multi::many0_count;
+use winnow::bytes::any;
+use winnow::bytes::one_of;
+use winnow::combinator::cut_err;
+use winnow::combinator::eof;
+use winnow::combinator::opt;
+use winnow::combinator::peek;
+use winnow::error::FromExternalError;
+use winnow::multi::many0;
use crate::document::Document;
use crate::key::Key;
@@ -38,27 +38,28 @@ pub(crate) fn document(input: Input<'_>) -> IResult<Input<'_>, Document, ParserE
// Remove BOM if present
opt(b"\xEF\xBB\xBF"),
parse_ws(state_ref),
- many0_count((
+ many0((
dispatch! {peek(any);
- crate::parser::trivia::COMMENT_START_SYMBOL => cut(parse_comment(state_ref)),
- crate::parser::table::STD_TABLE_OPEN => cut(table(state_ref)),
+ crate::parser::trivia::COMMENT_START_SYMBOL => cut_err(parse_comment(state_ref)),
+ crate::parser::table::STD_TABLE_OPEN => cut_err(table(state_ref)),
crate::parser::trivia::LF |
crate::parser::trivia::CR => parse_newline(state_ref),
- _ => cut(keyval(state_ref)),
+ _ => cut_err(keyval(state_ref)),
},
parse_ws(state_ref),
- )),
+ ))
+ .map(|()| ()),
eof,
)
- .parse(input)?;
+ .parse_next(input)?;
state
.into_inner()
.into_document()
.map(|document| (i, document))
.map_err(|err| {
- nom8::Err::Error(ParserError::from_external_error(
+ winnow::error::ErrMode::Backtrack(ParserError::from_external_error(
i,
- nom8::error::ErrorKind::MapRes,
+ winnow::error::ErrorKind::Verify,
err,
))
})
@@ -73,7 +74,7 @@ pub(crate) fn parse_comment<'s, 'i>(
.map(|span| {
state.borrow_mut().on_comment(span);
})
- .parse(i)
+ .parse_next(i)
}
}
@@ -83,7 +84,7 @@ pub(crate) fn parse_ws<'s, 'i>(
move |i| {
ws.span()
.map(|span| state.borrow_mut().on_ws(span))
- .parse(i)
+ .parse_next(i)
}
}
@@ -94,7 +95,7 @@ pub(crate) fn parse_newline<'s, 'i>(
newline
.span()
.map(|span| state.borrow_mut().on_ws(span))
- .parse(i)
+ .parse_next(i)
}
}
@@ -104,7 +105,7 @@ pub(crate) fn keyval<'s, 'i>(
move |i| {
parse_keyval
.map_res(|(p, kv)| state.borrow_mut().on_keyval(p, kv))
- .parse(i)
+ .parse_next(i)
}
}
@@ -114,7 +115,7 @@ pub(crate) fn parse_keyval(
) -> IResult<Input<'_>, (Vec<Key>, TableKeyValue), ParserError<'_>> {
(
key,
- cut((
+ cut_err((
one_of(KEYVAL_SEP)
.context(Context::Expected(ParserValue::CharLiteral('.')))
.context(Context::Expected(ParserValue::CharLiteral('='))),
@@ -143,5 +144,5 @@ pub(crate) fn parse_keyval(
},
))
})
- .parse(input)
+ .parse_next(input)
}
diff --git a/vendor/toml_edit/src/parser/errors.rs b/vendor/toml_edit/src/parser/errors.rs
index 0baf6bdd4..4e3825f99 100644
--- a/vendor/toml_edit/src/parser/errors.rs
+++ b/vendor/toml_edit/src/parser/errors.rs
@@ -4,6 +4,8 @@ use std::fmt::{Display, Formatter, Result};
use crate::parser::prelude::*;
use crate::Key;
+use winnow::BStr;
+
/// Type representing a TOML parse error
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct TomlError {
@@ -15,10 +17,10 @@ pub struct TomlError {
impl TomlError {
pub(crate) fn new(error: ParserError<'_>, original: Input<'_>) -> Self {
- use nom8::input::IntoOutput;
- use nom8::input::Offset;
+ use winnow::stream::Offset;
+ use winnow::stream::Stream;
- let offset = original.offset(&error.input);
+ let offset = original.offset_to(&error.input);
let span = if offset == original.len() {
offset..offset
} else {
@@ -26,12 +28,12 @@ impl TomlError {
};
let message = error.to_string();
+ let original = original.next_slice(original.eof_offset()).1;
Self {
message,
original: Some(
- String::from_utf8(original.into_output().to_owned())
- .expect("original document was utf8"),
+ String::from_utf8(original.to_owned()).expect("original document was utf8"),
),
keys: Vec::new(),
span: Some(span),
@@ -151,8 +153,8 @@ pub(crate) struct ParserError<'b> {
cause: Option<Box<dyn std::error::Error + Send + Sync + 'static>>,
}
-impl<'b> nom8::error::ParseError<Input<'b>> for ParserError<'b> {
- fn from_error_kind(input: Input<'b>, _kind: nom8::error::ErrorKind) -> Self {
+impl<'b> winnow::error::ParseError<Input<'b>> for ParserError<'b> {
+ fn from_error_kind(input: Input<'b>, _kind: winnow::error::ErrorKind) -> Self {
Self {
input,
context: Default::default(),
@@ -160,12 +162,8 @@ impl<'b> nom8::error::ParseError<Input<'b>> for ParserError<'b> {
}
}
- fn append(_input: Input<'b>, _kind: nom8::error::ErrorKind, other: Self) -> Self {
- other
- }
-
- fn from_char(_input: Input<'b>, _: char) -> Self {
- unimplemented!("this shouldn't be called with a binary parser")
+ fn append(self, _input: Input<'b>, _kind: winnow::error::ErrorKind) -> Self {
+ self
}
fn or(self, other: Self) -> Self {
@@ -173,21 +171,17 @@ impl<'b> nom8::error::ParseError<Input<'b>> for ParserError<'b> {
}
}
-impl<'b> nom8::error::ParseError<&'b str> for ParserError<'b> {
- fn from_error_kind(input: &'b str, _kind: nom8::error::ErrorKind) -> Self {
+impl<'b> winnow::error::ParseError<&'b str> for ParserError<'b> {
+ fn from_error_kind(input: &'b str, _kind: winnow::error::ErrorKind) -> Self {
Self {
- input: Input::new(input.as_bytes()),
+ input: Input::new(BStr::new(input)),
context: Default::default(),
cause: Default::default(),
}
}
- fn append(_input: &'b str, _kind: nom8::error::ErrorKind, other: Self) -> Self {
- other
- }
-
- fn from_char(_input: &'b str, _: char) -> Self {
- unimplemented!("this shouldn't be called with a binary parser")
+ fn append(self, _input: &'b str, _kind: winnow::error::ErrorKind) -> Self {
+ self
}
fn or(self, other: Self) -> Self {
@@ -195,17 +189,17 @@ impl<'b> nom8::error::ParseError<&'b str> for ParserError<'b> {
}
}
-impl<'b> nom8::error::ContextError<Input<'b>, Context> for ParserError<'b> {
- fn add_context(_input: Input<'b>, ctx: Context, mut other: Self) -> Self {
- other.context.push(ctx);
- other
+impl<'b> winnow::error::ContextError<Input<'b>, Context> for ParserError<'b> {
+ fn add_context(mut self, _input: Input<'b>, ctx: Context) -> Self {
+ self.context.push(ctx);
+ self
}
}
-impl<'b, E: std::error::Error + Send + Sync + 'static> nom8::error::FromExternalError<Input<'b>, E>
- for ParserError<'b>
+impl<'b, E: std::error::Error + Send + Sync + 'static>
+ winnow::error::FromExternalError<Input<'b>, E> for ParserError<'b>
{
- fn from_external_error(input: Input<'b>, _kind: nom8::error::ErrorKind, e: E) -> Self {
+ fn from_external_error(input: Input<'b>, _kind: winnow::error::ErrorKind, e: E) -> Self {
Self {
input,
context: Default::default(),
@@ -214,12 +208,12 @@ impl<'b, E: std::error::Error + Send + Sync + 'static> nom8::error::FromExternal
}
}
-impl<'b, E: std::error::Error + Send + Sync + 'static> nom8::error::FromExternalError<&'b str, E>
+impl<'b, E: std::error::Error + Send + Sync + 'static> winnow::error::FromExternalError<&'b str, E>
for ParserError<'b>
{
- fn from_external_error(input: &'b str, _kind: nom8::error::ErrorKind, e: E) -> Self {
+ fn from_external_error(input: &'b str, _kind: winnow::error::ErrorKind, e: E) -> Self {
Self {
- input: Input::new(input.as_bytes()),
+ input: Input::new(BStr::new(input)),
context: Default::default(),
cause: Some(Box::new(e)),
}
diff --git a/vendor/toml_edit/src/parser/inline_table.rs b/vendor/toml_edit/src/parser/inline_table.rs
index e8d38f4a9..7bec28723 100644
--- a/vendor/toml_edit/src/parser/inline_table.rs
+++ b/vendor/toml_edit/src/parser/inline_table.rs
@@ -1,7 +1,7 @@
-use nom8::bytes::one_of;
-use nom8::combinator::cut;
-use nom8::multi::separated_list0;
-use nom8::sequence::delimited;
+use winnow::bytes::one_of;
+use winnow::combinator::cut_err;
+use winnow::multi::separated0;
+use winnow::sequence::delimited;
use crate::key::Key;
use crate::parser::errors::CustomError;
@@ -23,12 +23,12 @@ pub(crate) fn inline_table(
move |input| {
delimited(
INLINE_TABLE_OPEN,
- cut(inline_table_keyvals(check).map_res(|(kv, p)| table_from_pairs(kv, p))),
- cut(INLINE_TABLE_CLOSE)
+ cut_err(inline_table_keyvals(check).map_res(|(kv, p)| table_from_pairs(kv, p))),
+ cut_err(INLINE_TABLE_CLOSE)
.context(Context::Expression("inline table"))
.context(Context::Expected(ParserValue::CharLiteral('}'))),
)
- .parse(input)
+ .parse_next(input)
}
}
@@ -104,10 +104,10 @@ fn inline_table_keyvals(
move |input| {
let check = check.recursing(input)?;
(
- separated_list0(INLINE_TABLE_SEP, keyval(check)),
+ separated0(keyval(check), INLINE_TABLE_SEP),
ws.span().map(RawString::with_span),
)
- .parse(input)
+ .parse_next(input)
}
}
@@ -117,7 +117,7 @@ fn keyval(
move |input| {
(
key,
- cut((
+ cut_err((
one_of(KEYVAL_SEP)
.context(Context::Expected(ParserValue::CharLiteral('.')))
.context(Context::Expected(ParserValue::CharLiteral('='))),
@@ -140,7 +140,7 @@ fn keyval(
},
)
})
- .parse(input)
+ .parse_next(input)
}
}
@@ -159,9 +159,7 @@ mod test {
];
for input in inputs {
dbg!(input);
- let mut parsed = inline_table(Default::default())
- .parse(new_input(input))
- .finish();
+ let mut parsed = inline_table(Default::default()).parse(new_input(input));
if let Ok(parsed) = &mut parsed {
parsed.despan(input);
}
@@ -174,9 +172,7 @@ mod test {
let invalid_inputs = [r#"{a = 1e165"#, r#"{ hello = "world", a = 2, hello = 1}"#];
for input in invalid_inputs {
dbg!(input);
- let mut parsed = inline_table(Default::default())
- .parse(new_input(input))
- .finish();
+ let mut parsed = inline_table(Default::default()).parse(new_input(input));
if let Ok(parsed) = &mut parsed {
parsed.despan(input);
}
diff --git a/vendor/toml_edit/src/parser/key.rs b/vendor/toml_edit/src/parser/key.rs
index 82424916f..c3d4e7962 100644
--- a/vendor/toml_edit/src/parser/key.rs
+++ b/vendor/toml_edit/src/parser/key.rs
@@ -1,9 +1,9 @@
use std::ops::RangeInclusive;
-use nom8::bytes::any;
-use nom8::bytes::take_while1;
-use nom8::combinator::peek;
-use nom8::multi::separated_list1;
+use winnow::bytes::any;
+use winnow::bytes::take_while1;
+use winnow::combinator::peek;
+use winnow::multi::separated1;
use crate::key::Key;
use crate::parser::errors::CustomError;
@@ -17,8 +17,7 @@ use crate::RawString;
// key = simple-key / dotted-key
// dotted-key = simple-key 1*( dot-sep simple-key )
pub(crate) fn key(input: Input<'_>) -> IResult<Input<'_>, Vec<Key>, ParserError<'_>> {
- separated_list1(
- DOT_SEP,
+ separated1(
(ws.span(), simple_key, ws.span()).map(|(pre, (raw, key), suffix)| {
Key::new(key)
.with_repr_unchecked(Repr::new_unchecked(raw))
@@ -27,14 +26,15 @@ pub(crate) fn key(input: Input<'_>) -> IResult<Input<'_>, Vec<Key>, ParserError<
RawString::with_span(suffix),
))
}),
+ DOT_SEP,
)
.context(Context::Expression("key"))
- .map_res(|k| {
+ .map_res(|k: Vec<_>| {
// Inserting the key will require recursion down the line
RecursionCheck::check_depth(k.len())?;
Ok::<_, CustomError>(k)
})
- .parse(input)
+ .parse_next(input)
}
// simple-key = quoted-key / unquoted-key
@@ -53,19 +53,19 @@ pub(crate) fn simple_key(
let raw = RawString::with_span(span);
(raw, k)
})
- .parse(input)
+ .parse_next(input)
}
// unquoted-key = 1*( ALPHA / DIGIT / %x2D / %x5F ) ; A-Z / a-z / 0-9 / - / _
fn unquoted_key(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
take_while1(UNQUOTED_CHAR)
.map(|b| unsafe { from_utf8_unchecked(b, "`is_unquoted_char` filters out on-ASCII") })
- .parse(input)
+ .parse_next(input)
}
pub(crate) fn is_unquoted_char(c: u8) -> bool {
- use nom8::input::FindToken;
- UNQUOTED_CHAR.find_token(c)
+ use winnow::stream::ContainsToken;
+ UNQUOTED_CHAR.contains_token(c)
}
const UNQUOTED_CHAR: (
@@ -93,7 +93,7 @@ mod test {
for (input, expected) in cases {
dbg!(input);
- let parsed = simple_key.parse(new_input(input)).finish();
+ let parsed = simple_key.parse(new_input(input));
assert_eq!(
parsed,
Ok((RawString::with_span(0..(input.len())), expected.into())),
diff --git a/vendor/toml_edit/src/parser/macros.rs b/vendor/toml_edit/src/parser/macros.rs
index 591b2f7b1..93050f5ad 100644
--- a/vendor/toml_edit/src/parser/macros.rs
+++ b/vendor/toml_edit/src/parser/macros.rs
@@ -2,10 +2,10 @@ macro_rules! dispatch {
($match_parser: expr; $( $pat:pat $(if $pred:expr)? => $expr: expr ),+ $(,)? ) => {
move |i|
{
- let (i, initial) = $match_parser.parse(i)?;
+ let (i, initial) = $match_parser.parse_next(i)?;
match initial {
$(
- $pat $(if $pred)? => $expr.parse(i),
+ $pat $(if $pred)? => $expr.parse_next(i),
)*
}
}
diff --git a/vendor/toml_edit/src/parser/mod.rs b/vendor/toml_edit/src/parser/mod.rs
index 2c7751ee0..b2ce4bc5e 100644
--- a/vendor/toml_edit/src/parser/mod.rs
+++ b/vendor/toml_edit/src/parser/mod.rs
@@ -24,7 +24,6 @@ pub(crate) fn parse_document(raw: &str) -> Result<crate::Document, TomlError> {
let b = new_input(raw);
let mut doc = document::document
.parse(b)
- .finish()
.map_err(|e| TomlError::new(e, b))?;
doc.span = Some(0..(raw.len()));
doc.original = Some(raw.to_owned());
@@ -35,7 +34,7 @@ pub(crate) fn parse_key(raw: &str) -> Result<crate::Key, TomlError> {
use prelude::*;
let b = new_input(raw);
- let result = key::simple_key.parse(b).finish();
+ let result = key::simple_key.parse(b);
match result {
Ok((raw, key)) => {
Ok(crate::Key::new(key).with_repr_unchecked(crate::Repr::new_unchecked(raw)))
@@ -48,7 +47,7 @@ pub(crate) fn parse_key_path(raw: &str) -> Result<Vec<crate::Key>, TomlError> {
use prelude::*;
let b = new_input(raw);
- let result = key::key.parse(b).finish();
+ let result = key::key.parse(b);
match result {
Ok(mut keys) => {
for key in &mut keys {
@@ -64,7 +63,7 @@ pub(crate) fn parse_value(raw: &str) -> Result<crate::Value, TomlError> {
use prelude::*;
let b = new_input(raw);
- let parsed = value::value(RecursionCheck::default()).parse(b).finish();
+ let parsed = value::value(RecursionCheck::default()).parse(b);
match parsed {
Ok(mut value) => {
// Only take the repr and not decor, as its probably not intended
@@ -80,21 +79,21 @@ pub(crate) mod prelude {
pub(crate) use super::errors::Context;
pub(crate) use super::errors::ParserError;
pub(crate) use super::errors::ParserValue;
- pub(crate) use nom8::IResult;
- pub(crate) use nom8::Parser as _;
+ pub(crate) use winnow::IResult;
+ pub(crate) use winnow::Parser as _;
- pub(crate) use nom8::FinishIResult as _;
-
- pub(crate) type Input<'b> = nom8::input::Located<&'b [u8]>;
+ pub(crate) type Input<'b> = winnow::Located<&'b winnow::BStr>;
pub(crate) fn new_input(s: &str) -> Input<'_> {
- nom8::input::Located::new(s.as_bytes())
+ winnow::Located::new(winnow::BStr::new(s))
}
- pub(crate) fn ok_error<I, O, E>(res: IResult<I, O, E>) -> Result<Option<(I, O)>, nom8::Err<E>> {
+ pub(crate) fn ok_error<I, O, E>(
+ res: IResult<I, O, E>,
+ ) -> Result<Option<(I, O)>, winnow::error::ErrMode<E>> {
match res {
Ok(ok) => Ok(Some(ok)),
- Err(nom8::Err::Error(_)) => Ok(None),
+ Err(winnow::error::ErrMode::Backtrack(_)) => Ok(None),
Err(err) => Err(err),
}
}
@@ -102,13 +101,13 @@ pub(crate) mod prelude {
#[allow(dead_code)]
pub(crate) fn trace<I: std::fmt::Debug, O: std::fmt::Debug, E: std::fmt::Debug>(
context: impl std::fmt::Display,
- mut parser: impl nom8::Parser<I, O, E>,
+ mut parser: impl winnow::Parser<I, O, E>,
) -> impl FnMut(I) -> IResult<I, O, E> {
static DEPTH: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
move |input: I| {
let depth = DEPTH.fetch_add(1, std::sync::atomic::Ordering::SeqCst) * 2;
eprintln!("{:depth$}--> {} {:?}", "", context, input);
- match parser.parse(input) {
+ match parser.parse_next(input) {
Ok((i, o)) => {
DEPTH.fetch_sub(1, std::sync::atomic::Ordering::SeqCst);
eprintln!("{:depth$}<-- {} {:?}", "", context, i);
@@ -142,15 +141,15 @@ pub(crate) mod prelude {
pub(crate) fn recursing(
mut self,
input: Input<'_>,
- ) -> Result<Self, nom8::Err<ParserError<'_>>> {
+ ) -> Result<Self, winnow::error::ErrMode<ParserError<'_>>> {
self.current += 1;
if self.current < 128 {
Ok(self)
} else {
- Err(nom8::Err::Error(
- nom8::error::FromExternalError::from_external_error(
+ Err(winnow::error::ErrMode::Backtrack(
+ winnow::error::FromExternalError::from_external_error(
input,
- nom8::error::ErrorKind::Eof,
+ winnow::error::ErrorKind::Eof,
super::errors::CustomError::RecursionLimitExceeded,
),
))
@@ -171,7 +170,7 @@ pub(crate) mod prelude {
pub(crate) fn recursing(
self,
_input: Input<'_>,
- ) -> Result<Self, nom8::Err<ParserError<'_>>> {
+ ) -> Result<Self, winnow::error::ErrMode<ParserError<'_>>> {
Ok(self)
}
}
diff --git a/vendor/toml_edit/src/parser/numbers.rs b/vendor/toml_edit/src/parser/numbers.rs
index 5a2a931f7..903b5f54a 100644
--- a/vendor/toml_edit/src/parser/numbers.rs
+++ b/vendor/toml_edit/src/parser/numbers.rs
@@ -1,15 +1,15 @@
use std::ops::RangeInclusive;
-use nom8::branch::alt;
-use nom8::bytes::one_of;
-use nom8::bytes::tag;
-use nom8::bytes::take;
-use nom8::combinator::cut;
-use nom8::combinator::opt;
-use nom8::combinator::peek;
-use nom8::combinator::rest;
-use nom8::multi::many0_count;
-use nom8::sequence::preceded;
+use winnow::branch::alt;
+use winnow::bytes::one_of;
+use winnow::bytes::tag;
+use winnow::bytes::take;
+use winnow::combinator::cut_err;
+use winnow::combinator::opt;
+use winnow::combinator::peek;
+use winnow::combinator::rest;
+use winnow::multi::many0;
+use winnow::sequence::preceded;
use crate::parser::prelude::*;
use crate::parser::trivia::from_utf8_unchecked;
@@ -19,16 +19,18 @@ use crate::parser::trivia::from_utf8_unchecked;
// boolean = true / false
#[allow(dead_code)] // directly define in `fn value`
pub(crate) fn boolean(input: Input<'_>) -> IResult<Input<'_>, bool, ParserError<'_>> {
- alt((true_, false_)).parse(input)
+ alt((true_, false_)).parse_next(input)
}
pub(crate) fn true_(input: Input<'_>) -> IResult<Input<'_>, bool, ParserError<'_>> {
- (peek(TRUE[0]), cut(TRUE)).value(true).parse(input)
+ (peek(TRUE[0]), cut_err(TRUE)).value(true).parse_next(input)
}
const TRUE: &[u8] = b"true";
pub(crate) fn false_(input: Input<'_>) -> IResult<Input<'_>, bool, ParserError<'_>> {
- (peek(FALSE[0]), cut(FALSE)).value(false).parse(input)
+ (peek(FALSE[0]), cut_err(FALSE))
+ .value(false)
+ .parse_next(input)
}
const FALSE: &[u8] = b"false";
@@ -37,13 +39,13 @@ const FALSE: &[u8] = b"false";
// integer = dec-int / hex-int / oct-int / bin-int
pub(crate) fn integer(input: Input<'_>) -> IResult<Input<'_>, i64, ParserError<'_>> {
dispatch! {peek(opt::<_, &[u8], _, _>(take(2usize)));
- Some(b"0x") => cut(hex_int.map_res(|s| i64::from_str_radix(&s.replace('_', ""), 16))),
- Some(b"0o") => cut(oct_int.map_res(|s| i64::from_str_radix(&s.replace('_', ""), 8))),
- Some(b"0b") => cut(bin_int.map_res(|s| i64::from_str_radix(&s.replace('_', ""), 2))),
- _ => dec_int.and_then(cut(rest
+ Some(b"0x") => cut_err(hex_int.map_res(|s| i64::from_str_radix(&s.replace('_', ""), 16))),
+ Some(b"0o") => cut_err(oct_int.map_res(|s| i64::from_str_radix(&s.replace('_', ""), 8))),
+ Some(b"0b") => cut_err(bin_int.map_res(|s| i64::from_str_radix(&s.replace('_', ""), 2))),
+ _ => dec_int.and_then(cut_err(rest
.map_res(|s: &str| s.replace('_', "").parse())))
}
- .parse(input)
+ .parse_next(input)
}
// dec-int = [ minus / plus ] unsigned-dec-int
@@ -54,14 +56,16 @@ pub(crate) fn dec_int(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<
alt((
(
one_of(DIGIT1_9),
- many0_count(alt((
+ many0(alt((
digit.value(()),
(
one_of(b'_'),
- cut(digit).context(Context::Expected(ParserValue::Description("digit"))),
+ cut_err(digit)
+ .context(Context::Expected(ParserValue::Description("digit"))),
)
.value(()),
- ))),
+ )))
+ .map(|()| ()),
)
.value(()),
digit.value(()),
@@ -70,7 +74,7 @@ pub(crate) fn dec_int(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<
.recognize()
.map(|b: &[u8]| unsafe { from_utf8_unchecked(b, "`digit` and `_` filter out non-ASCII") })
.context(Context::Expression("integer"))
- .parse(input)
+ .parse_next(input)
}
const DIGIT1_9: RangeInclusive<u8> = b'1'..=b'9';
@@ -79,22 +83,23 @@ const DIGIT1_9: RangeInclusive<u8> = b'1'..=b'9';
pub(crate) fn hex_int(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
preceded(
HEX_PREFIX,
- cut((
+ cut_err((
hexdig,
- many0_count(alt((
+ many0(alt((
hexdig.value(()),
(
one_of(b'_'),
- cut(hexdig).context(Context::Expected(ParserValue::Description("digit"))),
+ cut_err(hexdig).context(Context::Expected(ParserValue::Description("digit"))),
)
.value(()),
- ))),
+ )))
+ .map(|()| ()),
))
.recognize(),
)
.map(|b| unsafe { from_utf8_unchecked(b, "`hexdig` and `_` filter out non-ASCII") })
.context(Context::Expression("hexadecimal integer"))
- .parse(input)
+ .parse_next(input)
}
const HEX_PREFIX: &[u8] = b"0x";
@@ -103,23 +108,24 @@ const HEX_PREFIX: &[u8] = b"0x";
pub(crate) fn oct_int(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
preceded(
OCT_PREFIX,
- cut((
+ cut_err((
one_of(DIGIT0_7),
- many0_count(alt((
+ many0(alt((
one_of(DIGIT0_7).value(()),
(
one_of(b'_'),
- cut(one_of(DIGIT0_7))
+ cut_err(one_of(DIGIT0_7))
.context(Context::Expected(ParserValue::Description("digit"))),
)
.value(()),
- ))),
+ )))
+ .map(|()| ()),
))
.recognize(),
)
.map(|b| unsafe { from_utf8_unchecked(b, "`DIGIT0_7` and `_` filter out non-ASCII") })
.context(Context::Expression("octal integer"))
- .parse(input)
+ .parse_next(input)
}
const OCT_PREFIX: &[u8] = b"0o";
const DIGIT0_7: RangeInclusive<u8> = b'0'..=b'7';
@@ -129,23 +135,24 @@ const DIGIT0_7: RangeInclusive<u8> = b'0'..=b'7';
pub(crate) fn bin_int(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
preceded(
BIN_PREFIX,
- cut((
+ cut_err((
one_of(DIGIT0_1),
- many0_count(alt((
+ many0(alt((
one_of(DIGIT0_1).value(()),
(
one_of(b'_'),
- cut(one_of(DIGIT0_1))
+ cut_err(one_of(DIGIT0_1))
.context(Context::Expected(ParserValue::Description("digit"))),
)
.value(()),
- ))),
+ )))
+ .map(|()| ()),
))
.recognize(),
)
.map(|b| unsafe { from_utf8_unchecked(b, "`DIGIT0_1` and `_` filter out non-ASCII") })
.context(Context::Expression("binary integer"))
- .parse(input)
+ .parse_next(input)
}
const BIN_PREFIX: &[u8] = b"0b";
const DIGIT0_1: RangeInclusive<u8> = b'0'..=b'1';
@@ -157,13 +164,14 @@ const DIGIT0_1: RangeInclusive<u8> = b'0'..=b'1';
// float-int-part = dec-int
pub(crate) fn float(input: Input<'_>) -> IResult<Input<'_>, f64, ParserError<'_>> {
alt((
- float_.and_then(cut(rest
- .map_res(|s: &str| s.replace('_', "").parse())
- .verify(|f: &f64| *f != f64::INFINITY))),
+ float_.and_then(cut_err(
+ rest.map_res(|s: &str| s.replace('_', "").parse())
+ .verify(|f: &f64| *f != f64::INFINITY),
+ )),
special_float,
))
.context(Context::Expression("floating-point number"))
- .parse(input)
+ .parse_next(input)
}
pub(crate) fn float_(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
@@ -175,7 +183,7 @@ pub(crate) fn float_(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'
"`dec_int`, `one_of`, `exp`, and `frac` filter out non-ASCII",
)
})
- .parse(input)
+ .parse_next(input)
}
// frac = decimal-point zero-prefixable-int
@@ -183,7 +191,7 @@ pub(crate) fn float_(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'
pub(crate) fn frac(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
(
b'.',
- cut(zero_prefixable_int).context(Context::Expected(ParserValue::Description("digit"))),
+ cut_err(zero_prefixable_int).context(Context::Expected(ParserValue::Description("digit"))),
)
.recognize()
.map(|b: &[u8]| unsafe {
@@ -192,25 +200,26 @@ pub(crate) fn frac(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>
"`.` and `parse_zero_prefixable_int` filter out non-ASCII",
)
})
- .parse(input)
+ .parse_next(input)
}
// zero-prefixable-int = DIGIT *( DIGIT / underscore DIGIT )
pub(crate) fn zero_prefixable_int(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
(
digit,
- many0_count(alt((
+ many0(alt((
digit.value(()),
(
one_of(b'_'),
- cut(digit).context(Context::Expected(ParserValue::Description("digit"))),
+ cut_err(digit).context(Context::Expected(ParserValue::Description("digit"))),
)
.value(()),
- ))),
+ )))
+ .map(|()| ()),
)
.recognize()
.map(|b: &[u8]| unsafe { from_utf8_unchecked(b, "`digit` and `_` filter out non-ASCII") })
- .parse(input)
+ .parse_next(input)
}
// exp = "e" float-exp-part
@@ -219,7 +228,7 @@ pub(crate) fn exp(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>>
(
one_of((b'e', b'E')),
opt(one_of([b'+', b'-'])),
- cut(zero_prefixable_int),
+ cut_err(zero_prefixable_int),
)
.recognize()
.map(|b: &[u8]| unsafe {
@@ -228,7 +237,7 @@ pub(crate) fn exp(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>>
"`one_of` and `parse_zero_prefixable_int` filter out non-ASCII",
)
})
- .parse(input)
+ .parse_next(input)
}
// special-float = [ minus / plus ] ( inf / nan )
@@ -239,28 +248,28 @@ pub(crate) fn special_float(input: Input<'_>) -> IResult<Input<'_>, f64, ParserE
Some(b'-') => -f,
_ => unreachable!("one_of should prevent this"),
})
- .parse(input)
+ .parse_next(input)
}
// inf = %x69.6e.66 ; inf
pub(crate) fn inf(input: Input<'_>) -> IResult<Input<'_>, f64, ParserError<'_>> {
- tag(INF).value(f64::INFINITY).parse(input)
+ tag(INF).value(f64::INFINITY).parse_next(input)
}
const INF: &[u8] = b"inf";
// nan = %x6e.61.6e ; nan
pub(crate) fn nan(input: Input<'_>) -> IResult<Input<'_>, f64, ParserError<'_>> {
- tag(NAN).value(f64::NAN).parse(input)
+ tag(NAN).value(f64::NAN).parse_next(input)
}
const NAN: &[u8] = b"nan";
// DIGIT = %x30-39 ; 0-9
pub(crate) fn digit(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<'_>> {
- one_of(DIGIT).parse(input)
+ one_of(DIGIT).parse_next(input)
}
const DIGIT: RangeInclusive<u8> = b'0'..=b'9';
// HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
pub(crate) fn hexdig(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<'_>> {
- one_of(HEXDIG).parse(input)
+ one_of(HEXDIG).parse_next(input)
}
pub(crate) const HEXDIG: (RangeInclusive<u8>, RangeInclusive<u8>, RangeInclusive<u8>) =
(DIGIT, b'A'..=b'F', b'a'..=b'f');
@@ -287,12 +296,12 @@ mod test {
];
for &(input, expected) in &cases {
dbg!(input);
- let parsed = integer.parse(new_input(input)).finish();
+ let parsed = integer.parse(new_input(input));
assert_eq!(parsed, Ok(expected), "Parsing {input:?}");
}
let overflow = "1000000000000000000000000000000000";
- let parsed = integer.parse(new_input(overflow)).finish();
+ let parsed = integer.parse(new_input(overflow));
assert!(parsed.is_err());
}
@@ -333,11 +342,11 @@ mod test {
];
for &(input, expected) in &cases {
dbg!(input);
- let parsed = float.parse(new_input(input)).finish().unwrap();
+ let parsed = float.parse(new_input(input)).unwrap();
assert_float_eq(parsed, expected);
let overflow = "9e99999";
- let parsed = float.parse(new_input(overflow)).finish();
+ let parsed = float.parse(new_input(overflow));
assert!(parsed.is_err(), "{:?}", parsed);
}
}
diff --git a/vendor/toml_edit/src/parser/strings.rs b/vendor/toml_edit/src/parser/strings.rs
index d31c43887..93d034c00 100644
--- a/vendor/toml_edit/src/parser/strings.rs
+++ b/vendor/toml_edit/src/parser/strings.rs
@@ -2,24 +2,25 @@ use std::borrow::Cow;
use std::char;
use std::ops::RangeInclusive;
-use nom8::branch::alt;
-use nom8::bytes::any;
-use nom8::bytes::none_of;
-use nom8::bytes::one_of;
-use nom8::bytes::tag;
-use nom8::bytes::take_while;
-use nom8::bytes::take_while1;
-use nom8::bytes::take_while_m_n;
-use nom8::combinator::cut;
-use nom8::combinator::fail;
-use nom8::combinator::opt;
-use nom8::combinator::peek;
-use nom8::combinator::success;
-use nom8::multi::many0_count;
-use nom8::multi::many1_count;
-use nom8::sequence::delimited;
-use nom8::sequence::preceded;
-use nom8::sequence::terminated;
+use winnow::branch::alt;
+use winnow::bytes::any;
+use winnow::bytes::none_of;
+use winnow::bytes::one_of;
+use winnow::bytes::tag;
+use winnow::bytes::take_while0;
+use winnow::bytes::take_while1;
+use winnow::bytes::take_while_m_n;
+use winnow::combinator::cut_err;
+use winnow::combinator::fail;
+use winnow::combinator::opt;
+use winnow::combinator::peek;
+use winnow::combinator::success;
+use winnow::multi::many0;
+use winnow::multi::many1;
+use winnow::prelude::*;
+use winnow::sequence::delimited;
+use winnow::sequence::preceded;
+use winnow::sequence::terminated;
use crate::parser::errors::CustomError;
use crate::parser::numbers::HEXDIG;
@@ -36,28 +37,28 @@ pub(crate) fn string(input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, Parse
ml_literal_string,
literal_string.map(Cow::Borrowed),
))
- .parse(input)
+ .parse_next(input)
}
// ;; Basic String
// basic-string = quotation-mark *basic-char quotation-mark
pub(crate) fn basic_string(input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, ParserError<'_>> {
- let (mut input, _) = one_of(QUOTATION_MARK).parse(input)?;
+ let (mut input, _) = one_of(QUOTATION_MARK).parse_next(input)?;
let mut c = Cow::Borrowed("");
- if let Some((i, ci)) = ok_error(basic_chars.parse(input))? {
+ if let Some((i, ci)) = ok_error(basic_chars.parse_next(input))? {
input = i;
c = ci;
}
- while let Some((i, ci)) = ok_error(basic_chars.parse(input))? {
+ while let Some((i, ci)) = ok_error(basic_chars.parse_next(input))? {
input = i;
c.to_mut().push_str(&ci);
}
- let (input, _) = cut(one_of(QUOTATION_MARK))
+ let (input, _) = cut_err(one_of(QUOTATION_MARK))
.context(Context::Expression("basic string"))
- .parse(input)?;
+ .parse_next(input)?;
Ok((input, c))
}
@@ -75,7 +76,7 @@ fn basic_chars(input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, ParserError
.map(Cow::Borrowed),
escaped.map(|c| Cow::Owned(String::from(c))),
))
- .parse(input)
+ .parse_next(input)
}
// basic-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii
@@ -89,7 +90,7 @@ pub(crate) const BASIC_UNESCAPED: (
// escaped = escape escape-seq-char
fn escaped(input: Input<'_>) -> IResult<Input<'_>, char, ParserError<'_>> {
- preceded(ESCAPE, escape_seq_char).parse(input)
+ preceded(ESCAPE, escape_seq_char).parse_next(input)
}
// escape = %x5C ; \
@@ -111,12 +112,12 @@ fn escape_seq_char(input: Input<'_>) -> IResult<Input<'_>, char, ParserError<'_>
b'n' => success('\n'),
b'r' => success('\r'),
b't' => success('\t'),
- b'u' => cut(hexescape::<4>).context(Context::Expression("unicode 4-digit hex code")),
- b'U' => cut(hexescape::<8>).context(Context::Expression("unicode 8-digit hex code")),
+ b'u' => cut_err(hexescape::<4>).context(Context::Expression("unicode 4-digit hex code")),
+ b'U' => cut_err(hexescape::<8>).context(Context::Expression("unicode 8-digit hex code")),
b'\\' => success('\\'),
b'"' => success('"'),
_ => {
- cut(fail::<_, char, _>)
+ cut_err(fail::<_, char, _>)
.context(Context::Expression("escape sequence"))
.context(Context::Expected(ParserValue::CharLiteral('b')))
.context(Context::Expected(ParserValue::CharLiteral('f')))
@@ -129,7 +130,7 @@ fn escape_seq_char(input: Input<'_>) -> IResult<Input<'_>, char, ParserError<'_>
.context(Context::Expected(ParserValue::CharLiteral('"')))
}
}
- .parse(input)
+ .parse_next(input)
}
pub(crate) fn hexescape<const N: usize>(
@@ -138,9 +139,9 @@ pub(crate) fn hexescape<const N: usize>(
take_while_m_n(0, N, HEXDIG)
.verify(|b: &[u8]| b.len() == N)
.map(|b: &[u8]| unsafe { from_utf8_unchecked(b, "`is_ascii_digit` filters out on-ASCII") })
- .map_opt(|s| u32::from_str_radix(s, 16).ok())
+ .verify_map(|s| u32::from_str_radix(s, 16).ok())
.map_res(|h| char::from_u32(h).ok_or(CustomError::OutOfRange))
- .parse(input)
+ .parse_next(input)
}
// ;; Multiline Basic String
@@ -150,11 +151,11 @@ pub(crate) fn hexescape<const N: usize>(
fn ml_basic_string(input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, ParserError<'_>> {
delimited(
ML_BASIC_STRING_DELIM,
- preceded(opt(newline), cut(ml_basic_body)),
- cut(ML_BASIC_STRING_DELIM),
+ preceded(opt(newline), cut_err(ml_basic_body)),
+ cut_err(ML_BASIC_STRING_DELIM),
)
.context(Context::Expression("multiline basic string"))
- .parse(input)
+ .parse_next(input)
}
// ml-basic-string-delim = 3quotation-mark
@@ -163,21 +164,21 @@ pub(crate) const ML_BASIC_STRING_DELIM: &[u8] = b"\"\"\"";
// ml-basic-body = *mlb-content *( mlb-quotes 1*mlb-content ) [ mlb-quotes ]
fn ml_basic_body(mut input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, ParserError<'_>> {
let mut c = Cow::Borrowed("");
- if let Some((i, ci)) = ok_error(mlb_content.parse(input))? {
+ if let Some((i, ci)) = ok_error(mlb_content.parse_next(input))? {
input = i;
c = ci;
}
- while let Some((i, ci)) = ok_error(mlb_content.parse(input))? {
+ while let Some((i, ci)) = ok_error(mlb_content.parse_next(input))? {
input = i;
c.to_mut().push_str(&ci);
}
- while let Some((i, qi)) = ok_error(mlb_quotes(none_of(b'\"').value(())).parse(input))? {
- if let Some((i, ci)) = ok_error(mlb_content.parse(i))? {
+ while let Some((i, qi)) = ok_error(mlb_quotes(none_of(b'\"').value(())).parse_next(input))? {
+ if let Some((i, ci)) = ok_error(mlb_content.parse_next(i))? {
input = i;
c.to_mut().push_str(qi);
c.to_mut().push_str(&ci);
- while let Some((i, ci)) = ok_error(mlb_content.parse(input))? {
+ while let Some((i, ci)) = ok_error(mlb_content.parse_next(input))? {
input = i;
c.to_mut().push_str(&ci);
}
@@ -186,7 +187,8 @@ fn ml_basic_body(mut input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, Parse
}
}
- if let Some((i, qi)) = ok_error(mlb_quotes(tag(ML_BASIC_STRING_DELIM).value(())).parse(input))?
+ if let Some((i, qi)) =
+ ok_error(mlb_quotes(tag(ML_BASIC_STRING_DELIM).value(())).parse_next(input))?
{
input = i;
c.to_mut().push_str(qi);
@@ -204,27 +206,27 @@ fn mlb_content(input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, ParserError
take_while1(MLB_UNESCAPED)
.map_res(std::str::from_utf8)
.map(Cow::Borrowed),
- // Order changed fromg grammar so `escaped` can more easily `cut` on bad escape sequences
+ // Order changed fromg grammar so `escaped` can more easily `cut_err` on bad escape sequences
mlb_escaped_nl.map(|_| Cow::Borrowed("")),
escaped.map(|c| Cow::Owned(String::from(c))),
newline.map(|_| Cow::Borrowed("\n")),
))
- .parse(input)
+ .parse_next(input)
}
// mlb-quotes = 1*2quotation-mark
fn mlb_quotes<'i>(
- mut term: impl nom8::Parser<Input<'i>, (), ParserError<'i>>,
+ mut term: impl winnow::Parser<Input<'i>, (), ParserError<'i>>,
) -> impl FnMut(Input<'i>) -> IResult<Input<'i>, &str, ParserError<'i>> {
move |input| {
let res = terminated(b"\"\"", peek(term.by_ref()))
.map(|b| unsafe { from_utf8_unchecked(b, "`bytes` out non-ASCII") })
- .parse(input);
+ .parse_next(input);
match res {
- Err(nom8::Err::Error(_)) => terminated(b"\"", peek(term.by_ref()))
+ Err(winnow::error::ErrMode::Backtrack(_)) => terminated(b"\"", peek(term.by_ref()))
.map(|b| unsafe { from_utf8_unchecked(b, "`bytes` out non-ASCII") })
- .parse(input),
+ .parse_next(input),
res => res,
}
}
@@ -245,19 +247,24 @@ pub(crate) const MLB_UNESCAPED: (
// (including newlines) up to the next non-whitespace
// character or closing delimiter.
fn mlb_escaped_nl(input: Input<'_>) -> IResult<Input<'_>, (), ParserError<'_>> {
- many1_count((ESCAPE, ws, ws_newlines))
+ many1((ESCAPE, ws, ws_newlines))
+ .map(|()| ())
.value(())
- .parse(input)
+ .parse_next(input)
}
// ;; Literal String
// literal-string = apostrophe *literal-char apostrophe
pub(crate) fn literal_string(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
- delimited(APOSTROPHE, cut(take_while(LITERAL_CHAR)), cut(APOSTROPHE))
- .map_res(std::str::from_utf8)
- .context(Context::Expression("literal string"))
- .parse(input)
+ delimited(
+ APOSTROPHE,
+ cut_err(take_while0(LITERAL_CHAR)),
+ cut_err(APOSTROPHE),
+ )
+ .map_res(std::str::from_utf8)
+ .context(Context::Expression("literal string"))
+ .parse_next(input)
}
// apostrophe = %x27 ; ' apostrophe
@@ -278,17 +285,17 @@ pub(crate) const LITERAL_CHAR: (
fn ml_literal_string(input: Input<'_>) -> IResult<Input<'_>, Cow<'_, str>, ParserError<'_>> {
delimited(
(ML_LITERAL_STRING_DELIM, opt(newline)),
- cut(ml_literal_body.map(|t| {
+ cut_err(ml_literal_body.map(|t| {
if t.contains("\r\n") {
Cow::Owned(t.replace("\r\n", "\n"))
} else {
Cow::Borrowed(t)
}
})),
- cut(ML_LITERAL_STRING_DELIM),
+ cut_err(ML_LITERAL_STRING_DELIM),
)
.context(Context::Expression("multiline literal string"))
- .parse(input)
+ .parse_next(input)
}
// ml-literal-string-delim = 3apostrophe
@@ -297,21 +304,22 @@ pub(crate) const ML_LITERAL_STRING_DELIM: &[u8] = b"'''";
// ml-literal-body = *mll-content *( mll-quotes 1*mll-content ) [ mll-quotes ]
fn ml_literal_body(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
(
- many0_count(mll_content),
- many0_count((
+ many0(mll_content).map(|()| ()),
+ many0((
mll_quotes(none_of(APOSTROPHE).value(())),
- many1_count(mll_content),
- )),
+ many1(mll_content).map(|()| ()),
+ ))
+ .map(|()| ()),
opt(mll_quotes(tag(ML_LITERAL_STRING_DELIM).value(()))),
)
.recognize()
.map_res(std::str::from_utf8)
- .parse(input)
+ .parse_next(input)
}
// mll-content = mll-char / newline
fn mll_content(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<'_>> {
- alt((one_of(MLL_CHAR), newline)).parse(input)
+ alt((one_of(MLL_CHAR), newline)).parse_next(input)
}
// mll-char = %x09 / %x20-26 / %x28-7E / non-ascii
@@ -324,17 +332,17 @@ const MLL_CHAR: (
// mll-quotes = 1*2apostrophe
fn mll_quotes<'i>(
- mut term: impl nom8::Parser<Input<'i>, (), ParserError<'i>>,
+ mut term: impl winnow::Parser<Input<'i>, (), ParserError<'i>>,
) -> impl FnMut(Input<'i>) -> IResult<Input<'i>, &str, ParserError<'i>> {
move |input| {
let res = terminated(b"''", peek(term.by_ref()))
.map(|b| unsafe { from_utf8_unchecked(b, "`bytes` out non-ASCII") })
- .parse(input);
+ .parse_next(input);
match res {
- Err(nom8::Err::Error(_)) => terminated(b"'", peek(term.by_ref()))
+ Err(winnow::error::ErrMode::Backtrack(_)) => terminated(b"'", peek(term.by_ref()))
.map(|b| unsafe { from_utf8_unchecked(b, "`bytes` out non-ASCII") })
- .parse(input),
+ .parse_next(input),
res => res,
}
}
@@ -349,7 +357,7 @@ mod test {
let input =
r#""I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF. \U0002070E""#;
let expected = "I\'m a string. \"You can quote me\". Name\tJosé\nLocation\tSF. \u{2070E}";
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
@@ -368,14 +376,14 @@ Violets are blue"#,
];
for &(input, expected) in &cases {
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
let invalid_cases = [r#"""" """#, r#"""" \""""#];
for input in &invalid_cases {
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert!(parsed.is_err());
}
}
@@ -397,7 +405,7 @@ The quick brown \
];
for input in &inputs {
let expected = "The quick brown fox jumps over the lazy dog.";
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
let empties = [
@@ -410,7 +418,7 @@ The quick brown \
];
for input in &empties {
let expected = "";
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
}
@@ -426,7 +434,7 @@ The quick brown \
for input in &inputs {
let expected = &input[1..input.len() - 1];
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
}
@@ -439,7 +447,7 @@ The quick brown \
];
for input in &inputs {
let expected = &input[3..input.len() - 3];
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
@@ -450,7 +458,7 @@ trimmed in raw strings.
is preserved.
'''"#;
let expected = &input[4..input.len() - 3];
- let parsed = string.parse(new_input(input)).finish();
+ let parsed = string.parse(new_input(input));
assert_eq!(parsed.as_deref(), Ok(expected), "Parsing {input:?}");
}
}
diff --git a/vendor/toml_edit/src/parser/table.rs b/vendor/toml_edit/src/parser/table.rs
index 1c76ed19b..a6085e475 100644
--- a/vendor/toml_edit/src/parser/table.rs
+++ b/vendor/toml_edit/src/parser/table.rs
@@ -2,10 +2,10 @@ use std::cell::RefCell;
#[allow(unused_imports)]
use std::ops::DerefMut;
-use nom8::bytes::take;
-use nom8::combinator::cut;
-use nom8::combinator::peek;
-use nom8::sequence::delimited;
+use winnow::bytes::take;
+use winnow::combinator::cut_err;
+use winnow::combinator::peek;
+use winnow::sequence::delimited;
// https://github.com/rust-lang/rust/issues/41358
use crate::parser::key::key;
@@ -32,18 +32,18 @@ pub(crate) fn std_table<'s, 'i>(
(
delimited(
STD_TABLE_OPEN,
- cut(key),
- cut(STD_TABLE_CLOSE)
+ cut_err(key),
+ cut_err(STD_TABLE_CLOSE)
.context(Context::Expected(ParserValue::CharLiteral('.')))
.context(Context::Expected(ParserValue::StringLiteral("]"))),
)
.with_span(),
- cut(line_trailing)
+ cut_err(line_trailing)
.context(Context::Expected(ParserValue::CharLiteral('\n')))
.context(Context::Expected(ParserValue::CharLiteral('#'))),
)
.map_res(|((h, span), t)| state.borrow_mut().deref_mut().on_std_header(h, t, span))
- .parse(i)
+ .parse_next(i)
}
}
@@ -57,18 +57,18 @@ pub(crate) fn array_table<'s, 'i>(
(
delimited(
ARRAY_TABLE_OPEN,
- cut(key),
- cut(ARRAY_TABLE_CLOSE)
+ cut_err(key),
+ cut_err(ARRAY_TABLE_CLOSE)
.context(Context::Expected(ParserValue::CharLiteral('.')))
.context(Context::Expected(ParserValue::StringLiteral("]]"))),
)
.with_span(),
- cut(line_trailing)
+ cut_err(line_trailing)
.context(Context::Expected(ParserValue::CharLiteral('\n')))
.context(Context::Expected(ParserValue::CharLiteral('#'))),
)
.map_res(|((h, span), t)| state.borrow_mut().deref_mut().on_array_header(h, t, span))
- .parse(i)
+ .parse_next(i)
}
}
@@ -84,6 +84,6 @@ pub(crate) fn table<'s, 'i>(
_ => std_table(state),
)
.context(Context::Expression("table header"))
- .parse(i)
+ .parse_next(i)
}
}
diff --git a/vendor/toml_edit/src/parser/trivia.rs b/vendor/toml_edit/src/parser/trivia.rs
index 981c7b23d..97ff49c73 100644
--- a/vendor/toml_edit/src/parser/trivia.rs
+++ b/vendor/toml_edit/src/parser/trivia.rs
@@ -1,15 +1,15 @@
use std::ops::RangeInclusive;
-use nom8::branch::alt;
-use nom8::bytes::one_of;
-use nom8::bytes::take_while;
-use nom8::bytes::take_while1;
-use nom8::combinator::eof;
-use nom8::combinator::opt;
-use nom8::multi::many0_count;
-use nom8::multi::many1_count;
-use nom8::prelude::*;
-use nom8::sequence::terminated;
+use winnow::branch::alt;
+use winnow::bytes::one_of;
+use winnow::bytes::take_while0;
+use winnow::bytes::take_while1;
+use winnow::combinator::eof;
+use winnow::combinator::opt;
+use winnow::multi::many0;
+use winnow::multi::many1;
+use winnow::prelude::*;
+use winnow::sequence::terminated;
use crate::parser::prelude::*;
@@ -31,9 +31,9 @@ pub(crate) const WSCHAR: (u8, u8) = (b' ', b'\t');
// ws = *wschar
pub(crate) fn ws(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
- take_while(WSCHAR)
+ take_while0(WSCHAR)
.map(|b| unsafe { from_utf8_unchecked(b, "`is_wschar` filters out on-ASCII") })
- .parse(input)
+ .parse_next(input)
}
// non-ascii = %x80-D7FF / %xE000-10FFFF
@@ -51,9 +51,9 @@ pub(crate) const COMMENT_START_SYMBOL: u8 = b'#';
// comment = comment-start-symbol *non-eol
pub(crate) fn comment(input: Input<'_>) -> IResult<Input<'_>, &[u8], ParserError<'_>> {
- (COMMENT_START_SYMBOL, take_while(NON_EOL))
+ (COMMENT_START_SYMBOL, take_while0(NON_EOL))
.recognize()
- .parse(input)
+ .parse_next(input)
}
// newline = ( %x0A / ; LF
@@ -63,19 +63,20 @@ pub(crate) fn newline(input: Input<'_>) -> IResult<Input<'_>, u8, ParserError<'_
one_of(LF).value(b'\n'),
(one_of(CR), one_of(LF)).value(b'\n'),
))
- .parse(input)
+ .parse_next(input)
}
pub(crate) const LF: u8 = b'\n';
pub(crate) const CR: u8 = b'\r';
// ws-newline = *( wschar / newline )
pub(crate) fn ws_newline(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
- many0_count(alt((newline.value(&b"\n"[..]), take_while1(WSCHAR))))
+ many0(alt((newline.value(&b"\n"[..]), take_while1(WSCHAR))))
+ .map(|()| ())
.recognize()
.map(|b| unsafe {
from_utf8_unchecked(b, "`is_wschar` and `newline` filters out on-ASCII")
})
- .parse(input)
+ .parse_next(input)
}
// ws-newlines = newline *( wschar / newline )
@@ -85,24 +86,25 @@ pub(crate) fn ws_newlines(input: Input<'_>) -> IResult<Input<'_>, &str, ParserEr
.map(|b| unsafe {
from_utf8_unchecked(b, "`is_wschar` and `newline` filters out on-ASCII")
})
- .parse(input)
+ .parse_next(input)
}
// note: this rule is not present in the original grammar
// ws-comment-newline = *( ws-newline-nonempty / comment )
pub(crate) fn ws_comment_newline(input: Input<'_>) -> IResult<Input<'_>, &[u8], ParserError<'_>> {
- many0_count(alt((
- many1_count(alt((take_while1(WSCHAR), newline.value(&b"\n"[..])))).value(()),
+ many0(alt((
+ many1(alt((take_while1(WSCHAR), newline.value(&b"\n"[..])))).map(|()| ()),
comment.value(()),
)))
+ .map(|()| ())
.recognize()
- .parse(input)
+ .parse_next(input)
}
// note: this rule is not present in the original grammar
// line-ending = newline / eof
pub(crate) fn line_ending(input: Input<'_>) -> IResult<Input<'_>, &str, ParserError<'_>> {
- alt((newline.value("\n"), eof.value(""))).parse(input)
+ alt((newline.value("\n"), eof.value(""))).parse_next(input)
}
// note: this rule is not present in the original grammar
@@ -110,7 +112,7 @@ pub(crate) fn line_ending(input: Input<'_>) -> IResult<Input<'_>, &str, ParserEr
pub(crate) fn line_trailing(
input: Input<'_>,
) -> IResult<Input<'_>, std::ops::Range<usize>, ParserError<'_>> {
- terminated((ws, opt(comment)).span(), line_ending).parse(input)
+ terminated((ws, opt(comment)).span(), line_ending).parse_next(input)
}
#[cfg(test)]
@@ -141,7 +143,7 @@ mod test {
];
for input in inputs {
dbg!(input);
- let parsed = ws_comment_newline.parse(new_input(input)).finish();
+ let parsed = ws_comment_newline.parse(new_input(input));
assert!(parsed.is_ok(), "{:?}", parsed);
let parsed = parsed.unwrap();
assert_eq!(parsed, input.as_bytes());
diff --git a/vendor/toml_edit/src/parser/value.rs b/vendor/toml_edit/src/parser/value.rs
index 15ba4478e..63a821114 100644
--- a/vendor/toml_edit/src/parser/value.rs
+++ b/vendor/toml_edit/src/parser/value.rs
@@ -1,7 +1,7 @@
-use nom8::branch::alt;
-use nom8::bytes::any;
-use nom8::combinator::fail;
-use nom8::combinator::peek;
+use winnow::branch::alt;
+use winnow::bytes::any;
+use winnow::combinator::fail;
+use winnow::combinator::peek;
use crate::parser::array::array;
use crate::parser::datetime::date_time;
@@ -85,7 +85,7 @@ pub(crate) fn value(
}
.with_span()
.map_res(|(value, span)| apply_raw(value, span))
- .parse(input)
+ .parse_next(input)
}
}
@@ -147,7 +147,7 @@ trimmed in raw strings.
];
for input in inputs {
dbg!(input);
- let mut parsed = value(Default::default()).parse(new_input(input)).finish();
+ let mut parsed = value(Default::default()).parse(new_input(input));
if let Ok(parsed) = &mut parsed {
parsed.despan(input);
}