Skip to content

Commit fd105a9

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 825c17d commit fd105a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static String mk(String str, String regex, String replacement) {
4545
public static String regexCompress(String str) {
4646
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
4747
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
48-
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3 // line comments
48+
"(\\/\\/[^\\n\\r]*$)|" + // 1:3 // line comments
4949
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5 // block comments
5050
"(\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7 // regular expression
5151
"([^\\w\\x24\\/'\"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*)"; // 1:8 // regular expression
@@ -61,7 +61,7 @@ public static String regexCompress2(String str) {
6161
String whiteSpace = "[ \\f\\t\\v]";
6262
String regEx = "('[^\\n\\r]*[^\\\\]')|" + // 1:1
6363
"(\"[^\\n\\r]*[^\\\\]\")|" + // 1:2
64-
"(\\/\\/[^\\n\\r]*[\\n\\r])|" + // 1:3 // line comments
64+
"(\\/\\/[^\\n\\r]*$)|" + // 1:3 // line comments
6565
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" + // 2:4,5 // block comments
6666
"(" + whiteSpace + "+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" + // 2:6,7 // regular expression
6767
"([^\\w\\x24\\/'\"*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*)"; // 1:8 // regular expression

0 commit comments

Comments
 (0)