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

Recognize cases where rascal is greedy instead of non-greedy #11

Open
DavyLandman opened this issue Jul 23, 2024 · 0 comments
Open

Recognize cases where rascal is greedy instead of non-greedy #11

DavyLandman opened this issue Jul 23, 2024 · 0 comments
Labels

Comments

@DavyLandman
Copy link
Member

DavyLandman commented Jul 23, 2024

I see a pattern where rascal's greedy matches (a+ !>> a) are mapped to non greedy regexes with a follow guard. a+? (?!a).

We could optimize this as: a+ in regex.

Some heuristics on when A+ or A* is greedy:

  • it's followed by a non optional literal that does not match A. example: [0-9]+ "e"
  • it has a a follow restriction with same chars as itself: example: [0-9]+ !>> [0-9]
@sungshik sungshik added enhancement New feature or request regular expressions labels Sep 6, 2024
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

2 participants