Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf439dcc

Browse files
author
zhourenjian
committed
Fixed bug that expression:
String s = isOK ? "" : " error";will get compiled into var s=isOK?"" : "error";in which, the space before "error" gets trimmed.
1 parentbc24fdd commitf439dcc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public static String regexCompress(String str) {
6464
cssCodes =str.substring(idx1,idx2);
6565
str =str.substring(0,idx1) +specialFunKey +str.substring(idx2);
6666
}
67-
StringregEx ="('[^\\n\\r]*[^\\\\]')|" +// 1:1
68-
"(\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 1:3
67+
StringregEx ="(''|'[^\\n\\r]*[^\\\\]')|" +// 1:1
68+
"(\"\"|\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 1:3
6969
"(\\/\\/[^\\n\\r]*[\\n\\r])|" +// 1:4
7070
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" +// 2:5,6
7171
"(\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" +// 2:7,8
@@ -102,15 +102,15 @@ public static String regexCompress2(String str) {
102102
}else {
103103
break;
104104
}
105-
}
105+
}
106106
StringspecialFunKey ="@324@();\r\n";
107107
if (ignoreCSS) {
108108
cssCodes =str.substring(idx1,idx2);
109109
str =str.substring(0,idx1) +specialFunKey +str.substring(idx2);
110110
}
111111
StringwhiteSpace ="[\\f\\t\\v]";
112-
StringregEx ="('[^\\n\\r]*[^\\\\]')|" +// 1:1
113-
"(\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 2:2,3
112+
StringregEx ="(''|'[^\\n\\r]*[^\\\\]')|" +// 1:1
113+
"(\"\"|\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 2:2,3
114114
"(\\/\\/[^\\n\\r]*[\\n\\r])|" +// 1:4 // line comments
115115
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" +// 2:5,6 // block comments
116116
"(" +whiteSpace +"+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" +// 2:7,8 // regular expression

‎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
@@ -119,8 +119,8 @@ public static String regexCompress(String str) {
119119
cssCodes =str.substring(idx1,idx2);
120120
str =str.substring(0,idx1) +specialFunKey +str.substring(idx2);
121121
}
122-
StringregEx ="('[^\\n\\r]*[^\\\\]')|" +// 1:1
123-
"(\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 1:3
122+
StringregEx ="(''|'[^\\n\\r]*[^\\\\]')|" +// 1:1
123+
"(\"\"|\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 1:3
124124
"(\\/\\/[^\\n\\r]*[\\n\\r])|" +// 1:4
125125
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" +// 2:5,6
126126
"(\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" +// 2:7,8
@@ -164,8 +164,8 @@ public static String regexCompress2(String str) {
164164
str =str.substring(0,idx1) +specialFunKey +str.substring(idx2);
165165
}
166166
StringwhiteSpace ="[\\f\\t\\v]";
167-
StringregEx ="('[^\\n\\r]*[^\\\\]')|" +// 1:1
168-
"(\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 2:2,3
167+
StringregEx ="(''|'[^\\n\\r]*[^\\\\]')|" +// 1:1
168+
"(\"\"|\"([^\\n\\r\\\"]|\\\\\\\")*[^\\\\]\")|" +// 2:2,3
169169
"(\\/\\/[^\\n\\r]*[\\n\\r])|" +// 1:4 // line comments
170170
"(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)|" +// 2:5,6 // block comments
171171
"(" +whiteSpace +"+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/[gim]*))|" +// 2:7,8 // regular expression

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp