Skip to content

Conversation

@asibahi
Copy link

@asibahi asibahi commented Mar 3, 2025

Issues: #1823 , #1801 in addition to some self-prompted fixes.

fixes #1823
fixes #1801

@asibahi asibahi requested a review from Geal as a code owner March 3, 2025 11:11
| [pair](https://docs.rs/nom/latest/nom/sequence/fn.pair.html) | `pair(tag("ab"), tag("XY"))` | `"abXYZ"` | `Ok(("Z", ("ab", "XY")))` |Gets an object from the first parser, then gets another object from the second parser.|
| [separated_pair](https://docs.rs/nom/latest/nom/sequence/fn.separated_pair.html) | `separated_pair(tag("hello"), char(','), tag("world"))` | `"hello,world!"` | `Ok(("!", ("hello", "world")))` |Gets an object from the first parser, then matches an object from the sep_parser and discards it, then gets another object from the second parser.|
| [tuple](https://docs.rs/nom/latest/nom/sequence/fn.tuple.html) | `tuple((tag("ab"), tag("XY"), take(1)))` | `"abXYZ!"` | `Ok(("!", ("ab", "XY", "Z")))` | Chains parsers and assemble the sub results in a tuple. You can use as many child parsers as you can put elements in a tuple|
| tuples | `((tag("ab"), tag("XY"), take(1)))` | `"abXYZ!"` | `Ok(("!", ("ab", "XY", "Z")))` | `Parser` is implemented for tuples: it chains parsers and assemble the sub results in a tuple. You can use as many child parsers as you can put elements in a tuple|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the doc link here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thought was that the tuple combinator (which is linked to) is deprecated and the examples would just use tuples immediately

### getting more information: nom-language::error::VerboseError

The `VerboseError<I>` type accumulates more information about the chain of
The `VerboseError<I>` type (available from the companion `nom-language` crate) accumulates more information about the chain of
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this PR, I've come here after trying to use the VerboseError from nom :)

Just a minor suggestion: that the struct comes from a different crate is an important piece of information, I'd not put it in a parenthetical. Maybe something like this instead:

The companion nom-language crate's VerboseError<I> type accumulates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error_management.md mentions non-existent VerboseError Docs for Parser::parse and Parser::parse_complete do not note any difference

3 participants