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 bytes/2 combinator #132

Merged
merged 5 commits into from
Dec 6, 2023
Merged

add bytes/2 combinator #132

merged 5 commits into from
Dec 6, 2023

Conversation

foresttoney
Copy link
Contributor

This pull request adds a new bytes/2 combinator ( #131). This combinator allows a user to pull the next n bytes from the input. It will compile to a binary-size pattern match on the input string and will return a parsing error if there are insufficient bytes.

@josevalim, I know that in #30, you proposed a binary_size combinator which seems to take this idea further. From what I can tell, it would add similar compile time optimizations to other bounded combinators. However, bytes was also included as a secondary combinator in that proposal.

This commit adds a new combinator bytes/2. The combinator will
pull the next n bytes from the input. It combiles to a byte-size
pattern match on the input.
lib/nimble_parsec.ex Outdated Show resolved Hide resolved
lib/nimble_parsec.ex Outdated Show resolved Hide resolved
@josevalim josevalim merged commit 0ccc43e into dashbitco:master Dec 6, 2023
2 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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