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
Replace hard-coded parser unicode identifier detection with RegExp #144
Comments
Noting: https://mathiasbynens.be/notes/javascript-identifiers-es6
|
Noting: https://github.com/tc39/proposal-regexp-unicode-property-escapes#other-examples const regexIdentifierStart = /[$_\p{ID_Start}]/u;
const regexIdentifierPart = /[$_\u200C\u200D\p{ID_Continue}]/u;
const regexIdentifierName = /^(?:[$_\p{ID_Start}])(?:[$_\u200C\u200D\p{ID_Continue}])*$/u; |
I have not worked with unicode ranges before, but shouldn't the regex be able to be generated runtime (maybe as a fallback)? The website used to generate the regex clearly does it runtime. The regex generation may be slow, but I think it's better as a fallback than nothing. Am I missing something? |
This may become our min browser: Chrome 50
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode
We can then get rid of the following 10kb:
https://github.com/knockout/tko/blob/4a0c9c0d03bb2ed53aa058672b5429d88bf92264/packages/utils.parser/src/identifierExpressions.js
The text was updated successfully, but these errors were encountered: