Index: tools/jsmin.py |
=================================================================== |
--- tools/jsmin.py (revision 3562) |
+++ tools/jsmin.py (working copy) |
@@ -230,7 +230,9 @@ |
# A regexp that matches a literal string surrounded by 'double quotes'. |
single_quoted_string = r"'(?:[^'\\]|\\.)*'" |
# A regexp that matches a regexp literal surrounded by /slashes/. |
- slash_quoted_regexp = r"/(?:[^/\\]|\\.)+/" |
+ # Don't allow a regexp to have a ) before the first ( since that's a |
+ # syntax error and it's probably just two unrelated slashes. |
+ slash_quoted_regexp = r"/(?:(?=\()|(?:[^()/\\]|\\.)+)(?:\([^/\\]|\\.)*/" |
# Replace multiple spaces with a single space. |
line = re.sub("|".join([double_quoted_string, |
single_quoted_string, |