acornjs / acorn

A small, fast, JavaScript-based JavaScript parser
10.58k stars 883 forks source link

ES6 RegExp flags in 0.4.1 #1163

Closed NeilFraser closed 1 year ago

NeilFraser commented 1 year ago

A bit of archeology here.

Back in version 0.4.1 RegExp flags are checked with this line:

    if (mods && !/^[gmsiy]*$/.test(mods)) raise(start, "Invalid regexp flag");

According to the ES5 spec:

If F contains any character other than "g", "i", or "m", or if it contains the same character more than once, then throw a SyntaxError exception.

Am I wrong in thinking that the gmsiy in version 0.4.1 (which only supports ES5) should actually be gmi?

marijnh commented 1 year ago

I ... really don't care enough about triaging bugs in ancient versions to go dig into specs and old code for this, sorry.

NeilFraser commented 1 year ago

I totally understand, that was a long time ago. You might be interested to know that 0.5.0 is in active use at Google (and elsewhere) powering secure ES5 sandboxes via the JS-Interpreter.