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

WIP: Byte pattern #3979

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Draft

WIP: Byte pattern #3979

wants to merge 3 commits into from

Conversation

stew
Copy link
Member

@stew stew commented May 11, 2023

Add Pattern Bytes

Overview

add support for constructing Patterns over Bytes

Implementation notes

Genericized Pattern and CPattern.

  • Pattern now takes two type parameters, one is the type like Bytes or Text and one is the type which is going to contain all the character class like things, right now it is CharPattern which lets you do things like "range" and "set" and "not" and "any". bytes will be largely similar.

Interesting/controversial decisions

Test coverage

not yet

Loose ends

TBD

Adding a Pattern.captureAs which will act just like capture, but
additionally takes an `a` which will be used as a replacement for the
capture.

My motivation for adding it is that I want to match on escape
sequence, but actually capture the unescaped character instead.

For example:

```
Pattern.captureAs "\n" (Pattern.literal "\\n")
```
@aryairani aryairani marked this pull request as draft November 28, 2023 14:29
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.

None yet

2 participants