-
Notifications
You must be signed in to change notification settings - Fork 419
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
Suggested Feature: Unicode Properties #648
Comments
I did not know Unicode properties, so if others are wondering about this, see this Unicode annex, and ECMAScript syntax. This is quite new in ECMAScript (9th Edition – ECMAScript 2018) and I guess it would be very complicated to polyfill it, at least inside PEG.js; so perhaps the user should be warned its parser is not compatible with older environments? (Perhaps Babel has or will have a polyfill, but it is outside of PEG.js.) About the syntax I would favour console.log( pegjs.generate( "Number = [\d]", { output: "source" } ) );
// See beginning of function peg$parse around line 140:
// variable peg$c0 or peg$r0 depending on PEG.js version |
Great idea. I think there are at least a few options re: polyfilling:
|
Issue type
Prerequisites
Description
Hi, first of all, thanks a lot for the work here!
I'm wondering why there is no facilities to accept characters based on unicode properties. The examples I've seen are based on enumerations and character ranges. But I argue that using unicode properties is cleaner.
Currently this is possible but requires the use of JS RegExp wrapped around predicates which seems convoluted and slow:
(I Apologies if there is a cleaner way to use use predicate, I'm fairly new to this module)
Slightly enriching the pegjs syntax would lead to a much nicer result:
Am I missing something?
Regards,
Laurent
The text was updated successfully, but these errors were encountered: