vscode-css-languageservice 5.4.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/SECURITY.md +41 -0
  3. package/lib/esm/beautify/beautify-css.js +11 -4
  4. package/lib/esm/cssLanguageService.d.ts +2 -1
  5. package/lib/esm/cssLanguageService.js +15 -17
  6. package/lib/esm/cssLanguageTypes.js +2 -2
  7. package/lib/esm/data/webCustomData.js +356 -232
  8. package/lib/esm/languageFacts/builtinData.js +15 -15
  9. package/lib/esm/languageFacts/colors.js +66 -69
  10. package/lib/esm/languageFacts/dataManager.js +38 -42
  11. package/lib/esm/languageFacts/dataProvider.js +17 -23
  12. package/lib/esm/languageFacts/entry.js +22 -23
  13. package/lib/esm/parser/cssErrors.js +5 -7
  14. package/lib/esm/parser/cssNodes.js +869 -1377
  15. package/lib/esm/parser/cssParser.js +419 -376
  16. package/lib/esm/parser/cssScanner.js +168 -175
  17. package/lib/esm/parser/cssSymbolScope.js +107 -137
  18. package/lib/esm/parser/lessParser.js +177 -202
  19. package/lib/esm/parser/lessScanner.js +22 -43
  20. package/lib/esm/parser/scssErrors.js +5 -7
  21. package/lib/esm/parser/scssParser.js +196 -208
  22. package/lib/esm/parser/scssScanner.js +33 -54
  23. package/lib/esm/services/cssCodeActions.js +36 -40
  24. package/lib/esm/services/cssCompletion.js +300 -395
  25. package/lib/esm/services/cssFolding.js +32 -35
  26. package/lib/esm/services/cssFormatter.js +22 -22
  27. package/lib/esm/services/cssHover.js +30 -33
  28. package/lib/esm/services/cssNavigation.js +260 -289
  29. package/lib/esm/services/cssSelectionRange.js +6 -6
  30. package/lib/esm/services/cssValidation.js +13 -16
  31. package/lib/esm/services/lessCompletion.js +351 -370
  32. package/lib/esm/services/lint.js +161 -175
  33. package/lib/esm/services/lintRules.js +20 -27
  34. package/lib/esm/services/lintUtil.js +19 -28
  35. package/lib/esm/services/pathCompletion.js +84 -158
  36. package/lib/esm/services/scssCompletion.js +283 -307
  37. package/lib/esm/services/scssNavigation.js +65 -137
  38. package/lib/esm/services/selectorPrinting.js +131 -175
  39. package/lib/esm/utils/arrays.js +6 -12
  40. package/lib/esm/utils/objects.js +1 -1
  41. package/lib/esm/utils/resources.js +3 -16
  42. package/lib/esm/utils/strings.js +10 -12
  43. package/lib/umd/beautify/beautify-css.js +11 -4
  44. package/lib/umd/cssLanguageService.d.ts +2 -1
  45. package/lib/umd/cssLanguageService.js +34 -32
  46. package/lib/umd/cssLanguageTypes.js +4 -3
  47. package/lib/umd/data/webCustomData.js +355 -231
  48. package/lib/umd/languageFacts/colors.js +65 -68
  49. package/lib/umd/languageFacts/dataManager.js +41 -44
  50. package/lib/umd/languageFacts/dataProvider.js +17 -22
  51. package/lib/umd/languageFacts/entry.js +22 -23
  52. package/lib/umd/languageFacts/facts.js +5 -1
  53. package/lib/umd/parser/cssErrors.js +5 -6
  54. package/lib/umd/parser/cssNodes.js +870 -1307
  55. package/lib/umd/parser/cssParser.js +424 -380
  56. package/lib/umd/parser/cssScanner.js +168 -173
  57. package/lib/umd/parser/cssSymbolScope.js +109 -134
  58. package/lib/umd/parser/lessParser.js +182 -206
  59. package/lib/umd/parser/lessScanner.js +22 -42
  60. package/lib/umd/parser/scssErrors.js +5 -6
  61. package/lib/umd/parser/scssParser.js +202 -213
  62. package/lib/umd/parser/scssScanner.js +25 -45
  63. package/lib/umd/services/cssCodeActions.js +41 -44
  64. package/lib/umd/services/cssCompletion.js +308 -402
  65. package/lib/umd/services/cssFolding.js +35 -38
  66. package/lib/umd/services/cssFormatter.js +25 -25
  67. package/lib/umd/services/cssHover.js +36 -38
  68. package/lib/umd/services/cssNavigation.js +267 -295
  69. package/lib/umd/services/cssSelectionRange.js +8 -8
  70. package/lib/umd/services/cssValidation.js +17 -19
  71. package/lib/umd/services/lessCompletion.js +354 -372
  72. package/lib/umd/services/lint.js +167 -180
  73. package/lib/umd/services/lintRules.js +20 -24
  74. package/lib/umd/services/lintUtil.js +20 -28
  75. package/lib/umd/services/pathCompletion.js +87 -160
  76. package/lib/umd/services/scssCompletion.js +287 -310
  77. package/lib/umd/services/scssNavigation.js +69 -140
  78. package/lib/umd/services/selectorPrinting.js +134 -174
  79. package/lib/umd/utils/arrays.js +6 -12
  80. package/lib/umd/utils/objects.js +1 -1
  81. package/lib/umd/utils/resources.js +4 -17
  82. package/lib/umd/utils/strings.js +10 -12
  83. package/package.json +16 -15
