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
@@ -1,18 +1,3 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
1
  (function (factory) {
17
2
  if (typeof module === "object" && typeof module.exports === "object") {
18
3
  var v = factory(require, exports);
@@ -29,23 +14,21 @@ var __extends = (this && this.__extends) || (function () {
29
14
  'use strict';
30
15
  Object.defineProperty(exports, "__esModule", { value: true });
31
16
  exports.SCSSParser = void 0;
32
- var scssScanner = require("./scssScanner");
33
- var cssScanner_1 = require("./cssScanner");
34
- var cssParser = require("./cssParser");
35
- var nodes = require("./cssNodes");
36
- var scssErrors_1 = require("./scssErrors");
37
- var cssErrors_1 = require("./cssErrors");
17
+ const scssScanner = require("./scssScanner");
18
+ const cssScanner_1 = require("./cssScanner");
19
+ const cssParser = require("./cssParser");
20
+ const nodes = require("./cssNodes");
21
+ const scssErrors_1 = require("./scssErrors");
22
+ const cssErrors_1 = require("./cssErrors");
38
23
  /// <summary>
39
24
  /// A parser for scss
40
25
  /// http://sass-lang.com/documentation/file.SASS_REFERENCE.html
41
26
  /// </summary>
42
- var SCSSParser = /** @class */ (function (_super) {
43
- __extends(SCSSParser, _super);
44
- function SCSSParser() {
45
- return _super.call(this, new scssScanner.SCSSScanner()) || this;
27
+ class SCSSParser extends cssParser.Parser {
28
+ constructor() {
29
+ super(new scssScanner.SCSSScanner());
46
30
  }
47
- SCSSParser.prototype._parseStylesheetStatement = function (isNested) {
48
- if (isNested === void 0) { isNested = false; }
31
+ _parseStylesheetStatement(isNested = false) {
49
32
  if (this.peek(cssScanner_1.TokenType.AtKeyword)) {
50
33
  return this._parseWarnAndDebug() // @warn, @debug and @error statements
51
34
  || this._parseControlStatement() // @if, @while, @for, @each
@@ -56,15 +39,15 @@ var __extends = (this && this.__extends) || (function () {
56
39
  || this._parseForward() // @forward
57
40
  || this._parseUse() // @use
58
41
  || this._parseRuleset(isNested) // @at-rule
59
- || _super.prototype._parseStylesheetAtStatement.call(this, isNested);
42
+ || super._parseStylesheetAtStatement(isNested);
60
43
  }
61
44
  return this._parseRuleset(true) || this._parseVariableDeclaration();
62
- };
63
- SCSSParser.prototype._parseImport = function () {
45
+ }
46
+ _parseImport() {
64
47
  if (!this.peekKeyword('@import')) {
65
48
  return null;
66
49
  }
67
- var node = this.create(nodes.Import);
50
+ const node = this.create(nodes.Import);
68
51
  this.consumeToken();
69
52
  if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) {
70
53
  return this.finish(node, cssErrors_1.ParseError.URIOrStringExpected);
@@ -78,14 +61,13 @@ var __extends = (this && this.__extends) || (function () {
78
61
  node.setMedialist(this._parseMediaQueryList());
79
62
  }
80
63
  return this.finish(node);
81
- };
64
+ }
82
65
  // scss variables: $font-size: 12px;
83
- SCSSParser.prototype._parseVariableDeclaration = function (panic) {
84
- if (panic === void 0) { panic = []; }
66
+ _parseVariableDeclaration(panic = []) {
85
67
  if (!this.peek(scssScanner.VariableName)) {
86
68
  return null;
87
69
  }
88
- var node = this.create(nodes.VariableDeclaration);
70
+ const node = this.create(nodes.VariableDeclaration);
89
71
  if (!node.setVariable(this._parseVariable())) {
90
72
  return null;
91
73
  }
@@ -114,33 +96,33 @@ var __extends = (this && this.__extends) || (function () {
114
96
  node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist
115
97
  }
116
98
  return this.finish(node);
117
- };
118
- SCSSParser.prototype._parseMediaCondition = function () {
119
- return this._parseInterpolation() || _super.prototype._parseMediaCondition.call(this);
120
- };
121
- SCSSParser.prototype._parseMediaFeatureName = function () {
99
+ }
100
+ _parseMediaCondition() {
101
+ return this._parseInterpolation() || super._parseMediaCondition();
102
+ }
103
+ _parseMediaFeatureName() {
122
104
  return this._parseModuleMember()
123
105
  || this._parseFunction() // function before ident
124
106
  || this._parseIdent()
125
107
  || this._parseVariable();
126
- };
127
- SCSSParser.prototype._parseKeyframeSelector = function () {
108
+ }
109
+ _parseKeyframeSelector() {
128
110
  return this._tryParseKeyframeSelector()
129
111
  || this._parseControlStatement(this._parseKeyframeSelector.bind(this))
130
112
  || this._parseVariableDeclaration()
131
113
  || this._parseMixinContent();
132
- };
133
- SCSSParser.prototype._parseVariable = function () {
114
+ }
115
+ _parseVariable() {
134
116
  if (!this.peek(scssScanner.VariableName)) {
135
117
  return null;
136
118
  }
137
- var node = this.create(nodes.Variable);
119
+ const node = this.create(nodes.Variable);
138
120
  this.consumeToken();
139
121
  return node;
140
- };
141
- SCSSParser.prototype._parseModuleMember = function () {
142
- var pos = this.mark();
143
- var node = this.create(nodes.Module);
122
+ }
123
+ _parseModuleMember() {
124
+ const pos = this.mark();
125
+ const node = this.create(nodes.Module);
144
126
  if (!node.setIdentifier(this._parseIdent([nodes.ReferenceType.Module]))) {
145
127
  return null;
146
128
  }
@@ -154,28 +136,27 @@ var __extends = (this && this.__extends) || (function () {
154
136
  return this.finish(node, cssErrors_1.ParseError.IdentifierOrVariableExpected);
155
137
  }
156
138
  return node;
157
- };
158
- SCSSParser.prototype._parseIdent = function (referenceTypes) {
159
- var _this = this;
139
+ }
140
+ _parseIdent(referenceTypes) {
160
141
  if (!this.peek(cssScanner_1.TokenType.Ident) && !this.peek(scssScanner.InterpolationFunction) && !this.peekDelim('-')) {
161
142
  return null;
162
143
  }
163
- var node = this.create(nodes.Identifier);
144
+ const node = this.create(nodes.Identifier);
164
145
  node.referenceTypes = referenceTypes;
165
146
  node.isCustomProperty = this.peekRegExp(cssScanner_1.TokenType.Ident, /^--/);
166
- var hasContent = false;
167
- var indentInterpolation = function () {
168
- var pos = _this.mark();
169
- if (_this.acceptDelim('-')) {
170
- if (!_this.hasWhitespace()) {
171
- _this.acceptDelim('-');
147
+ let hasContent = false;
148
+ const indentInterpolation = () => {
149
+ const pos = this.mark();
150
+ if (this.acceptDelim('-')) {
151
+ if (!this.hasWhitespace()) {
152
+ this.acceptDelim('-');
172
153
  }
173
- if (_this.hasWhitespace()) {
174
- _this.restoreAtMark(pos);
154
+ if (this.hasWhitespace()) {
155
+ this.restoreAtMark(pos);
175
156
  return null;
176
157
  }
177
158
  }
178
- return _this._parseInterpolation();
159
+ return this._parseInterpolation();
179
160
  };
180
161
  while (this.accept(cssScanner_1.TokenType.Ident) || node.addChild(indentInterpolation()) || (hasContent && this.acceptRegexp(/^[\w-]/))) {
181
162
  hasContent = true;
@@ -184,17 +165,17 @@ var __extends = (this && this.__extends) || (function () {
184
165
  }
185
166
  }
186
167
  return hasContent ? this.finish(node) : null;
187
- };
188
- SCSSParser.prototype._parseTermExpression = function () {
168
+ }
169
+ _parseTermExpression() {
189
170
  return this._parseModuleMember() ||
190
171
  this._parseVariable() ||
191
172
  this._parseSelectorCombinator() ||
192
173
  //this._tryParsePrio() ||
193
- _super.prototype._parseTermExpression.call(this);
194
- };
195
- SCSSParser.prototype._parseInterpolation = function () {
174
+ super._parseTermExpression();
175
+ }
176
+ _parseInterpolation() {
196
177
  if (this.peek(scssScanner.InterpolationFunction)) {
197
- var node = this.create(nodes.Interpolation);
178
+ const node = this.create(nodes.Interpolation);
198
179
  this.consumeToken();
199
180
  if (!node.addChild(this._parseExpr()) && !this._parseSelectorCombinator()) {
200
181
  if (this.accept(cssScanner_1.TokenType.CurlyR)) {
@@ -208,28 +189,28 @@ var __extends = (this && this.__extends) || (function () {
208
189
  return this.finish(node);
209
190
  }
210
191
  return null;
211
- };
212
- SCSSParser.prototype._parseOperator = function () {
192
+ }
193
+ _parseOperator() {
213
194
  if (this.peek(scssScanner.EqualsOperator) || this.peek(scssScanner.NotEqualsOperator)
214
195
  || this.peek(scssScanner.GreaterEqualsOperator) || this.peek(scssScanner.SmallerEqualsOperator)
215
196
  || this.peekDelim('>') || this.peekDelim('<')
216
197
  || this.peekIdent('and') || this.peekIdent('or')
217
198
  || this.peekDelim('%')) {
218
- var node = this.createNode(nodes.NodeType.Operator);
199
+ const node = this.createNode(nodes.NodeType.Operator);
219
200
  this.consumeToken();
220
201
  return this.finish(node);
221
202
  }
222
- return _super.prototype._parseOperator.call(this);
223
- };
224
- SCSSParser.prototype._parseUnaryOperator = function () {
203
+ return super._parseOperator();
204
+ }
205
+ _parseUnaryOperator() {
225
206
  if (this.peekIdent('not')) {
226
- var node = this.create(nodes.Node);
207
+ const node = this.create(nodes.Node);
227
208
  this.consumeToken();
228
209
  return this.finish(node);
229
210
  }
230
- return _super.prototype._parseUnaryOperator.call(this);
231
- };
232
- SCSSParser.prototype._parseRuleSetDeclaration = function () {
211
+ return super._parseUnaryOperator();
212
+ }
213
+ _parseRuleSetDeclaration() {
233
214
  if (this.peek(cssScanner_1.TokenType.AtKeyword)) {
234
215
  return this._parseKeyframe() // nested @keyframe
235
216
  || this._parseImport() // nested @import
@@ -244,18 +225,19 @@ var __extends = (this && this.__extends) || (function () {
244
225
  || this._parseMixinDeclaration() // nested @mixin
245
226
  || this._parseRuleset(true) // @at-rule
246
227
  || this._parseSupports(true) // @supports
247
- || _super.prototype._parseRuleSetDeclarationAtStatement.call(this);
228
+ || this._parseLayer() // @layer
229
+ || super._parseRuleSetDeclarationAtStatement();
248
230
  }
249
231
  return this._parseVariableDeclaration() // variable declaration
250
232
  || this._tryParseRuleset(true) // nested ruleset
251
- || _super.prototype._parseRuleSetDeclaration.call(this); // try css ruleset declaration as last so in the error case, the ast will contain a declaration
252
- };
253
- SCSSParser.prototype._parseDeclaration = function (stopTokens) {
254
- var custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens);
233
+ || super._parseRuleSetDeclaration(); // try css ruleset declaration as last so in the error case, the ast will contain a declaration
234
+ }
235
+ _parseDeclaration(stopTokens) {
236
+ const custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens);
255
237
  if (custonProperty) {
256
238
  return custonProperty;
257
239
  }
258
- var node = this.create(nodes.Declaration);
240
+ const node = this.create(nodes.Declaration);
259
241
  if (!node.setProperty(this._parseProperty())) {
260
242
  return null;
261
243
  }
@@ -265,7 +247,7 @@ var __extends = (this && this.__extends) || (function () {
265
247
  if (this.prevToken) {
266
248
  node.colonPosition = this.prevToken.offset;
267
249
  }
268
- var hasContent = false;
250
+ let hasContent = false;
269
251
  if (node.setValue(this._parseExpr())) {
270
252
  hasContent = true;
271
253
  node.addChild(this._parsePrio());
@@ -282,14 +264,14 @@ var __extends = (this && this.__extends) || (function () {
282
264
  node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist
283
265
  }
284
266
  return this.finish(node);
285
- };
286
- SCSSParser.prototype._parseNestedProperties = function () {
287
- var node = this.create(nodes.NestedProperties);
267
+ }
268
+ _parseNestedProperties() {
269
+ const node = this.create(nodes.NestedProperties);
288
270
  return this._parseBody(node, this._parseDeclaration.bind(this));
289
- };
290
- SCSSParser.prototype._parseExtends = function () {
271
+ }
272
+ _parseExtends() {
291
273
  if (this.peekKeyword('@extend')) {
292
- var node = this.create(nodes.ExtendsReference);
274
+ const node = this.create(nodes.ExtendsReference);
293
275
  this.consumeToken();
294
276
  if (!node.getSelectors().addChild(this._parseSimpleSelector())) {
295
277
  return this.finish(node, cssErrors_1.ParseError.SelectorExpected);
@@ -305,13 +287,13 @@ var __extends = (this && this.__extends) || (function () {
305
287
  return this.finish(node);
306
288
  }
307
289
  return null;
308
- };
309
- SCSSParser.prototype._parseSimpleSelectorBody = function () {
310
- return this._parseSelectorCombinator() || this._parseSelectorPlaceholder() || _super.prototype._parseSimpleSelectorBody.call(this);
311
- };
312
- SCSSParser.prototype._parseSelectorCombinator = function () {
290
+ }
291
+ _parseSimpleSelectorBody() {
292
+ return this._parseSelectorCombinator() || this._parseSelectorPlaceholder() || super._parseSimpleSelectorBody();
293
+ }
294
+ _parseSelectorCombinator() {
313
295
  if (this.peekDelim('&')) {
314
- var node = this.createNode(nodes.NodeType.SelectorCombinator);
296
+ const node = this.createNode(nodes.NodeType.SelectorCombinator);
315
297
  this.consumeToken();
316
298
  while (!this.hasWhitespace() && (this.acceptDelim('-') || this.accept(cssScanner_1.TokenType.Num) || this.accept(cssScanner_1.TokenType.Dimension) || node.addChild(this._parseIdent()) || this.acceptDelim('&'))) {
317
299
  // support &-foo-1
@@ -319,60 +301,73 @@ var __extends = (this && this.__extends) || (function () {
319
301
  return this.finish(node);
320
302
  }
321
303
  return null;
322
- };
323
- SCSSParser.prototype._parseSelectorPlaceholder = function () {
304
+ }
305
+ _parseSelectorPlaceholder() {
324
306
  if (this.peekDelim('%')) {
325
- var node = this.createNode(nodes.NodeType.SelectorPlaceholder);
307
+ const node = this.createNode(nodes.NodeType.SelectorPlaceholder);
326
308
  this.consumeToken();
327
309
  this._parseIdent();
328
310
  return this.finish(node);
329
311
  }
330
312
  else if (this.peekKeyword('@at-root')) {
331
- var node = this.createNode(nodes.NodeType.SelectorPlaceholder);
313
+ const node = this.createNode(nodes.NodeType.SelectorPlaceholder);
332
314
  this.consumeToken();
315
+ if (this.accept(cssScanner_1.TokenType.ParenthesisL)) {
316
+ if (!this.acceptIdent('with') && !this.acceptIdent('without')) {
317
+ return this.finish(node, cssErrors_1.ParseError.IdentifierExpected);
318
+ }
319
+ if (!this.accept(cssScanner_1.TokenType.Colon)) {
320
+ return this.finish(node, cssErrors_1.ParseError.ColonExpected);
321
+ }
322
+ if (!node.addChild(this._parseIdent())) {
323
+ return this.finish(node, cssErrors_1.ParseError.IdentifierExpected);
324
+ }
325
+ if (!this.accept(cssScanner_1.TokenType.ParenthesisR)) {
326
+ return this.finish(node, cssErrors_1.ParseError.RightParenthesisExpected, [cssScanner_1.TokenType.CurlyR]);
327
+ }
328
+ }
333
329
  return this.finish(node);
334
330
  }
335
331
  return null;
336
- };
337
- SCSSParser.prototype._parseElementName = function () {
338
- var pos = this.mark();
339
- var node = _super.prototype._parseElementName.call(this);
332
+ }
333
+ _parseElementName() {
334
+ const pos = this.mark();
335
+ const node = super._parseElementName();
340
336
  if (node && !this.hasWhitespace() && this.peek(cssScanner_1.TokenType.ParenthesisL)) { // for #49589
341
337
  this.restoreAtMark(pos);
342
338
  return null;
343
339
  }
344
340
  return node;
345
- };
346
- SCSSParser.prototype._tryParsePseudoIdentifier = function () {
347
- return this._parseInterpolation() || _super.prototype._tryParsePseudoIdentifier.call(this); // for #49589
348
- };
349
- SCSSParser.prototype._parseWarnAndDebug = function () {
341
+ }
342
+ _tryParsePseudoIdentifier() {
343
+ return this._parseInterpolation() || super._tryParsePseudoIdentifier(); // for #49589
344
+ }
345
+ _parseWarnAndDebug() {
350
346
  if (!this.peekKeyword('@debug')
351
347
  && !this.peekKeyword('@warn')
352
348
  && !this.peekKeyword('@error')) {
353
349
  return null;
354
350
  }
355
- var node = this.createNode(nodes.NodeType.Debug);
351
+ const node = this.createNode(nodes.NodeType.Debug);
356
352
  this.consumeToken(); // @debug, @warn or @error
357
353
  node.addChild(this._parseExpr()); // optional
358
354
  return this.finish(node);
359
- };
360
- SCSSParser.prototype._parseControlStatement = function (parseStatement) {
361
- if (parseStatement === void 0) { parseStatement = this._parseRuleSetDeclaration.bind(this); }
355
+ }
356
+ _parseControlStatement(parseStatement = this._parseRuleSetDeclaration.bind(this)) {
362
357
  if (!this.peek(cssScanner_1.TokenType.AtKeyword)) {
363
358
  return null;
364
359
  }
365
360
  return this._parseIfStatement(parseStatement) || this._parseForStatement(parseStatement)
366
361
  || this._parseEachStatement(parseStatement) || this._parseWhileStatement(parseStatement);
367
- };
368
- SCSSParser.prototype._parseIfStatement = function (parseStatement) {
362
+ }
363
+ _parseIfStatement(parseStatement) {
369
364
  if (!this.peekKeyword('@if')) {
370
365
  return null;
371
366
  }
372
367
  return this._internalParseIfStatement(parseStatement);
373
- };
374
- SCSSParser.prototype._internalParseIfStatement = function (parseStatement) {
375
- var node = this.create(nodes.IfStatement);
368
+ }
369
+ _internalParseIfStatement(parseStatement) {
370
+ const node = this.create(nodes.IfStatement);
376
371
  this.consumeToken(); // @if or if
377
372
  if (!node.setExpression(this._parseExpr(true))) {
378
373
  return this.finish(node, cssErrors_1.ParseError.ExpressionExpected);
@@ -383,18 +378,18 @@ var __extends = (this && this.__extends) || (function () {
383
378
  node.setElseClause(this._internalParseIfStatement(parseStatement));
384
379
  }
385
380
  else if (this.peek(cssScanner_1.TokenType.CurlyL)) {
386
- var elseNode = this.create(nodes.ElseStatement);
381
+ const elseNode = this.create(nodes.ElseStatement);
387
382
  this._parseBody(elseNode, parseStatement);
388
383
  node.setElseClause(elseNode);
389
384
  }
390
385
  }
391
386
  return this.finish(node);
392
- };
393
- SCSSParser.prototype._parseForStatement = function (parseStatement) {
387
+ }
388
+ _parseForStatement(parseStatement) {
394
389
  if (!this.peekKeyword('@for')) {
395
390
  return null;
396
391
  }
397
- var node = this.create(nodes.ForStatement);
392
+ const node = this.create(nodes.ForStatement);
398
393
  this.consumeToken(); // @for
399
394
  if (!node.setVariable(this._parseVariable())) {
400
395
  return this.finish(node, cssErrors_1.ParseError.VariableNameExpected, [cssScanner_1.TokenType.CurlyR]);
@@ -412,14 +407,14 @@ var __extends = (this && this.__extends) || (function () {
412
407
  return this.finish(node, cssErrors_1.ParseError.ExpressionExpected, [cssScanner_1.TokenType.CurlyR]);
413
408
  }
414
409
  return this._parseBody(node, parseStatement);
415
- };
416
- SCSSParser.prototype._parseEachStatement = function (parseStatement) {
410
+ }
411
+ _parseEachStatement(parseStatement) {
417
412
  if (!this.peekKeyword('@each')) {
418
413
  return null;
419
414
  }
420
- var node = this.create(nodes.EachStatement);
415
+ const node = this.create(nodes.EachStatement);
421
416
  this.consumeToken(); // @each
422
- var variables = node.getVariables();
417
+ const variables = node.getVariables();
423
418
  if (!variables.addChild(this._parseVariable())) {
424
419
  return this.finish(node, cssErrors_1.ParseError.VariableNameExpected, [cssScanner_1.TokenType.CurlyR]);
425
420
  }
@@ -436,27 +431,27 @@ var __extends = (this && this.__extends) || (function () {
436
431
  return this.finish(node, cssErrors_1.ParseError.ExpressionExpected, [cssScanner_1.TokenType.CurlyR]);
437
432
  }
438
433
  return this._parseBody(node, parseStatement);
439
- };
440
- SCSSParser.prototype._parseWhileStatement = function (parseStatement) {
434
+ }
435
+ _parseWhileStatement(parseStatement) {
441
436
  if (!this.peekKeyword('@while')) {
442
437
  return null;
443
438
  }
444
- var node = this.create(nodes.WhileStatement);
439
+ const node = this.create(nodes.WhileStatement);
445
440
  this.consumeToken(); // @while
446
441
  if (!node.addChild(this._parseBinaryExpr())) {
447
442
  return this.finish(node, cssErrors_1.ParseError.ExpressionExpected, [cssScanner_1.TokenType.CurlyR]);
448
443
  }
449
444
  return this._parseBody(node, parseStatement);
450
- };
451
- SCSSParser.prototype._parseFunctionBodyDeclaration = function () {
445
+ }
446
+ _parseFunctionBodyDeclaration() {
452
447
  return this._parseVariableDeclaration() || this._parseReturnStatement() || this._parseWarnAndDebug()
453
448
  || this._parseControlStatement(this._parseFunctionBodyDeclaration.bind(this));
454
- };
455
- SCSSParser.prototype._parseFunctionDeclaration = function () {
449
+ }
450
+ _parseFunctionDeclaration() {
456
451
  if (!this.peekKeyword('@function')) {
457
452
  return null;
458
453
  }
459
- var node = this.create(nodes.FunctionDeclaration);
454
+ const node = this.create(nodes.FunctionDeclaration);
460
455
  this.consumeToken(); // @function
461
456
  if (!node.setIdentifier(this._parseIdent([nodes.ReferenceType.Function]))) {
462
457
  return this.finish(node, cssErrors_1.ParseError.IdentifierExpected, [cssScanner_1.TokenType.CurlyR]);
@@ -478,23 +473,23 @@ var __extends = (this && this.__extends) || (function () {
478
473
  return this.finish(node, cssErrors_1.ParseError.RightParenthesisExpected, [cssScanner_1.TokenType.CurlyR]);
479
474
  }
480
475
  return this._parseBody(node, this._parseFunctionBodyDeclaration.bind(this));
481
- };
482
- SCSSParser.prototype._parseReturnStatement = function () {
476
+ }
477
+ _parseReturnStatement() {
483
478
  if (!this.peekKeyword('@return')) {
484
479
  return null;
485
480
  }
486
- var node = this.createNode(nodes.NodeType.ReturnStatement);
481
+ const node = this.createNode(nodes.NodeType.ReturnStatement);
487
482
  this.consumeToken(); // @function
488
483
  if (!node.addChild(this._parseExpr())) {
489
484
  return this.finish(node, cssErrors_1.ParseError.ExpressionExpected);
490
485
  }
491
486
  return this.finish(node);
492
- };
493
- SCSSParser.prototype._parseMixinDeclaration = function () {
487
+ }
488
+ _parseMixinDeclaration() {
494
489
  if (!this.peekKeyword('@mixin')) {
495
490
  return null;
496
491
  }
497
- var node = this.create(nodes.MixinDeclaration);
492
+ const node = this.create(nodes.MixinDeclaration);
498
493
  this.consumeToken();
499
494
  if (!node.setIdentifier(this._parseIdent([nodes.ReferenceType.Mixin]))) {
500
495
  return this.finish(node, cssErrors_1.ParseError.IdentifierExpected, [cssScanner_1.TokenType.CurlyR]);
@@ -515,9 +510,9 @@ var __extends = (this && this.__extends) || (function () {
515
510
  }
516
511
  }
517
512
  return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
518
- };
519
- SCSSParser.prototype._parseParameterDeclaration = function () {
520
- var node = this.create(nodes.FunctionParameter);
513
+ }
514
+ _parseParameterDeclaration() {
515
+ const node = this.create(nodes.FunctionParameter);
521
516
  if (!node.setIdentifier(this._parseVariable())) {
522
517
  return null;
523
518
  }
@@ -530,12 +525,12 @@ var __extends = (this && this.__extends) || (function () {
530
525
  }
531
526
  }
532
527
  return this.finish(node);
533
- };
534
- SCSSParser.prototype._parseMixinContent = function () {
528
+ }
529
+ _parseMixinContent() {
535
530
  if (!this.peekKeyword('@content')) {
536
531
  return null;
537
532
  }
538
- var node = this.create(nodes.MixinContentReference);
533
+ const node = this.create(nodes.MixinContentReference);
539
534
  this.consumeToken();
540
535
  if (this.accept(cssScanner_1.TokenType.ParenthesisL)) {
541
536
  if (node.getArguments().addChild(this._parseFunctionArgument())) {
@@ -553,25 +548,25 @@ var __extends = (this && this.__extends) || (function () {
553
548
  }
554
549
  }
555
550
  return this.finish(node);
556
- };
557
- SCSSParser.prototype._parseMixinReference = function () {
551
+ }
552
+ _parseMixinReference() {
558
553
  if (!this.peekKeyword('@include')) {
559
554
  return null;
560
555
  }
561
- var node = this.create(nodes.MixinReference);
556
+ const node = this.create(nodes.MixinReference);
562
557
  this.consumeToken();
563
558
  // Could be module or mixin identifier, set as mixin as default.
564
- var firstIdent = this._parseIdent([nodes.ReferenceType.Mixin]);
559
+ const firstIdent = this._parseIdent([nodes.ReferenceType.Mixin]);
565
560
  if (!node.setIdentifier(firstIdent)) {
566
561
  return this.finish(node, cssErrors_1.ParseError.IdentifierExpected, [cssScanner_1.TokenType.CurlyR]);
567
562
  }
568
563
  // Is a module accessor.
569
564
  if (!this.hasWhitespace() && this.acceptDelim('.') && !this.hasWhitespace()) {
570
- var secondIdent = this._parseIdent([nodes.ReferenceType.Mixin]);
565
+ const secondIdent = this._parseIdent([nodes.ReferenceType.Mixin]);
571
566
  if (!secondIdent) {
572
567
  return this.finish(node, cssErrors_1.ParseError.IdentifierExpected, [cssScanner_1.TokenType.CurlyR]);
573
568
  }
574
- var moduleToken = this.create(nodes.Module);
569
+ const moduleToken = this.create(nodes.Module);
575
570
  // Re-purpose first matched ident as identifier for module token.
576
571
  firstIdent.referenceTypes = [nodes.ReferenceType.Module];
577
572
  moduleToken.setIdentifier(firstIdent);
@@ -598,9 +593,9 @@ var __extends = (this && this.__extends) || (function () {
598
593
  node.setContent(this._parseMixinContentDeclaration());
599
594
  }
600
595
  return this.finish(node);
601
- };
602
- SCSSParser.prototype._parseMixinContentDeclaration = function () {
603
- var node = this.create(nodes.MixinContentDeclaration);
596
+ }
597
+ _parseMixinContentDeclaration() {
598
+ const node = this.create(nodes.MixinContentDeclaration);
604
599
  if (this.acceptIdent('using')) {
605
600
  if (!this.accept(cssScanner_1.TokenType.ParenthesisL)) {
606
601
  return this.finish(node, cssErrors_1.ParseError.LeftParenthesisExpected, [cssScanner_1.TokenType.CurlyL]);
@@ -623,15 +618,15 @@ var __extends = (this && this.__extends) || (function () {
623
618
  this._parseBody(node, this._parseMixinReferenceBodyStatement.bind(this));
624
619
  }
625
620
  return this.finish(node);
626
- };
627
- SCSSParser.prototype._parseMixinReferenceBodyStatement = function () {
621
+ }
622
+ _parseMixinReferenceBodyStatement() {
628
623
  return this._tryParseKeyframeSelector() || this._parseRuleSetDeclaration();
629
- };
630
- SCSSParser.prototype._parseFunctionArgument = function () {
624
+ }
625
+ _parseFunctionArgument() {
631
626
  // [variableName ':'] expression | variableName '...'
632
- var node = this.create(nodes.FunctionArgument);
633
- var pos = this.mark();
634
- var argument = this._parseVariable();
627
+ const node = this.create(nodes.FunctionArgument);
628
+ const pos = this.mark();
629
+ const argument = this._parseVariable();
635
630
  if (argument) {
636
631
  if (!this.accept(cssScanner_1.TokenType.Colon)) {
637
632
  if (this.accept(scssScanner.Ellipsis)) { // optional
@@ -655,23 +650,23 @@ var __extends = (this && this.__extends) || (function () {
655
650
  return this.finish(node);
656
651
  }
657
652
  return null;
658
- };
659
- SCSSParser.prototype._parseURLArgument = function () {
660
- var pos = this.mark();
661
- var node = _super.prototype._parseURLArgument.call(this);
653
+ }
654
+ _parseURLArgument() {
655
+ const pos = this.mark();
656
+ const node = super._parseURLArgument();
662
657
  if (!node || !this.peek(cssScanner_1.TokenType.ParenthesisR)) {
663
658
  this.restoreAtMark(pos);
664
- var node_1 = this.create(nodes.Node);
665
- node_1.addChild(this._parseBinaryExpr());
666
- return this.finish(node_1);
659
+ const node = this.create(nodes.Node);
660
+ node.addChild(this._parseBinaryExpr());
661
+ return this.finish(node);
667
662
  }
668
663
  return node;
669
- };
670
- SCSSParser.prototype._parseOperation = function () {
664
+ }
665
+ _parseOperation() {
671
666
  if (!this.peek(cssScanner_1.TokenType.ParenthesisL)) {
672
667
  return null;
673
668
  }
674
- var node = this.create(nodes.Node);
669
+ const node = this.create(nodes.Node);
675
670
  this.consumeToken();
676
671
  while (node.addChild(this._parseListElement())) {
677
672
  this.accept(cssScanner_1.TokenType.Comma); // optional
@@ -680,10 +675,10 @@ var __extends = (this && this.__extends) || (function () {
680
675
  return this.finish(node, cssErrors_1.ParseError.RightParenthesisExpected);
681
676
  }
682
677
  return this.finish(node);
683
- };
684
- SCSSParser.prototype._parseListElement = function () {
685
- var node = this.create(nodes.ListEntry);
686
- var child = this._parseBinaryExpr();
678
+ }
679
+ _parseListElement() {
680
+ const node = this.create(nodes.ListEntry);
681
+ const child = this._parseBinaryExpr();
687
682
  if (!child) {
688
683
  return null;
689
684
  }
@@ -697,12 +692,12 @@ var __extends = (this && this.__extends) || (function () {
697
692
  node.setValue(child);
698
693
  }
699
694
  return this.finish(node);
700
- };
701
- SCSSParser.prototype._parseUse = function () {
695
+ }
696
+ _parseUse() {
702
697
  if (!this.peekKeyword('@use')) {
703
698
  return null;
704
699
  }
705
- var node = this.create(nodes.Use);
700
+ const node = this.create(nodes.Use);
706
701
  this.consumeToken(); // @use
707
702
  if (!node.addChild(this._parseStringLiteral())) {
708
703
  return this.finish(node, cssErrors_1.ParseError.StringLiteralExpected);
@@ -740,9 +735,9 @@ var __extends = (this && this.__extends) || (function () {
740
735
  return this.finish(node, cssErrors_1.ParseError.SemiColonExpected);
741
736
  }
742
737
  return this.finish(node);
743
- };
744
- SCSSParser.prototype._parseModuleConfigDeclaration = function () {
745
- var node = this.create(nodes.ModuleConfiguration);
738
+ }
739
+ _parseModuleConfigDeclaration() {
740
+ const node = this.create(nodes.ModuleConfiguration);
746
741
  if (!node.setIdentifier(this._parseVariable())) {
747
742
  return null;
748
743
  }
@@ -755,16 +750,26 @@ var __extends = (this && this.__extends) || (function () {
755
750
  }
756
751
  }
757
752
  return this.finish(node);
758
- };
759
- SCSSParser.prototype._parseForward = function () {
753
+ }
754
+ _parseForward() {
760
755
  if (!this.peekKeyword('@forward')) {
761
756
  return null;
762
757
  }
763
- var node = this.create(nodes.Forward);
758
+ const node = this.create(nodes.Forward);
764
759
  this.consumeToken();
765
760
  if (!node.addChild(this._parseStringLiteral())) {
766
761
  return this.finish(node, cssErrors_1.ParseError.StringLiteralExpected);
767
762
  }
763
+ if (this.acceptIdent('as')) {
764
+ const identifier = this._parseIdent([nodes.ReferenceType.Forward]);
765
+ if (!node.setIdentifier(identifier)) {
766
+ return this.finish(node, cssErrors_1.ParseError.IdentifierExpected);
767
+ }
768
+ // Wildcard must be the next character after the identifier string.
769
+ if (this.hasWhitespace() || !this.acceptDelim('*')) {
770
+ return this.finish(node, cssErrors_1.ParseError.WildcardExpected);
771
+ }
772
+ }
768
773
  if (this.acceptIdent('with')) {
769
774
  if (!this.accept(cssScanner_1.TokenType.ParenthesisL)) {
770
775
  return this.finish(node, cssErrors_1.ParseError.LeftParenthesisExpected, [cssScanner_1.TokenType.ParenthesisR]);
@@ -785,33 +790,18 @@ var __extends = (this && this.__extends) || (function () {
785
790
  return this.finish(node, cssErrors_1.ParseError.RightParenthesisExpected);
786
791
  }
787
792
  }
788
- if (!this.peek(cssScanner_1.TokenType.SemiColon) && !this.peek(cssScanner_1.TokenType.EOF)) {
789
- if (!this.peekRegExp(cssScanner_1.TokenType.Ident, /as|hide|show/)) {
790
- return this.finish(node, cssErrors_1.ParseError.UnknownKeyword);
791
- }
792
- if (this.acceptIdent('as')) {
793
- var identifier = this._parseIdent([nodes.ReferenceType.Forward]);
794
- if (!node.setIdentifier(identifier)) {
795
- return this.finish(node, cssErrors_1.ParseError.IdentifierExpected);
796
- }
797
- // Wildcard must be the next character after the identifier string.
798
- if (this.hasWhitespace() || !this.acceptDelim('*')) {
799
- return this.finish(node, cssErrors_1.ParseError.WildcardExpected);
800
- }
801
- }
802
- if (this.peekIdent('hide') || this.peekIdent('show')) {
803
- if (!node.addChild(this._parseForwardVisibility())) {
804
- return this.finish(node, cssErrors_1.ParseError.IdentifierOrVariableExpected);
805
- }
793
+ else if (this.peekIdent('hide') || this.peekIdent('show')) {
794
+ if (!node.addChild(this._parseForwardVisibility())) {
795
+ return this.finish(node, cssErrors_1.ParseError.IdentifierOrVariableExpected);
806
796
  }
807
797
  }
808
798
  if (!this.accept(cssScanner_1.TokenType.SemiColon) && !this.accept(cssScanner_1.TokenType.EOF)) {
809
799
  return this.finish(node, cssErrors_1.ParseError.SemiColonExpected);
810
800
  }
811
801
  return this.finish(node);
812
- };
813
- SCSSParser.prototype._parseForwardVisibility = function () {
814
- var node = this.create(nodes.ForwardVisibility);
802
+ }
803
+ _parseForwardVisibility() {
804
+ const node = this.create(nodes.ForwardVisibility);
815
805
  // Assume to be "hide" or "show".
816
806
  node.setIdentifier(this._parseIdent());
817
807
  while (node.addChild(this._parseVariable() || this._parseIdent())) {
@@ -820,11 +810,10 @@ var __extends = (this && this.__extends) || (function () {
820
810
  }
821
811
  // More than just identifier
822
812
  return node.getChildren().length > 1 ? node : null;
823
- };
824
- SCSSParser.prototype._parseSupportsCondition = function () {
825
- return this._parseInterpolation() || _super.prototype._parseSupportsCondition.call(this);
826
- };
827
- return SCSSParser;
828
- }(cssParser.Parser));
813
+ }
814
+ _parseSupportsCondition() {
815
+ return this._parseInterpolation() || super._parseSupportsCondition();
816
+ }
817
+ }
829
818
  exports.SCSSParser = SCSSParser;
830
819
  });