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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the parser to allow the RegExp d flag. #13393

Closed
1 task done
ota-meshi opened this issue May 29, 2021 · 3 comments 路 Fixed by #13396
Closed
1 task done

Change the parser to allow the RegExp d flag. #13393

ota-meshi opened this issue May 29, 2021 · 3 comments 路 Fixed by #13396
Assignees
Labels
i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@ota-meshi
Copy link
Contributor

ota-meshi commented May 29, 2021

馃捇

  • Would you like to work on this feature?

What problem are you trying to solve?

RegExp literals can now use the d flag, but the d flag causes a parsing error.

https://github.com/tc39/proposals/blob/master/finished-proposals.md
tc39/proposals@f0adbe1
https://github.com/tc39/proposal-regexp-match-indices
tc39/ecma262#1713

Describe the solution you'd like

Change the parser so that the d flag of the RegExp literal does not cause a parsing error.

I'm not familiar with it, but I might just add the flag to the next line.
https://github.com/babel/babel/blob/main/packages/babel-parser/src/tokenizer/index.js#L24

Describe alternatives you've considered

I don't think there is an alternative.

Documentation, Adoption, Migration Strategy

No response

@babel-bot
Copy link
Collaborator

Hey @ota-meshi! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@nicolo-ribaudo
Copy link
Member

Thanks for the bug report! This needs to be fixed adding the flag to

const VALID_REGEX_FLAGS = new Set(["g", "m", "s", "i", "y", "u"]);

Then, we should add a test in https://github.com/babel/babel/tree/main/packages/babel-parser/test/fixtures/es2022.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 29, 2021

I'm assigning this issue to you since you ticked "Would you like to work on this feature?" 馃槃
If you need any help, feel free to ask!

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 31, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: enhancement outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants