esprima
esprima copied to clipboard
Consider using Unicode RegExp property escapes for identifier matching
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:
- IIUC, TypeScript doesn't currently support transpiling Unicode RegExp property escapes, so we might need to add a transpilation step to the existing build process.
Thoughts?