Closed Bug 627609 Opened 9 years ago Closed 9 years ago
Empty group matching fails on /((a|)+b)+/.exec('bb')
dmandelin and I thought through this example in talking over the patch for bug 599854. We need a more robust way of tracking parens with valid empty group matches.
blocking2.0: ? → betaN+
Assignee: general → dmandelin
Status: NEW → ASSIGNED
Attachment #506578 - Flags: review?(cdleary)
Comment on attachment 506578 [details] [diff] [review] Patch This is clearly the right way to do it: if I knew what I was doing a little more when we first imported PCRE or we had a test case like this one, maybe I would have found this solution. :-) Quantified assertions are invalid in the ES5 spec, although the ES3 grammar seems to allow it, which would calls into question examples like |/(?=foo)+/.exec('foofoo')|. Can atOptionalBracket fall off the beginning of the pattern? If not, we should put a comment as to why the negative indexing is safe. IRL we talked about whether BRAMINZERO was needed as a case within atOptionalBracket, but it doesn't seem so: if you lazy match my matching the empty string this situation should be equivalent to not executing the regexp within the lazy match at all. A comment about this within the atOptionalBracket would be nice.
Attachment #506578 - Flags: review?(cdleary) → review+
Whiteboard: softblocker → softblocker, fixed-in-tracemonkey
cdleary-bot mozilla-central merge info: http://hg.mozilla.org/mozilla-central/rev/9f58085a9081 http://hg.mozilla.org/mozilla-central/rev/0f340f13b171 http://hg.mozilla.org/mozilla-central/rev/68e341f7ac4e
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.