esprima icon indicating copy to clipboard operation
esprima copied to clipboard

Consider using Unicode RegExp property escapes for identifier matching

Open mathiasbynens opened this issue 6 years ago • 0 comments

Currently, Esprima uses large script-generated regular expression patterns to match identifier characters correctly:

https://github.com/jquery/esprima/blob/24eb7ed0fc816c8b5f51087f07dc932a28766c53/src/character.ts#L1-L8

Now that Unicode RegExp property escapes are now part of the language, we could use \p{ID_Start} and \p{ID_Continue} instead to massively simplify the Esprima source code and get rid of separate script + manual updating workflow.

Pros:

  • Source code would become simpler and more readable
  • No more need for a separate build script + manual updating workflow

Cons:

Thoughts?

mathiasbynens avatar Jul 02 '19 09:07 mathiasbynens