Skip to content

Parser: Unicode group names and named group references #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DmitrySoshnikov opened this issue Dec 30, 2017 · 1 comment · Fixed by #184
Closed

Parser: Unicode group names and named group references #144

DmitrySoshnikov opened this issue Dec 30, 2017 · 1 comment · Fixed by #184

Comments

@DmitrySoshnikov
Copy link
Owner

Currently parser doesn't consider group reference as a reference since doesn't normalize Unicode names to check:

/(?<\u{41}\u0042AB>\k<AB\u{41}\u0042>)/u

This should recognize \k<AB\u{41}\u0042 as a group reference (ABAB).

@rbuckton
Copy link
Contributor

It also fails to recognize unicode group names:

spec-compliant › indices-array-unicode-property-names

    SyntaxError: 

    /(?<π>a)/u
      ^
    Unexpected token: "?" at 1:2.

      10 | describeEachMode(() => {
      11 |     it("indices-array-unicode-property-names", () => {
    > 12 |         parse('/(?<π>a)/u');
         |         ^
      13 |         // expect(exec.call(/(?<π>a)/u, "bab")!.indices.groups!.π).toEqual([1, 2]);
      14 |         // expect(exec.call(/(?<\u{03C0}>a)/u, "bab")!.indices.groups!.π).toEqual([1, 2]);
      15 |         // expect(exec.call(/(?<\u{03C0}>a)/u, "bab")!.indices.groups!.π).toEqual([1, 2]);

      at Object.throwUnexpectedToken (node_modules/regexp-tree/dist/parser/generated/regexp-tree.js:626:11)
      at unexpectedToken (node_modules/regexp-tree/dist/parser/generated/regexp-tree.js:1342:13)
      at Object.parse (node_modules/regexp-tree/dist/parser/generated/regexp-tree.js:785:9)
      at Object.<anonymous>.regexpTreeParser.parse (node_modules/regexp-tree/dist/parser/index.js:22:10)
      at Object.parse (node_modules/regexp-tree/dist/regexp-tree.js:57:19)
      at Object.it (__tests__/test262/indices-array-unicode-property-names.ts:12:9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants