Consider using Unicode RegExp property escapes for identifier matching
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 772
- PR merge metrics
- No merged PRs in 30d
Description
Currently, Esprima uses large script-generated regular expression patterns to match identifier characters correctly:
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading tools/generate-identifier-regex.js and src/character.ts to understand the generated identifier patterns and their update workflow. Then inspect the existing TypeScript build process and determine whether Unicode property escapes can be supported without changing identifier matching; done means a simpler source and build workflow with equivalent behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- build-system, compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100