Closure-compiler: Closure compiler doesn't recognize `\u{XXXX}` in regular expression

Created on 27 Feb 2020  路  5Comments  路  Source: google/closure-compiler

The following code:

let x = /\u{ffff}/u;

would yield:

WARNING - [JSC_MALFORMED_REGEXP] Malformed Regular Expression: {ffff}

from closure compiler, but it's a valid regular expression, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes

good first issue

All 5 comments

Thanks for the report!
I think this might be a good starter issue for someone learning about the compiler.

Sure, the parsing package is the right place to look. I'd start with a unit test in:
https://github.com/google/closure-compiler/blob/master/test/com/google/javascript/jscomp/parsing/ParserTest.java

Hi! I would like to start working on it.

Sounds good. Thanks!

I stand by my advice in https://github.com/google/closure-compiler/issues/3563#issuecomment-593548756 on where I'd recommend starting.

The original repro was completely fixed by https://github.com/google/closure-compiler/pull/3656 (thanks @VoronD!) so I'm closing this issue.

Please file a new issue if you find any remaining bugs.

Was this page helpful?
0 / 5 - 0 ratings