RegExp Flags

# Kevin Smith (12 years ago)

SM and v8 exhibit different behavior when evaluating the following:

false ? /abc/ii : 0;

In v8, no syntax error is thrown, presumably because regular expression flags are only validated when a RegExp object is created. In SM, a syntax error is thrown because flag validation is performed by the scanner.

The current spec seems to lean toward the v8 interpretation. Thoughts?

# Yusuke SUZUKI (12 years ago)

I think SM behavior is right to the spec.

According to 7.8.5,

the error must be treated as an early error (Clause 16)

And early error should be reported before evaluation of the Program (section 16)

# Allen Wirfs-Brock (12 years ago)

-------- Original message -------- Subject:RE: RegExp Flags From:Allen Wirfs-Brock <allen at wirfs-brock.com>

To:zenparsing at gmail.com Cc:

It's supposed to be an early syntax error. See last sentence of www.ecma-international.org/ecma-262/5.1/#sec-7.8.5

# Yusuke SUZUKI (12 years ago)

I've already reported this issue :) code.google.com/p/v8/issues/detail?id=896

# Domenic Denicola (12 years ago)

Should this be added to test-262?

It'd be cool if test-262 took pull requests :).

From: es-discuss-bounces at mozilla.org [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Yusuke SUZUKI Sent: Monday, April 1, 2013 22:44 To: Allen Wirfs-Brock Cc: es-discuss at mozilla.org Subject: Re: RegExp Flags

I've already reported this issue :) code.google.com/p/v8/issues/detail?id=896

# Kevin Smith (12 years ago)