diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/winnow/src/_tutorial | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/winnow/src/_tutorial')
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_2.rs | 26 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_3.rs | 48 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_4.rs | 26 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_5.rs | 86 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_6.rs | 26 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_7.rs | 22 |
6 files changed, 117 insertions, 117 deletions
diff --git a/vendor/winnow/src/_tutorial/chapter_2.rs b/vendor/winnow/src/_tutorial/chapter_2.rs index a7f9ea9e7..49b61f3f4 100644 --- a/vendor/winnow/src/_tutorial/chapter_2.rs +++ b/vendor/winnow/src/_tutorial/chapter_2.rs @@ -61,7 +61,7 @@ //! ```rust //! # use winnow::Parser; //! # use winnow::IResult; -//! use winnow::bytes::one_of; +//! use winnow::token::one_of; //! //! fn parse_digits(input: &str) -> IResult<&str, char> { //! one_of("0123456789abcdefgABCDEFG").parse_next(input) @@ -87,7 +87,7 @@ //! > list: &'static str //! > ) -> impl Parser<&'i str, char, Error<&'i str>> { //! > // ... -//! > # winnow::bytes::one_of(list) +//! > # winnow::token::one_of(list) //! > } //! > ``` //! > If you have not programmed in a language where functions are values, the type signature of the @@ -97,18 +97,18 @@ //! > configurable or stateful parsers. //! //! Some of character classes are common enough that a named parser is provided, like with: -//! - [`line_ending`][crate::character::line_ending]: Recognizes an end of line (both `\n` and `\r\n`) -//! - [`newline`][crate::character::newline]: Matches a newline character `\n` -//! - [`tab`][crate::character::tab]: Matches a tab character `\t` +//! - [`line_ending`][crate::ascii::line_ending]: Recognizes an end of line (both `\n` and `\r\n`) +//! - [`newline`][crate::ascii::newline]: Matches a newline character `\n` +//! - [`tab`][crate::ascii::tab]: Matches a tab character `\t` //! -//! You can then capture sequences of these characters with parsers like [`take_while1`]. +//! You can then capture sequences of these characters with parsers like [`take_while`]. //! ```rust //! # use winnow::Parser; //! # use winnow::IResult; -//! use winnow::bytes::take_while1; +//! use winnow::token::take_while; //! //! fn parse_digits(input: &str) -> IResult<&str, &str> { -//! take_while1("0123456789abcdefgABCDEFG").parse_next(input) +//! take_while(1.., "0123456789abcdefgABCDEFG").parse_next(input) //! } //! //! fn main() { @@ -126,7 +126,7 @@ //! ```rust //! # use winnow::Parser; //! # use winnow::IResult; -//! use winnow::character::hex_digit1; +//! use winnow::ascii::hex_digit1; //! //! fn parse_digits(input: &str) -> IResult<&str, &str> { //! hex_digit1.parse_next(input) @@ -144,11 +144,11 @@ //! ``` #![allow(unused_imports)] -use crate::bytes::one_of; -use crate::bytes::tag; -use crate::bytes::take_while1; -use crate::character::hex_digit1; +use crate::ascii::hex_digit1; use crate::stream::ContainsToken; +use crate::token::one_of; +use crate::token::tag; +use crate::token::take_while; use crate::Parser; use std::ops::RangeInclusive; diff --git a/vendor/winnow/src/_tutorial/chapter_3.rs b/vendor/winnow/src/_tutorial/chapter_3.rs index 29c5db457..8d307e324 100644 --- a/vendor/winnow/src/_tutorial/chapter_3.rs +++ b/vendor/winnow/src/_tutorial/chapter_3.rs @@ -10,7 +10,7 @@ //! Now that we can create more interesting parsers, we can sequence them together, like: //! //! ```rust -//! # use winnow::bytes::take_while1; +//! # use winnow::token::take_while; //! # use winnow::Parser; //! # use winnow::IResult; //! # @@ -19,7 +19,7 @@ //! } //! //! fn parse_digits(input: &str) -> IResult<&str, &str> { -//! take_while1(( +//! take_while(1.., ( //! ('0'..='9'), //! ('A'..='F'), //! ('a'..='f'), @@ -40,7 +40,7 @@ //! //! To sequence these together, you can just put them in a tuple: //! ```rust -//! # use winnow::bytes::take_while1; +//! # use winnow::token::take_while; //! # use winnow::Parser; //! # use winnow::IResult; //! # @@ -49,7 +49,7 @@ //! # } //! # //! # fn parse_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -75,17 +75,17 @@ //! Frequently, you won't care about the tag and you can instead use one of the provided combinators, //! like [`preceded`]: //! ```rust -//! # use winnow::bytes::take_while1; +//! # use winnow::token::take_while; //! # use winnow::Parser; //! # use winnow::IResult; -//! use winnow::sequence::preceded; +//! use winnow::combinator::preceded; //! //! # fn parse_prefix(input: &str) -> IResult<&str, &str> { //! # "0x".parse_next(input) //! # } //! # //! # fn parse_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -120,8 +120,8 @@ //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! use winnow::branch::alt; +//! # use winnow::token::take_while; +//! use winnow::combinator::alt; //! //! fn parse_digits(input: &str) -> IResult<&str, (&str, &str)> { //! alt(( @@ -134,25 +134,25 @@ //! //! // ... //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -174,14 +174,14 @@ //! //! Sometimes a giant if/else-if ladder can be slow and you'd rather have a `match` statement for //! branches of your parser that have unique prefixes. In this case, you can use the -//! [`dispatch`][crate::branch::dispatch] macro: +//! [`dispatch`][crate::combinator::dispatch] macro: //! //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! use winnow::branch::dispatch; -//! use winnow::bytes::take; +//! # use winnow::token::take_while; +//! use winnow::combinator::dispatch; +//! use winnow::token::take; //! use winnow::combinator::fail; //! //! fn parse_digits(input: &str) -> IResult<&str, &str> { @@ -196,25 +196,25 @@ //! //! // ... //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -234,9 +234,9 @@ //! ``` #![allow(unused_imports)] -use crate::branch::alt; -use crate::branch::dispatch; -use crate::sequence::preceded; +use crate::combinator::alt; +use crate::combinator::dispatch; +use crate::combinator::preceded; pub use super::chapter_2 as previous; pub use super::chapter_4 as next; diff --git a/vendor/winnow/src/_tutorial/chapter_4.rs b/vendor/winnow/src/_tutorial/chapter_4.rs index 5d19a05bc..315d185ba 100644 --- a/vendor/winnow/src/_tutorial/chapter_4.rs +++ b/vendor/winnow/src/_tutorial/chapter_4.rs @@ -22,7 +22,7 @@ //! ```rust //! # use winnow::Parser; //! # use winnow::IResult; -//! # use winnow::character::digit1; +//! # use winnow::ascii::digit1; //! # //! fn parse_digits(input: &str) -> IResult<&str, usize> { //! digit1 @@ -41,47 +41,47 @@ //! } //! ``` //! -//! `Parser::parse_to` is just a convenient form of [`Parser::map_res`] which we can use to handle +//! `Parser::parse_to` is just a convenient form of [`Parser::try_map`] which we can use to handle //! all radices of numbers: //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! use winnow::branch::dispatch; -//! use winnow::bytes::take; +//! # use winnow::token::take_while; +//! use winnow::combinator::dispatch; +//! use winnow::token::take; //! use winnow::combinator::fail; //! //! fn parse_digits(input: &str) -> IResult<&str, usize> { //! dispatch!(take(2usize); -//! "0b" => parse_bin_digits.map_res(|s| usize::from_str_radix(s, 2)), -//! "0o" => parse_oct_digits.map_res(|s| usize::from_str_radix(s, 8)), -//! "0d" => parse_dec_digits.map_res(|s| usize::from_str_radix(s, 10)), -//! "0x" => parse_hex_digits.map_res(|s| usize::from_str_radix(s, 16)), +//! "0b" => parse_bin_digits.try_map(|s| usize::from_str_radix(s, 2)), +//! "0o" => parse_oct_digits.try_map(|s| usize::from_str_radix(s, 8)), +//! "0d" => parse_dec_digits.try_map(|s| usize::from_str_radix(s, 10)), +//! "0x" => parse_hex_digits.try_map(|s| usize::from_str_radix(s, 16)), //! _ => fail, //! ).parse_next(input) //! } //! //! // ... //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), diff --git a/vendor/winnow/src/_tutorial/chapter_5.rs b/vendor/winnow/src/_tutorial/chapter_5.rs index b703bcf5c..3a4be4b32 100644 --- a/vendor/winnow/src/_tutorial/chapter_5.rs +++ b/vendor/winnow/src/_tutorial/chapter_5.rs @@ -1,55 +1,55 @@ //! # Chapter 5: Repetition //! //! In [`chapter_3`], we covered how to sequence different parsers into a tuple but sometimes you need to run a -//! single parser many times into a [`Vec`]. +//! single parser multiple times, collecting the result into a [`Vec`]. //! -//! Let's take our `parse_digits` and collect a list of them with [`many0`]: +//! Let's take our `parse_digits` and collect a list of them with [`repeat`]: //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! # use winnow::branch::dispatch; -//! # use winnow::bytes::take; +//! # use winnow::token::take_while; +//! # use winnow::combinator::dispatch; +//! # use winnow::token::take; //! # use winnow::combinator::fail; //! use winnow::combinator::opt; -//! use winnow::multi::many0; -//! use winnow::sequence::terminated; +//! use winnow::combinator::repeat; +//! use winnow::combinator::terminated; //! //! fn parse_list(input: &str) -> IResult<&str, Vec<usize>> { -//! many0(terminated(parse_digits, opt(','))).parse_next(input) +//! repeat(0.., terminated(parse_digits, opt(','))).parse_next(input) //! } //! //! // ... //! # fn parse_digits(input: &str) -> IResult<&str, usize> { //! # dispatch!(take(2usize); -//! # "0b" => parse_bin_digits.map_res(|s| usize::from_str_radix(s, 2)), -//! # "0o" => parse_oct_digits.map_res(|s| usize::from_str_radix(s, 8)), -//! # "0d" => parse_dec_digits.map_res(|s| usize::from_str_radix(s, 10)), -//! # "0x" => parse_hex_digits.map_res(|s| usize::from_str_radix(s, 16)), +//! # "0b" => parse_bin_digits.try_map(|s| usize::from_str_radix(s, 2)), +//! # "0o" => parse_oct_digits.try_map(|s| usize::from_str_radix(s, 8)), +//! # "0d" => parse_dec_digits.try_map(|s| usize::from_str_radix(s, 10)), +//! # "0x" => parse_hex_digits.try_map(|s| usize::from_str_radix(s, 16)), //! # _ => fail, //! # ).parse_next(input) //! # } //! # //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -73,11 +73,11 @@ //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! # use winnow::branch::dispatch; -//! # use winnow::bytes::take; +//! # use winnow::token::take_while; +//! # use winnow::combinator::dispatch; +//! # use winnow::token::take; //! # use winnow::combinator::fail; -//! use winnow::multi::separated0; +//! use winnow::combinator::separated0; //! //! fn parse_list(input: &str) -> IResult<&str, Vec<usize>> { //! separated0(parse_digits, ",").parse_next(input) @@ -86,34 +86,34 @@ //! // ... //! # fn parse_digits(input: &str) -> IResult<&str, usize> { //! # dispatch!(take(2usize); -//! # "0b" => parse_bin_digits.map_res(|s| usize::from_str_radix(s, 2)), -//! # "0o" => parse_oct_digits.map_res(|s| usize::from_str_radix(s, 8)), -//! # "0d" => parse_dec_digits.map_res(|s| usize::from_str_radix(s, 10)), -//! # "0x" => parse_hex_digits.map_res(|s| usize::from_str_radix(s, 16)), +//! # "0b" => parse_bin_digits.try_map(|s| usize::from_str_radix(s, 2)), +//! # "0o" => parse_oct_digits.try_map(|s| usize::from_str_radix(s, 8)), +//! # "0d" => parse_dec_digits.try_map(|s| usize::from_str_radix(s, 10)), +//! # "0x" => parse_hex_digits.try_map(|s| usize::from_str_radix(s, 16)), //! # _ => fail, //! # ).parse_next(input) //! # } //! # //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -132,17 +132,17 @@ //! } //! ``` //! -//! If you look closely at [`many0`], it isn't collecting directly into a [`Vec`] but +//! If you look closely at [`repeat`], it isn't collecting directly into a [`Vec`] but //! [`Accumulate`] to gather the results. This let's us make more complex parsers than we did in //! [`chapter_2`] by accumulating the results into a `()` and [`recognize`][Parser::recognize]-ing the captured input: //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! # use winnow::branch::dispatch; -//! # use winnow::bytes::take; +//! # use winnow::token::take_while; +//! # use winnow::combinator::dispatch; +//! # use winnow::token::take; //! # use winnow::combinator::fail; -//! # use winnow::multi::separated0; +//! # use winnow::combinator::separated0; //! # //! fn recognize_list(input: &str) -> IResult<&str, &str> { //! parse_list.recognize().parse_next(input) @@ -155,34 +155,34 @@ //! // ... //! # fn parse_digits(input: &str) -> IResult<&str, usize> { //! # dispatch!(take(2usize); -//! # "0b" => parse_bin_digits.map_res(|s| usize::from_str_radix(s, 2)), -//! # "0o" => parse_oct_digits.map_res(|s| usize::from_str_radix(s, 8)), -//! # "0d" => parse_dec_digits.map_res(|s| usize::from_str_radix(s, 10)), -//! # "0x" => parse_hex_digits.map_res(|s| usize::from_str_radix(s, 16)), +//! # "0b" => parse_bin_digits.try_map(|s| usize::from_str_radix(s, 2)), +//! # "0o" => parse_oct_digits.try_map(|s| usize::from_str_radix(s, 8)), +//! # "0d" => parse_dec_digits.try_map(|s| usize::from_str_radix(s, 10)), +//! # "0x" => parse_hex_digits.try_map(|s| usize::from_str_radix(s, 16)), //! # _ => fail, //! # ).parse_next(input) //! # } //! # //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -204,8 +204,8 @@ #![allow(unused_imports)] use super::chapter_2; use super::chapter_3; -use crate::multi::many0; -use crate::multi::separated0; +use crate::combinator::repeat; +use crate::combinator::separated0; use crate::stream::Accumulate; use crate::Parser; use std::vec::Vec; diff --git a/vendor/winnow/src/_tutorial/chapter_6.rs b/vendor/winnow/src/_tutorial/chapter_6.rs index 74169429d..268e38a31 100644 --- a/vendor/winnow/src/_tutorial/chapter_6.rs +++ b/vendor/winnow/src/_tutorial/chapter_6.rs @@ -14,8 +14,8 @@ //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! # use winnow::branch::alt; +//! # use winnow::token::take_while; +//! # use winnow::combinator::alt; //! use winnow::error::VerboseError; //! //! fn parse_digits(input: &str) -> IResult<&str, (&str, &str), VerboseError<&str>> { @@ -29,25 +29,25 @@ //! //! // ... //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -89,8 +89,8 @@ //! ```rust //! # use winnow::IResult; //! # use winnow::Parser; -//! # use winnow::bytes::take_while1; -//! # use winnow::branch::alt; +//! # use winnow::token::take_while; +//! # use winnow::combinator::alt; //! # use winnow::error::VerboseError; //! use winnow::combinator::cut_err; //! @@ -105,25 +105,25 @@ //! //! // ... //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str, VerboseError<&str>> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), @@ -145,7 +145,7 @@ #![allow(unused_imports)] use super::chapter_1; use super::chapter_3; -use crate::branch::alt; +use crate::combinator::alt; use crate::combinator::cut_err; use crate::error::ErrMode; use crate::error::Error; diff --git a/vendor/winnow/src/_tutorial/chapter_7.rs b/vendor/winnow/src/_tutorial/chapter_7.rs index 8c27cb5ad..c20607c36 100644 --- a/vendor/winnow/src/_tutorial/chapter_7.rs +++ b/vendor/winnow/src/_tutorial/chapter_7.rs @@ -27,9 +27,9 @@ //! winnow provides some helpers for this: //! ```rust //! # use winnow::IResult; -//! # use winnow::bytes::take_while1; -//! # use winnow::branch::dispatch; -//! # use winnow::bytes::take; +//! # use winnow::token::take_while; +//! # use winnow::combinator::dispatch; +//! # use winnow::token::take; //! # use winnow::combinator::fail; //! use winnow::Parser; //! use winnow::error::Error; @@ -51,34 +51,34 @@ //! // ... //! # fn parse_digits(input: &str) -> IResult<&str, usize> { //! # dispatch!(take(2usize); -//! # "0b" => parse_bin_digits.map_res(|s| usize::from_str_radix(s, 2)), -//! # "0o" => parse_oct_digits.map_res(|s| usize::from_str_radix(s, 8)), -//! # "0d" => parse_dec_digits.map_res(|s| usize::from_str_radix(s, 10)), -//! # "0x" => parse_hex_digits.map_res(|s| usize::from_str_radix(s, 16)), +//! # "0b" => parse_bin_digits.try_map(|s| usize::from_str_radix(s, 2)), +//! # "0o" => parse_oct_digits.try_map(|s| usize::from_str_radix(s, 8)), +//! # "0d" => parse_dec_digits.try_map(|s| usize::from_str_radix(s, 10)), +//! # "0x" => parse_hex_digits.try_map(|s| usize::from_str_radix(s, 16)), //! # _ => fail, //! # ).parse_next(input) //! # } //! # //! # fn parse_bin_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_oct_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='7'), //! # )).parse_next(input) //! # } //! # //! # fn parse_dec_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # )).parse_next(input) //! # } //! # //! # fn parse_hex_digits(input: &str) -> IResult<&str, &str> { -//! # take_while1(( +//! # take_while(1.., ( //! # ('0'..='9'), //! # ('A'..='F'), //! # ('a'..='f'), |