Closed Bug 157509 Opened 22 years ago Closed 22 years ago

No error on invalid usage of \ in identifiers

Categories

(Rhino Graveyard :: Core, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: igor, Assigned: norrisboyd)

Details

Attachments

(1 file)

Rhino does not throw SyntaxError on invalid \ usage in identifiers like in: var a\b; In general, as long as \ in the middle of the identifier does not follow by u, Rhino silently swallow that: try { eval("var a\\1 = 0; print(a\\1); "); } catch (e) { print(e); } which prints 0 while SM correctly prints: SyntaxError: illegal character
Testcase added to JS testsuite: mozilla/js/tests/ecma_3/Statements/regress-157509.js As Igor says, this is passing in SpiderMonkey, failing in Rhino -
I commited the patch with the following comments: -- I changed TokenStream to use internal buffer in place of LineBuffer#startString/ getString to store currently read characters for identifiers, strings and number s. For the price of yet another character coping it allows to simplify code logi c especially regarding interaction with LineBuffer. --
With the above patch commited Rhino passes mozilla/js/tests/ecma_3/Statements/regress-157509.js
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Verified FIXED. Testcase now passes in both the rhino, rhinoi shells -
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: