Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Understanding ECMAScript production parameterized annotations

I have been reading about how regular expressions are parsed in JS in this link: https://262.ecma-international.org/13.0/#sec-regular-expressions, but I don't quite understand what are the parameterized annotations [N] and [Sep].

Like in this example:

enter image description here

If I am not wrong I think that the annotation [UnicodeMode] refers to the Unicode flag of the regexp.

Can someone guide me into what [N] and [Sep] means?

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

For how parameterised grammar productions work in general, see JavaScript grammar notation.

If I am not wrong I think that the annotation [UnicodeMode] refers to the Unicode flag of the regexp.

Yes indeed, it is used in ParsePattern which is called both for regex literals and from the RegExp constructor, and the UnicodeMode grammar flag is set when the /u regex flag is given.

Can someone guide me into what [N] means?

This flag is used to change the meaning of named backreferences. If the regex contains at least one named group (?<name>…), then \k<name> notation will refer to such groups (and a group with the given name must exist, according to early error static semantics). But if the regex does not use (?<…>…) anywhere, then \k will just be treated as an IdentityEscape (i.e. matching a literal k in the input text).

What about [Sep]?

That's just a reference to the DecimalDigits production from the normal number literal grammar. It prevents the use of a NumericLiteralSeparator in the number, essentially making it a production matching only integer literals.

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!