Closed
Bug 157509
Opened 22 years ago
Closed 22 years ago
No error on invalid usage of \ in identifiers
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R4
People
(Reporter: igor, Assigned: norrisboyd)
Details
Attachments
(1 file)
20.90 KB,
patch
|
Details | Diff | Splinter Review |
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
Comment 1•22 years ago
|
||
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 -
Reporter | ||
Comment 2•22 years ago
|
||
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.
--
Reporter | ||
Comment 3•22 years ago
|
||
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
Comment 4•22 years ago
|
||
Verified FIXED. Testcase now passes in both the rhino, rhinoi shells -
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•