Closed
Bug 223451
Opened 21 years ago
Closed 21 years ago
Unescaped, unbalanced parens in a regexp should cause SyntaxError
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
1.5R5
People
(Reporter: pschwartau, Assigned: igor)
Details
(Whiteboard: [ compare bug 223273 against SpiderMonkey ])
Attachments
(1 file)
Unescaped, unbalanced parens in a regexp should cause a SyntaxError.
The same should also be true for unescaped, unbalanced brackets or braces.
This is the Rhino version of bug 223273 against SpiderMonkey.
There is a testcase for this at
mozilla/js/tests/ecma_3/RegExp/regress-223273.js
It is currently failing in the Rhino shell -
Reporter | ||
Comment 1•21 years ago
|
||
> The same should also be true for unescaped, unbalanced brackets or braces.
Yes, to be fully ECMA-compliant. However, this differs from Perl, and
SpiderMonkey has decided to go with Perl for backward compatibility.
Rhino might wish to do the same.
See bug 223273 comment 29 and following -
Reporter | ||
Comment 2•21 years ago
|
||
Changing summary:
from: "Unescaped, unbalanced parens in a regexp should cause SyntaxError"
to: "Allow unescaped, unbalanced parens in a regexp?"
This reflects what SpiderMonkey decided to do. If Rhino wants to
remain in sync with SpiderMonkey and Perl, it should do the same,
even though this is not ECMA-correct.
Summary: Unescaped, unbalanced parens in a regexp should cause SyntaxError → Allow unescaped, unbalanced parens in a regexp?
Whiteboard: [ compare bug 223273 against SpiderMonkey ]
Reporter | ||
Comment 3•21 years ago
|
||
OOPS! Changing summary back to:
"Unescaped, unbalanced parens in a regexp should cause SyntaxError"
I got mixed up - unescaped, unbalanced parens SHOULD cause a SyntaxError.
Where SpiderMonkey and Perl deviate from ECMA is in the treatment of
unescaped, unbalanced right-brackets, and braces (both left and right).
The testcase above is failing in Rhino in two different sections:
1. Unescaped, unbalanced right-parens are not generating a SyntaxError.
They should. (Sections 2, 4 of the above test).
2. Unescaped, unbalanced braces (left and right) are generating SyntaxErrors
They should if Rhino wants to be in sync with SpiderMonkey and Perl
instead of ECMA. (Sections 21-24 of the above test).
Summary: Allow unescaped, unbalanced parens in a regexp? → Unescaped, unbalanced parens in a regexp should cause SyntaxError
Reporter | ||
Comment 4•21 years ago
|
||
Typo above:
> Unescaped, unbalanced braces (left and right) are generating SyntaxErrors.
> They should if Rhino wants to be in sync with SpiderMonkey and Perl
They should NOT if Rhino wants to be in sync with SpiderMonkey and Perl -
Assignee | ||
Comment 5•21 years ago
|
||
Check for unbalanced ')' is done differently then in SM since rhino uses
recursive version of SM code while fix for ArrayIndexOutOfBoundsException is
just a variation of my patch for bug 227705 in SM.
Assignee | ||
Comment 6•21 years ago
|
||
The above ArrayIndexOutOfBoundsException is trivially triggered in Rhino with
the following regexp:
/(?/
as in :
js> /(?/
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at org.mozilla.javascript.regexp.NativeRegExp.parseTerm(NativeRegExp.jav
Assignee | ||
Comment 8•21 years ago
|
||
I committed the fix
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•