Closed Bug 228336 Opened 22 years ago Closed 22 years ago

bug with braces in JavaScript regular expressions

Categories

(Rhino Graveyard :: Core, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pschwartau, Assigned: igor)

Details

(Whiteboard: [ Rhino version of bug 228087 against SpiderMonkey ])

Attachments

(1 file)

This is the Rhino version of bug 228087 against SpiderMonkey. The following regexp patterns are causing SyntaxErrors: js> re = /{1.*}/g; js: uncaught JavaScript exception: SyntaxError: Invalid quantifier { js> re = /{1[.!}]*}/g; js: uncaught JavaScript exception: SyntaxError: Invalid quantifier { This is correct per ECMA-262 Ed. 3, which prohibits the use of unescaped braces in regexp patterns unless they form part of a quantifier. However, as part of the SpiderMonkey RegExp rewrite (bug 85721), it was decided to follow Perl and IE, and allow unescaped braces even if they are not part of a quantifier. See bug 188206 comment 12; also bug 223273 comment 29 and following. It looks like the RegExp parser is mistakenly identifying the above use of braces as quantifiers (hence the SyntaxErrors), instead of the non-quantifier, literal use of unescaped braces that we permit. The testcase for this bug is mozilla/js/tests/ecma_3/RegExp/regress-228087.js It is currently failing in both the SpiderMonkey and Rhino shells -
Whiteboard: [ Rhino version of bug 228087 against SpiderMonkey ]
I will look at it
Assignee: nboyd → igor
This is a Rhino version of Brandan's patch from attachment 138844 [details] [diff] [review], bug 228087 plus code to fix overflow problem reported in bug 230216.
I committed the fix
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Trageting as resolved against 1.5R5
Target Milestone: --- → 1.5R5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: