Skip to content
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

Use ES6 syntax for astral Unicode characters #651

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Seb35
Copy link

@Seb35 Seb35 commented Jun 4, 2020

PR type

  • Bug fix (non-breaking change which fixes an issue): no
  • New feature (non-breaking change which adds functionality): yes
  • Breaking change (fix or feature that would cause existing functionality to change): no
  • Documentation change: no

Prerequisites

  • I have read the CONTRIBUTING.md document: yes
  • I have updated the documentation accordingly: no but it should be done indeed
  • I have added tests to cover my changes: there is one

Description

This PR is constructed on #586 but uses the ES 6 syntax for astral Unicode characters \u{1F4AF} instead of the syntax \U0001F4AF (recognised in Python world).

The rule CodePoint (named after ECMAScript grammar) recognises the following sequences:

  • \u{0+} e.g. \u{00000000000000} resulting in the Unicode character U+0000
  • \u{0*HexDigit{1,4}} resulting in the Unicode character in BMP
  • \u{0*(10|HexDigit)HexDigit{4}} resulting in the Unicode character in astral plane

This PR or #586 have a similar goal but a different proposed syntax.

They are both limited to constant strings and do both a bad job in characters classes like [a-\u{1F4AF}]. Characters classes should be treated by further PRs, see my comment for other points.

@vercel
Copy link

vercel bot commented Jun 4, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/peg-js/pegjs/ewy36hurn
✅ Preview: https://pegjs-git-fork-seb35-651.peg-js.now.sh

@hildjj
Copy link

hildjj commented Apr 13, 2021

Can you port this over to merge cleanly on peggyjs/peggy please? I'd like this to be in the first peggy release.

@hildjj
Copy link

hildjj commented Apr 15, 2021

Actually, not before peggy 1.0. See: peggyjs/peggy#15

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 this pull request may close these issues.

3 participants