early reporting of malformed regex literals
waldemar at google.com
Wed Jul 9 17:56:19 PDT 2008
Allen Wirfs-Brock wrote:
> In your comments on the June 11, ES3.1 draft you said:
> p22 7.8. Unacceptable change: The requirement to signal regular
> expression syntax errors at scanning time breaks existing programs.
> (The justification ("since the arguments are the same every tine[sic],
> ..." appears to have no bearing on that and should be removed in any
> If the existing browser implementations don’t do this, would you agree
> it would be better to simply eliminate the scanning time option?
> Presumably, it would be acceptable to require early report in an opt-in
> “strict mode”
If you intend to allow unescaped slashes inside regular expression literals, then you must report at least some regular expression syntax errors early. There's no way to continue parsing the rest of the program if you don't because you don't know where the regular expression literal ends.
More information about the Es4-discuss