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

Prevent empty negated groups in Rust #68

Open
Aloso opened this issue Jan 13, 2023 · 0 comments
Open

Prevent empty negated groups in Rust #68

Aloso opened this issue Jan 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@Aloso
Copy link
Member

Aloso commented Jan 13, 2023

Describe the bug

Since empty groups such as [] or [^\s\S] are forbidden in Rust, Pomsky tries its best to detect them and show an error. However, this is currently far from comprehensive.

To Reproduce

Try to compile any of these with the regex crate:

  • ![w !d]
  • [!w !s]
  • [!Latin !s]
  • [U+00-U+10FFFF]

There are many more cases, and catching all requires some refactoring.

Expected behavior

This error should also be emitted for the above cases:

error P0307(resolve): 
  × This negated character class matches nothing
   ╭────
 1 │ ![s !s]
   ·  ───┬──
   ·     ╰── error occurred here
   ╰────
@Aloso Aloso added the bug Something isn't working label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant