Closed Bug 660371 Opened 10 years ago Closed 10 years ago

"Invalid quantifer" errors in regular expressions aren't reported in standard form by js shell

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: eric.promislow, Assigned: dmandelin)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

Given these this three-line program:
var a = 3;
var s = /abc:(*?)def/;
var c = 4;

the js shell just reports 
"invalid quantifier"

instead of following the form of other error messages, as given
in the Expected Results field.



Reproducible: Always

Steps to Reproduce:
Build Mozilla with the js shell.

Create the file with the above three lines.  Run the command
[path to js]/js foo.js  

Actual Results:  
invalid quantifier


Expected Results:  
I would expect output like so:
foo.js:2: SyntaxError: invalid quantifier:
foo.js:2: var s = /abc:(*?)def/;
foo.js:2: ..............^

Although that third line is somewhat hopeful on my part.
But instead I'm not getting any line number.
Assignee: general → dmandelin
Blocks: 625600
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
This behavior is present even before the recent Yarr landing. It seems to relate to some detail of Spidermonkey error reporting.
No longer blocks: 625600
(In reply to comment #1)
> This behavior is present even before the recent Yarr landing. It seems to
> relate to some detail of Spidermonkey error reporting.

It did regress on the first Yarr landing, though. So that should help in tracking it down.
There are actually 2 separate regressions from the pre-Yarr behavior here:

1. Syntax errors in regexp literals aren't getting reported as syntax errors, but just get a raw error string instead.

2. We used to show the point of the error within the regexp text, but now we don't.

#1 is the more serious one, and easier to fix: the patch is for that.

#2 is less serious, and harder to fix: it would require teaching Yarr to report the point at which syntax errors occur. Should be possible, but it would be nice to coordinate with WebKit. So let's let this be a followup bug.
Attachment #542356 - Flags: review?(cdleary)
Attachment #542356 - Flags: review?(cdleary) → review+
http://hg.mozilla.org/tracemonkey/rev/38322c7498ff
Whiteboard: fixed-in-tracemonkey
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.