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

[JavaScript]: unicode escape sequence within identifier is always in unicode mode #2372

Open
JLHwung opened this issue Oct 28, 2024 · 2 comments
Labels

Comments

@JLHwung
Copy link

JLHwung commented Oct 28, 2024

Bug Description

Per spec:

RegExpIdentifierStart [UnicodeMode] ::
   \ RegExpUnicodeEscapeSequence [+UnicodeMode] 

The unicode escape sequence within a regexp identifier is always parsed with UnicodeMode, so /(?<\u{41}>)\k\u{41}/ should be valid.

Reproduction steps

Input (?<\u{41}>)\k<\u{41}>

Expected Outcome

It should parse

Browser

Include browser name and version
Firefox 133.0a1 (2024-10-22) (aarch64)

OS

Include OS name and version
Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:39 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6000 arm64

@JLHwung JLHwung added the bug label Oct 28, 2024
@firasdib
Copy link
Owner

I've never seen this before, very interesting. Do you know when support for this syntax was introduced?

@JLHwung
Copy link
Author

JLHwung commented Nov 17, 2024

Good question. It seems that the always-UnicodeMode semantic was introduced in ES2020: https://tc39.es/ecma262/2020/#prod-RegExpIdentifierPart, specifically from this normative change: tc39/ecma262#1869

Previously in ES2019, https://tc39.es/ecma262/2019/#prod-RegExpIdentifierPart, the UnicodeMode was inherited from the context.

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

No branches or pull requests

2 participants