@@ -49,54 +49,51 @@ export var TokenType;
49
49
  TokenType[TokenType["EOF"] = 41] = "EOF";
50
50
  TokenType[TokenType["CustomToken"] = 42] = "CustomToken";
51
51
  })(TokenType || (TokenType = {}));
52
- var MultiLineStream = /** @class */ (function () {
53
- function MultiLineStream(source) {
52
+ export class MultiLineStream {
53
+ constructor(source) {
54
54
  this.source = source;
55
55
  this.len = source.length;
56
56
  this.position = 0;
57
57
  }
58
- MultiLineStream.prototype.substring = function (from, to) {
59
- if (to === void 0) { to = this.position; }
58
+ substring(from, to = this.position) {
60
59
  return this.source.substring(from, to);
61
- };
62
- MultiLineStream.prototype.eos = function () {
60
+ }
61
+ eos() {
63
62
  return this.len <= this.position;
64
- };
65
- MultiLineStream.prototype.pos = function () {
63
+ }
64
+ pos() {
66
65
  return this.position;
67
- };
68
- MultiLineStream.prototype.goBackTo = function (pos) {
66
+ }
67
+ goBackTo(pos) {
69
68
  this.position = pos;
70
- };
71
- MultiLineStream.prototype.goBack = function (n) {
69
+ }
70
+ goBack(n) {
72
71
  this.position -= n;
73
- };
74
- MultiLineStream.prototype.advance = function (n) {
72
+ }
73
+ advance(n) {
75
74
  this.position += n;
76
- };
77
- MultiLineStream.prototype.nextChar = function () {
75
+ }
76
+ nextChar() {
78
77
  return this.source.charCodeAt(this.position++) || 0;
79
- };
80
- MultiLineStream.prototype.peekChar = function (n) {
81
- if (n === void 0) { n = 0; }
78
+ }
79
+ peekChar(n = 0) {
82
80
  return this.source.charCodeAt(this.position + n) || 0;
83
- };
84
- MultiLineStream.prototype.lookbackChar = function (n) {
85
- if (n === void 0) { n = 0; }
81
+ }
82
+ lookbackChar(n = 0) {
86
83
  return this.source.charCodeAt(this.position - n) || 0;
87
- };
88
- MultiLineStream.prototype.advanceIfChar = function (ch) {
84
+ }
85
+ advanceIfChar(ch) {
89
86
  if (ch === this.source.charCodeAt(this.position)) {
90
87
  this.position++;
91
88
  return true;
92
89
  }
93
90
  return false;
94
- };
95
- MultiLineStream.prototype.advanceIfChars = function (ch) {
91
+ }
92
+ advanceIfChars(ch) {
96
93
  if (this.position + ch.length > this.source.length) {
97
94
  return false;
98
95
  }
99
- var i = 0;
96
+ let i = 0;
100
97
  for (; i < ch.length; i++) {
101
98
  if (this.source.charCodeAt(this.position + i) !== ch[i]) {
102
99
  return false;
@@ -104,62 +101,60 @@ var MultiLineStream = /** @class */ (function () {
104
101
  }
105
102
  this.advance(i);
106
103
  return true;
107
- };
108
- MultiLineStream.prototype.advanceWhileChar = function (condition) {
109
- var posNow = this.position;
104
+ }
105
+ advanceWhileChar(condition) {
106
+ const posNow = this.position;
110
107
  while (this.position < this.len && condition(this.source.charCodeAt(this.position))) {
111
108
  this.position++;
112
109
  }
113
110
  return this.position - posNow;
114
- };
115
- return MultiLineStream;
116
- }());
117
- export { MultiLineStream };
118
- var _a = 'a'.charCodeAt(0);
119
- var _f = 'f'.charCodeAt(0);
120
- var _z = 'z'.charCodeAt(0);
121
- var _u = 'u'.charCodeAt(0);
122
- var _A = 'A'.charCodeAt(0);
123
- var _F = 'F'.charCodeAt(0);
124
- var _Z = 'Z'.charCodeAt(0);
125
- var _0 = '0'.charCodeAt(0);
126
- var _9 = '9'.charCodeAt(0);
127
- var _TLD = '~'.charCodeAt(0);
128
- var _HAT = '^'.charCodeAt(0);
129
- var _EQS = '='.charCodeAt(0);
130
- var _PIP = '|'.charCodeAt(0);
131
- var _MIN = '-'.charCodeAt(0);
132
- var _USC = '_'.charCodeAt(0);
133
- var _PRC = '%'.charCodeAt(0);
134
- var _MUL = '*'.charCodeAt(0);
135
- var _LPA = '('.charCodeAt(0);
136
- var _RPA = ')'.charCodeAt(0);
137
- var _LAN = '<'.charCodeAt(0);
138
- var _RAN = '>'.charCodeAt(0);
139
- var _ATS = '@'.charCodeAt(0);
140
- var _HSH = '#'.charCodeAt(0);
141
- var _DLR = '$'.charCodeAt(0);
142
- var _BSL = '\\'.charCodeAt(0);
143
- var _FSL = '/'.charCodeAt(0);
144
- var _NWL = '\n'.charCodeAt(0);
145
- var _CAR = '\r'.charCodeAt(0);
146
- var _LFD = '\f'.charCodeAt(0);
147
- var _DQO = '"'.charCodeAt(0);
148
- var _SQO = '\''.charCodeAt(0);
149
- var _WSP = ' '.charCodeAt(0);
150
- var _TAB = '\t'.charCodeAt(0);
151
- var _SEM = ';'.charCodeAt(0);
152
- var _COL = ':'.charCodeAt(0);
153
- var _CUL = '{'.charCodeAt(0);
154
- var _CUR = '}'.charCodeAt(0);
155
- var _BRL = '['.charCodeAt(0);
156
- var _BRR = ']'.charCodeAt(0);
157
- var _CMA = ','.charCodeAt(0);
158
- var _DOT = '.'.charCodeAt(0);
159
- var _BNG = '!'.charCodeAt(0);
160
- var _QSM = '?'.charCodeAt(0);
161
- var _PLS = '+'.charCodeAt(0);
162
- var staticTokenTable = {};
111
+ }
112
+ }
113
+ const _a = 'a'.charCodeAt(0);
114
+ const _f = 'f'.charCodeAt(0);
115
+ const _z = 'z'.charCodeAt(0);
116
+ const _u = 'u'.charCodeAt(0);
117
+ const _A = 'A'.charCodeAt(0);
118
+ const _F = 'F'.charCodeAt(0);
119
+ const _Z = 'Z'.charCodeAt(0);
120
+ const _0 = '0'.charCodeAt(0);
121
+ const _9 = '9'.charCodeAt(0);
122
+ const _TLD = '~'.charCodeAt(0);
123
+ const _HAT = '^'.charCodeAt(0);
124
+ const _EQS = '='.charCodeAt(0);
125
+ const _PIP = '|'.charCodeAt(0);
126
+ const _MIN = '-'.charCodeAt(0);
127
+ const _USC = '_'.charCodeAt(0);
128
+ const _PRC = '%'.charCodeAt(0);
129
+ const _MUL = '*'.charCodeAt(0);
130
+ const _LPA = '('.charCodeAt(0);
131
+ const _RPA = ')'.charCodeAt(0);
132
+ const _LAN = '<'.charCodeAt(0);
133
+ const _RAN = '>'.charCodeAt(0);
134
+ const _ATS = '@'.charCodeAt(0);
135
+ const _HSH = '#'.charCodeAt(0);
136
+ const _DLR = '$'.charCodeAt(0);
137
+ const _BSL = '\\'.charCodeAt(0);
138
+ const _FSL = '/'.charCodeAt(0);
139
+ const _NWL = '\n'.charCodeAt(0);
140
+ const _CAR = '\r'.charCodeAt(0);
141
+ const _LFD = '\f'.charCodeAt(0);
142
+ const _DQO = '"'.charCodeAt(0);
143
+ const _SQO = '\''.charCodeAt(0);
144
+ const _WSP = ' '.charCodeAt(0);
145
+ const _TAB = '\t'.charCodeAt(0);
146
+ const _SEM = ';'.charCodeAt(0);
147
+ const _COL = ':'.charCodeAt(0);
148
+ const _CUL = '{'.charCodeAt(0);
149
+ const _CUR = '}'.charCodeAt(0);
150
+ const _BRL = '['.charCodeAt(0);
151
+ const _BRR = ']'.charCodeAt(0);
152
+ const _CMA = ','.charCodeAt(0);
153
+ const _DOT = '.'.charCodeAt(0);
154
+ const _BNG = '!'.charCodeAt(0);
155
+ const _QSM = '?'.charCodeAt(0);
156
+ const _PLS = '+'.charCodeAt(0);
157
+ const staticTokenTable = {};
163
158
  staticTokenTable[_SEM] = TokenType.SemiColon;
164
159
  staticTokenTable[_COL] = TokenType.Colon;
165
160
  staticTokenTable[_CUL] = TokenType.CurlyL;
@@ -169,7 +164,7 @@ staticTokenTable[_BRL] = TokenType.BracketL;
169
164
  staticTokenTable[_LPA] = TokenType.ParenthesisL;
170
165
  staticTokenTable[_RPA] = TokenType.ParenthesisR;
171
166
  staticTokenTable[_CMA] = TokenType.Comma;
172
- var staticUnitTable = {};
167
+ const staticUnitTable = {};
173
168
  staticUnitTable['em'] = TokenType.EMS;
174
169
  staticUnitTable['ex'] = TokenType.EXS;
175
170
  staticUnitTable['px'] = TokenType.Length;
@@ -189,68 +184,68 @@ staticUnitTable['%'] = TokenType.Percentage;
189
184
  staticUnitTable['fr'] = TokenType.Percentage;
190
185
  staticUnitTable['dpi'] = TokenType.Resolution;
191
186
  staticUnitTable['dpcm'] = TokenType.Resolution;
192
- var Scanner = /** @class */ (function () {
193
- function Scanner() {
187
+ export class Scanner {
188
+ constructor() {
194
189
  this.stream = new MultiLineStream('');
195
190
  this.ignoreComment = true;
196
191
  this.ignoreWhitespace = true;
197
192
  this.inURL = false;
198
193
  }
199
- Scanner.prototype.setSource = function (input) {
194
+ setSource(input) {
200
195
  this.stream = new MultiLineStream(input);
201
- };
202
- Scanner.prototype.finishToken = function (offset, type, text) {
196
+ }
197
+ finishToken(offset, type, text) {
203
198
  return {
204
199
  offset: offset,
205
200
  len: this.stream.pos() - offset,
206
201
  type: type,
207
202
  text: text || this.stream.substring(offset)
208
203
  };
209
- };
210
- Scanner.prototype.substring = function (offset, len) {
204
+ }
205
+ substring(offset, len) {
211
206
  return this.stream.substring(offset, offset + len);
212
- };
213
- Scanner.prototype.pos = function () {
207
+ }
208
+ pos() {
214
209
  return this.stream.pos();
215
- };
216
- Scanner.prototype.goBackTo = function (pos) {
210
+ }
211
+ goBackTo(pos) {
217
212
  this.stream.goBackTo(pos);
218
- };
219
- Scanner.prototype.scanUnquotedString = function () {
220
- var offset = this.stream.pos();
221
- var content = [];
213
+ }
214
+ scanUnquotedString() {
215
+ const offset = this.stream.pos();
216
+ const content = [];
222
217
  if (this._unquotedString(content)) {
223
218
  return this.finishToken(offset, TokenType.UnquotedString, content.join(''));
224
219
  }
225
220
  return null;
226
- };
227
- Scanner.prototype.scan = function () {
221
+ }
222
+ scan() {
228
223
  // processes all whitespaces and comments
229
- var triviaToken = this.trivia();
224
+ const triviaToken = this.trivia();
230
225
  if (triviaToken !== null) {
231
226
  return triviaToken;
232
227
  }
233
- var offset = this.stream.pos();
228
+ const offset = this.stream.pos();
234
229
  // End of file/input
235
230
  if (this.stream.eos()) {
236
231
  return this.finishToken(offset, TokenType.EOF);
237
232
  }
238
233
  return this.scanNext(offset);
239
- };
234
+ }
240
235
  /**
241
236
  * Read the range as described in https://www.w3.org/TR/CSS21/syndata.html#tokenization
242
237
  * Assume the `u` has aleady been consumed
243
238
  * @returns if reading the unicode was successful
244
239
  */
245
- Scanner.prototype.tryScanUnicode = function () {
246
- var offset = this.stream.pos();
240
+ tryScanUnicode() {
241
+ const offset = this.stream.pos();
247
242
  if (!this.stream.eos() && this._unicodeRange()) {
248
243
  return this.finishToken(offset, TokenType.UnicodeRange);
249
244
  }
250
245
  this.stream.goBackTo(offset);
251
246
  return undefined;
252
- };
253
- Scanner.prototype.scanNext = function (offset) {
247
+ }
248
+ scanNext(offset) {
254
249
  // CDO <!--
255
250
  if (this.stream.advanceIfChars([_LAN, _BNG, _MIN, _MIN])) {
256
251
  return this.finishToken(offset, TokenType.CDO);
@@ -259,7 +254,7 @@ var Scanner = /** @class */ (function () {
259
254
  if (this.stream.advanceIfChars([_MIN, _MIN, _RAN])) {
260
255
  return this.finishToken(offset, TokenType.CDC);
261
256
  }
262
- var content = [];
257
+ let content = [];
263
258
  if (this.ident(content)) {
264
259
  return this.finishToken(offset, TokenType.Ident, content.join(''));
265
260
  }
@@ -267,7 +262,7 @@ var Scanner = /** @class */ (function () {
267
262
  if (this.stream.advanceIfChar(_ATS)) {
268
263
  content = ['@'];
269
264
  if (this._name(content)) {
270
- var keywordText = content.join('');
265
+ const keywordText = content.join('');
271
266
  if (keywordText === '@charset') {
272
267
  return this.finishToken(offset, TokenType.Charset, keywordText);
273
268
  }
@@ -293,18 +288,18 @@ var Scanner = /** @class */ (function () {
293
288
  }
294
289
  // Numbers
295
290
  if (this._number()) {
296
- var pos = this.stream.pos();
291
+ const pos = this.stream.pos();
297
292
  content = [this.stream.substring(offset, pos)];
298
293
  if (this.stream.advanceIfChar(_PRC)) {
299
294
  // Percentage 43%
300
295
  return this.finishToken(offset, TokenType.Percentage);
301
296
  }
302
297
  else if (this.ident(content)) {
303
- var dim = this.stream.substring(pos).toLowerCase();
304
- var tokenType_1 = staticUnitTable[dim];
305
- if (typeof tokenType_1 !== 'undefined') {
298
+ const dim = this.stream.substring(pos).toLowerCase();
299
+ const tokenType = staticUnitTable[dim];
300
+ if (typeof tokenType !== 'undefined') {
306
301
  // Known dimension 43px
307
- return this.finishToken(offset, tokenType_1, content.join(''));
302
+ return this.finishToken(offset, tokenType, content.join(''));
308
303
  }
309
304
  else {
310
305
  // Unknown dimension 43ft
@@ -315,7 +310,7 @@ var Scanner = /** @class */ (function () {
315
310
  }
316
311
  // String, BadString
317
312
  content = [];
318
- var tokenType = this._string(content);
313
+ let tokenType = this._string(content);
319
314
  if (tokenType !== null) {
320
315
  return this.finishToken(offset, tokenType, content.join(''));
321
316
  }
@@ -353,10 +348,10 @@ var Scanner = /** @class */ (function () {
353
348
  // Delim
354
349
  this.stream.nextChar();
355
350
  return this.finishToken(offset, TokenType.Delim);
356
- };
357
- Scanner.prototype.trivia = function () {
351
+ }
352
+ trivia() {
358
353
  while (true) {
359
- var offset = this.stream.pos();
354
+ const offset = this.stream.pos();
360
355
  if (this._whitespace()) {
361
356
  if (!this.ignoreWhitespace) {
362
357
  return this.finishToken(offset, TokenType.Whitespace);
@@ -371,42 +366,42 @@ var Scanner = /** @class */ (function () {
371
366
  return null;
372
367
  }
373
368
  }
374
- };
375
- Scanner.prototype.comment = function () {
369
+ }
370
+ comment() {
376
371
  if (this.stream.advanceIfChars([_FSL, _MUL])) {
377
- var success_1 = false, hot_1 = false;
378
- this.stream.advanceWhileChar(function (ch) {
379
- if (hot_1 && ch === _FSL) {
380
- success_1 = true;
372
+ let success = false, hot = false;
373
+ this.stream.advanceWhileChar((ch) => {
374
+ if (hot && ch === _FSL) {
375
+ success = true;
381
376
  return false;
382
377
  }
383
- hot_1 = ch === _MUL;
378
+ hot = ch === _MUL;
384
379
  return true;
385
380
  });
386
- if (success_1) {
381
+ if (success) {
387
382
  this.stream.advance(1);
388
383
  }
389
384
  return true;
390
385
  }
391
386
  return false;
392
- };
393
- Scanner.prototype._number = function () {
394
- var npeek = 0, ch;
387
+ }
388
+ _number() {
389
+ let npeek = 0, ch;
395
390
  if (this.stream.peekChar() === _DOT) {
396
391
  npeek = 1;
397
392
  }
398
393
  ch = this.stream.peekChar(npeek);
399
394
  if (ch >= _0 && ch <= _9) {
400
395
  this.stream.advance(npeek + 1);
401
- this.stream.advanceWhileChar(function (ch) {
396
+ this.stream.advanceWhileChar((ch) => {
402
397
  return ch >= _0 && ch <= _9 || npeek === 0 && ch === _DOT;
403
398
  });
404
399
  return true;
405
400
  }
406
401
  return false;
407
- };
408
- Scanner.prototype._newline = function (result) {
409
- var ch = this.stream.peekChar();
402
+ }
403
+ _newline(result) {
404
+ const ch = this.stream.peekChar();
410
405
  switch (ch) {
411
406
  case _CAR:
412
407
  case _LFD:
@@ -419,13 +414,13 @@ var Scanner = /** @class */ (function () {
419
414
  return true;
420
415
  }
421
416
  return false;
422
- };
423
- Scanner.prototype._escape = function (result, includeNewLines) {
424
- var ch = this.stream.peekChar();
417
+ }
418
+ _escape(result, includeNewLines) {
419
+ let ch = this.stream.peekChar();
425
420
  if (ch === _BSL) {
426
421
  this.stream.advance(1);
427
422
  ch = this.stream.peekChar();
428
- var hexNumCount = 0;
423
+ let hexNumCount = 0;
429
424
  while (hexNumCount < 6 && (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F)) {
430
425
  this.stream.advance(1);
431
426
  ch = this.stream.peekChar();
@@ -433,7 +428,7 @@ var Scanner = /** @class */ (function () {
433
428
  }
434
429
  if (hexNumCount > 0) {
435
430
  try {
436
- var hexVal = parseInt(this.stream.substring(this.stream.pos() - hexNumCount), 16);
431
+ const hexVal = parseInt(this.stream.substring(this.stream.pos() - hexNumCount), 16);
437
432
  if (hexVal) {
438
433
  result.push(String.fromCharCode(hexVal));
439
434
  }
@@ -460,20 +455,20 @@ var Scanner = /** @class */ (function () {
460
455
  }
461
456
  }
462
457
  return false;
463
- };
464
- Scanner.prototype._stringChar = function (closeQuote, result) {
458
+ }
459
+ _stringChar(closeQuote, result) {
465
460
  // not closeQuote, not backslash, not newline
466
- var ch = this.stream.peekChar();
461
+ const ch = this.stream.peekChar();
467
462
  if (ch !== 0 && ch !== closeQuote && ch !== _BSL && ch !== _CAR && ch !== _LFD && ch !== _NWL) {
468
463
  this.stream.advance(1);
469
464
  result.push(String.fromCharCode(ch));
470
465
  return true;
471
466
  }
472
467
  return false;
473
- };
474
- Scanner.prototype._string = function (result) {
468
+ }
469
+ _string(result) {
475
470
  if (this.stream.peekChar() === _SQO || this.stream.peekChar() === _DQO) {
476
- var closeQuote = this.stream.nextChar();
471
+ const closeQuote = this.stream.nextChar();
477
472
  result.push(String.fromCharCode(closeQuote));
478
473
  while (this._stringChar(closeQuote, result) || this._escape(result, true)) {
479
474
  // loop
@@ -488,40 +483,40 @@ var Scanner = /** @class */ (function () {
488
483
  }
489
484
  }
490
485
  return null;
491
- };
492
- Scanner.prototype._unquotedChar = function (result) {
486
+ }
487
+ _unquotedChar(result) {
493
488
  // not closeQuote, not backslash, not newline
494
- var ch = this.stream.peekChar();
489
+ const ch = this.stream.peekChar();
495
490
  if (ch !== 0 && ch !== _BSL && ch !== _SQO && ch !== _DQO && ch !== _LPA && ch !== _RPA && ch !== _WSP && ch !== _TAB && ch !== _NWL && ch !== _LFD && ch !== _CAR) {
496
491
  this.stream.advance(1);
497
492
  result.push(String.fromCharCode(ch));
498
493
  return true;
499
494
  }
500
495
  return false;
501
- };
502
- Scanner.prototype._unquotedString = function (result) {
503
- var hasContent = false;
496
+ }
497
+ _unquotedString(result) {
498
+ let hasContent = false;
504
499
  while (this._unquotedChar(result) || this._escape(result)) {
505
500
  hasContent = true;
506
501
  }
507
502
  return hasContent;
508
- };
509
- Scanner.prototype._whitespace = function () {
510
- var n = this.stream.advanceWhileChar(function (ch) {
503
+ }
504
+ _whitespace() {
505
+ const n = this.stream.advanceWhileChar((ch) => {
511
506
  return ch === _WSP || ch === _TAB || ch === _NWL || ch === _LFD || ch === _CAR;
512
507
  });
513
508
  return n > 0;
514
- };
515
- Scanner.prototype._name = function (result) {
516
- var matched = false;
509
+ }
510
+ _name(result) {
511
+ let matched = false;
517
512
  while (this._identChar(result) || this._escape(result)) {
518
513
  matched = true;
519
514
  }
520
515
  return matched;
521
- };
522
- Scanner.prototype.ident = function (result) {
523
- var pos = this.stream.pos();
524
- var hasMinus = this._minus(result);
516
+ }
517
+ ident(result) {
518
+ const pos = this.stream.pos();
519
+ const hasMinus = this._minus(result);
525
520
  if (hasMinus) {
526
521
  if (this._minus(result) /* -- */ || this._identFirstChar(result) || this._escape(result)) {
527
522
  while (this._identChar(result) || this._escape(result)) {
@@ -538,9 +533,9 @@ var Scanner = /** @class */ (function () {
538
533
  }
539
534
  this.stream.goBackTo(pos);
540
535
  return false;
541
- };
542
- Scanner.prototype._identFirstChar = function (result) {
543
- var ch = this.stream.peekChar();
536
+ }
537
+ _identFirstChar(result) {
538
+ const ch = this.stream.peekChar();
544
539
  if (ch === _USC || // _
545
540
  ch >= _a && ch <= _z || // a-z
546
541
  ch >= _A && ch <= _Z || // A-Z
@@ -550,18 +545,18 @@ var Scanner = /** @class */ (function () {
550
545
  return true;
551
546
  }
552
547
  return false;
553
- };
554
- Scanner.prototype._minus = function (result) {
555
- var ch = this.stream.peekChar();
548
+ }
549
+ _minus(result) {
550
+ const ch = this.stream.peekChar();
556
551
  if (ch === _MIN) {
557
552
  this.stream.advance(1);
558
553
  result.push(String.fromCharCode(ch));
559
554
  return true;
560
555
  }
561
556
  return false;
562
- };
563
- Scanner.prototype._identChar = function (result) {
564
- var ch = this.stream.peekChar();
557
+ }
558
+ _identChar(result) {
559
+ const ch = this.stream.peekChar();
565
560
  if (ch === _USC || // _
566
561
  ch === _MIN || // -
567
562
  ch >= _a && ch <= _z || // a-z
@@ -573,16 +568,16 @@ var Scanner = /** @class */ (function () {
573
568
  return true;
574
569
  }
575
570
  return false;
576
- };
577
- Scanner.prototype._unicodeRange = function () {
571
+ }
572
+ _unicodeRange() {
578
573
  // follow https://www.w3.org/TR/CSS21/syndata.html#tokenization and https://www.w3.org/TR/css-syntax-3/#urange-syntax
579
574
  // assume u has already been parsed
580
575
  if (this.stream.advanceIfChar(_PLS)) {
581
- var isHexDigit = function (ch) { return (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F); };
582
- var codePoints = this.stream.advanceWhileChar(isHexDigit) + this.stream.advanceWhileChar(function (ch) { return ch === _QSM; });
576
+ const isHexDigit = (ch) => (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F);
577
+ const codePoints = this.stream.advanceWhileChar(isHexDigit) + this.stream.advanceWhileChar(ch => ch === _QSM);
583
578
  if (codePoints >= 1 && codePoints <= 6) {
584
579
  if (this.stream.advanceIfChar(_MIN)) {
585
- var digits = this.stream.advanceWhileChar(isHexDigit);
580
+ const digits = this.stream.advanceWhileChar(isHexDigit);
586
581
  if (digits >= 1 && digits <= 6) {
587
582
  return true;
588
583
  }
@@ -593,7 +588,5 @@ var Scanner = /** @class */ (function () {
593
588
  }
594
589
  }
595
590
  return false;
596
- };
597
- return Scanner;
598
- }());
599
- export { Scanner };
591
+ }
592
+ }