ES6 Unicode Identifiers #214

Closed
getify opened this Issue Mar 4, 2015 · 5 comments

Projects

None yet

3 participants

@getify
getify commented Mar 4, 2015

The new Unicode "code point escape" form is also valid for identifiers, such as:

var \u{2B400} = 42;

As usual, @mathiasbynens has a bunch of great stuff about what makes a valid Unicode identifier in ES6 vs ES5, etc.

@getify getify referenced this issue in babel/babel Mar 4, 2015
Closed

Support ES6 Unicode escaped identifiers #941

@marijnh
Member
marijnh commented Mar 4, 2015

The hard part here appears to be that we don't yet know how to distinguish >0xFFFF code points as being identifier characters.

@getify
getify commented Mar 4, 2015

I believe the regex at the above link gives that answer definitively, right?

@marijnh
Member
marijnh commented Mar 4, 2015

So that means there are no code points above 0xffff that can be part of an identifier? (This is entirely possible, I just don't know)

@mathiasbynens
Contributor

New blog post that documents the differences between ES5 and ES6 identifiers, with examples: https://mathiasbynens.be/notes/javascript-identifiers-es6 It answers your question, @marijnh.

@marijnh marijnh added a commit that referenced this issue Mar 4, 2015
@marijnh marijnh Allow braced \u escapes in identifiers
We still can't properly recognize code points as ES6-style
identifier chars.

Issue #214
891d5d0
@marijnh
Member
marijnh commented Mar 4, 2015

Right, so that puts us in a bit of a bind -- including another giant regexp (even bigger than the old ones -- some 14k) in the library to handle obscure identifier names is not a very attractive idea. But not being able to properly identify ES6 identifiers is also a shame.

Attached patch solves the issue reported here. The ES6 identifier issue is now tracked in #215

@marijnh marijnh closed this Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment