X Tutup
Skip to content

Commit 99d6bb8

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 1017899 commit 99d6bb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static void pack(File src, File dest, boolean completelyCompress) throws
100100
public static String regexCompress(String str) {
101101
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
102102
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
103-
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3
103+
"(\\/\\/[^\\n\\r]*$)|" + // 1:3
104104
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5
105105
"(\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7
106106
"([^\\w\\x24\\/'\"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*)"; // 1:8
@@ -116,7 +116,7 @@ public static String regexCompress2(String str) {
116116
String whiteSpace = "[ \\f\\t\\v]";
117117
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
118118
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
119-
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3 // line comments
119+
"(\\/\\/[^\\n\\r]*$)|" + // 1:3 // line comments
120120
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5 // block comments
121121
"(" + whiteSpace + "+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7 // regular expression
122122
"([^\\w\\x24\\/'\"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*)"; // 1:8 // regular expression

0 commit comments

Comments
 (0)
X Tutup