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

Ensure grouping of alternation is needed before applying #34

Closed
jsim2010 opened this issue Jun 17, 2019 · 1 comment
Closed

Ensure grouping of alternation is needed before applying #34

jsim2010 opened this issue Jun 17, 2019 · 1 comment

Comments

@jsim2010
Copy link
Owner

Currently grouping occurs when the alternation is applied. This results in regexes with just the alternation, ex: "aa" | "bb", being grouped, i.e. (?:aa|bb), even though the grouping is not needed, aa|bb. Ideally, this grouping only applies if it is necessary, ex: ("aa" | "bb") + "c" = (?:aa|bb)c.

@jsim2010
Copy link
Owner Author

Need to check that an alternation has not already been handled. For example:

("aa" | "bb") + Ch::whitespace() + "cc" = (?:aa|bb)\scc instead of (?:(?:aa|bb)\s)cc.

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

No branches or pull requests

1 participant