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

Allow pest to match against byte literals #244

Open
jstnlef opened this issue May 28, 2018 · 7 comments
Open

Allow pest to match against byte literals #244

jstnlef opened this issue May 28, 2018 · 7 comments

Comments

@jstnlef
Copy link
Contributor

jstnlef commented May 28, 2018

For example, if we would like to match against an occurrence of one or more actual bytes (like 7c or FFFF) we should be able to. This would take a bit of design work, however, since we make assumptions in many places in the code that we'll be dealing with UTF-8 strings.

Request from @Restioson

@dragostis
Copy link
Contributor

The redesign should tackle the issue of capturing strings from the input with the generated Spans. Currently, these guarantee UTF-8 cheap captures.

@Restioson
Copy link

Yes hello, thanks. For more info: my usecase is matching actual bytes (not literals) for capturing values in AML.

@dragostis
Copy link
Contributor

@Restioson, do you need this feature soon? Going through the design work to add this feature will probably take some time. Probably some post 2.0 launch.

The big issue here is that Position and Span only work on UTF-8 borders. The types guarantee this. In order for byte parsing to work, one needs to either use completely different types, (imagine 2.x release), or rebase the current types to handle both cases somehow. (3.0+)

@Restioson
Copy link

TBH we're probably going to do it with a handwritten parser @IsaacWoods wrote a while back (but nevertheless I really like this library and would like to keep helping). So, no timeframe really.

@iptq
Copy link
Contributor

iptq commented Mar 9, 2021

bump, any progress on this? i might be needing this soon (am parsing IMAP with pest) so i'll probably implement a proof-of-concept in a bit

@12089897411
Copy link

Can you put it on the agenda?

@tomtau
Copy link
Contributor

tomtau commented Mar 14, 2024

@12089897411 I posted it as one of ideas here: #885 (comment) feel free to upvote or comment on it.
It won't likely be an initial priority in pest3, but once the pest3 codebase settles, it'll be more open to experiment with changes in that regard

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

No branches or pull requests

6 participants