jquery / jquery/esprima

Non-identifier tokens are valid part/start of identifier when specified with \u

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.1k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

Test case

\u{1}

Expected: An "Unexpected token" exception.
Actual: A valid AST is generated.

Any escaped character is treated as part/start of an identifier (independently of its code):

\u{20} // This whitespace is valid identifier.

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

Reproduce the JavaScript snippets with Esprima and trace the parser entry point that handles escaped identifier characters. Confirm that \u{1} and \u{20} are rejected as invalid identifier characters, with the first case producing an "Unexpected token" exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.