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

Ergex's regex API should match the Aho-Corasick API #3

Open
deadpixi opened this issue Jan 11, 2022 · 2 comments
Open

Ergex's regex API should match the Aho-Corasick API #3

deadpixi opened this issue Jan 11, 2022 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@deadpixi
Copy link
Owner

The push-oriented implementation of Aho-Corasick returns an iterator over the matches it finds. The public regex API instead reports matches via callbacks. I'd like to see the public API also return an iterator.

Something like:

for match in scratch.push(bytes) {
    // do things
}

A big question is how to handle scratch.finish, which consumes the scratch but also might return matches.

@deadpixi deadpixi added enhancement New feature or request help wanted Extra attention is needed labels Jan 11, 2022
@raghav-deepsource
Copy link

that could be handled using Iterator::collect. the only difference being that it would be possible to get a collection with 0 elements if there are no stored matches in the instance. I admit I haven't seen much of how this library works, but I'm throwing this idea out there.

@raghav-deepsource
Copy link

you could implement drop on the iterator in such a way that it also "finishes" the associated scratch struct...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants