@@ -69,49 +69,22 @@ const forbiddenNumericSeparatorSiblings = {
69
69
] ) ,
70
70
} ;
71
71
72
- const allowedNumericSeparatorSiblings = { } ;
73
- allowedNumericSeparatorSiblings . bin = new Set ( [
72
+ const isAllowedNumericSeparatorSibling = {
74
73
// 0 - 1
75
- charCodes . digit0 ,
76
- charCodes . digit1 ,
77
- ] ) ;
78
- allowedNumericSeparatorSiblings . oct = new Set ( [
74
+ bin : ch => ch === charCodes . digit0 || ch === charCodes . digit1 ,
75
+
79
76
// 0 - 7
80
- ...allowedNumericSeparatorSiblings . bin ,
81
-
82
- charCodes . digit2 ,
83
- charCodes . digit3 ,
84
- charCodes . digit4 ,
85
- charCodes . digit5 ,
86
- charCodes . digit6 ,
87
- charCodes . digit7 ,
88
- ] ) ;
89
- allowedNumericSeparatorSiblings . dec = new Set ( [
90
- // 0 - 9
91
- ...allowedNumericSeparatorSiblings . oct ,
77
+ oct : ch => ch >= charCodes . digit0 && ch <= charCodes . digit7 ,
92
78
93
- charCodes . digit8 ,
94
- charCodes . digit9 ,
95
- ] ) ;
79
+ // 0 - 9
80
+ dec : ch => ch >= charCodes . digit0 && ch <= charCodes . digit9 ,
96
81
97
- allowedNumericSeparatorSiblings . hex = new Set ( [
98
82
// 0 - 9, A - F, a - f,
99
- ...allowedNumericSeparatorSiblings . dec ,
100
-
101
- charCodes . uppercaseA ,
102
- charCodes . uppercaseB ,
103
- charCodes . uppercaseC ,
104
- charCodes . uppercaseD ,
105
- charCodes . uppercaseE ,
106
- charCodes . uppercaseF ,
107
-
108
- charCodes . lowercaseA ,
109
- charCodes . lowercaseB ,
110
- charCodes . lowercaseC ,
111
- charCodes . lowercaseD ,
112
- charCodes . lowercaseE ,
113
- charCodes . lowercaseF ,
114
- ] ) ;
83
+ hex : ch =>
84
+ ( ch >= charCodes . digit0 && ch <= charCodes . digit9 ) ||
85
+ ( ch >= charCodes . uppercaseA && ch <= charCodes . uppercaseF ) ||
86
+ ( ch >= charCodes . lowercaseA && ch <= charCodes . lowercaseF ) ,
87
+ } ;
115
88
116
89
// Object type used to represent tokens. Note that normally, tokens
117
90
// simply exist as properties on the parser object. This is only
@@ -1180,14 +1153,14 @@ export default class Tokenizer extends CommentsParser {
1180
1153
radix === 16
1181
1154
? forbiddenNumericSeparatorSiblings . hex
1182
1155
: forbiddenNumericSeparatorSiblings . decBinOct ;
1183
- const allowedSiblings =
1156
+ const isAllowedSibling =
1184
1157
radix === 16
1185
- ? allowedNumericSeparatorSiblings . hex
1158
+ ? isAllowedNumericSeparatorSibling . hex
1186
1159
: radix === 10
1187
- ? allowedNumericSeparatorSiblings . dec
1160
+ ? isAllowedNumericSeparatorSibling . dec
1188
1161
: radix === 8
1189
- ? allowedNumericSeparatorSiblings . oct
1190
- : allowedNumericSeparatorSiblings . bin ;
1162
+ ? isAllowedNumericSeparatorSibling . oct
1163
+ : isAllowedNumericSeparatorSibling . bin ;
1191
1164
1192
1165
let invalid = false ;
1193
1166
let total = 0 ;
@@ -1206,7 +1179,7 @@ export default class Tokenizer extends CommentsParser {
1206
1179
} ) ;
1207
1180
} else if (
1208
1181
Number . isNaN ( next ) ||
1209
- ! allowedSiblings . has ( next ) ||
1182
+ ! isAllowedSibling ( next ) ||
1210
1183
forbiddenSiblings . has ( prev ) ||
1211
1184
forbiddenSiblings . has ( next )
1212
1185
) {
0 commit comments