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

Deduplication of alts does not preserve capture groups #270

Open
hvdijk opened this issue Oct 10, 2020 · 2 comments
Open

Deduplication of alts does not preserve capture groups #270

hvdijk opened this issue Oct 10, 2020 · 2 comments
Labels

Comments

@hvdijk
Copy link
Collaborator

hvdijk commented Oct 10, 2020

$ libfsm/build/bin/re -p -rpcre -lpcre '(foo)|(foo)'
(foo)
$ libfsm/build/bin/re -p -rpcre -lpcre '(foo)|(bar)'
(bar)|(foo)

In general, deduplicating alts is a good simple optimisation to speed up the generation of an FSM, but for regexes containing capture groups, the optimisation is not valid.

@katef katef added the bug label Oct 10, 2020
@katef
Copy link
Owner

katef commented Oct 10, 2020

There's also reordering, and I suppose we either refrain from doing that, or we error about it as an unsupported situation.

@silentbicycle
Copy link
Collaborator

This has definitely been addressed in my capture branch.

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

No branches or pull requests

3 participants