X Tutup
Skip to content

Commit 1017899

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 372418c commit 1017899

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sources/net.sf.j2s.lib/src/net/sf/j2s/lib/build/RegExCompress.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ private static void pack(File src, File dest, boolean completelyCompress) throws
9898
}
9999
}
100100
public static String regexCompress(String str) {
101-
String regEx = "('[^'\\n\\r]*')|" + // 1:1
102-
"(\"[^\"\\n\\r]*\")|" + // 1:2
101+
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
102+
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
103103
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3
104104
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5
105105
"(\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7
@@ -114,8 +114,8 @@ public static String regexCompress(String str) {
114114
}
115115
public static String regexCompress2(String str) {
116116
String whiteSpace = "[ \\f\\t\\v]";
117-
String regEx = "('[^'\\n\\r]*')|" + // 1:1
118-
"(\"[^\"\\n\\r]*\")|" + // 1:2
117+
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
118+
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
119119
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3 // line comments
120120
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5 // block comments
121121
"(" + whiteSpace + "+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7 // regular expression

0 commit comments

Comments
 (0)
X Tutup