Skip to content

Commit 825c17d

Browse files
author
zhourenjian
committed
Fixed bug that the URL part of "str = \"http://...\";" may be treated as inline comment when compressing the generated script
1 parent 1b3f3f6 commit 825c17d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/net/sf/j2s/core/compiler/RegExCompress.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public static String mk(String str, String regex, String replacement) {
4343
return str;
4444
}
4545
public static String regexCompress(String str) {
46-
String regEx = "('[^'\\n\\r]*')|" + // 1:1
47-
"(\"[^\"\\n\\r]*\")|" + // 1:2
46+
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
47+
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
4848
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3 // line comments
4949
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5 // block comments
5050
"(\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7 // regular expression
@@ -59,8 +59,8 @@ public static String regexCompress(String str) {
5959
}
6060
public static String regexCompress2(String str) {
6161
String whiteSpace = "[ \\f\\t\\v]";
62-
String regEx = "('[^'\\n\\r]*')|" + // 1:1
63-
"(\"[^\"\\n\\r]*\")|" + // 1:2
62+
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
63+
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
6464
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3 // line comments
6565
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5 // block comments
6666
"(" + whiteSpace + "+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7 // regular expression

0 commit comments

Comments
 (0)