Here are two examples.
var x = 1/(1+Math.sqrt(sum)) // convert to number between 1-0
return Math.round((num / den) * 100)/100
I propose a quick heuristic:
These would stay regexes:
x = /abc/;
x = /abc/.match;
These specific misparses would be fixed:
x = 1 / 2 / 3;
x = 1/1/.1;
These would still be broken:
(treats =/ as an operator, while x is a regex in Firefox 3)
(the g looks like a modifier, but this correctly is treated as math by Firefox 3)
(same as above)
The last two also are mishandled in vim. Without variable length lookbehind I don't see an easy way to fix these. See [febbbf8f29c2] for the fix, which I think is good enough to close this ticket.
OK, closing it -- I think it's as good as we can get without a full parser.