jquery / jquery/esprima

Consider using Unicode RegExp property escapes for identifier matching

Open
#1,979 0 comments 0 reactions 0 assignees View on GitHub

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:

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.