estools / esmangle

esmangle is mangler / minifier for Mozilla Parser API AST
https://estools.github.io/esmangle/
BSD 2-Clause "Simplified" License
295 stars 39 forks source link

reduce escape sequences in regular expressions #90

Open michaelficarra opened 11 years ago

michaelficarra commented 11 years ago

We already do something similar with strings, reducing '\x20' to ' ' (escodegen handles this for us automatically). It gets trickier with regular expressions, though, because we will need to avoid control characters such as [](){}-\. When expressed as \u????, these control characters can still be reduced to \x??.

Constellation commented 11 years ago

It breaks the regexp.source result. So we need to provide advance mode to do such optimizations.