-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
feat(linter): regex parser #1164
Comments
Let's do this incrementally with proper testing, we can cherry-pick some of the code from Maneren's branch My requirements:
|
Roadmap (Draft) (For Contributors)
|
@Ubugeeei Nice work! I hope your are learning a lot. |
ref: #1164 I have initialized a crate for handling JavaScript Regexp and defined the AST. I implemented the AST while referring to [eslint-community/regexpp](https://github.com/eslint-community/regexpp/blob/2e8f1af992fb12eae46a446253e8fa3f6cede92a/src/ast.ts).
Hello, I saw it has been 3 weeks since your last pr, are you still interested in this feature, or can I continue your work? |
@Ubugeeei is too busy with other stuff (vapor mode I guess?). Feel free to assign this to yourself @IWANABETHATGUY |
Ah, sorry, I completely missed this comment. (My time bottleneck is my main job... Actually, Vapor often has discussions that are put on hold, so it's not that busy yet..) |
This seems like the kind of self-inflicted torture that I'd enjoy. May I have a go at moving it forward? |
@IWANABETHATGUY have you started working on this? |
WIP |
@maurice it seems like @IWANABETHATGUY is working on it, I'll let him coordinate the tasks. |
I have quick investigated the current status of this issue and the rules related to Rules related to
|
Linting regexp may be doable without a parser, but it'll definitely be easier to lint by visiting an AST. I still want to regex parser for oxc for maximum performance gains 😅 We should only parse the regex once and visit the AST once for linting. There completeness, there is also https://github.com/ota-meshi/eslint-plugin-regexp from the same author. |
Ah~, I see, that makes sense! I've updated my comment. I didn't know this... And this looks also... challenging! 😂 |
@leaysgur The current blocking task is the parser, we can always distribute the linter rules to future contributors. You don't need to implement the linter rules like you did with the jsdoc plugins 😅 |
Yes, I understand. I have finally grasped the situation now. 👍🏻
🙈 Now, I will tackle the implementation of the parser. I'm going to read the |
I'm going through the code and written a bit myself, then I'd like to confirm a few things. Is a Lexer necessary?In the original implementation of What do you think? Support for strict mode (annexB) and various ecmaVersions?These options seem to significantly affect behavior and implementation. What should we do about them? |
Probably not, since there is no whitespace or semi colons like JavaScript. We can try one without a lexer.
We always support the latest ecma version, just like our parser. For strict mode, you may leave them out from your first version. |
OK, thanks! 🙏 |
I pushed current progress #3824 , of course it is WIP... 😴
Maybe yes. But I will refer to or pick up on them as necessary. Currently, they are in
That is very helpful! I was just thinking about what to do. 😅 |
Progress update: Implementation is ongoing. 🚧 #3824 But there's still some work to complete.(Early errors, test262 tests and integration to Linter, etc...) While working on this, I went through the specification and the
Also, for ease of rewriting in Rust, it cannot be implemented as a complete 1-to-1 copy. (since it relies heavily on the dynamic nature of JavaScript) For these reasons, I'm thinking of abandoning original goal of re-implementing Fortunately or unfortunately, there are no de-facts like ESTree, and I think there are any problems, but just in case, I'll look at the specific usecases of the Lint rules that depend on
All usecase were just as expected. |
👍 always bet on the spec! |
Implement a regular expression parser equivalent to @eslint-community/regexpp.
Todo:
Ref: #611
The text was updated successfully, but these errors were encountered: