Closed Bug 23607 Opened 26 years ago Closed 26 years ago

Identifiers don't support escapes

Categories

(Core :: JavaScript Engine, defect, P3)

All
Mac System 8.6
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: waldemar, Assigned: rogerl)

Details

(Keywords: js1.5)

ECMA Edition 3 requires the support for escape sequences in identifiers. For example, the identifier A could also be specified as \u0041. JavaScript currently does not conform to the spec: js> var \u0041 = 5 1: illegal character: 1: var \u0041 = 5 1: ....^ 1: missing variable name: 1: var \u0041 = 5 1: ....^ js> \u0041 = 5 2: illegal character: 2: \u0041 = 5 2: ^ js> A = 5 5 js> \u0041 4: illegal character: 4: \u0041 4: ^ Non-ASCII letters or digits should also be allowed: js> A\u03B2 = 5 6: illegal character: 6: A\u03B2 = 5 6: .^ However, other non-ASCII characters should be rejected (they are, but for the wrong reason): js> \u0020 = 5 7: illegal character: 7: \u0020 = 5 7: ^ Finally, an identifier with escapes that, when unescaped, would become a reserved word is not itself a reserved word. Thus, c\u0061se should be a valid identifier name.
Assignee: mccabe → rogerl
Passing this one on to Roger.
Keywords: js1.5
testcases ecma_3/Unicode/uc-002-n.js and ecma_3/Unicode/uc-003.js added.
Fix checked in.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Marking Verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.