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

RESOLVED FIXED in mozilla8



JavaScript Engine
7 years ago
6 years ago


(Reporter: Eric Promislow, Assigned: dmandelin)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: fixed-in-tracemonkey)


(1 attachment)



7 years ago
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.


7 years ago
Assignee: general → dmandelin
Blocks: 625600
Ever confirmed: true

Comment 1

7 years ago
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

Comment 2

7 years ago
(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.

Comment 3

6 years ago
Created attachment 542356 [details] [diff] [review]
Patch to enable syntax error reporting

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+

Comment 4

6 years ago
Whiteboard: fixed-in-tracemonkey
cdleary-bot mozilla-central merge info:
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.