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

Regexp does not support empty character classes. #832

Closed
RunDevelopment opened this issue Jun 22, 2020 · 1 comment
Closed

Regexp does not support empty character classes. #832

RunDevelopment opened this issue Jun 22, 2020 · 1 comment

Comments

@RunDevelopment
Copy link

TS and JS Grammar Extension version: 0.0.53 / latest

Description

Empty character classes, while not very useful, are valid JS/TS and should be supported. This issue is especially noticeable while writing regexes because highlighting breaks whenever you add a new character class.

Code

let a = /foo[]bar/;
let b = /foo[^]bar/;

Will be highlighted as:

image

Fix

The pattern for character classes is \[([^\]\\]|\\.)+\], right now. Simply changing it to \[([^\]\\]|\\.)*\] (uses * not +) should fix the issue.

@RunDevelopment
Copy link
Author

Thank you very much @sheetalkamat! This problem annoyed me for over a year now, so it's nice that it's fixed.

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