diff options
Diffstat (limited to 'vendor/winnow/src/_tutorial')
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_0.rs | 2 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_1.rs | 12 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_2.rs | 10 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_3.rs | 6 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_4.rs | 3 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_5.rs | 16 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/chapter_6.rs | 4 | ||||
-rw-r--r-- | vendor/winnow/src/_tutorial/mod.rs | 1 |
8 files changed, 26 insertions, 28 deletions
diff --git a/vendor/winnow/src/_tutorial/chapter_0.rs b/vendor/winnow/src/_tutorial/chapter_0.rs index 47c196e86..35a2d1476 100644 --- a/vendor/winnow/src/_tutorial/chapter_0.rs +++ b/vendor/winnow/src/_tutorial/chapter_0.rs @@ -10,7 +10,7 @@ //! ## About //! //! `winnow` is a parser-combinator library. In other words, it gives you tools to define: -//! - "parsers", or functions that takes an input and gives back an output +//! - "parsers", or functions that take an input and give back an output //! - "combinators", or functions that take parsers and _combine_ them together! //! //! While "combinator" might be an unfamiliar word, you are likely using them in your rust code diff --git a/vendor/winnow/src/_tutorial/chapter_1.rs b/vendor/winnow/src/_tutorial/chapter_1.rs index b16a16657..2d94418a9 100644 --- a/vendor/winnow/src/_tutorial/chapter_1.rs +++ b/vendor/winnow/src/_tutorial/chapter_1.rs @@ -10,17 +10,17 @@ //! - `Err` indicates the parser could not find what it was looking for. //! //! Parsers do more than just return a binary "success"/"failure" code. -//! On success, the parser will return the processed data. The input will be left pointing to +//! On success, the parser will return the processed data. The input will be left pointing to //! data that still needs processing //! //! If the parser failed, then there are multiple errors that could be returned. //! For simplicity, however, in the next chapters we will leave these unexplored. //! //! ```text -//! ┌─► Ok(what matched the parser) -//! ┌─────────┐ │ -//! my input───►│my parser├──►either──┤ -//! └─────────┘ └─► Err(...) +//! ┌─► Ok(what matched the parser) +//! ┌─────────┐ │ +//! my input───►│my parser├──►either──┤ +//! └─────────┘ └─► Err(...) //! ``` //! //! @@ -53,7 +53,7 @@ //! //! This parser function should take in a `&str`: //! -//! - Since it is supposed to succeed, we know it will return the Ok Variant. +//! - Since it is supposed to succeed, we know it will return the `Ok` variant. //! - Since it does nothing to our input, the remaining input is the same as the input. //! - Since it doesn't parse anything, it also should just return an empty string. //! diff --git a/vendor/winnow/src/_tutorial/chapter_2.rs b/vendor/winnow/src/_tutorial/chapter_2.rs index 0fb80ac37..c27b7196e 100644 --- a/vendor/winnow/src/_tutorial/chapter_2.rs +++ b/vendor/winnow/src/_tutorial/chapter_2.rs @@ -4,7 +4,7 @@ //! //! ## Tokens //! -//! [`Stream`] provides some core operations to help with parsing. For example, to process a +//! [`Stream`] provides some core operations to help with parsing. For example, to process a //! single token, you can do: //! ```rust //! # use winnow::Parser; @@ -135,13 +135,13 @@ //! # } //! ``` //! -//! In `winnow`, we call this type of parser a [`tag`]. See [`token`] for additional individual +//! In `winnow`, we call this type of parser a [`tag`]. See [`token`] for additional individual //! and token-slice parsers. //! //! ## Character Classes //! -//! Selecting a single `char` or a [`tag`] is fairly limited. Sometimes, you will want to select one of several -//! `chars` of a specific class, like digits. For this, we use the [`one_of`] parer: +//! Selecting a single `char` or a [`tag`] is fairly limited. Sometimes, you will want to select one of several +//! `chars` of a specific class, like digits. For this, we use the [`one_of`] parser: //! //! ```rust //! # use winnow::Parser; @@ -207,7 +207,7 @@ //! } //! ``` //! -//! We could simplify this further with by using one of the built-in character classes, [`hex_digit1`]: +//! We could simplify this further by using one of the built-in character classes, [`hex_digit1`]: //! ```rust //! # use winnow::Parser; //! # use winnow::PResult; diff --git a/vendor/winnow/src/_tutorial/chapter_3.rs b/vendor/winnow/src/_tutorial/chapter_3.rs index 4dfdc31e4..e3f86b501 100644 --- a/vendor/winnow/src/_tutorial/chapter_3.rs +++ b/vendor/winnow/src/_tutorial/chapter_3.rs @@ -179,7 +179,7 @@ //! ``` //! //! > **Warning:** the above example is for illustrative purposes and relying on `Result::Ok` or -//! > `Result::Err` can lead to incorrect behavior. This will be clarified in later when covering +//! > `Result::Err` can lead to incorrect behavior. This will be clarified in later when covering //! > [error handling][`chapter_6`#errmode] //! //! [`opt`] is a basic building block for correctly handling retrying parsing: @@ -296,8 +296,8 @@ //! > **Note:** [`success`] and [`fail`] are parsers that might be useful in the `else` case. //! //! 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::combinator::dispatch] macro: +//! branches of your parser that have unique prefixes. In this case, you can use the +//! [`dispatch`] macro: //! //! ```rust //! # use winnow::prelude::*; diff --git a/vendor/winnow/src/_tutorial/chapter_4.rs b/vendor/winnow/src/_tutorial/chapter_4.rs index 59aa7ee87..328a64843 100644 --- a/vendor/winnow/src/_tutorial/chapter_4.rs +++ b/vendor/winnow/src/_tutorial/chapter_4.rs @@ -10,9 +10,6 @@ //! All we need to do for our parser to return a different type is to change //! the type parameter of [`PResult`] to the desired return type. //! For example, to return a `usize`, return a `PResult<usize>`. -//! Recall that the type parameter of the `PResult` is the input -//! type, so even if you're returning something different, if your input -//! is a `&str`, the type argument of `PResult` should be also. //! //! One winnow-native way of doing a type conversion is to use the //! [`Parser::parse_to`] combinator diff --git a/vendor/winnow/src/_tutorial/chapter_5.rs b/vendor/winnow/src/_tutorial/chapter_5.rs index ffd8a29ce..8aa719b98 100644 --- a/vendor/winnow/src/_tutorial/chapter_5.rs +++ b/vendor/winnow/src/_tutorial/chapter_5.rs @@ -136,18 +136,18 @@ //! # } //! ``` //! -//! You'll notice that the above allows trailing `,` when we intended to not support that. We can -//! easily fix this by using [`separated0`]: +//! You'll notice that the above allows trailing `,` when we intended to not support that. We can +//! easily fix this by using [`separated`]: //! ```rust //! # use winnow::prelude::*; //! # use winnow::token::take_while; //! # use winnow::combinator::dispatch; //! # use winnow::token::take; //! # use winnow::combinator::fail; -//! use winnow::combinator::separated0; +//! use winnow::combinator::separated; //! //! fn parse_list(input: &mut &str) -> PResult<Vec<usize>> { -//! separated0(parse_digits, ",").parse_next(input) +//! separated(0.., parse_digits, ",").parse_next(input) //! } //! //! // ... @@ -200,7 +200,7 @@ //! ``` //! //! 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 +//! [`Accumulate`] to gather the results. This lets 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::prelude::*; @@ -208,14 +208,14 @@ //! # use winnow::combinator::dispatch; //! # use winnow::token::take; //! # use winnow::combinator::fail; -//! # use winnow::combinator::separated0; +//! # use winnow::combinator::separated; //! # //! fn recognize_list<'s>(input: &mut &'s str) -> PResult<&'s str> { //! parse_list.recognize().parse_next(input) //! } //! //! fn parse_list(input: &mut &str) -> PResult<()> { -//! separated0(parse_digits, ",").parse_next(input) +//! separated(0.., parse_digits, ",").parse_next(input) //! } //! //! # fn parse_digits(input: &mut &str) -> PResult<usize> { @@ -272,7 +272,7 @@ use super::chapter_2; use super::chapter_3; use crate::combinator; use crate::combinator::repeat; -use crate::combinator::separated0; +use crate::combinator::separated; 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 9f4230942..0d54e1505 100644 --- a/vendor/winnow/src/_tutorial/chapter_6.rs +++ b/vendor/winnow/src/_tutorial/chapter_6.rs @@ -72,13 +72,13 @@ //! ```rust //! # use winnow::error::ErrorKind; //! # use winnow::error::ErrMode; -//! pub type OResult<O, E = ErrorKind> = Result<O, ErrMode<E>>; +//! pub type PResult<O, E = ErrorKind> = Result<O, ErrMode<E>>; //! ``` //! [`PResult`] is just a fancy wrapper around `Result` that wraps our error in an [`ErrMode`] //! type. //! //! [`ErrMode`] is an enum with [`Backtrack`] and [`Cut`] variants (ignore [`Incomplete`] as its only -//! relevant for [streaming][_topic::stream]). By default, errors are [`Backtrack`], meaning that +//! relevant for [streaming][_topic::stream]). By default, errors are [`Backtrack`], meaning that //! other parsing branches will be attempted on failure, like the next case of an [`alt`]. [`Cut`] //! shortcircuits all other branches, immediately reporting the error. //! diff --git a/vendor/winnow/src/_tutorial/mod.rs b/vendor/winnow/src/_tutorial/mod.rs index 224fe6a80..2a4bd61f7 100644 --- a/vendor/winnow/src/_tutorial/mod.rs +++ b/vendor/winnow/src/_tutorial/mod.rs @@ -1,6 +1,7 @@ //! # Tutorial //! //! Table of Contents +#![allow(clippy::std_instead_of_core)] pub mod chapter_0; pub mod chapter_1; |