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

Detect infinite recursion #103

Open
Aloso opened this issue Nov 5, 2023 · 1 comment
Open

Detect infinite recursion #103

Aloso opened this issue Nov 5, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Aloso
Copy link
Member

Aloso commented Nov 5, 2023

Is your feature request related to a problem? Please describe.

Pomsky should prevent you from accidentally introducing infinite recursion. Oniguruma actually does this, so Pomsky may produce regexes that are rejected by oniguruma.

Describe the solution you'd like

Pomsky should detect whenever recursion may be infinite. It should at least reject all expressions that are rejected by oniguruma.

@Aloso Aloso added the enhancement New feature or request label Nov 5, 2023
@Aloso
Copy link
Member Author

Aloso commented May 29, 2024

This should be rather simple: We need to make sure that the expression can match without matching the recursion keyword.

Let's define a sub-expression as "terminating" if it

  1. does not contain any recursion, or
  2. is an alternation where at least one branch is terminating, or
  3. is a repetition that may repeat 0 times

If the entire expression (after resolving variables) is terminating, there is no infinite recursion.

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

No branches or pull requests

1 participant