Skip to content

Commit 5a50fc4

Browse files
committed
rewrite imap-parser, fix common issues
1 parent 3dfe218 commit 5a50fc4

3 files changed

Lines changed: 478 additions & 298 deletions

File tree

imap-core/lib/handler/imap-formal-syntax.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,119 +24,119 @@ function excludeChars(source, exclude) {
2424
}
2525

2626
module.exports = {
27-
CHAR: function() {
27+
CHAR() {
2828
let value = expandRange(0x01, 0x7f);
29-
this.CHAR = function() {
29+
this.CHAR = function () {
3030
return value;
3131
};
3232
return value;
3333
},
3434

35-
CHAR8: function() {
35+
CHAR8() {
3636
let value = expandRange(0x01, 0xff);
37-
this.CHAR8 = function() {
37+
this.CHAR8 = function () {
3838
return value;
3939
};
4040
return value;
4141
},
4242

43-
SP: function() {
43+
SP() {
4444
return ' ';
4545
},
4646

47-
CTL: function() {
47+
CTL() {
4848
let value = expandRange(0x00, 0x1f) + '\x7F';
49-
this.CTL = function() {
49+
this.CTL = function () {
5050
return value;
5151
};
5252
return value;
5353
},
5454

55-
DQUOTE: function() {
55+
DQUOTE() {
5656
return '"';
5757
},
5858

59-
ALPHA: function() {
59+
ALPHA() {
6060
let value = expandRange(0x41, 0x5a) + expandRange(0x61, 0x7a);
61-
this.ALPHA = function() {
61+
this.ALPHA = function () {
6262
return value;
6363
};
6464
return value;
6565
},
6666

67-
DIGIT: function() {
68-
let value = expandRange(0x30, 0x39) + expandRange(0x61, 0x7a);
69-
this.DIGIT = function() {
67+
DIGIT() {
68+
let value = expandRange(0x30, 0x39);
69+
this.DIGIT = function () {
7070
return value;
7171
};
7272
return value;
7373
},
7474

75-
'ATOM-CHAR': function() {
75+
'ATOM-CHAR'() {
7676
let value = excludeChars(this.CHAR(), this['atom-specials']());
77-
this['ATOM-CHAR'] = function() {
77+
this['ATOM-CHAR'] = function () {
7878
return value;
7979
};
8080
return value;
8181
},
8282

83-
'ASTRING-CHAR': function() {
83+
'ASTRING-CHAR'() {
8484
let value = this['ATOM-CHAR']() + this['resp-specials']();
85-
this['ASTRING-CHAR'] = function() {
85+
this['ASTRING-CHAR'] = function () {
8686
return value;
8787
};
8888
return value;
8989
},
9090

91-
'TEXT-CHAR': function() {
91+
'TEXT-CHAR'() {
9292
let value = excludeChars(this.CHAR(), '\r\n');
93-
this['TEXT-CHAR'] = function() {
93+
this['TEXT-CHAR'] = function () {
9494
return value;
9595
};
9696
return value;
9797
},
9898

99-
'atom-specials': function() {
99+
'atom-specials'() {
100100
let value = '(' + ')' + '{' + this.SP() + this.CTL() + this['list-wildcards']() + this['quoted-specials']() + this['resp-specials']();
101-
this['atom-specials'] = function() {
101+
this['atom-specials'] = function () {
102102
return value;
103103
};
104104
return value;
105105
},
106106

107-
'list-wildcards': function() {
107+
'list-wildcards'() {
108108
return '%' + '*';
109109
},
110110

111-
'quoted-specials': function() {
111+
'quoted-specials'() {
112112
let value = this.DQUOTE() + '\\';
113-
this['quoted-specials'] = function() {
113+
this['quoted-specials'] = function () {
114114
return value;
115115
};
116116
return value;
117117
},
118118

119-
'resp-specials': function() {
119+
'resp-specials'() {
120120
return ']';
121121
},
122122

123-
tag: function() {
123+
tag() {
124124
let value = excludeChars(this['ASTRING-CHAR'](), '+');
125-
this.tag = function() {
125+
this.tag = function () {
126126
return value;
127127
};
128128
return value;
129129
},
130130

131-
command: function() {
131+
command() {
132132
let value = this.ALPHA() + this.DIGIT() + '-';
133-
this.command = function() {
133+
this.command = function () {
134134
return value;
135135
};
136136
return value;
137137
},
138138

139-
verify: function(str, allowedChars) {
139+
verify(str, allowedChars) {
140140
for (let i = 0, len = str.length; i < len; i++) {
141141
if (allowedChars.indexOf(str.charAt(i)) < 0) {
142142
return i;

0 commit comments

Comments
 (0)