Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example parsing ISO 8601 duration #24

Merged
merged 1 commit into from
Dec 21, 2018

Conversation

JoshMcguigan
Copy link
Contributor

Inspired by this comparison of Nom, Combine, and Pest, I wrote an example parser for the ISO 8601 duration format using pom.

I'd welcome any feedback you have to improve this parser. In particular, I don't like the map statement required to flatten the tuples after chaining multiple parsers with + in the date_part and time_part functions.

Generally, I really enjoy working with pom. Thanks for your work on it!

@J-F-Liu J-F-Liu merged commit b135f2b into J-F-Liu:master Dec 21, 2018
@J-F-Liu
Copy link
Owner

J-F-Liu commented Dec 21, 2018

Thanks, this is a very good example. I find no better alternative to flatten tuples.

@JoshMcguigan
Copy link
Contributor Author

Thanks for the merge.

On the topic of flattening the tuples, this combine example demonstrates what I think is a nice approach to combining parsers which avoids the need to flatten tuples all together. It also handles the +, -, and * use cases without having to remember which one is which.

If you have any interest / could provide guidance on bringing something like this to pom, I'd be happy to work on it.

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.

2 participants