Skip to content

Commit

Permalink
chore: fix some comments (#1766)
Browse files Browse the repository at this point in the history
Signed-off-by: wangcundashang <[email protected]>
  • Loading branch information
wangcundashang authored Jul 26, 2024
1 parent f87d397 commit 392c486
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/error_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl ContextError<&str> for DebugError {
```

So when calling our JSON parser with this error type, we will get a trace
of all the times a parser stoppped and backtracked:
of all the times a parser stopped and backtracked:

```rust
println!("debug: {:#?}", root::<DebugError>(data));
Expand Down
2 changes: 1 addition & 1 deletion doc/nom_recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ integer value instead is demonstrated for hexadecimal integers. The others are s
The parsers allow the grouping character `_`, which allows one to group the digits by byte, for
example: `0xA4_3F_11_28`. If you prefer to exclude the `_` character, the lambda to convert from a
string slice to an integer value is slightly simpler. You can also strip the `_` from the string
slice that is returned, which is demonstrated in the second hexdecimal number parser.
slice that is returned, which is demonstrated in the second hexadecimal number parser.

If you wish to limit the number of digits in a valid integer literal, replace `many1` with
`many_m_n` in the recipes.
Expand Down
6 changes: 3 additions & 3 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl Mode for Emit {
/// Applies the parser, but do not a produce a value
///
/// This has the effect of greatly reducing the amount of code generated and the
/// parser memory usage. Some combinators chek for an error in a child parser but
/// parser memory usage. Some combinators check for an error in a child parser but
/// discard the error, and for those, using [Check] makes sure the error is not
/// even generated, only the fact that an error happened remains
pub struct Check;
Expand Down Expand Up @@ -331,7 +331,7 @@ pub type PResult<OM, I, O, E> = Result<
/// output mode
pub trait OutputMode {
/// Defines the [Mode] for the output type. [Emit] will generate the value, [Check] will
/// apply the parser but will only generate `()` if successul. This can be used when
/// apply the parser but will only generate `()` if successful. This can be used when
/// verifying that the input data conforms to the format without having to generate any
/// output data
type Output: Mode;
Expand All @@ -351,7 +351,7 @@ pub trait OutputMode {
/// Specifies the behaviour when a parser encounters an error that could be due to partial ata
pub trait IsStreaming {
/// called by parsers on partial data errors
/// * `needed` can hold the amount of dditional data the parser would need to decide
/// * `needed` can hold the amount of additional data the parser would need to decide
/// * `err_f`: produces the error when in "complete" mode
fn incomplete<E, F: FnOnce() -> E>(needed: Needed, err_f: F) -> Err<E>;
/// Indicates whether the data is in streaming mode or not
Expand Down

0 comments on commit 392c486

Please sign in to comment.