.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / gonzales-pe / lib / gonzales.js
1 (function webpackUniversalModuleDefinition(root, factory) {
2         if(typeof exports === 'object' && typeof module === 'object')
3                 module.exports = factory();
4         else if(typeof define === 'function' && define.amd)
5                 define([], factory);
6         else if(typeof exports === 'object')
7                 exports["gonzales"] = factory();
8         else
9                 root["gonzales"] = factory();
10 })(this, function() {
11 return /******/ (function(modules) { // webpackBootstrap
12 /******/        // The module cache
13 /******/        var installedModules = {};
14
15 /******/        // The require function
16 /******/        function __webpack_require__(moduleId) {
17
18 /******/                // Check if module is in cache
19 /******/                if(installedModules[moduleId])
20 /******/                        return installedModules[moduleId].exports;
21
22 /******/                // Create a new module (and put it into the cache)
23 /******/                var module = installedModules[moduleId] = {
24 /******/                        exports: {},
25 /******/                        id: moduleId,
26 /******/                        loaded: false
27 /******/                };
28
29 /******/                // Execute the module function
30 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
32 /******/                // Flag the module as loaded
33 /******/                module.loaded = true;
34
35 /******/                // Return the exports of the module
36 /******/                return module.exports;
37 /******/        }
38
39
40 /******/        // expose the modules object (__webpack_modules__)
41 /******/        __webpack_require__.m = modules;
42
43 /******/        // expose the module cache
44 /******/        __webpack_require__.c = installedModules;
45
46 /******/        // __webpack_public_path__
47 /******/        __webpack_require__.p = "";
48
49 /******/        // Load entry module and return exports
50 /******/        return __webpack_require__(0);
51 /******/ })
52 /************************************************************************/
53 /******/ ([
54 /* 0 */
55 /***/ (function(module, exports, __webpack_require__) {
56
57         'use strict';
58
59         var Node = __webpack_require__(1);
60         var parse = __webpack_require__(7);
61
62         module.exports = {
63           createNode: function createNode(options) {
64             return new Node(options);
65           },
66           parse: parse
67         };
68
69 /***/ }),
70 /* 1 */
71 /***/ (function(module, exports, __webpack_require__) {
72
73         'use strict';
74
75         /**
76          * @param {string} type
77          * @param {array|string} content
78          * @param {number} line
79          * @param {number} column
80          * @constructor
81          */
82
83         var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
84
85         function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
86
87         var Node = function () {
88           function Node(options) {
89             _classCallCheck(this, Node);
90
91             this.type = options.type;
92             this.content = options.content;
93             this.syntax = options.syntax;
94
95             if (options.start) this.start = options.start;
96             if (options.end) this.end = options.end;
97           }
98
99           /**
100            * @param {String} type Node type
101            * @return {Boolean} Whether there is a child node of given type
102            */
103
104
105           Node.prototype.contains = function contains(type) {
106             if (!Array.isArray(this.content)) {
107               return false;
108             }
109
110             return this.content.some(function (node) {
111               return node.type === type;
112             });
113           };
114
115           /**
116            * @param {String} type Node type
117            * @param {Function} callback Function to call for every found node
118            */
119
120
121           Node.prototype.eachFor = function eachFor(type, callback) {
122             if (!Array.isArray(this.content)) return;
123
124             if (typeof type !== 'string') {
125               callback = type;
126               type = null;
127             }
128
129             var l = this.content.length;
130             var breakLoop;
131
132             for (var i = l; i--;) {
133               if (breakLoop === null) break;
134
135               if (!type || this.content[i] && this.content[i].type === type) breakLoop = callback(this.content[i], i, this);
136             }
137
138             if (breakLoop === null) return null;
139           };
140
141           /**
142            * @param {String} type
143            * @return {?Node} First child node or `null` if nothing's been found.
144            */
145
146
147           Node.prototype.first = function first(type) {
148             if (!Array.isArray(this.content)) return null;
149
150             if (!type) return this.content[0];
151
152             var i = 0;
153             var l = this.content.length;
154
155             for (; i < l; i++) {
156               if (this.content[i].type === type) return this.content[i];
157             }
158
159             return null;
160           };
161
162           /**
163            * @param {String} type Node type
164            * @param {Function} callback Function to call for every found node
165            */
166
167
168           Node.prototype.forEach = function forEach(type, callback) {
169             if (!Array.isArray(this.content)) return;
170
171             if (typeof type !== 'string') {
172               callback = type;
173               type = null;
174             }
175
176             var i = 0;
177             var l = this.content.length;
178             var breakLoop;
179
180             for (; i < l; i++) {
181               if (breakLoop === null) break;
182
183               if (!type || this.content[i] && this.content[i].type === type) breakLoop = callback(this.content[i], i, this);
184             }
185
186             if (breakLoop === null) return null;
187           };
188
189           /**
190            * @param {Number} index
191            * @return {?Node}
192            */
193
194
195           Node.prototype.get = function get(index) {
196             if (!Array.isArray(this.content)) return null;
197
198             var node = this.content[index];
199             return node ? node : null;
200           };
201
202           /**
203            * @param {Number} index
204            * @param {Node} node
205            */
206
207
208           Node.prototype.insert = function insert(index, node) {
209             if (!Array.isArray(this.content)) return;
210
211             this.content.splice(index, 0, node);
212           };
213
214           /**
215            * @param {String} type
216            * @return {Boolean} Whether the node is of given type
217            */
218
219
220           Node.prototype.is = function is(type) {
221             return this.type === type;
222           };
223
224           /**
225            * @param {String} type
226            * @return {?Node} Last child node or `null` if nothing's been found.
227            */
228
229
230           Node.prototype.last = function last(type) {
231             if (!Array.isArray(this.content)) return null;
232
233             var i = this.content.length;
234             if (!type) return this.content[i - 1];
235
236             for (; i--;) {
237               if (this.content[i].type === type) return this.content[i];
238             }
239
240             return null;
241           };
242
243           /**
244            * Number of child nodes.
245            * @type {number}
246            */
247
248
249           /**
250            * @param {Number} index
251            * @return {Node}
252            */
253           Node.prototype.removeChild = function removeChild(index) {
254             if (!Array.isArray(this.content)) return;
255
256             var removedChild = this.content.splice(index, 1);
257
258             return removedChild;
259           };
260
261           Node.prototype.toJson = function toJson() {
262             return JSON.stringify(this, false, 2);
263           };
264
265           Node.prototype.toString = function toString() {
266             var stringify = void 0;
267
268             try {
269               stringify = __webpack_require__(2)("./" + this.syntax + '/stringify');
270             } catch (e) {
271               var message = 'Syntax "' + this.syntax + '" is not supported yet, sorry';
272               return console.error(message);
273             }
274
275             return stringify(this);
276           };
277
278           /**
279            * @param {Function} callback
280            */
281
282
283           Node.prototype.traverse = function traverse(callback, index) {
284             var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
285             var parent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
286
287             var breakLoop;
288             var x;
289
290             level++;
291
292             callback(this, index, parent, level);
293
294             if (!Array.isArray(this.content)) return;
295
296             for (var i = 0, l = this.content.length; i < l; i++) {
297               breakLoop = this.content[i].traverse(callback, i, level, this);
298               if (breakLoop === null) break;
299
300               // If some nodes were removed or added:
301               if (x = this.content.length - l) {
302                 l += x;
303                 i += x;
304               }
305             }
306
307             if (breakLoop === null) return null;
308           };
309
310           Node.prototype.traverseByType = function traverseByType(type, callback) {
311             this.traverse(function (node) {
312               if (node.type === type) callback.apply(node, arguments);
313             });
314           };
315
316           Node.prototype.traverseByTypes = function traverseByTypes(types, callback) {
317             this.traverse(function (node) {
318               if (types.indexOf(node.type) !== -1) callback.apply(node, arguments);
319             });
320           };
321
322           _createClass(Node, [{
323             key: 'length',
324             get: function get() {
325               if (!Array.isArray(this.content)) return 0;
326               return this.content.length;
327             }
328           }]);
329
330           return Node;
331         }();
332
333         module.exports = Node;
334
335 /***/ }),
336 /* 2 */
337 /***/ (function(module, exports, __webpack_require__) {
338
339         var map = {
340                 "./css/stringify": 3,
341                 "./less/stringify": 4,
342                 "./sass/stringify": 5,
343                 "./scss/stringify": 6
344         };
345         function webpackContext(req) {
346                 return __webpack_require__(webpackContextResolve(req));
347         };
348         function webpackContextResolve(req) {
349                 return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
350         };
351         webpackContext.keys = function webpackContextKeys() {
352                 return Object.keys(map);
353         };
354         webpackContext.resolve = webpackContextResolve;
355         module.exports = webpackContext;
356         webpackContext.id = 2;
357
358
359 /***/ }),
360 /* 3 */
361 /***/ (function(module, exports) {
362
363         'use strict';
364
365         module.exports = function stringify(tree) {
366           // TODO: Better error message
367           if (!tree) throw new Error('We need tree to translate');
368
369           function _t(tree) {
370             var type = tree.type;
371             if (_unique[type]) return _unique[type](tree);
372             if (typeof tree.content === 'string') return tree.content;
373             if (Array.isArray(tree.content)) return _composite(tree.content);
374             return '';
375           }
376
377           function _composite(t, i) {
378             if (!t) return '';
379
380             var s = '';
381             i = i || 0;
382             for (; i < t.length; i++) {
383               s += _t(t[i]);
384             }return s;
385           }
386
387           var _unique = {
388             'arguments': function _arguments(t) {
389               return '(' + _composite(t.content) + ')';
390             },
391             'atkeyword': function atkeyword(t) {
392               return '@' + _composite(t.content);
393             },
394             'attributeSelector': function attributeSelector(t) {
395               return '[' + _composite(t.content) + ']';
396             },
397             'block': function block(t) {
398               return '{' + _composite(t.content) + '}';
399             },
400             'brackets': function brackets(t) {
401               return '[' + _composite(t.content) + ']';
402             },
403             'class': function _class(t) {
404               return '.' + _composite(t.content);
405             },
406             'color': function color(t) {
407               return '#' + t.content;
408             },
409             'customProperty': function customProperty(t) {
410               return '--' + t.content;
411             },
412             'expression': function expression(t) {
413               return 'expression(' + t.content + ')';
414             },
415             'id': function id(t) {
416               return '#' + _composite(t.content);
417             },
418             'multilineComment': function multilineComment(t) {
419               return '/*' + t.content + '*/';
420             },
421             'nthSelector': function nthSelector(t) {
422               return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')';
423             },
424             'parentheses': function parentheses(t) {
425               return '(' + _composite(t.content) + ')';
426             },
427             'percentage': function percentage(t) {
428               return _composite(t.content) + '%';
429             },
430             'pseudoClass': function pseudoClass(t) {
431               return ':' + _composite(t.content);
432             },
433             'pseudoElement': function pseudoElement(t) {
434               return '::' + _composite(t.content);
435             },
436             'universalSelector': function universalSelector(t) {
437               return _composite(t.content) + '*';
438             },
439             'uri': function uri(t) {
440               return 'url(' + _composite(t.content) + ')';
441             }
442           };
443
444           return _t(tree);
445         };
446
447 /***/ }),
448 /* 4 */
449 /***/ (function(module, exports) {
450
451         'use strict';
452
453         module.exports = function stringify(tree) {
454           // TODO: Better error message
455           if (!tree) throw new Error('We need tree to translate');
456
457           function _t(tree) {
458             var type = tree.type;
459             if (_unique[type]) return _unique[type](tree);
460             if (typeof tree.content === 'string') return tree.content;
461             if (Array.isArray(tree.content)) return _composite(tree.content);
462             return '';
463           }
464
465           function _composite(t, i) {
466             if (!t) return '';
467
468             var s = '';
469             i = i || 0;
470             for (; i < t.length; i++) {
471               s += _t(t[i]);
472             }return s;
473           }
474
475           var _unique = {
476             'arguments': function _arguments(t) {
477               return '(' + _composite(t.content) + ')';
478             },
479             'atkeyword': function atkeyword(t) {
480               return '@' + _composite(t.content);
481             },
482             'attributeSelector': function attributeSelector(t) {
483               return '[' + _composite(t.content) + ']';
484             },
485             'block': function block(t) {
486               return '{' + _composite(t.content) + '}';
487             },
488             'brackets': function brackets(t) {
489               return '[' + _composite(t.content) + ']';
490             },
491             'class': function _class(t) {
492               return '.' + _composite(t.content);
493             },
494             'color': function color(t) {
495               return '#' + t.content;
496             },
497             'escapedString': function escapedString(t) {
498               return '~' + t.content;
499             },
500             'expression': function expression(t) {
501               return 'expression(' + t.content + ')';
502             },
503             'id': function id(t) {
504               return '#' + _composite(t.content);
505             },
506             'interpolatedVariable': function interpolatedVariable(t) {
507               return '@{' + _composite(t.content) + '}';
508             },
509             'multilineComment': function multilineComment(t) {
510               return '/*' + t.content + '*/';
511             },
512             'nthSelector': function nthSelector(t) {
513               return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')';
514             },
515             'parentheses': function parentheses(t) {
516               return '(' + _composite(t.content) + ')';
517             },
518             'percentage': function percentage(t) {
519               return _composite(t.content) + '%';
520             },
521             'pseudoClass': function pseudoClass(t) {
522               return ':' + _composite(t.content);
523             },
524             'pseudoElement': function pseudoElement(t) {
525               return '::' + _composite(t.content);
526             },
527             'singlelineComment': function singlelineComment(t) {
528               return '/' + '/' + t.content;
529             },
530             'universalSelector': function universalSelector(t) {
531               return _composite(t.content) + '*';
532             },
533             'uri': function uri(t) {
534               return 'url(' + _composite(t.content) + ')';
535             },
536             'variable': function variable(t) {
537               return '@' + _composite(t.content);
538             },
539             'variablesList': function variablesList(t) {
540               return _composite(t.content) + '...';
541             }
542           };
543
544           return _t(tree);
545         };
546
547 /***/ }),
548 /* 5 */
549 /***/ (function(module, exports) {
550
551         'use strict';
552
553         module.exports = function stringify(tree) {
554           // TODO: Better error message
555           if (!tree) throw new Error('We need tree to translate');
556
557           function _t(tree) {
558             var type = tree.type;
559             if (_unique[type]) return _unique[type](tree);
560             if (typeof tree.content === 'string') return tree.content;
561             if (Array.isArray(tree.content)) return _composite(tree.content);
562             return '';
563           }
564
565           function _composite(t, i) {
566             if (!t) return '';
567
568             var s = '';
569             i = i || 0;
570             for (; i < t.length; i++) {
571               s += _t(t[i]);
572             }return s;
573           }
574
575           var _unique = {
576             'arguments': function _arguments(t) {
577               return '(' + _composite(t.content) + ')';
578             },
579             'atkeyword': function atkeyword(t) {
580               return '@' + _composite(t.content);
581             },
582             'attributeSelector': function attributeSelector(t) {
583               return '[' + _composite(t.content) + ']';
584             },
585             'block': function block(t) {
586               return _composite(t.content);
587             },
588             'brackets': function brackets(t) {
589               return '[' + _composite(t.content) + ']';
590             },
591             'class': function _class(t) {
592               return '.' + _composite(t.content);
593             },
594             'color': function color(t) {
595               return '#' + t.content;
596             },
597             'customProperty': function customProperty(t) {
598               return '--' + t.content;
599             },
600             'expression': function expression(t) {
601               return 'expression(' + t.content + ')';
602             },
603             'functionsList': function functionsList(t) {
604               return _composite(t.content) + '...';
605             },
606             'id': function id(t) {
607               return '#' + _composite(t.content);
608             },
609             'interpolation': function interpolation(t) {
610               return '#{' + _composite(t.content) + '}';
611             },
612             'multilineComment': function multilineComment(t) {
613               var lines = t.content.split('\n');
614               var close = '';
615
616               if (lines.length > 1) {
617                 var lastLine = lines[lines.length - 1];
618                 if (lastLine.length < t.end.column) {
619                   close = '*/';
620                 }
621               } else if (t.content.length + 4 === t.end.column - t.start.column + 1) {
622                 close = '*/';
623               }
624
625               return '/*' + t.content + close;
626             },
627             'nthSelector': function nthSelector(t) {
628               return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')';
629             },
630             'parentheses': function parentheses(t) {
631               return '(' + _composite(t.content) + ')';
632             },
633             'percentage': function percentage(t) {
634               return _composite(t.content) + '%';
635             },
636             'placeholder': function placeholder(t) {
637               return '%' + _composite(t.content);
638             },
639             'pseudoClass': function pseudoClass(t) {
640               return ':' + _composite(t.content);
641             },
642             'pseudoElement': function pseudoElement(t) {
643               return '::' + _composite(t.content);
644             },
645             'singlelineComment': function singlelineComment(t) {
646               return '/' + '/' + t.content;
647             },
648             'universalSelector': function universalSelector(t) {
649               return _composite(t.content) + '*';
650             },
651             'uri': function uri(t) {
652               return 'url(' + _composite(t.content) + ')';
653             },
654             'variable': function variable(t) {
655               return '$' + _composite(t.content);
656             },
657             'variablesList': function variablesList(t) {
658               return _composite(t.content) + '...';
659             }
660           };
661
662           return _t(tree);
663         };
664
665 /***/ }),
666 /* 6 */
667 /***/ (function(module, exports) {
668
669         'use strict';
670
671         module.exports = function stringify(tree) {
672           // TODO: Better error message
673           if (!tree) throw new Error('We need tree to translate');
674
675           function _t(tree) {
676             var type = tree.type;
677             if (_unique[type]) return _unique[type](tree);
678             if (typeof tree.content === 'string') return tree.content;
679             if (Array.isArray(tree.content)) return _composite(tree.content);
680             return '';
681           }
682
683           function _composite(t, i) {
684             if (!t) return '';
685
686             var s = '';
687             i = i || 0;
688             for (; i < t.length; i++) {
689               s += _t(t[i]);
690             }return s;
691           }
692
693           var _unique = {
694             'arguments': function _arguments(t) {
695               return '(' + _composite(t.content) + ')';
696             },
697             'atkeyword': function atkeyword(t) {
698               return '@' + _composite(t.content);
699             },
700             'attributeSelector': function attributeSelector(t) {
701               return '[' + _composite(t.content) + ']';
702             },
703             'block': function block(t) {
704               return '{' + _composite(t.content) + '}';
705             },
706             'brackets': function brackets(t) {
707               return '[' + _composite(t.content) + ']';
708             },
709             'class': function _class(t) {
710               return '.' + _composite(t.content);
711             },
712             'color': function color(t) {
713               return '#' + t.content;
714             },
715             'customProperty': function customProperty(t) {
716               return '--' + t.content;
717             },
718             'expression': function expression(t) {
719               return 'expression(' + t.content + ')';
720             },
721             'functionsList': function functionsList(t) {
722               return _composite(t.content) + '...';
723             },
724             'id': function id(t) {
725               return '#' + _composite(t.content);
726             },
727             'interpolation': function interpolation(t) {
728               return '#{' + _composite(t.content) + '}';
729             },
730             'multilineComment': function multilineComment(t) {
731               return '/*' + t.content + '*/';
732             },
733             'nthSelector': function nthSelector(t) {
734               return ':' + _t(t.content[0]) + '(' + _composite(t.content.slice(1)) + ')';
735             },
736             'parentheses': function parentheses(t) {
737               return '(' + _composite(t.content) + ')';
738             },
739             'percentage': function percentage(t) {
740               return _composite(t.content) + '%';
741             },
742             'placeholder': function placeholder(t) {
743               return '%' + _composite(t.content);
744             },
745             'pseudoClass': function pseudoClass(t) {
746               return ':' + _composite(t.content);
747             },
748             'pseudoElement': function pseudoElement(t) {
749               return '::' + _composite(t.content);
750             },
751             'singlelineComment': function singlelineComment(t) {
752               return '/' + '/' + t.content;
753             },
754             'universalSelector': function universalSelector(t) {
755               return _composite(t.content) + '*';
756             },
757             'uri': function uri(t) {
758               return 'url(' + _composite(t.content) + ')';
759             },
760             'variable': function variable(t) {
761               return '$' + _composite(t.content);
762             },
763             'variablesList': function variablesList(t) {
764               return _composite(t.content) + '...';
765             }
766           };
767
768           return _t(tree);
769         };
770
771 /***/ }),
772 /* 7 */
773 /***/ (function(module, exports, __webpack_require__) {
774
775         'use strict';
776
777         var ParsingError = __webpack_require__(8);
778         var syntaxes = __webpack_require__(10);
779
780         var isInteger = Number.isInteger || function (value) {
781           return typeof value === 'number' && Math.floor(value) === value;
782         };
783
784         /**
785          * @param {String} css
786          * @param {Object} options
787          * @return {Object} AST
788          */
789         function parser(css, options) {
790           if (typeof css !== 'string') throw new Error('Please, pass a string to parse');else if (!css) return __webpack_require__(29)();
791
792           var syntax = options && options.syntax || 'css';
793           var context = options && options.context || 'stylesheet';
794           var tabSize = options && options.tabSize;
795           if (!isInteger(tabSize) || tabSize < 1) tabSize = 1;
796
797           var syntaxParser = syntaxes[syntax];
798
799           if (!syntaxParser) {
800             var message = 'Syntax "' + syntax + '" is not supported yet, sorry';
801             return console.error(message);
802           }
803
804           var getTokens = syntaxParser.tokenizer;
805           var mark = syntaxParser.mark;
806           var parse = syntaxParser.parse;
807
808           var tokens = getTokens(css, tabSize);
809           mark(tokens);
810
811           var ast;
812           try {
813             ast = parse(tokens, context);
814           } catch (e) {
815             if (!e.syntax) throw e;
816             throw new ParsingError(e, css);
817           }
818
819           return ast;
820         }
821
822         module.exports = parser;
823
824 /***/ }),
825 /* 8 */
826 /***/ (function(module, exports, __webpack_require__) {
827
828         'use strict';
829
830         var parserPackage = __webpack_require__(9);
831
832         /**
833          * @param {Error} e
834          * @param {String} css
835          */
836         function ParsingError(e, css) {
837           this.line = e.line;
838           this.syntax = e.syntax;
839           this.css_ = css;
840         }
841
842         ParsingError.prototype = {
843           /**
844            * @type {String}
845            * @private
846            */
847           customMessage_: '',
848
849           /**
850            * @type {Number}
851            */
852           line: null,
853
854           /**
855            * @type {String}
856            */
857           name: 'Parsing error',
858
859           /**
860            * @type {String}
861            */
862           syntax: null,
863
864           /**
865            * @type {String}
866            */
867           version: parserPackage.version,
868
869           /**
870            * @type {String}
871            */
872           get context() {
873             var LINES_AROUND = 2;
874
875             var result = [];
876             var currentLineNumber = this.line;
877             var start = currentLineNumber - 1 - LINES_AROUND;
878             var end = currentLineNumber + LINES_AROUND;
879             var lines = this.css_.split(/\r\n|\r|\n/);
880
881             for (var i = start; i < end; i++) {
882               var line = lines[i];
883               if (!line) continue;
884               var ln = i + 1;
885               var mark = ln === currentLineNumber ? '*' : ' ';
886               result.push(ln + mark + '| ' + line);
887             }
888
889             return result.join('\n');
890           },
891
892           /**
893            * @type {String}
894            */
895           get message() {
896             if (this.customMessage_) {
897               return this.customMessage_;
898             } else {
899               var message = 'Please check validity of the block';
900               if (typeof this.line === 'number') message += ' starting from line #' + this.line;
901               return message;
902             }
903           },
904
905           set message(message) {
906             this.customMessage_ = message;
907           },
908
909           /**
910            * @return {String}
911            */
912           toString: function toString() {
913             return [this.name + ': ' + this.message, '', this.context, '', 'Syntax: ' + this.syntax, 'Gonzales PE version: ' + this.version].join('\n');
914           }
915         };
916
917         module.exports = ParsingError;
918
919 /***/ }),
920 /* 9 */
921 /***/ (function(module, exports) {
922
923         module.exports = {"name":"gonzales-pe","description":"Gonzales Preprocessor Edition (fast CSS parser)","version":"4.3.0","homepage":"http://github.com/tonyganch/gonzales-pe","bugs":"http://github.com/tonyganch/gonzales-pe/issues","license":"MIT","author":{"name":"Tony Ganch","email":"tonyganch+github@gmail.com","url":"http://tonyganch.com"},"main":"./lib/gonzales","repository":{"type":"git","url":"http://github.com/tonyganch/gonzales-pe.git"},"scripts":{"autofix-tests":"bash ./scripts/build.sh && bash ./scripts/autofix-tests.sh","build":"bash ./scripts/build.sh","init":"bash ./scripts/init.sh","lint":"bash ./scripts/lint.sh","log":"bash ./scripts/log.sh","prepublishOnly":"bash ./scripts/build.sh","test":"bash ./scripts/test.sh","watch":"bash ./scripts/watch.sh"},"bin":{"gonzales":"./bin/gonzales.js"},"dependencies":{"minimist":"^1.2.5"},"devDependencies":{"babel-core":"^6.18.2","babel-loader":"^6.2.7","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.18.0","coffee-script":"~1.7.1","eslint":"^3.0.0","jscs":"2.1.0","jshint":"2.10.2","json-loader":"^0.5.3","mocha":"2.2.x","webpack":"^1.12.2","webpack-closure-compiler":"^2.0.2"},"engines":{"node":">=0.6.0"},"files":["MIT-LICENSE.txt","bin/gonzales.js","lib/gonzales.js"]}
924
925 /***/ }),
926 /* 10 */
927 /***/ (function(module, exports, __webpack_require__) {
928
929         'use strict';
930
931         module.exports = {
932           css: __webpack_require__(11),
933           less: __webpack_require__(17),
934           sass: __webpack_require__(21),
935           scss: __webpack_require__(25)
936         };
937
938 /***/ }),
939 /* 11 */
940 /***/ (function(module, exports, __webpack_require__) {
941
942         'use strict';
943
944         exports.__esModule = true;
945         exports.default = {
946           mark: __webpack_require__(12),
947           parse: __webpack_require__(14),
948           stringify: __webpack_require__(3),
949           tokenizer: __webpack_require__(16)
950         };
951         module.exports = exports['default'];
952
953 /***/ }),
954 /* 12 */
955 /***/ (function(module, exports, __webpack_require__) {
956
957         'use strict';
958
959         var TokenType = __webpack_require__(13);
960
961         /**
962          * Mark whitespaces and comments
963          * @param {Array} tokens
964          */
965         function markSpacesAndComments(tokens) {
966           var tokensLength = tokens.length;
967           var spaces = [-1, -1];
968           var type; // Current token's type
969
970           // For every token in the token list, mark spaces and line breaks
971           // as spaces (set both `ws` and `sc` flags). Mark multiline comments
972           // with `sc` flag.
973           // If there are several spaces or tabs or line breaks or multiline
974           // comments in a row, group them: take the last one's index number
975           // and save it to the first token in the group as a reference:
976           // e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9`
977           // for a group of whitespaces and comments.
978           for (var i = 0; i < tokensLength; i++) {
979             type = tokens[i].type;
980
981             if (type === TokenType.Space || type === TokenType.Tab || type === TokenType.Newline) {
982               markSpace(tokens, i, spaces);
983             } else if (type === TokenType.CommentML) {
984               markComment(tokens, i, spaces);
985             } else {
986               markEndOfSpacesAndComments(tokens, i, spaces);
987             }
988           }
989
990           markEndOfSpacesAndComments(tokens, i, spaces);
991         }
992
993         function markSpace(tokens, i, spaces) {
994           var token = tokens[i];
995           token.ws = true;
996           token.sc = true;
997
998           if (spaces[0] === -1) spaces[0] = i;
999           if (spaces[1] === -1) spaces[1] = i;
1000         }
1001
1002         function markComment(tokens, i, spaces) {
1003           var ws = spaces[0];
1004           tokens[i].sc = true;
1005
1006           if (ws !== -1) {
1007             tokens[ws].ws_last = i - 1;
1008             spaces[0] = -1;
1009           }
1010         }
1011
1012         function markEndOfSpacesAndComments(tokens, i, spaces) {
1013           var ws = spaces[0];
1014           var sc = spaces[1];
1015           if (ws !== -1) {
1016             tokens[ws].ws_last = i - 1;
1017             spaces[0] = -1;
1018           }
1019           if (sc !== -1) {
1020             tokens[sc].sc_last = i - 1;
1021             spaces[1] = -1;
1022           }
1023         }
1024
1025         /**
1026          * Pair brackets
1027          * @param {Array} tokens
1028          */
1029         function markBrackets(tokens) {
1030           var tokensLength = tokens.length;
1031           var ps = []; // Parentheses
1032           var sbs = []; // Square brackets
1033           var cbs = []; // Curly brackets
1034           var t = void 0; // Current token
1035
1036           // For every token in the token list, if we meet an opening (left)
1037           // bracket, push its index number to a corresponding array.
1038           // If we then meet a closing (right) bracket, look at the corresponding
1039           // array. If there are any elements (records about previously met
1040           // left brackets), take a token of the last left bracket (take
1041           // the last index number from the array and find a token with
1042           // this index number) and save right bracket's index as a reference:
1043           for (var i = 0; i < tokensLength; i++) {
1044             t = tokens[i];
1045             var type = t.type;
1046
1047             if (type === TokenType.LeftParenthesis) {
1048               ps.push(i);
1049             } else if (type === TokenType.RightParenthesis) {
1050               if (ps.length) {
1051                 t.left = ps.pop();
1052                 tokens[t.left].right = i;
1053               }
1054             } else if (type === TokenType.LeftSquareBracket) {
1055               sbs.push(i);
1056             } else if (type === TokenType.RightSquareBracket) {
1057               if (sbs.length) {
1058                 t.left = sbs.pop();
1059                 tokens[t.left].right = i;
1060               }
1061             } else if (type === TokenType.LeftCurlyBracket) {
1062               cbs.push(i);
1063             } else if (type === TokenType.RightCurlyBracket) {
1064               if (cbs.length) {
1065                 t.left = cbs.pop();
1066                 tokens[t.left].right = i;
1067               }
1068             }
1069           }
1070         }
1071
1072         /**
1073          * @param {Array} tokens
1074          */
1075         function markTokens(tokens) {
1076           // Mark paired brackets:
1077           markBrackets(tokens);
1078           // Mark whitespaces and comments:
1079           markSpacesAndComments(tokens);
1080         }
1081
1082         module.exports = markTokens;
1083
1084 /***/ }),
1085 /* 13 */
1086 /***/ (function(module, exports) {
1087
1088         // jscs:disable
1089
1090         'use strict';
1091
1092         module.exports = {
1093             StringSQ: 'StringSQ',
1094             StringDQ: 'StringDQ',
1095             CommentML: 'CommentML',
1096             CommentSL: 'CommentSL',
1097
1098             Newline: 'Newline',
1099             Space: 'Space',
1100             Tab: 'Tab',
1101
1102             ExclamationMark: 'ExclamationMark', // !
1103             QuotationMark: 'QuotationMark', // "
1104             NumberSign: 'NumberSign', // #
1105             DollarSign: 'DollarSign', // $
1106             PercentSign: 'PercentSign', // %
1107             Ampersand: 'Ampersand', // &
1108             Apostrophe: 'Apostrophe', // '
1109             LeftParenthesis: 'LeftParenthesis', // (
1110             RightParenthesis: 'RightParenthesis', // )
1111             Asterisk: 'Asterisk', // *
1112             PlusSign: 'PlusSign', // +
1113             Comma: 'Comma', // ,
1114             HyphenMinus: 'HyphenMinus', // -
1115             FullStop: 'FullStop', // .
1116             Solidus: 'Solidus', // /
1117             Colon: 'Colon', // :
1118             Semicolon: 'Semicolon', // ;
1119             LessThanSign: 'LessThanSign', // <
1120             EqualsSign: 'EqualsSign', // =
1121             EqualitySign: 'EqualitySign', // ==
1122             InequalitySign: 'InequalitySign', // !=
1123             GreaterThanSign: 'GreaterThanSign', // >
1124             QuestionMark: 'QuestionMark', // ?
1125             CommercialAt: 'CommercialAt', // @
1126             LeftSquareBracket: 'LeftSquareBracket', // [
1127             ReverseSolidus: 'ReverseSolidus', // \
1128             RightSquareBracket: 'RightSquareBracket', // ]
1129             CircumflexAccent: 'CircumflexAccent', // ^
1130             LowLine: 'LowLine', // _
1131             LeftCurlyBracket: 'LeftCurlyBracket', // {
1132             VerticalLine: 'VerticalLine', // |
1133             RightCurlyBracket: 'RightCurlyBracket', // }
1134             Tilde: 'Tilde', // ~
1135
1136             Identifier: 'Identifier',
1137             DecimalNumber: 'DecimalNumber'
1138         };
1139
1140 /***/ }),
1141 /* 14 */
1142 /***/ (function(module, exports, __webpack_require__) {
1143
1144         'use strict';
1145
1146         var Node = __webpack_require__(1);
1147         var NodeType = __webpack_require__(15);
1148         var TokenType = __webpack_require__(13);
1149
1150         /**
1151          * @type {Array}
1152          */
1153         var tokens = void 0;
1154
1155         /**
1156          * @type {Number}
1157          */
1158         var tokensLength = void 0;
1159
1160         /**
1161          * @type {Number}
1162          */
1163         var pos = void 0;
1164
1165         var contexts = {
1166           'atkeyword': function atkeyword() {
1167             return checkAtkeyword(pos) && getAtkeyword();
1168           },
1169           'atrule': function atrule() {
1170             return checkAtrule(pos) && getAtrule();
1171           },
1172           'attributeSelector': function attributeSelector() {
1173             return checkAttributeSelector(pos) && getAttributeSelector();
1174           },
1175           'block': function block() {
1176             return checkBlock(pos) && getBlock();
1177           },
1178           'brackets': function brackets() {
1179             return checkBrackets(pos) && getBrackets();
1180           },
1181           'class': function _class() {
1182             return checkClass(pos) && getClass();
1183           },
1184           'combinator': function combinator() {
1185             return checkCombinator(pos) && getCombinator();
1186           },
1187           'commentML': function commentML() {
1188             return checkCommentML(pos) && getCommentML();
1189           },
1190           'declaration': function declaration() {
1191             return checkDeclaration(pos) && getDeclaration();
1192           },
1193           'declDelim': function declDelim() {
1194             return checkDeclDelim(pos) && getDeclDelim();
1195           },
1196           'delim': function delim() {
1197             return checkDelim(pos) && getDelim();
1198           },
1199           'dimension': function dimension() {
1200             return checkDimension(pos) && getDimension();
1201           },
1202           'expression': function expression() {
1203             return checkExpression(pos) && getExpression();
1204           },
1205           'function': function _function() {
1206             return checkFunction(pos) && getFunction();
1207           },
1208           'ident': function ident() {
1209             return checkIdent(pos) && getIdent();
1210           },
1211           'important': function important() {
1212             return checkImportant(pos) && getImportant();
1213           },
1214           'namespace': function namespace() {
1215             return checkNamespace(pos) && getNamespace();
1216           },
1217           'number': function number() {
1218             return checkNumber(pos) && getNumber();
1219           },
1220           'operator': function operator() {
1221             return checkOperator(pos) && getOperator();
1222           },
1223           'parentheses': function parentheses() {
1224             return checkParentheses(pos) && getParentheses();
1225           },
1226           'percentage': function percentage() {
1227             return checkPercentage(pos) && getPercentage();
1228           },
1229           'progid': function progid() {
1230             return checkProgid(pos) && getProgid();
1231           },
1232           'property': function property() {
1233             return checkProperty(pos) && getProperty();
1234           },
1235           'propertyDelim': function propertyDelim() {
1236             return checkPropertyDelim(pos) && getPropertyDelim();
1237           },
1238           'pseudoc': function pseudoc() {
1239             return checkPseudoc(pos) && getPseudoc();
1240           },
1241           'pseudoe': function pseudoe() {
1242             return checkPseudoe(pos) && getPseudoe();
1243           },
1244           'ruleset': function ruleset() {
1245             return checkRuleset(pos) && getRuleset();
1246           },
1247           's': function s() {
1248             return checkS(pos) && getS();
1249           },
1250           'selector': function selector() {
1251             return checkSelector(pos) && getSelector();
1252           },
1253           'shash': function shash() {
1254             return checkShash(pos) && getShash();
1255           },
1256           'string': function string() {
1257             return checkString(pos) && getString();
1258           },
1259           'stylesheet': function stylesheet() {
1260             return checkStylesheet(pos) && getStylesheet();
1261           },
1262           'unary': function unary() {
1263             return checkUnary(pos) && getUnary();
1264           },
1265           'unicodeRange': function unicodeRange() {
1266             return checkUnicodeRange(pos) && getUnicodeRange();
1267           },
1268           'universalSelector': function universalSelector() {
1269             return checkUniversalSelector(pos) && getUniversalSelector();
1270           },
1271           'urange': function urange() {
1272             return checkUrange(pos) && getUrange();
1273           },
1274           'uri': function uri() {
1275             return checkUri(pos) && getUri();
1276           },
1277           'value': function value() {
1278             return checkValue(pos) && getValue();
1279           },
1280           'vhash': function vhash() {
1281             return checkVhash(pos) && getVhash();
1282           }
1283         };
1284
1285         /**
1286          * Stop parsing and display error
1287          * @param {Number=} i Token's index number
1288          */
1289         function throwError(i) {
1290           var ln = tokens[i].ln;
1291
1292           throw { line: ln, syntax: 'css' };
1293         }
1294
1295         /**
1296          * @param {Object} exclude
1297          * @param {Number} i Token's index number
1298          * @return {Number}
1299          */
1300         function checkExcluding(exclude, i) {
1301           var start = i;
1302
1303           while (i < tokensLength) {
1304             if (exclude[tokens[i++].type]) break;
1305           }
1306
1307           return i - start - 2;
1308         }
1309
1310         /**
1311          * @param {Number} start
1312          * @param {Number} finish
1313          * @return {String}
1314          */
1315         function joinValues(start, finish) {
1316           var s = '';
1317
1318           for (var i = start; i < finish + 1; i++) {
1319             s += tokens[i].value;
1320           }
1321
1322           return s;
1323         }
1324
1325         /**
1326          * @param {Number} start
1327          * @param {Number} num
1328          * @return {String}
1329          */
1330         function joinValues2(start, num) {
1331           if (start + num - 1 >= tokensLength) return;
1332
1333           var s = '';
1334
1335           for (var i = 0; i < num; i++) {
1336             s += tokens[start + i].value;
1337           }
1338
1339           return s;
1340         }
1341
1342         function getLastPosition(content, line, column, colOffset) {
1343           return typeof content === 'string' ? getLastPositionForString(content, line, column, colOffset) : getLastPositionForArray(content, line, column, colOffset);
1344         }
1345
1346         function getLastPositionForString(content, line, column, colOffset) {
1347           var position = [];
1348
1349           if (!content) {
1350             position = [line, column];
1351             if (colOffset) position[1] += colOffset - 1;
1352             return position;
1353           }
1354
1355           var lastLinebreak = content.lastIndexOf('\n');
1356           var endsWithLinebreak = lastLinebreak === content.length - 1;
1357           var splitContent = content.split('\n');
1358           var linebreaksCount = splitContent.length - 1;
1359           var prevLinebreak = linebreaksCount === 0 || linebreaksCount === 1 ? -1 : content.length - splitContent[linebreaksCount - 1].length - 2;
1360
1361           // Line:
1362           var offset = endsWithLinebreak ? linebreaksCount - 1 : linebreaksCount;
1363           position[0] = line + offset;
1364
1365           // Column:
1366           if (endsWithLinebreak) {
1367             offset = prevLinebreak !== -1 ? content.length - prevLinebreak : content.length - 1;
1368           } else {
1369             offset = linebreaksCount !== 0 ? content.length - lastLinebreak - column - 1 : content.length - 1;
1370           }
1371           position[1] = column + offset;
1372
1373           if (!colOffset) return position;
1374
1375           if (endsWithLinebreak) {
1376             position[0]++;
1377             position[1] = colOffset;
1378           } else {
1379             position[1] += colOffset;
1380           }
1381
1382           return position;
1383         }
1384
1385         function getLastPositionForArray(content, line, column, colOffset) {
1386           var position = void 0;
1387
1388           if (content.length === 0) {
1389             position = [line, column];
1390           } else {
1391             var c = content[content.length - 1];
1392             if (c.hasOwnProperty('end')) {
1393               position = [c.end.line, c.end.column];
1394             } else {
1395               position = getLastPosition(c.content, line, column);
1396             }
1397           }
1398
1399           if (!colOffset) return position;
1400
1401           if (tokens[pos - 1] && tokens[pos - 1].type !== 'Newline') {
1402             position[1] += colOffset;
1403           } else {
1404             position[0]++;
1405             position[1] = 1;
1406           }
1407
1408           return position;
1409         }
1410
1411         function newNode(type, content, line, column, end) {
1412           if (!end) end = getLastPosition(content, line, column);
1413           return new Node({
1414             type: type,
1415             content: content,
1416             start: {
1417               line: line,
1418               column: column
1419             },
1420             end: {
1421               line: end[0],
1422               column: end[1]
1423             },
1424             syntax: 'css'
1425           });
1426         }
1427
1428         /**
1429          * @param {Number} i Token's index number
1430          * @return {Number}
1431          */
1432         function checkAny(i) {
1433           var l = void 0;
1434
1435           if (l = checkBrackets(i)) tokens[i].any_child = 1;else if (l = checkParentheses(i)) tokens[i].any_child = 2;else if (l = checkString(i)) tokens[i].any_child = 3;else if (l = checkPercentage(i)) tokens[i].any_child = 4;else if (l = checkDimension(i)) tokens[i].any_child = 5;else if (l = checkUnicodeRange(i)) tokens[i].any_child = 13;else if (l = checkNumber(i)) tokens[i].any_child = 6;else if (l = checkUri(i)) tokens[i].any_child = 7;else if (l = checkExpression(i)) tokens[i].any_child = 8;else if (l = checkFunction(i)) tokens[i].any_child = 9;else if (l = checkIdent(i)) tokens[i].any_child = 10;else if (l = checkClass(i)) tokens[i].any_child = 11;else if (l = checkUnary(i)) tokens[i].any_child = 12;
1436
1437           return l;
1438         }
1439
1440         /**
1441          * @return {Node}
1442          */
1443         function getAny() {
1444           var childType = tokens[pos].any_child;
1445
1446           if (childType === 1) return getBrackets();
1447           if (childType === 2) return getParentheses();
1448           if (childType === 3) return getString();
1449           if (childType === 4) return getPercentage();
1450           if (childType === 5) return getDimension();
1451           if (childType === 13) return getUnicodeRange();
1452           if (childType === 6) return getNumber();
1453           if (childType === 7) return getUri();
1454           if (childType === 8) return getExpression();
1455           if (childType === 9) return getFunction();
1456           if (childType === 10) return getIdent();
1457           if (childType === 11) return getClass();
1458           if (childType === 12) return getUnary();
1459         }
1460
1461         /**
1462          * @return {Node}
1463          */
1464         function getArguments() {
1465           var type = NodeType.ArgumentsType;
1466           var token = tokens[pos];
1467           var line = token.ln;
1468           var column = token.col;
1469           var content = [];
1470           var body = void 0;
1471
1472           // Skip `(`.
1473           pos++;
1474
1475           while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) {
1476             if (checkDeclaration(pos)) content.push(getDeclaration());else if (checkArgument(pos)) {
1477               body = getArgument();
1478               if (typeof body.content === 'string') content.push(body);else content = content.concat(body);
1479             } else if (checkClass(pos)) content.push(getClass());else throwError(pos);
1480           }
1481
1482           var end = getLastPosition(content, line, column, 1);
1483
1484           // Skip `)`.
1485           pos++;
1486
1487           return newNode(type, content, line, column, end);
1488         }
1489
1490         /**
1491          * @param {Number} i Token's index number
1492          * @return {Number}
1493          */
1494         function checkArgument(i) {
1495           var l = void 0;
1496
1497           if (l = checkVhash(i)) tokens[i].argument_child = 1;else if (l = checkCustomProperty(i)) tokens[i].argument_child = 2;else if (l = checkAny(i)) tokens[i].argument_child = 3;else if (l = checkSC(i)) tokens[i].argument_child = 4;else if (l = checkOperator(i)) tokens[i].argument_child = 5;
1498
1499           return l;
1500         }
1501
1502         /**
1503          * @return {Node}
1504          */
1505         function getArgument() {
1506           var childType = tokens[pos].argument_child;
1507
1508           if (childType === 1) return getVhash();
1509           if (childType === 2) return getCustomProperty();
1510           if (childType === 3) return getAny();
1511           if (childType === 4) return getSC();
1512           if (childType === 5) return getOperator();
1513         }
1514
1515         /**
1516          * Check if token is part of an @-word (e.g. `@import`, `@include`)
1517          * @param {Number} i Token's index number
1518          * @return {Number}
1519          */
1520         function checkAtkeyword(i) {
1521           var l = void 0;
1522
1523           // Check that token is `@`:
1524           if (i >= tokensLength || tokens[i++].type !== TokenType.CommercialAt) return 0;
1525
1526           return (l = checkIdent(i)) ? l + 1 : 0;
1527         }
1528
1529         /**
1530          * Get node with @-word
1531          * @return {Node}
1532          */
1533         function getAtkeyword() {
1534           var type = NodeType.AtkeywordType;
1535           var token = tokens[pos];
1536           var line = token.ln;
1537           var column = token.col;
1538
1539           // Skip `@`.
1540           pos++;
1541
1542           var content = [getIdent()];
1543
1544           return newNode(type, content, line, column);
1545         }
1546
1547         /**
1548          * Check if token is a part of an @-rule
1549          * @param {Number} i Token's index number
1550          * @return {Number} Length of @-rule
1551          */
1552         function checkAtrule(i) {
1553           var l = void 0;
1554
1555           if (i >= tokensLength) return 0;
1556
1557           // If token already has a record of being part of an @-rule,
1558           // return the @-rule's length:
1559           if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l;
1560
1561           // If token is part of an @-rule, save the rule's type to token.
1562           // @keyframes:
1563           if (l = checkKeyframesRule(i)) tokens[i].atrule_type = 4;
1564           // @-rule with ruleset:
1565           else if (l = checkAtruler(i)) tokens[i].atrule_type = 1;
1566             // Block @-rule:
1567             else if (l = checkAtruleb(i)) tokens[i].atrule_type = 2;
1568               // Single-line @-rule:
1569               else if (l = checkAtrules(i)) tokens[i].atrule_type = 3;else return 0;
1570
1571           // If token is part of an @-rule, save the rule's length to token:
1572           tokens[i].atrule_l = l;
1573
1574           return l;
1575         }
1576
1577         /**
1578          * Get node with @-rule
1579          * @return {Node}
1580          */
1581         function getAtrule() {
1582           var childType = tokens[pos].atrule_type;
1583
1584           if (childType === 1) return getAtruler(); // @-rule with ruleset
1585           if (childType === 2) return getAtruleb(); // Block @-rule
1586           if (childType === 3) return getAtrules(); // Single-line @-rule
1587           if (childType === 4) return getKeyframesRule();
1588         }
1589
1590         /**
1591          * Check if token is part of a block @-rule
1592          * @param {Number} i Token's index number
1593          * @return {Number} Length of the @-rule
1594          */
1595         function checkAtruleb(i) {
1596           var start = i;
1597           var l = void 0;
1598
1599           if (i >= tokensLength) return 0;
1600
1601           if (l = checkAtkeyword(i)) i += l;else return 0;
1602
1603           if (l = checkTsets(i)) i += l;
1604
1605           if (l = checkBlock(i)) i += l;else return 0;
1606
1607           return i - start;
1608         }
1609
1610         /**
1611          * Get node with a block @-rule
1612          * @return {Node}
1613          */
1614         function getAtruleb() {
1615           var type = NodeType.AtruleType;
1616           var token = tokens[pos];
1617           var line = token.ln;
1618           var column = token.col;
1619           var content = [].concat(getAtkeyword(), getTsets(), getBlock());
1620
1621           return newNode(type, content, line, column);
1622         }
1623
1624         /**
1625          * Check if token is part of an @-rule with ruleset
1626          * @param {Number} i Token's index number
1627          * @return {Number} Length of the @-rule
1628          */
1629         function checkAtruler(i) {
1630           var start = i;
1631           var l = void 0;
1632
1633           if (i >= tokensLength) return 0;
1634
1635           if (l = checkAtkeyword(i)) i += l;else return 0;
1636
1637           if (l = checkTsets(i)) i += l;
1638
1639           if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;else return 0;
1640
1641           if (l = checkAtrulers(i)) i += l;
1642
1643           if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;else return 0;
1644
1645           return i - start;
1646         }
1647
1648         /**
1649          * Get node with an @-rule with ruleset
1650          * @return {Node}
1651          */
1652         function getAtruler() {
1653           var type = NodeType.AtruleType;
1654           var token = tokens[pos];
1655           var line = token.ln;
1656           var column = token.col;
1657           var content = [].concat(getAtkeyword(), getTsets(), getAtrulers());
1658
1659           return newNode(type, content, line, column);
1660         }
1661
1662         /**
1663          * @param {Number} i Token's index number
1664          * @return {Number}
1665          */
1666         function checkAtrulers(i) {
1667           var start = i;
1668           var l = void 0;
1669
1670           if (i >= tokensLength) return 0;
1671
1672           if (l = checkSC(i)) i += l;
1673
1674           while (i < tokensLength) {
1675             if (l = checkSC(i)) tokens[i].atrulers_child = 1;else if (l = checkAtrule(i)) tokens[i].atrulers_child = 2;else if (l = checkRuleset(i)) tokens[i].atrulers_child = 3;else break;
1676             i += l;
1677           }
1678
1679           if (i < tokensLength) tokens[i].atrulers_end = 1;
1680
1681           if (l = checkSC(i)) i += l;
1682
1683           return i - start;
1684         }
1685
1686         /**
1687          * @return {Node}
1688          */
1689         function getAtrulers() {
1690           var type = NodeType.BlockType;
1691           var token = tokens[pos];
1692           var line = token.ln;
1693           var column = token.col;
1694           var content = [];
1695
1696           // Skip `{`.
1697           pos++;
1698
1699           content = content.concat(getSC());
1700
1701           while (pos < tokensLength && !tokens[pos].atrulers_end) {
1702             var childType = tokens[pos].atrulers_child;
1703             if (childType === 1) content = content.concat(getSC());else if (childType === 2) content.push(getAtrule());else if (childType === 3) content.push(getRuleset());else break;
1704           }
1705
1706           content = content.concat(getSC());
1707
1708           var end = getLastPosition(content, line, column, 1);
1709
1710           // Skip `}`.
1711           pos++;
1712
1713           return newNode(type, content, line, column, end);
1714         }
1715
1716         /**
1717          * @param {Number} i Token's index number
1718          * @return {Number}
1719          */
1720         function checkAtrules(i) {
1721           var start = i;
1722           var l = void 0;
1723
1724           if (i >= tokensLength) return 0;
1725
1726           if (l = checkAtkeyword(i)) i += l;else return 0;
1727
1728           if (l = checkTsets(i)) i += l;
1729
1730           return i - start;
1731         }
1732
1733         /**
1734          * @return {Node}
1735          */
1736         function getAtrules() {
1737           var type = NodeType.AtruleType;
1738           var token = tokens[pos];
1739           var line = token.ln;
1740           var column = token.col;
1741           var content = [].concat(getAtkeyword(), getTsets());
1742
1743           return newNode(type, content, line, column);
1744         }
1745
1746         /**
1747          * Check if token is part of a block (e.g. `{...}`).
1748          * @param {Number} i Token's index number
1749          * @return {Number} Length of the block
1750          */
1751         function checkBlock(i) {
1752           return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? tokens[i].right - i + 1 : 0;
1753         }
1754
1755         /**
1756          * Get node with a block
1757          * @return {Node}
1758          */
1759         function getBlock() {
1760           var type = NodeType.BlockType;
1761           var token = tokens[pos];
1762           var line = token.ln;
1763           var column = token.col;
1764           var end = tokens[pos].right;
1765           var content = [];
1766
1767           // Skip `{`.
1768           pos++;
1769
1770           while (pos < end) {
1771             if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());else throwError(pos);
1772           }
1773
1774           var end_ = getLastPosition(content, line, column, 1);
1775           pos = end + 1;
1776
1777           return newNode(type, content, line, column, end_);
1778         }
1779
1780         /**
1781          * Check if token is part of a declaration (property-value pair)
1782          * @param {Number} i Token's index number
1783          * @return {Number} Length of the declaration
1784          */
1785         function checkBlockdecl(i) {
1786           var l = void 0;
1787
1788           if (i >= tokensLength) return 0;
1789
1790           if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1;else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2;else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3;else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4;else return 0;
1791
1792           return l;
1793         }
1794
1795         /**
1796          * @return {Array}
1797          */
1798         function getBlockdecl() {
1799           var childType = tokens[pos].bd_type;
1800
1801           if (childType === 1) return getBlockdecl1();
1802           if (childType === 2) return getBlockdecl2();
1803           if (childType === 3) return getBlockdecl3();
1804           if (childType === 4) return getBlockdecl4();
1805         }
1806
1807         /**
1808          * @param {Number} i Token's index number
1809          * @return {Number}
1810          */
1811         function checkBlockdecl1(i) {
1812           var start = i;
1813           var l = void 0;
1814
1815           if (l = checkSC(i)) i += l;
1816
1817           if (l = checkDeclaration(i)) tokens[i].bd_kind = 1;else if (l = checkAtrule(i)) tokens[i].bd_kind = 2;else return 0;
1818
1819           i += l;
1820
1821           if (l = checkSC(i)) i += l;
1822
1823           if (i < tokensLength && (l = checkDeclDelim(i))) i += l;else return 0;
1824
1825           if (l = checkSC(i)) i += l;else return 0;
1826
1827           return i - start;
1828         }
1829
1830         /**
1831          * @return {Array}
1832          */
1833         function getBlockdecl1() {
1834           var sc = getSC();
1835           var content = void 0;
1836
1837           switch (tokens[pos].bd_kind) {
1838             case 1:
1839               content = getDeclaration();
1840               break;
1841             case 2:
1842               content = getAtrule();
1843               break;
1844           }
1845
1846           return sc.concat(content, getSC(), getDeclDelim(), getSC());
1847         }
1848
1849         /**
1850          * @param {Number} i Token's index number
1851          * @return {Number}
1852          */
1853         function checkBlockdecl2(i) {
1854           var start = i;
1855           var l = void 0;
1856
1857           if (l = checkSC(i)) i += l;
1858
1859           if (l = checkDeclaration(i)) tokens[i].bd_kind = 1;else if (l = checkAtrule(i)) tokens[i].bd_kind = 2;else return 0;
1860
1861           i += l;
1862
1863           if (l = checkSC(i)) i += l;
1864
1865           return i - start;
1866         }
1867
1868         /**
1869          * @return {Array}
1870          */
1871         function getBlockdecl2() {
1872           var sc = getSC();
1873           var content = void 0;
1874
1875           switch (tokens[pos].bd_kind) {
1876             case 1:
1877               content = getDeclaration();
1878               break;
1879             case 2:
1880               content = getAtrule();
1881               break;
1882           }
1883
1884           return sc.concat(content, getSC());
1885         }
1886
1887         /**
1888          * @param {Number} i Token's index number
1889          * @return {Number}
1890          */
1891         function checkBlockdecl3(i) {
1892           var start = i;
1893           var l = void 0;
1894
1895           if (l = checkSC(i)) i += l;
1896
1897           if (l = checkDeclDelim(i)) i += l;else return 0;
1898
1899           if (l = checkSC(i)) i += l;
1900
1901           return i - start;
1902         }
1903
1904         /**
1905          * @return {Array}
1906          */
1907         function getBlockdecl3() {
1908           return [].concat(getSC(), getDeclDelim(), getSC());
1909         }
1910
1911         /**
1912          * @param {Number} i Token's index number
1913          * @return {Number}
1914          */
1915         function checkBlockdecl4(i) {
1916           return checkSC(i);
1917         }
1918
1919         /**
1920          * @return {Array}
1921          */
1922         function getBlockdecl4() {
1923           return getSC();
1924         }
1925
1926         /**
1927          * Check if token is part of text inside square brackets, e.g. `[1]`
1928          * @param {Number} i Token's index number
1929          * @return {Number}
1930          */
1931         function checkBrackets(i) {
1932           if (i >= tokensLength) return 0;
1933
1934           var start = i;
1935
1936           // Skip `[`.
1937           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
1938
1939           if (i < tokens[start].right) {
1940             var l = checkTsets(i);
1941             if (l) i += l;else return 0;
1942           }
1943
1944           // Skip `]`.
1945           i++;
1946
1947           return i - start;
1948         }
1949
1950         /**
1951          * Get node with text inside square brackets, e.g. `[1]`
1952          * @return {Node}
1953          */
1954         function getBrackets() {
1955           var type = NodeType.BracketsType;
1956           var token = tokens[pos];
1957           var line = token.ln;
1958           var column = token.col;
1959           var right = token.right;
1960           var content = [];
1961
1962           // Skip `[`.
1963           pos++;
1964
1965           if (pos < right) {
1966             content = getTsets();
1967           }
1968
1969           var end = getLastPosition(content, line, column, 1);
1970
1971           // Skip `]`.
1972           pos++;
1973
1974           return newNode(type, content, line, column, end);
1975         }
1976
1977         /**
1978          * Check if token is part of a class selector (e.g. `.abc`)
1979          * @param {Number} i Token's index number
1980          * @return {Number} Length of the class selector
1981          */
1982         function checkClass(i) {
1983           var start = i;
1984           var l = void 0;
1985
1986           if (i >= tokensLength) return 0;
1987
1988           if (tokens[i].class_l) return tokens[i].class_l;
1989
1990           // Skip `.`.
1991           if (tokens[i].type === TokenType.FullStop) i++;else return 0;
1992
1993           if (l = checkIdent(i)) {
1994             tokens[start].class_l = l + 1;
1995             i += l;
1996           } else return 0;
1997
1998           tokens[start].classEnd = i;
1999
2000           return i - start;
2001         }
2002
2003         /**
2004          * Get node with a class selector
2005          * @return {Node}
2006          */
2007         function getClass() {
2008           var type = NodeType.ClassType;
2009           var token = tokens[pos];
2010           var line = token.ln;
2011           var column = token.col;
2012
2013           // Skip `.`
2014           pos++;
2015
2016           var content = [getIdent()];
2017
2018           return newNode(type, content, line, column);
2019         }
2020
2021         function checkCombinator(i) {
2022           if (i >= tokensLength) return 0;
2023
2024           var l = void 0;
2025           if (l = checkCombinator1(i)) tokens[i].combinatorType = 1;else if (l = checkCombinator2(i)) tokens[i].combinatorType = 2;else if (l = checkCombinator3(i)) tokens[i].combinatorType = 3;else if (l = checkCombinator4(i)) tokens[i].combinatorType = 4;
2026
2027           return l;
2028         }
2029
2030         function getCombinator() {
2031           var type = tokens[pos].combinatorType;
2032           if (type === 1) return getCombinator1();
2033           if (type === 2) return getCombinator2();
2034           if (type === 3) return getCombinator3();
2035           if (type === 4) return getCombinator4();
2036         }
2037
2038         /**
2039          * (1) `>>>`
2040          *
2041          * @param {Number} i
2042          * @return {Number}
2043          */
2044         function checkCombinator1(i) {
2045           if (i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign) return 3;
2046
2047           return 0;
2048         }
2049
2050         /**
2051          * @return {Node}
2052          */
2053         function getCombinator1() {
2054           var type = NodeType.CombinatorType;
2055           var token = tokens[pos];
2056           var line = token.ln;
2057           var column = token.col;
2058           var content = '>>>';
2059
2060           // Skip combinator
2061           pos += 3;
2062
2063           return newNode(type, content, line, column);
2064         }
2065
2066         /**
2067          * (1) `||`
2068          * (2) `>>`
2069          *
2070          * @param {Number} i
2071          * @return {Number}
2072          */
2073         function checkCombinator2(i) {
2074           if (i + 1 >= tokensLength) return 0;
2075
2076           if (tokens[i].type === TokenType.VerticalLine && tokens[i + 1].type === TokenType.VerticalLine) return 2;
2077
2078           if (tokens[i].type === TokenType.GreaterThanSign && tokens[i + 1].type === TokenType.GreaterThanSign) return 2;
2079
2080           return 0;
2081         }
2082
2083         /**
2084          * @return {Node}
2085          */
2086         function getCombinator2() {
2087           var type = NodeType.CombinatorType;
2088           var token = tokens[pos];
2089           var line = token.ln;
2090           var column = token.col;
2091           var content = '' + token.value + tokens[pos + 1].value;
2092
2093           // Skip combinator
2094           pos += 2;
2095
2096           return newNode(type, content, line, column);
2097         }
2098
2099         /**
2100          * (1) `>`
2101          * (2) `+`
2102          * (3) `~`
2103          *
2104          * @param {Number} i
2105          * @return {Number}
2106          */
2107         function checkCombinator3(i) {
2108           var type = tokens[i].type;
2109           if (type === TokenType.PlusSign || type === TokenType.GreaterThanSign || type === TokenType.Tilde) return 1;else return 0;
2110         }
2111
2112         /**
2113          * @return {Node}
2114          */
2115         function getCombinator3() {
2116           var type = NodeType.CombinatorType;
2117           var token = tokens[pos];
2118           var line = token.ln;
2119           var column = token.col;
2120           var content = token.value;
2121
2122           // Skip combinator
2123           pos++;
2124
2125           return newNode(type, content, line, column);
2126         }
2127
2128         /**
2129          * (1) `/panda/`
2130          */
2131         function checkCombinator4(i) {
2132           var start = i;
2133
2134           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
2135
2136           var l = void 0;
2137           if (l = checkIdent(i)) i += l;else return 0;
2138
2139           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
2140
2141           return i - start;
2142         }
2143
2144         /**
2145          * @return {Node}
2146          */
2147         function getCombinator4() {
2148           var type = NodeType.CombinatorType;
2149           var token = tokens[pos];
2150           var line = token.ln;
2151           var column = token.col;
2152
2153           // Skip `/`.
2154           pos++;
2155
2156           var ident = getIdent();
2157
2158           // Skip `/`.
2159           pos++;
2160
2161           var content = '/' + ident.content + '/';
2162
2163           return newNode(type, content, line, column);
2164         }
2165
2166         /**
2167          * Check if token is a multiline comment.
2168          * @param {Number} i Token's index number
2169          * @return {Number} `1` if token is a multiline comment, otherwise `0`
2170          */
2171         function checkCommentML(i) {
2172           return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0;
2173         }
2174
2175         /**
2176          * Get node with a multiline comment
2177          * @return {Node}
2178          */
2179         function getCommentML() {
2180           var type = NodeType.CommentMLType;
2181           var token = tokens[pos];
2182           var line = token.ln;
2183           var column = token.col;
2184           var content = tokens[pos].value.substring(2);
2185           var l = content.length;
2186
2187           if (content.charAt(l - 2) === '*' && content.charAt(l - 1) === '/') content = content.substring(0, l - 2);
2188
2189           var end = getLastPosition(content, line, column, 2);
2190           if (end[0] === line) end[1] += 2;
2191           pos++;
2192
2193           return newNode(type, content, line, column, end);
2194         }
2195
2196         /**
2197          * Check if token is part of a declaration (property-value pair)
2198          * @param {Number} i Token's index number
2199          * @return {Number} Length of the declaration
2200          */
2201         function checkDeclaration(i) {
2202           var start = i;
2203           var l = void 0;
2204
2205           if (i >= tokensLength) return 0;
2206
2207           if (l = checkProperty(i)) i += l;else return 0;
2208
2209           if (l = checkSC(i)) i += l;
2210
2211           if (l = checkPropertyDelim(i)) i++;else return 0;
2212
2213           if (l = checkSC(i)) i += l;
2214
2215           if (l = checkValue(i)) i += l;else return 0;
2216
2217           return i - start;
2218         }
2219
2220         /**
2221          * Get node with a declaration
2222          * @return {Node}
2223          */
2224         function getDeclaration() {
2225           var type = NodeType.DeclarationType;
2226           var token = tokens[pos];
2227           var line = token.ln;
2228           var column = token.col;
2229           var content = [].concat(getProperty(), getSC(), getPropertyDelim(), getSC(), getValue());
2230
2231           return newNode(type, content, line, column);
2232         }
2233
2234         /**
2235          * Check if token is a semicolon
2236          * @param {Number} i Token's index number
2237          * @return {Number} `1` if token is a semicolon, otherwise `0`
2238          */
2239         function checkDeclDelim(i) {
2240           return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0;
2241         }
2242
2243         /**
2244          * Get node with a semicolon
2245          * @return {Node}
2246          */
2247         function getDeclDelim() {
2248           var type = NodeType.DeclDelimType;
2249           var token = tokens[pos];
2250           var line = token.ln;
2251           var column = token.col;
2252           var content = ';';
2253
2254           pos++;
2255
2256           return newNode(type, content, line, column);
2257         }
2258
2259         /**
2260          * Check if token is a comma
2261          * @param {Number} i Token's index number
2262          * @return {Number} `1` if token is a comma, otherwise `0`
2263          */
2264         function checkDelim(i) {
2265           return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0;
2266         }
2267
2268         /**
2269          * Get node with a comma
2270          * @return {Node}
2271          */
2272         function getDelim() {
2273           var type = NodeType.DelimType;
2274           var token = tokens[pos];
2275           var line = token.ln;
2276           var column = token.col;
2277           var content = ',';
2278
2279           pos++;
2280
2281           return newNode(type, content, line, column);
2282         }
2283
2284         /**
2285          * Check if token is part of a number with dimension unit (e.g. `10px`)
2286          * @param {Number} i Token's index number
2287          * @return {Number}
2288          */
2289         function checkDimension(i) {
2290           var ln = checkNumber(i);
2291           var li = void 0;
2292
2293           if (i >= tokensLength || !ln || i + ln >= tokensLength) return 0;
2294
2295           return (li = checkUnit(i + ln)) ? ln + li : 0;
2296         }
2297
2298         /**
2299          * Get node of a number with dimension unit
2300          * @return {Node}
2301          */
2302         function getDimension() {
2303           var type = NodeType.DimensionType;
2304           var token = tokens[pos];
2305           var line = token.ln;
2306           var column = token.col;
2307           var content = [getNumber(), getUnit()];
2308
2309           return newNode(type, content, line, column);
2310         }
2311
2312         /**
2313          * @param {Number} i Token's index number
2314          * @return {Number}
2315          */
2316         function checkExpression(i) {
2317           var start = i;
2318
2319           if (i >= tokensLength || tokens[i++].value !== 'expression' || i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) {
2320             return 0;
2321           }
2322
2323           return tokens[i].right - start + 1;
2324         }
2325
2326         /**
2327          * @return {Node}
2328          */
2329         function getExpression() {
2330           var type = NodeType.ExpressionType;
2331           var token = tokens[pos];
2332           var line = token.ln;
2333           var column = token.col;
2334
2335           pos++;
2336
2337           var content = joinValues(pos + 1, tokens[pos].right - 1);
2338           var end = getLastPosition(content, line, column, 1);
2339
2340           if (end[0] === line) end[1] += 11;
2341           pos = tokens[pos].right + 1;
2342
2343           return newNode(type, content, line, column, end);
2344         }
2345
2346         /**
2347          * @param {Number} i Token's index number
2348          * @return {Number}
2349          */
2350         function checkFunction(i) {
2351           var start = i;
2352           var l = void 0;
2353
2354           if (i >= tokensLength) return 0;
2355
2356           if (l = checkIdent(i)) i += l;else return 0;
2357
2358           return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? tokens[i].right - start + 1 : 0;
2359         }
2360
2361         /**
2362          * @return {Node}
2363          */
2364         function getFunction() {
2365           var type = NodeType.FunctionType;
2366           var token = tokens[pos];
2367           var line = token.ln;
2368           var column = token.col;
2369           var content = [].concat(getIdent(), getArguments());
2370
2371           return newNode(type, content, line, column);
2372         }
2373
2374         /**
2375          * Check if token is part of an identifierÑŽ
2376          * Grammar from CSS spec:
2377          *   h         [0-9a-f]
2378          *   nonascii  [\240-\377]
2379          *   unicode   \\{h}{1,6}(\r\n|[ \t\r\n\f])?
2380          *   escape    {unicode}|\\[^\r\n\f0-9a-f]
2381          *   nmstart   [_a-z]|{nonascii}|{escape}
2382          *   nmchar    [_a-z0-9-]|{nonascii}|{escape}
2383          *   ident     -?{nmstart}{nmchar}*
2384          *
2385          * @param {number} i Token's index number
2386          * @return {number} Length of the identifier
2387          */
2388         function checkIdent(i) {
2389           var start = i;
2390
2391           if (i >= tokensLength) return 0;
2392
2393           if (tokens[i].type === TokenType.HyphenMinus) i++;
2394
2395           if (tokens[i].type === TokenType.LowLine || tokens[i].type === TokenType.Identifier) i++;else return 0;
2396
2397           for (; i < tokensLength; i++) {
2398             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
2399           }
2400
2401           tokens[start].ident_last = i - 1;
2402
2403           return i - start;
2404         }
2405
2406         /**
2407          * Get node with an identifier
2408          * @return {Node}
2409          */
2410         function getIdent() {
2411           var type = NodeType.IdentType;
2412           var token = tokens[pos];
2413           var line = token.ln;
2414           var column = token.col;
2415           var content = joinValues(pos, tokens[pos].ident_last);
2416
2417           pos = tokens[pos].ident_last + 1;
2418
2419           return newNode(type, content, line, column);
2420         }
2421
2422         /**
2423          * Check if token is part of `!important` word
2424          * @param {Number} i Token's index number
2425          * @return {Number}
2426          */
2427         function checkImportant(i) {
2428           var start = i;
2429           var l = void 0;
2430
2431           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
2432
2433           if (l = checkSC(i)) i += l;
2434
2435           if (tokens[i].value === 'important') {
2436             tokens[start].importantEnd = i;
2437             return i - start + 1;
2438           } else {
2439             return 0;
2440           }
2441         }
2442
2443         /**
2444          * Get node with `!important` word
2445          * @return {Node}
2446          */
2447         function getImportant() {
2448           var type = NodeType.ImportantType;
2449           var token = tokens[pos];
2450           var line = token.ln;
2451           var column = token.col;
2452           var content = joinValues(pos, token.importantEnd);
2453
2454           pos = token.importantEnd + 1;
2455
2456           return newNode(type, content, line, column);
2457         }
2458
2459         /**
2460          * Check a single keyframe block - `5% {}`
2461          * @param {Number} i
2462          * @returns {Number}
2463          */
2464         function checkKeyframesBlock(i) {
2465           var start = i;
2466           var l = void 0;
2467
2468           if (i >= tokensLength) return 0;
2469
2470           if (l = checkKeyframesSelectorsGroup(i)) i += l;else return 0;
2471
2472           if (l = checkSC(i)) i += l;
2473
2474           if (l = checkBlock(i)) i += l;else return 0;
2475
2476           return i - start;
2477         }
2478
2479         /**
2480          * Get a single keyframe block - `5% {}`
2481          * @returns {Node}
2482          */
2483         function getKeyframesBlock() {
2484           var type = NodeType.RulesetType;
2485           var token = tokens[pos];
2486           var line = token.ln;
2487           var column = token.col;
2488           var content = [].concat(getKeyframesSelectorsGroup(), getSC(), getBlock());
2489
2490           return newNode(type, content, line, column);
2491         }
2492
2493         /**
2494          * Check all keyframe blocks - `5% {} 100% {}`
2495          * @param {Number} i
2496          * @returns {Number}
2497          */
2498         function checkKeyframesBlocks(i) {
2499           var start = i;
2500           var l = void 0;
2501
2502           if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;else return 0;
2503
2504           if (l = checkSC(i)) i += l;
2505
2506           if (l = checkKeyframesBlock(i)) i += l;else return 0;
2507
2508           while (tokens[i].type !== TokenType.RightCurlyBracket) {
2509             if (l = checkSC(i)) i += l;else if (l = checkKeyframesBlock(i)) i += l;else break;
2510           }
2511
2512           if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;else return 0;
2513
2514           return i - start;
2515         }
2516
2517         /**
2518          * Get all keyframe blocks - `5% {} 100% {}`
2519          * @returns {Node}
2520          */
2521         function getKeyframesBlocks() {
2522           var type = NodeType.BlockType;
2523           var token = tokens[pos];
2524           var line = token.ln;
2525           var column = token.col;
2526           var keyframesBlocksEnd = token.right;
2527           var content = [];
2528
2529           // Skip `{`.
2530           pos++;
2531
2532           while (pos < keyframesBlocksEnd) {
2533             if (checkSC(pos)) content = content.concat(getSC());else if (checkKeyframesBlock(pos)) content.push(getKeyframesBlock());
2534           }
2535
2536           var end = getLastPosition(content, line, column, 1);
2537
2538           // Skip `}`.
2539           pos++;
2540
2541           return newNode(type, content, line, column, end);
2542         }
2543
2544         /**
2545          * Check if token is part of a @keyframes rule.
2546          * @param {Number} i Token's index number
2547          * @return {Number} Length of the @keyframes rule
2548          */
2549         function checkKeyframesRule(i) {
2550           var start = i;
2551           var l = void 0;
2552
2553           if (i >= tokensLength) return 0;
2554
2555           if (l = checkAtkeyword(i)) i += l;else return 0;
2556
2557           var atruleName = joinValues2(i - l, l);
2558           if (atruleName.toLowerCase().indexOf('keyframes') === -1) return 0;
2559
2560           if (l = checkSC(i)) i += l;else return 0;
2561
2562           if (l = checkIdent(i)) i += l;else return 0;
2563
2564           if (l = checkSC(i)) i += l;
2565
2566           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
2567
2568           return i - start;
2569         }
2570
2571         /**
2572          * @return {Node}
2573          */
2574         function getKeyframesRule() {
2575           var type = NodeType.AtruleType;
2576           var token = tokens[pos];
2577           var line = token.ln;
2578           var column = token.col;
2579           var content = [].concat(getAtkeyword(), getSC(), getIdent(), getSC(), getKeyframesBlocks());
2580
2581           return newNode(type, content, line, column);
2582         }
2583
2584         /**
2585          * Check a single keyframe selector - `5%`, `from` etc
2586          * @param {Number} i
2587          * @returns {Number}
2588          */
2589         function checkKeyframesSelector(i) {
2590           var start = i;
2591           var l = void 0;
2592
2593           if (i >= tokensLength) return 0;
2594
2595           if (l = checkIdent(i)) {
2596             // Valid selectors are only `from` and `to`.
2597             var selector = joinValues2(i, l);
2598             if (selector !== 'from' && selector !== 'to') return 0;
2599
2600             i += l;
2601             tokens[start].keyframesSelectorType = 1;
2602           } else if (l = checkPercentage(i)) {
2603             i += l;
2604             tokens[start].keyframesSelectorType = 2;
2605           } else {
2606             return 0;
2607           }
2608
2609           return i - start;
2610         }
2611
2612         /**
2613          * Get a single keyframe selector
2614          * @returns {Node}
2615          */
2616         function getKeyframesSelector() {
2617           var keyframesSelectorType = NodeType.KeyframesSelectorType;
2618           var selectorType = NodeType.SelectorType;
2619           var token = tokens[pos];
2620           var line = token.ln;
2621           var column = token.col;
2622           var content = [];
2623
2624           if (token.keyframesSelectorType === 1) {
2625             content.push(getIdent());
2626           } else {
2627             content.push(getPercentage());
2628           }
2629
2630           var keyframesSelector = newNode(keyframesSelectorType, content, line, column);
2631
2632           return newNode(selectorType, [keyframesSelector], line, column);
2633         }
2634
2635         /**
2636          * Check the keyframe's selector groups
2637          * @param {Number} i
2638          * @returns {Number}
2639          */
2640         function checkKeyframesSelectorsGroup(i) {
2641           var start = i;
2642           var l = void 0;
2643
2644           if (l = checkKeyframesSelector(i)) i += l;else return 0;
2645
2646           while (i < tokensLength) {
2647             var spaceBefore = checkSC(i);
2648             var comma = checkDelim(i + spaceBefore);
2649             if (!comma) break;
2650
2651             var spaceAfter = checkSC(i + spaceBefore + comma);
2652             if (l = checkKeyframesSelector(i + spaceBefore + comma + spaceAfter)) {
2653               i += spaceBefore + comma + spaceAfter + l;
2654             } else break;
2655           }
2656
2657           tokens[start].selectorsGroupEnd = i;
2658
2659           return i - start;
2660         }
2661
2662         /**
2663          * Get the keyframe's selector groups
2664          * @returns {Array} An array of keyframe selectors
2665          */
2666         function getKeyframesSelectorsGroup() {
2667           var selectorsGroup = [];
2668           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
2669
2670           selectorsGroup.push(getKeyframesSelector());
2671
2672           while (pos < selectorsGroupEnd) {
2673             selectorsGroup = selectorsGroup.concat(getSC(), getDelim(), getSC(), getKeyframesSelector());
2674           }
2675
2676           return selectorsGroup;
2677         }
2678
2679         /**
2680          * Check if token is a namespace sign (`|`)
2681          * @param {Number} i Token's index number
2682          * @return {Number} `1` if token is `|`, `0` if not
2683          */
2684         function checkNamespace(i) {
2685           return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0;
2686         }
2687
2688         /**
2689          * Get node with a namespace sign
2690          * @return {Node}
2691          */
2692         function getNamespace() {
2693           var type = NodeType.NamespaceType;
2694           var token = tokens[pos];
2695           var line = token.ln;
2696           var column = token.col;
2697           var content = '|';
2698
2699           pos++;
2700
2701           return newNode(type, content, line, column);
2702         }
2703
2704         /**
2705          * @param {Number} i Token's index number
2706          * @return {Number}
2707          */
2708         function checkNmName2(i) {
2709           if (tokens[i].type === TokenType.Identifier) return 1;else if (tokens[i].type !== TokenType.DecimalNumber) return 0;
2710
2711           i++;
2712
2713           return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1;
2714         }
2715
2716         /**
2717          * @return {String}
2718          */
2719         function getNmName2() {
2720           var s = tokens[pos].value;
2721
2722           if (tokens[pos++].type === TokenType.DecimalNumber && pos < tokensLength && tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value;
2723
2724           return s;
2725         }
2726
2727         /**
2728          * Check if token is part of a number
2729          * @param {Number} i Token's index number
2730          * @return {Number} Length of number
2731          */
2732         function checkNumber(i) {
2733           if (i >= tokensLength) return 0;
2734
2735           if (tokens[i].number_l) return tokens[i].number_l;
2736
2737           // `10`:
2738           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && (!tokens[i + 1] || tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop)) {
2739             tokens[i].number_l = 1;
2740             return 1;
2741           }
2742
2743           // `10.`:
2744           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && (!tokens[i + 2] || tokens[i + 2].type !== TokenType.DecimalNumber)) {
2745             tokens[i].number_l = 2;
2746             return 2;
2747           }
2748
2749           // `.10`:
2750           if (i < tokensLength && tokens[i].type === TokenType.FullStop && tokens[i + 1].type === TokenType.DecimalNumber) {
2751             tokens[i].number_l = 2;
2752             return 2;
2753           }
2754
2755           // `10.10`:
2756           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) {
2757             tokens[i].number_l = 3;
2758             return 3;
2759           }
2760
2761           return 0;
2762         }
2763
2764         /**
2765          * Get node with number
2766          * @return {Node}
2767          */
2768         function getNumber() {
2769           var type = NodeType.NumberType;
2770           var token = tokens[pos];
2771           var line = token.ln;
2772           var column = token.col;
2773           var l = tokens[pos].number_l;
2774           var content = '';
2775
2776           for (var j = 0; j < l; j++) {
2777             content += tokens[pos + j].value;
2778           }
2779
2780           pos += l;
2781
2782           return newNode(type, content, line, column);
2783         }
2784
2785         /**
2786          * Check if token is an operator (`/`, `,`, `:`, `=`, `*`).
2787          * @param {Number} i Token's index number
2788          * @return {Number} `1` if token is an operator, otherwise `0`
2789          */
2790         function checkOperator(i) {
2791           if (i >= tokensLength) return 0;
2792
2793           switch (tokens[i].type) {
2794             case TokenType.Solidus:
2795             case TokenType.Comma:
2796             case TokenType.Colon:
2797             case TokenType.EqualsSign:
2798             case TokenType.Asterisk:
2799               return 1;
2800           }
2801
2802           return 0;
2803         }
2804
2805         /**
2806          * Get node with an operator
2807          * @return {Node}
2808          */
2809         function getOperator() {
2810           var type = NodeType.OperatorType;
2811           var token = tokens[pos];
2812           var line = token.ln;
2813           var column = token.col;
2814           var content = token.value;
2815
2816           pos++;
2817
2818           return newNode(type, content, line, column);
2819         }
2820
2821         /**
2822          * Check if token is part of text inside parentheses, e.g. `(1)`
2823          * @param {Number} i Token's index number
2824          * @return {Number}
2825          */
2826         function checkParentheses(i) {
2827           if (i >= tokensLength) return 0;
2828
2829           var start = i;
2830           var right = tokens[i].right;
2831
2832           // Skip `(`.
2833           if (tokens[i].type === TokenType.LeftParenthesis) i++;else return 0;
2834
2835           if (i < right) {
2836             var l = checkTsets(i);
2837             if (l) i += l;else return 0;
2838           }
2839
2840           // Skip `)`.
2841           i++;
2842
2843           return i - start;
2844         }
2845
2846         /**
2847          * Get node with text inside parentheses, e.g. `(1)`
2848          * @return {Node}
2849          */
2850         function getParentheses() {
2851           var type = NodeType.ParenthesesType;
2852           var token = tokens[pos];
2853           var line = token.ln;
2854           var column = token.col;
2855           var right = token.right;
2856           var content = [];
2857
2858           // Skip `(`.
2859           pos++;
2860
2861           if (pos < right) {
2862             content = getTsets();
2863           }
2864
2865           var end = getLastPosition(content, line, column, 1);
2866
2867           // Skip `)`.
2868           pos++;
2869
2870           return newNode(type, content, line, column, end);
2871         }
2872
2873         /**
2874          * Check if token is part of a number with percent sign (e.g. `10%`)
2875          * @param {Number} i Token's index number
2876          * @return {Number}
2877          */
2878         function checkPercentage(i) {
2879           var start = i;
2880           var l = void 0;
2881
2882           if (i >= tokensLength) return 0;
2883
2884           if (l = checkNumber(i)) i += l;else return 0;
2885
2886           if (i >= tokensLength) return 0;
2887
2888           // Skip `%`.
2889           if (tokens[i].type === TokenType.PercentSign) i++;else return 0;
2890
2891           return i - start;
2892         }
2893
2894         /**
2895          * Get node of number with percent sign
2896          * @return {Node}
2897          */
2898         function getPercentage() {
2899           var type = NodeType.PercentageType;
2900           var token = tokens[pos];
2901           var line = token.ln;
2902           var column = token.col;
2903           var content = [getNumber()];
2904           var end = getLastPosition(content, line, column, 1);
2905
2906           // Skip `%`.
2907           pos++;
2908
2909           return newNode(type, content, line, column, end);
2910         }
2911
2912         /**
2913          * @param {Number} i Token's index number
2914          * @return {Number}
2915          */
2916         function checkProgid(i) {
2917           var start = i;
2918           var l = void 0;
2919
2920           if (i >= tokensLength) return 0;
2921
2922           if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6;else return 0;
2923
2924           if (l = checkIdent(i)) i += l;else return 0;
2925
2926           if (l = checkSC(i)) i += l;
2927
2928           if (tokens[i].type === TokenType.LeftParenthesis) {
2929             tokens[start].progid_end = tokens[i].right;
2930             i = tokens[i].right + 1;
2931           } else return 0;
2932
2933           return i - start;
2934         }
2935
2936         /**
2937          * @return {Node}
2938          */
2939         function getProgid() {
2940           var type = NodeType.ProgidType;
2941           var token = tokens[pos];
2942           var line = token.ln;
2943           var column = token.col;
2944           var progid_end = token.progid_end;
2945           var content = joinValues(pos, progid_end);
2946
2947           pos = progid_end + 1;
2948
2949           return newNode(type, content, line, column);
2950         }
2951
2952         /**
2953          * Check if token is part of a property
2954          * @param {Number} i Token's index number
2955          * @return {Number} Length of the property
2956          */
2957         function checkProperty(i) {
2958           var start = i;
2959           var l = void 0;
2960
2961           if (l = checkProperty1(i)) tokens[start].propertyType = 1;else if (l = checkProperty2(i)) tokens[start].propertyType = 2;
2962
2963           return l;
2964         }
2965
2966         /**
2967          * Get node with a property
2968          * @return {Node}
2969          */
2970         function getProperty() {
2971           var type = tokens[pos].propertyType;
2972
2973           if (type === 1) return getProperty1();
2974           if (type === 2) return getProperty2();
2975         }
2976
2977         /**
2978          * Check if token is part of a property
2979          * @param {Number} i Token's index number
2980          * @return {Number} Length of the property
2981          */
2982         function checkProperty1(i) {
2983           var start = i;
2984           var l = void 0;
2985
2986           if (i >= tokensLength) return 0;
2987
2988           if (l = checkIdent(i)) i += l;else return 0;
2989
2990           return i - start;
2991         }
2992
2993         /**
2994          * Get node with a property
2995          * @return {Node}
2996          */
2997         function getProperty1() {
2998           var type = NodeType.PropertyType;
2999           var token = tokens[pos];
3000           var line = token.ln;
3001           var column = token.col;
3002           var content = [getIdent()];
3003
3004           return newNode(type, content, line, column);
3005         }
3006
3007         /**
3008          * Check if token is part of a custom property
3009          * @param {Number} i Token's index number
3010          * @return {Number} Length of the property
3011          */
3012         function checkProperty2(i) {
3013           return checkCustomProperty(i);
3014         }
3015
3016         /**
3017          * Get node with a custom property
3018          * @return {Node}
3019          */
3020         function getProperty2() {
3021           return getCustomProperty();
3022         }
3023
3024         /**
3025          * Check if token is part of a custom property
3026          * @param {Number} i Token's index number
3027          * @return {Number} Length of the property
3028          */
3029         function checkCustomProperty(i) {
3030           var start = i;
3031           var l = void 0;
3032
3033           if (i >= tokensLength) return 0;
3034
3035           if (tokens[i].type !== TokenType.HyphenMinus || tokens[i + 1] && tokens[i + 1].type !== TokenType.HyphenMinus) return 0;
3036
3037           // Skip `--`
3038           i += 2;
3039
3040           if (l = checkIdent(i)) i += l;else return 0;
3041
3042           return i - start;
3043         }
3044
3045         /**
3046          * Get node with a custom property
3047          * @return {Node}
3048          */
3049         function getCustomProperty() {
3050           var type = NodeType.CustomPropertyType;
3051           var token = tokens[pos];
3052           var line = token.ln;
3053           var column = token.col;
3054
3055           // Skip `--`
3056           pos += 2;
3057
3058           var content = [getIdent()];
3059
3060           return newNode(type, content, line, column);
3061         }
3062
3063         /**
3064          * Check if token is a colon
3065          * @param {Number} i Token's index number
3066          * @return {Number} `1` if token is a colon, otherwise `0`
3067          */
3068         function checkPropertyDelim(i) {
3069           return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0;
3070         }
3071
3072         /**
3073          * Get node with a colon
3074          * @return {Node}
3075          */
3076         function getPropertyDelim() {
3077           var type = NodeType.PropertyDelimType;
3078           var token = tokens[pos];
3079           var line = token.ln;
3080           var column = token.col;
3081           var content = ':';
3082
3083           // Skip `:`.
3084           pos++;
3085
3086           return newNode(type, content, line, column);
3087         }
3088
3089         /**
3090          * @param {Number} i Token's index number
3091          * @return {Number}
3092          */
3093         function checkPseudo(i) {
3094           return checkPseudoe(i) || checkPseudoc(i);
3095         }
3096
3097         /**
3098          * @return {Node}
3099          */
3100         function getPseudo() {
3101           if (checkPseudoe(pos)) return getPseudoe();
3102           if (checkPseudoc(pos)) return getPseudoc();
3103         }
3104
3105         /**
3106          * @param {Number} i Token's index number
3107          * @return {Number}
3108          */
3109         function checkPseudoe(i) {
3110           var l = void 0;
3111
3112           // Check `::`
3113           if (i >= tokensLength || tokens[i].type !== TokenType.Colon || i >= tokensLength || tokens[i + 1].type !== TokenType.Colon) return 0;
3114
3115           if (l = checkPseudoElement1(i)) tokens[i].pseudoElementType = 1;else if (l = checkPseudoElement2(i)) tokens[i].pseudoElementType = 2;else return 0;
3116
3117           return l;
3118         }
3119
3120         /**
3121          * @return {Node}
3122          */
3123         function getPseudoe() {
3124           var childType = tokens[pos].pseudoElementType;
3125           if (childType === 1) return getPseudoElement1();
3126           if (childType === 2) return getPseudoElement2();
3127         }
3128
3129         /**
3130          * (1) `::slotted(selector)`
3131          * (2) `::slotted(selector, selector)`
3132          */
3133         function checkPseudoElement1(i) {
3134           var start = i;
3135           var l = void 0;
3136
3137           // Skip `::`.
3138           i += 2;
3139
3140           if (i >= tokensLength) return 0;
3141
3142           if (l = checkIdent(i)) i += l;else return 0;
3143
3144           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
3145
3146           var right = tokens[i].right;
3147
3148           // Skip `(`.
3149           i++;
3150
3151           if (l = checkSC(i)) i += l;
3152
3153           if (l = checkSelectorsGroup(i)) i += l;else return 0;
3154
3155           if (l = checkSC(i)) i += l;
3156
3157           if (i !== right) return 0;
3158
3159           // Skip `)`.
3160           i++;
3161
3162           return i - start;
3163         }
3164
3165         /**
3166          * (1) `::slotted(selector)`
3167          * (2) `::slotted(selector, selector)`
3168          */
3169         function getPseudoElement1() {
3170           var type = NodeType.PseudoeType;
3171           var token = tokens[pos];
3172           var line = token.ln;
3173           var column = token.col;
3174           var content = [];
3175
3176           // Skip `::`.
3177           pos += 2;
3178
3179           content.push(getIdent());
3180
3181           {
3182             var _type = NodeType.ArgumentsType;
3183             var _token = tokens[pos];
3184             var _line = _token.ln;
3185             var _column = _token.col;
3186
3187             // Skip `(`.
3188             pos++;
3189
3190             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
3191
3192             var end = getLastPosition(selectorContent, _line, _column, 1);
3193             var args = newNode(_type, selectorContent, _line, _column, end);
3194             content.push(args);
3195
3196             // Skip `)`.
3197             pos++;
3198           }
3199
3200           return newNode(type, content, line, column);
3201         }
3202
3203         function checkPseudoElement2(i) {
3204           var start = i;
3205           var l = void 0;
3206
3207           // Skip `::`.
3208           i += 2;
3209
3210           if (l = checkIdent(i)) i += l;else return 0;
3211
3212           return i - start;
3213         }
3214
3215         /**
3216          * @return {Node}
3217          */
3218         function getPseudoElement2() {
3219           var type = NodeType.PseudoeType;
3220           var token = tokens[pos];
3221           var line = token.ln;
3222           var column = token.col;
3223
3224           // Skip `::`.
3225           pos += 2;
3226
3227           var content = [getIdent()];
3228
3229           return newNode(type, content, line, column);
3230         }
3231
3232         /**
3233          * @param {Number} i Token's index number
3234          * @return {Number}
3235          */
3236         function checkPseudoc(i) {
3237           var l = void 0;
3238
3239           if (i >= tokensLength || tokens[i].type !== TokenType.Colon) return 0;
3240
3241           if (l = checkPseudoClass1(i)) tokens[i].pseudoClassType = 1;else if (l = checkPseudoClass2(i)) tokens[i].pseudoClassType = 2;else if (l = checkPseudoClass3(i)) tokens[i].pseudoClassType = 3;else if (l = checkPseudoClass4(i)) tokens[i].pseudoClassType = 4;else if (l = checkPseudoClass5(i)) tokens[i].pseudoClassType = 5;else if (l = checkPseudoClass6(i)) tokens[i].pseudoClassType = 6;else return 0;
3242
3243           return l;
3244         }
3245
3246         /**
3247          * @return {Node}
3248          */
3249         function getPseudoc() {
3250           var childType = tokens[pos].pseudoClassType;
3251           if (childType === 1) return getPseudoClass1();
3252           if (childType === 2) return getPseudoClass2();
3253           if (childType === 3) return getPseudoClass3();
3254           if (childType === 4) return getPseudoClass4();
3255           if (childType === 5) return getPseudoClass5();
3256           if (childType === 6) return getPseudoClass6();
3257         }
3258
3259         /**
3260          * (1) `:panda(selector)`
3261          * (2) `:panda(selector, selector)`
3262          */
3263         function checkPseudoClass1(i) {
3264           var start = i;
3265           var l = void 0;
3266
3267           // Skip `:`.
3268           i++;
3269
3270           if (i >= tokensLength) return 0;
3271
3272           if (l = checkIdent(i)) i += l;else return 0;
3273
3274           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
3275
3276           var right = tokens[i].right;
3277
3278           // Skip `(`.
3279           i++;
3280
3281           if (l = checkSC(i)) i += l;
3282
3283           if (l = checkSelectorsGroup(i)) i += l;else return 0;
3284
3285           if (l = checkSC(i)) i += l;
3286
3287           if (i !== right) return 0;
3288
3289           // Skip `)`.
3290           i++;
3291
3292           return i - start;
3293         }
3294
3295         /**
3296          * (-) `:not(panda)`
3297          */
3298         function getPseudoClass1() {
3299           var type = NodeType.PseudocType;
3300           var token = tokens[pos];
3301           var line = token.ln;
3302           var column = token.col;
3303           var content = [];
3304
3305           // Skip `:`.
3306           pos++;
3307
3308           content.push(getIdent());
3309
3310           {
3311             var _type2 = NodeType.ArgumentsType;
3312             var _token2 = tokens[pos];
3313             var _line2 = _token2.ln;
3314             var _column2 = _token2.col;
3315
3316             // Skip `(`.
3317             pos++;
3318
3319             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
3320
3321             var end = getLastPosition(selectorContent, _line2, _column2, 1);
3322             var args = newNode(_type2, selectorContent, _line2, _column2, end);
3323             content.push(args);
3324
3325             // Skip `)`.
3326             pos++;
3327           }
3328
3329           return newNode(type, content, line, column);
3330         }
3331
3332         /**
3333          * (1) `:nth-child(odd)`
3334          * (2) `:nth-child(even)`
3335          * (3) `:lang(de-DE)`
3336          */
3337         function checkPseudoClass2(i) {
3338           var start = i;
3339           var l = void 0;
3340
3341           // Skip `:`.
3342           i++;
3343
3344           if (i >= tokensLength) return 0;
3345
3346           if (l = checkIdent(i)) i += l;else return 0;
3347
3348           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
3349
3350           var right = tokens[i].right;
3351
3352           // Skip `(`.
3353           i++;
3354
3355           if (l = checkSC(i)) i += l;
3356
3357           if (l = checkIdent(i)) i += l;else return 0;
3358
3359           if (l = checkSC(i)) i += l;
3360
3361           if (i !== right) return 0;
3362
3363           // Skip `)`.
3364           i++;
3365
3366           return i - start;
3367         }
3368
3369         function getPseudoClass2() {
3370           var type = NodeType.PseudocType;
3371           var token = tokens[pos];
3372           var line = token.ln;
3373           var column = token.col;
3374           var content = [];
3375
3376           // Skip `:`.
3377           pos++;
3378
3379           content.push(getIdent());
3380
3381           // Skip `(`.
3382           pos++;
3383
3384           var l = tokens[pos].ln;
3385           var c = tokens[pos].col;
3386           var value = [].concat(getSC(), getIdent(), getSC());
3387
3388           var end = getLastPosition(value, l, c, 1);
3389           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
3390           content.push(args);
3391
3392           // Skip `)`.
3393           pos++;
3394
3395           return newNode(type, content, line, column);
3396         }
3397
3398         /**
3399          * (-) `:nth-child(-3n + 2)`
3400          */
3401         function checkPseudoClass3(i) {
3402           var start = i;
3403           var l = void 0;
3404
3405           // Skip `:`.
3406           i++;
3407
3408           if (i >= tokensLength) return 0;
3409
3410           if (l = checkIdent(i)) i += l;else return 0;
3411
3412           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
3413
3414           var right = tokens[i].right;
3415
3416           // Skip `(`.
3417           i++;
3418
3419           if (l = checkSC(i)) i += l;
3420
3421           if (l = checkUnary(i)) i += l;
3422
3423           if (i >= tokensLength) return 0;
3424           if (tokens[i].type === TokenType.DecimalNumber) i++;
3425
3426           if (i >= tokensLength) return 0;
3427           if (tokens[i].value === 'n') i++;else return 0;
3428
3429           if (l = checkSC(i)) i += l;
3430
3431           if (i >= tokensLength) return 0;
3432
3433           if (tokens[i].type === TokenType.PlusSign || tokens[i].type === TokenType.HyphenMinus) i++;else return 0;
3434
3435           if (l = checkSC(i)) i += l;
3436
3437           if (tokens[i].type === TokenType.DecimalNumber) i++;else return 0;
3438
3439           if (l = checkSC(i)) i += l;
3440
3441           if (i !== right) return 0;
3442
3443           // Skip `)`.
3444           i++;
3445
3446           return i - start;
3447         }
3448
3449         function getPseudoClass3() {
3450           var type = NodeType.PseudocType;
3451           var token = tokens[pos];
3452           var line = token.ln;
3453           var column = token.col;
3454           var content = [];
3455
3456           // Skip `:`.
3457           pos++;
3458
3459           content.push(getIdent());
3460
3461           var l = tokens[pos].ln;
3462           var c = tokens[pos].col;
3463           var value = [];
3464
3465           // Skip `(`.
3466           pos++;
3467
3468           value = value.concat(getSC());
3469
3470           if (checkUnary(pos)) value.push(getUnary());
3471           if (checkNumber(pos)) value.push(getNumber());
3472
3473           {
3474             var _l = tokens[pos].ln;
3475             var _c = tokens[pos].col;
3476             var _content = tokens[pos].value;
3477             var ident = newNode(NodeType.IdentType, _content, _l, _c);
3478             value.push(ident);
3479             pos++;
3480           }
3481
3482           value = value.concat(getSC());
3483
3484           if (checkUnary(pos)) value.push(getUnary());
3485
3486           value = value.concat(getSC());
3487
3488           if (checkNumber(pos)) value.push(getNumber());
3489
3490           value = value.concat(getSC());
3491
3492           var end = getLastPosition(value, l, c, 1);
3493           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
3494           content.push(args);
3495
3496           // Skip `)`.
3497           pos++;
3498
3499           return newNode(type, content, line, column);
3500         }
3501
3502         /**
3503          * (-) `:nth-child(-3n)`
3504          */
3505         function checkPseudoClass4(i) {
3506           var start = i;
3507           var l = void 0;
3508
3509           // Skip `:`.
3510           i++;
3511
3512           if (i >= tokensLength) return 0;
3513
3514           if (l = checkIdent(i)) i += l;else return 0;
3515
3516           if (i >= tokensLength) return 0;
3517           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
3518
3519           var right = tokens[i].right;
3520
3521           // Skip `(`.
3522           i++;
3523
3524           if (l = checkSC(i)) i += l;
3525
3526           if (l = checkUnary(i)) i += l;
3527           if (tokens[i].type === TokenType.DecimalNumber) i++;
3528
3529           if (tokens[i].value === 'n') i++;else return 0;
3530
3531           if (l = checkSC(i)) i += l;
3532
3533           if (i !== right) return 0;
3534
3535           // Skip `)`.
3536           i++;
3537
3538           return i - start;
3539         }
3540
3541         function getPseudoClass4() {
3542           var type = NodeType.PseudocType;
3543           var token = tokens[pos];
3544           var line = token.ln;
3545           var column = token.col;
3546           var content = [];
3547
3548           // Skip `:`.
3549           pos++;
3550
3551           content.push(getIdent());
3552
3553           var l = tokens[pos].ln;
3554           var c = tokens[pos].col;
3555           var value = [];
3556
3557           // Skip `(`.
3558           pos++;
3559
3560           value = value.concat(getSC());
3561
3562           if (checkUnary(pos)) value.push(getUnary());
3563           if (checkNumber(pos)) value.push(getNumber());
3564           if (checkIdent(pos)) value.push(getIdent());
3565
3566           value = value.concat(getSC());
3567
3568           var end = getLastPosition(value, l, c, 1);
3569           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
3570           content.push(args);
3571
3572           // Skip `)`.
3573           pos++;
3574
3575           return newNode(type, content, line, column);
3576         }
3577
3578         /**
3579          * (-) `:nth-child(+8)`
3580          */
3581         function checkPseudoClass5(i) {
3582           var start = i;
3583           var l = void 0;
3584
3585           // Skip `:`.
3586           i++;
3587
3588           if (i >= tokensLength) return 0;
3589
3590           if (l = checkIdent(i)) i += l;else return 0;
3591
3592           if (i >= tokensLength) return 0;
3593           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
3594
3595           var right = tokens[i].right;
3596
3597           // Skip `(`.
3598           i++;
3599
3600           if (l = checkSC(i)) i += l;
3601
3602           if (l = checkUnary(i)) i += l;
3603           if (tokens[i].type === TokenType.DecimalNumber) i++;else return 0;
3604
3605           if (l = checkSC(i)) i += l;
3606
3607           if (i !== right) return 0;
3608
3609           // Skip `)`.
3610           i++;
3611
3612           return i - start;
3613         }
3614
3615         function getPseudoClass5() {
3616           var type = NodeType.PseudocType;
3617           var token = tokens[pos];
3618           var line = token.ln;
3619           var column = token.col;
3620           var content = [];
3621
3622           // Skip `:`.
3623           pos++;
3624
3625           content.push(getIdent());
3626
3627           var l = tokens[pos].ln;
3628           var c = tokens[pos].col;
3629           var value = [];
3630
3631           // Skip `(`.
3632           pos++;
3633
3634           value = value.concat(getSC());
3635
3636           if (checkUnary(pos)) value.push(getUnary());
3637           if (checkNumber(pos)) value.push(getNumber());
3638
3639           value = value.concat(getSC());
3640
3641           var end = getLastPosition(value, l, c, 1);
3642           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
3643           content.push(args);
3644
3645           // Skip `)`.
3646           pos++;
3647
3648           return newNode(type, content, line, column);
3649         }
3650
3651         /**
3652          * (-) `:checked`
3653          */
3654         function checkPseudoClass6(i) {
3655           var start = i;
3656           var l = void 0;
3657
3658           // Skip `:`.
3659           i++;
3660
3661           if (i >= tokensLength) return 0;
3662
3663           if (l = checkIdent(i)) i += l;else return 0;
3664
3665           return i - start;
3666         }
3667
3668         function getPseudoClass6() {
3669           var type = NodeType.PseudocType;
3670           var token = tokens[pos];
3671           var line = token.ln;
3672           var column = token.col;
3673
3674           // Skip `:`.
3675           pos++;
3676
3677           var content = [getIdent()];
3678
3679           return newNode(type, content, line, column);
3680         }
3681
3682         /**
3683          * @param {Number} i Token's index number
3684          * @return {Number}
3685          */
3686         function checkRuleset(i) {
3687           var start = i;
3688           var l = void 0;
3689
3690           if (i >= tokensLength) return 0;
3691
3692           if (l = checkSelectorsGroup(i)) i += l;else return 0;
3693
3694           if (l = checkSC(i)) i += l;
3695
3696           if (l = checkBlock(i)) i += l;else return 0;
3697
3698           return i - start;
3699         }
3700
3701         /**
3702          * @return {Node}
3703          */
3704         function getRuleset() {
3705           var type = NodeType.RulesetType;
3706           var token = tokens[pos];
3707           var line = token.ln;
3708           var column = token.col;
3709           var content = [].concat(getSelectorsGroup(), getSC(), getBlock());
3710
3711           return newNode(type, content, line, column);
3712         }
3713
3714         /**
3715          * Check if token is marked as a space (if it's a space or a tab
3716          *      or a line break).
3717          * @param {Number} i
3718          * @return {Number} Number of spaces in a row starting with the given token.
3719          */
3720         function checkS(i) {
3721           return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0;
3722         }
3723
3724         /**
3725          * Get node with spaces
3726          * @return {Node}
3727          */
3728         function getS() {
3729           var type = NodeType.SType;
3730           var token = tokens[pos];
3731           var line = token.ln;
3732           var column = token.col;
3733           var content = joinValues(pos, tokens[pos].ws_last);
3734
3735           pos = tokens[pos].ws_last + 1;
3736
3737           return newNode(type, content, line, column);
3738         }
3739
3740         /**
3741          * Check if token is a space or a comment.
3742          * @param {Number} i Token's index number
3743          * @return {Number} Number of similar (space or comment) tokens
3744          *      in a row starting with the given token.
3745          */
3746         function checkSC(i) {
3747           if (i >= tokensLength) return 0;
3748
3749           var l = void 0;
3750           var lsc = 0;
3751
3752           while (i < tokensLength) {
3753             if (l = checkS(i)) tokens[i].sc_child = 1;else if (l = checkCommentML(i)) tokens[i].sc_child = 2;else break;
3754
3755             i += l;
3756             lsc += l;
3757           }
3758
3759           return lsc || 0;
3760         }
3761
3762         /**
3763          * Get node with spaces and comments
3764          * @return {Array}
3765          */
3766         function getSC() {
3767           var sc = [];
3768
3769           if (pos >= tokensLength) return sc;
3770
3771           while (pos < tokensLength) {
3772             var childType = tokens[pos].sc_child;
3773
3774             if (childType === 1) sc.push(getS());else if (childType === 2) sc.push(getCommentML());else break;
3775           }
3776
3777           return sc;
3778         }
3779
3780         /**
3781          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside
3782          *      a simple selector
3783          * @param {Number} i Token's index number
3784          * @return {Number}
3785          */
3786         function checkShash(i) {
3787           var start = i;
3788           var l = void 0;
3789
3790           if (i >= tokensLength) return 0;
3791
3792           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
3793
3794           if (l = checkIdent(i)) i += l;else return 0;
3795
3796           return i - start;
3797         }
3798
3799         /**
3800          * Get node with a hexadecimal number (e.g. `#fff`) inside a simple
3801          *      selector
3802          * @return {Node}
3803          */
3804         function getShash() {
3805           var type = NodeType.ShashType;
3806           var token = tokens[pos];
3807           var line = token.ln;
3808           var column = token.col;
3809
3810           // Skip `#`.
3811           pos++;
3812
3813           var content = [getIdent()];
3814
3815           return newNode(type, content, line, column);
3816         }
3817
3818         /**
3819          * Check if token is part of a string (text wrapped in quotes)
3820          * @param {Number} i Token's index number
3821          * @return {Number} `1` if token is part of a string, `0` if not
3822          */
3823         function checkString(i) {
3824           if (i >= tokensLength) return 0;
3825
3826           if (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) {
3827             return 1;
3828           }
3829
3830           return 0;
3831         }
3832
3833         /**
3834          * Get string's node
3835          * @return {Array} `['string', x]` where `x` is a string (including
3836          *      quotes).
3837          */
3838         function getString() {
3839           var type = NodeType.StringType;
3840           var token = tokens[pos];
3841           var line = token.ln;
3842           var column = token.col;
3843           var content = token.value;
3844
3845           pos++;
3846
3847           return newNode(type, content, line, column);
3848         }
3849
3850         /**
3851          * Validate stylesheet: it should consist of any number (0 or more) of
3852          * rulesets (sets of rules with selectors), @-rules, whitespaces or
3853          * comments.
3854          * @param {Number} i Token's index number
3855          * @return {Number}
3856          */
3857         function checkStylesheet(i) {
3858           var start = i;
3859           var l = void 0;
3860
3861           while (i < tokensLength) {
3862             if (l = checkSC(i)) tokens[i].stylesheet_child = 1;else if (l = checkRuleset(i)) tokens[i].stylesheet_child = 2;else if (l = checkAtrule(i)) tokens[i].stylesheet_child = 3;else if (l = checkDeclDelim(i)) tokens[i].stylesheet_child = 4;else throwError(i);
3863
3864             i += l;
3865           }
3866
3867           return i - start;
3868         }
3869
3870         /**
3871          * @return {Array} `['stylesheet', x]` where `x` is all stylesheet's
3872          *      nodes.
3873          */
3874         function getStylesheet() {
3875           var type = NodeType.StylesheetType;
3876           var token = tokens[pos];
3877           var line = token.ln;
3878           var column = token.col;
3879           var content = [];
3880
3881           while (pos < tokensLength) {
3882             var childType = tokens[pos].stylesheet_child;
3883
3884             if (childType === 1) content = content.concat(getSC());
3885             if (childType === 2) content.push(getRuleset());
3886             if (childType === 3) content.push(getAtrule());
3887             if (childType === 4) content.push(getDeclDelim());
3888           }
3889
3890           return newNode(type, content, line, column);
3891         }
3892
3893         /**
3894          * @param {Number} i Token's index number
3895          * @return {Number}
3896          */
3897         function checkTset(i) {
3898           var l = void 0;
3899
3900           if (l = checkVhash(i)) tokens[i].tset_child = 1;else if (l = checkAny(i)) tokens[i].tset_child = 2;else if (l = checkSC(i)) tokens[i].tset_child = 3;else if (l = checkOperator(i)) tokens[i].tset_child = 4;
3901
3902           return l;
3903         }
3904
3905         /**
3906          * @return {Array}
3907          */
3908         function getTset() {
3909           var childType = tokens[pos].tset_child;
3910
3911           if (childType === 1) return getVhash();
3912           if (childType === 2) return getAny();
3913           if (childType === 3) return getSC();
3914           if (childType === 4) return getOperator();
3915         }
3916
3917         /**
3918          * @param {Number} i Token's index number
3919          * @return {Number}
3920          */
3921         function checkTsets(i) {
3922           var start = i;
3923           var l = void 0;
3924
3925           if (i >= tokensLength) return 0;
3926
3927           while (l = checkTset(i)) {
3928             i += l;
3929           }
3930
3931           tokens[start].tsets_end = i;
3932           return i - start;
3933         }
3934
3935         /**
3936          * @return {Array}
3937          */
3938         function getTsets() {
3939           var content = [];
3940           var t = void 0;
3941
3942           if (pos >= tokensLength) return content;
3943
3944           var end = tokens[pos].tsets_end;
3945           while (pos < end) {
3946             t = getTset();
3947             if (typeof t.content === 'string') content.push(t);else content = content.concat(t);
3948           }
3949
3950           return content;
3951         }
3952
3953         /**
3954          * Check if token is an unary (arithmetical) sign (`+` or `-`)
3955          * @param {Number} i Token's index number
3956          * @return {Number} `1` if token is an unary sign, `0` if not
3957          */
3958         function checkUnary(i) {
3959           if (i >= tokensLength) return 0;
3960
3961           if (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) {
3962             return 1;
3963           }
3964
3965           return 0;
3966         }
3967
3968         /**
3969          * Get node with an unary (arithmetical) sign (`+` or `-`)
3970          * @return {Array} `['unary', x]` where `x` is an unary sign
3971          *      converted to string.
3972          */
3973         function getUnary() {
3974           var type = NodeType.OperatorType;
3975           var token = tokens[pos];
3976           var line = token.ln;
3977           var column = token.col;
3978           var content = token.value;
3979
3980           pos++;
3981
3982           return newNode(type, content, line, column);
3983         }
3984
3985         /**
3986          * Check if token is a unicode range (single or multiple <urange> nodes)
3987          * @param {number} i Token's index
3988          * @return {number} Unicode range node's length
3989          */
3990         function checkUnicodeRange(i) {
3991           var start = i;
3992           var l = void 0;
3993
3994           if (i >= tokensLength) return 0;
3995
3996           if (l = checkUrange(i)) i += l;else return 0;
3997
3998           while (i < tokensLength) {
3999             var spaceBefore = checkSC(i);
4000             var comma = checkDelim(i + spaceBefore);
4001             if (!comma) break;
4002
4003             var spaceAfter = checkSC(i + spaceBefore + comma);
4004             if (l = checkUrange(i + spaceBefore + comma + spaceAfter)) {
4005               i += spaceBefore + comma + spaceAfter + l;
4006             } else break;
4007           }
4008
4009           return i - start;
4010         }
4011
4012         /**
4013          * Get a unicode range node
4014          * @return {Node}
4015          */
4016         function getUnicodeRange() {
4017           var type = NodeType.UnicodeRangeType;
4018           var token = tokens[pos];
4019           var line = token.ln;
4020           var column = token.col;
4021           var content = [];
4022
4023           while (pos < tokensLength) {
4024             if (checkSC(pos)) content = content.concat(getSC());else if (checkDelim(pos)) content.push(getDelim());else if (checkUrange(pos)) content.push(getUrange());else break;
4025           }
4026
4027           return newNode(type, content, line, column);
4028         }
4029
4030         /**
4031          * Check if token is unit
4032          * @param {Number} i Token's index number
4033          * @return {Number}
4034          */
4035         function checkUnit(i) {
4036           var units = ['em', 'ex', 'ch', 'rem', 'vh', 'vw', 'vmin', 'vmax', 'px', 'mm', 'q', 'cm', 'in', 'pt', 'pc', 'deg', 'grad', 'rad', 'turn', 's', 'ms', 'Hz', 'kHz', 'dpi', 'dpcm', 'dppx'];
4037
4038           return units.indexOf(tokens[i].value) !== -1 ? 1 : 0;
4039         }
4040
4041         /**
4042          * Get unit node of type ident
4043          * @return {Node} An ident node containing the unit value
4044          */
4045         function getUnit() {
4046           var type = NodeType.IdentType;
4047           var token = tokens[pos];
4048           var line = token.ln;
4049           var column = token.col;
4050           var content = token.value;
4051
4052           pos++;
4053
4054           return newNode(type, content, line, column);
4055         }
4056
4057         /**
4058          * Check if token is a u-range (part of a unicode-range)
4059          * (1) `U+416`
4060          * (2) `U+400-4ff`
4061          * (3) `U+4??`
4062          * @param {number} i Token's index
4063          * @return {number} Urange node's length
4064          */
4065         function checkUrange(i) {
4066           var start = i;
4067           var l = void 0;
4068
4069           if (i >= tokensLength) return 0;
4070
4071           // Check for unicode prefix (u+ or U+)
4072           if (tokens[i].value === 'U' || tokens[i].value === 'u') i += 1;else return 0;
4073
4074           if (i >= tokensLength) return 0;
4075
4076           if (tokens[i].value === '+') i += 1;else return 0;
4077
4078           while (i < tokensLength) {
4079             if (l = checkIdent(i)) i += l;else if (l = checkNumber(i)) i += l;else if (l = checkUnary(i)) i += l;else if (l = _checkUnicodeWildcard(i)) i += l;else break;
4080           }
4081
4082           tokens[start].urangeEnd = i - 1;
4083
4084           return i - start;
4085         }
4086
4087         /**
4088          * Get a u-range node (part of a unicode-range)
4089          * @return {Node}
4090          */
4091         function getUrange() {
4092           var startPos = pos;
4093           var type = NodeType.UrangeType;
4094           var token = tokens[pos];
4095           var line = token.ln;
4096           var column = token.col;
4097           var content = [];
4098
4099           content = joinValues(startPos, tokens[startPos].urangeEnd);
4100           pos = tokens[startPos].urangeEnd + 1;
4101
4102           return newNode(type, content, line, column);
4103         }
4104
4105         /**
4106          * Check for unicode wildcard characters `?`
4107          * @param {number} i Token's index
4108          * @return {number} Wildcard length
4109          */
4110         function _checkUnicodeWildcard(i) {
4111           var start = i;
4112
4113           if (i >= tokensLength) return 0;
4114
4115           while (i < tokensLength) {
4116             if (tokens[i].type === TokenType.QuestionMark) i += 1;else break;
4117           }
4118
4119           return i - start;
4120         }
4121
4122         /**
4123          * Check if token is part of URI (e.g. `url('/css/styles.css')`)
4124          * @param {Number} i Token's index number
4125          * @return {Number} Length of URI
4126          */
4127         function checkUri(i) {
4128           var start = i;
4129
4130           if (i >= tokensLength || tokens[i].value !== 'url') return 0;
4131
4132           // Skip `url`.
4133           i++;
4134
4135           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
4136
4137           return tokens[i].right - start + 1;
4138         }
4139
4140         /**
4141          * Get node with URI
4142          * @return {Array} `['uri', x]` where `x` is URI's nodes (without `url`
4143          *      and braces, e.g. `['string', ''/css/styles.css'']`).
4144          */
4145         function getUri() {
4146           var startPos = pos;
4147           var uriExcluding = {};
4148           var uri = void 0;
4149           var l = void 0;
4150           var raw = void 0;
4151
4152           var rawContent = void 0;
4153           var t = void 0;
4154
4155           pos += 2;
4156
4157           uriExcluding[TokenType.Space] = 1;
4158           uriExcluding[TokenType.Tab] = 1;
4159           uriExcluding[TokenType.Newline] = 1;
4160           uriExcluding[TokenType.LeftParenthesis] = 1;
4161           uriExcluding[TokenType.RightParenthesis] = 1;
4162
4163           if (checkUri1(pos)) {
4164             uri = [].concat(getSC(), getString(), getSC());
4165           } else {
4166             uri = checkSC(pos) ? getSC() : [];
4167             l = checkExcluding(uriExcluding, pos);
4168             rawContent = joinValues(pos, pos + l);
4169             t = tokens[pos];
4170             raw = newNode(NodeType.RawType, rawContent, t.ln, t.col);
4171
4172             uri.push(raw);
4173
4174             pos += l + 1;
4175
4176             if (checkSC(pos)) uri = uri.concat(getSC());
4177           }
4178
4179           t = tokens[startPos];
4180           var line = t.ln;
4181           var column = t.col;
4182           var end = getLastPosition(uri, line, column, 1);
4183           pos++;
4184
4185           return newNode(NodeType.UriType, uri, line, column, end);
4186         }
4187
4188         /**
4189          * @param {Number} i Token's index number
4190          * @return {Number}
4191          */
4192         function checkUri1(i) {
4193           var start = i;
4194           var l = void 0;
4195
4196           if (i >= tokensLength) return 0;
4197
4198           if (l = checkSC(i)) i += l;
4199
4200           if (tokens[i].type !== TokenType.StringDQ && tokens[i].type !== TokenType.StringSQ) return 0;
4201
4202           i++;
4203
4204           if (l = checkSC(i)) i += l;
4205
4206           return i - start;
4207         }
4208
4209         /**
4210          * Check if token is part of a value
4211          * @param {Number} i Token's index number
4212          * @return {Number} Length of the value
4213          */
4214         function checkValue(i) {
4215           var start = i;
4216           var l = void 0;
4217           var s = void 0;
4218           var _i = void 0;
4219
4220           while (i < tokensLength) {
4221             s = checkSC(i);
4222             _i = i + s;
4223
4224             if (l = _checkValue(_i)) i += l + s;else break;
4225           }
4226
4227           tokens[start].value_end = i;
4228
4229           return i - start;
4230         }
4231
4232         /**
4233          * @return {Array}
4234          */
4235         function getValue() {
4236           var type = NodeType.ValueType;
4237           var token = tokens[pos];
4238           var line = token.ln;
4239           var column = token.col;
4240           var end = tokens[pos].value_end;
4241           var content = [];
4242
4243           while (pos < end) {
4244             if (tokens[pos].value_child) content.push(_getValue());else content = content.concat(getSC());
4245           }
4246
4247           return newNode(type, content, line, column);
4248         }
4249
4250         /**
4251          * @param {Number} i Token's index number
4252          * @return {Number}
4253          */
4254         function _checkValue(i) {
4255           var l = void 0;
4256
4257           if (l = checkProgid(i)) tokens[i].value_child = 1;else if (l = checkVhash(i)) tokens[i].value_child = 2;else if (l = checkAny(i)) tokens[i].value_child = 3;else if (l = checkOperator(i)) tokens[i].value_child = 4;else if (l = checkImportant(i)) tokens[i].value_child = 5;
4258
4259           return l;
4260         }
4261
4262         /**
4263          * @return {Array}
4264          */
4265         function _getValue() {
4266           var childType = tokens[pos].value_child;
4267           if (childType === 1) return getProgid();
4268           if (childType === 2) return getVhash();
4269           if (childType === 3) return getAny();
4270           if (childType === 4) return getOperator();
4271           if (childType === 5) return getImportant();
4272         }
4273
4274         /**
4275          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside
4276          *      some value
4277          * @param {Number} i Token's index number
4278          * @return {Number}
4279          */
4280         function checkVhash(i) {
4281           var start = i;
4282           var l = void 0;
4283
4284           if (i >= tokensLength) return 0;
4285
4286           // Skip `#`.
4287           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
4288
4289           if (l = checkNmName2(i)) i += l;else return 0;
4290
4291           return i - start;
4292         }
4293
4294         /**
4295          * Get node with a hexadecimal number (e.g. `#fff`) inside some value
4296          * @return {Array} `['vhash', x]` where `x` is a hexadecimal number
4297          *      converted to string (without `#`, e.g. `'fff'`).
4298          */
4299         function getVhash() {
4300           var type = NodeType.VhashType;
4301           var token = tokens[pos];
4302           var line = token.ln;
4303           var column = token.col;
4304
4305           // Skip `#`.
4306           pos++;
4307
4308           var content = getNmName2();
4309           var end = getLastPosition(content, line, column + 1);
4310           return newNode(type, content, line, column, end);
4311         }
4312
4313         function checkSelectorsGroup(i) {
4314           if (i >= tokensLength) return 0;
4315
4316           var start = i;
4317           var l = void 0;
4318           var selectorCounter = 0;
4319           var delimCounter = 0;
4320
4321           if (l = checkSelector(i)) {
4322             i += l;
4323             selectorCounter++;
4324           } else return 0;
4325
4326           while (i < tokensLength) {
4327             var tempStart = i;
4328             var tempIndex = i;
4329             var tempLength = void 0;
4330
4331             var spaceBefore = checkSC(tempIndex);
4332
4333             if (tempLength = checkDelim(tempIndex + spaceBefore)) {
4334               tempIndex += spaceBefore + tempLength;
4335               delimCounter++;
4336
4337               if (tempLength = checkSC(tempIndex)) tempIndex += tempLength;
4338               if (tempLength = checkSelector(tempIndex)) {
4339                 tempIndex += tempLength;
4340                 selectorCounter++;
4341               }
4342             } else break;
4343
4344             i += tempIndex - tempStart;
4345           }
4346
4347           tokens[start].selectorsGroupEnd = i;
4348           tokens[start].selectorsGroupSelectorCount = selectorCounter;
4349           tokens[start].selectorsGroupDelimCount = delimCounter;
4350
4351           return i - start;
4352         }
4353
4354         function getSelectorsGroup() {
4355           var selectorsGroup = [];
4356           var selectorCounter = 0;
4357           var delimCounter = 0;
4358
4359           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
4360           var selectorCount = tokens[pos].selectorsGroupSelectorCount;
4361           var delimCount = tokens[pos].selectorsGroupDelimCount;
4362
4363           selectorsGroup.push(getSelector());
4364           selectorCounter++;
4365
4366           while (pos < selectorsGroupEnd) {
4367             if (delimCounter < delimCount) {
4368               selectorsGroup = selectorsGroup.concat(getSC());
4369               selectorsGroup = selectorsGroup.concat(getDelim());
4370               delimCounter++;
4371
4372               selectorsGroup = selectorsGroup.concat(getSC());
4373
4374               if (selectorCounter < selectorCount) {
4375                 selectorsGroup = selectorsGroup.concat(getSelector());
4376                 selectorCounter++;
4377               }
4378             }
4379           }
4380
4381           return selectorsGroup;
4382         }
4383
4384         function checkSelector(i) {
4385           if (i >= tokensLength) return 0;
4386
4387           var start = i;
4388           var l = void 0;
4389
4390           if (l = checkCompoundSelector(i)) i += l;else return 0;
4391
4392           while (i < tokensLength) {
4393             var spaceBefore = checkSC(i);
4394             var comma = checkCombinator(i + spaceBefore);
4395             if (!spaceBefore && !comma) break;
4396
4397             var spaceAfter = checkSC(i + spaceBefore + comma);
4398             if (l = checkCompoundSelector(i + spaceBefore + comma + spaceAfter)) {
4399               i += spaceBefore + comma + spaceAfter + l;
4400             } else break;
4401           }
4402
4403           tokens[start].selectorEnd = i;
4404           return i - start;
4405         }
4406
4407         function getSelector() {
4408           var type = NodeType.SelectorType;
4409           var token = tokens[pos];
4410           var line = token.ln;
4411           var column = token.col;
4412           var selectorEnd = token.selectorEnd;
4413           var content = getCompoundSelector();
4414
4415           while (pos < selectorEnd) {
4416             content = content.concat(getSC());
4417             if (checkCombinator(pos)) content.push(getCombinator());
4418             content = content.concat(getSC(), getCompoundSelector());
4419           }
4420
4421           return newNode(type, content, line, column);
4422         }
4423
4424         function checkCompoundSelector(i) {
4425           var l = void 0;
4426
4427           if (l = checkCompoundSelector1(i)) {
4428             tokens[i].compoundSelectorType = 1;
4429           } else if (l = checkCompoundSelector2(i)) {
4430             tokens[i].compoundSelectorType = 2;
4431           }
4432
4433           return l;
4434         }
4435
4436         function getCompoundSelector() {
4437           var type = tokens[pos].compoundSelectorType;
4438           if (type === 1) return getCompoundSelector1();
4439           if (type === 2) return getCompoundSelector2();
4440         }
4441
4442         function checkCompoundSelector1(i) {
4443           if (i >= tokensLength) return 0;
4444
4445           var start = i;
4446           var l = void 0;
4447
4448           if (l = checkUniversalSelector(i) || checkTypeSelector(i)) i += l;else return 0;
4449
4450           while (i < tokensLength) {
4451             var _l2 = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i);
4452             if (_l2) i += _l2;else break;
4453           }
4454
4455           tokens[start].compoundSelectorEnd = i;
4456
4457           return i - start;
4458         }
4459
4460         function getCompoundSelector1() {
4461           var sequence = [];
4462           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
4463
4464           if (checkUniversalSelector(pos)) sequence.push(getUniversalSelector());else sequence.push(getTypeSelector());
4465
4466           while (pos < compoundSelectorEnd) {
4467             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());
4468           }
4469
4470           return sequence;
4471         }
4472
4473         function checkCompoundSelector2(i) {
4474           if (i >= tokensLength) return 0;
4475
4476           var start = i;
4477
4478           while (i < tokensLength) {
4479             var l = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i);
4480
4481             if (l) i += l;else break;
4482           }
4483
4484           tokens[start].compoundSelectorEnd = i;
4485
4486           return i - start;
4487         }
4488
4489         function getCompoundSelector2() {
4490           var sequence = [];
4491           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
4492
4493           while (pos < compoundSelectorEnd) {
4494             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());else break;
4495           }
4496
4497           return sequence;
4498         }
4499
4500         function checkUniversalSelector(i) {
4501           if (i >= tokensLength) return 0;
4502
4503           var start = i;
4504           var l = void 0;
4505
4506           if (l = checkNamePrefix(i)) i += l;
4507
4508           if (tokens[i].type === TokenType.Asterisk) i++;else return 0;
4509
4510           return i - start;
4511         }
4512
4513         function getUniversalSelector() {
4514           var type = NodeType.UniversalSelectorType;
4515           var token = tokens[pos];
4516           var line = token.ln;
4517           var column = token.col;
4518           var content = [];
4519           var end = void 0;
4520
4521           if (checkNamePrefix(pos)) {
4522             content.push(getNamePrefix());
4523             end = getLastPosition(content, line, column, 1);
4524           }
4525
4526           pos++;
4527
4528           return newNode(type, content, line, column, end);
4529         }
4530
4531         function checkTypeSelector(i) {
4532           if (i >= tokensLength) return 0;
4533
4534           var start = i;
4535           var l = void 0;
4536
4537           if (l = checkNamePrefix(i)) i += l;
4538
4539           if (l = checkIdent(i)) i += l;else return 0;
4540
4541           return i - start;
4542         }
4543
4544         function getTypeSelector() {
4545           var type = NodeType.TypeSelectorType;
4546           var token = tokens[pos];
4547           var line = token.ln;
4548           var column = token.col;
4549           var content = [];
4550
4551           if (checkNamePrefix(pos)) content.push(getNamePrefix());
4552
4553           content.push(getIdent());
4554
4555           return newNode(type, content, line, column);
4556         }
4557
4558         function checkAttributeSelector(i) {
4559           var l = void 0;
4560           if (l = checkAttributeSelector1(i)) tokens[i].attributeSelectorType = 1;else if (l = checkAttributeSelector2(i)) tokens[i].attributeSelectorType = 2;
4561
4562           return l;
4563         }
4564
4565         function getAttributeSelector() {
4566           var type = tokens[pos].attributeSelectorType;
4567           if (type === 1) return getAttributeSelector1();else return getAttributeSelector2();
4568         }
4569
4570         /**
4571          * (1) `[panda=nani]`
4572          * (2) `[panda='nani']`
4573          * (3) `[panda='nani' i]`
4574          *
4575          */
4576         function checkAttributeSelector1(i) {
4577           var start = i;
4578
4579           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
4580
4581           var l = void 0;
4582           if (l = checkSC(i)) i += l;
4583
4584           if (l = checkAttributeName(i)) i += l;else return 0;
4585
4586           if (l = checkSC(i)) i += l;
4587
4588           if (l = checkAttributeMatch(i)) i += l;else return 0;
4589
4590           if (l = checkSC(i)) i += l;
4591
4592           if (l = checkAttributeValue(i)) i += l;else return 0;
4593
4594           if (l = checkSC(i)) i += l;
4595
4596           if (l = checkAttributeFlags(i)) {
4597             i += l;
4598             if (l = checkSC(i)) i += l;
4599           }
4600
4601           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
4602
4603           return i - start;
4604         }
4605
4606         function getAttributeSelector1() {
4607           var type = NodeType.AttributeSelectorType;
4608           var token = tokens[pos];
4609           var line = token.ln;
4610           var column = token.col;
4611           var content = [];
4612
4613           // Skip `[`.
4614           pos++;
4615
4616           content = content.concat(getSC(), getAttributeName(), getSC(), getAttributeMatch(), getSC(), getAttributeValue(), getSC());
4617
4618           if (checkAttributeFlags(pos)) {
4619             content.push(getAttributeFlags());
4620             content = content.concat(getSC());
4621           }
4622
4623           // Skip `]`.
4624           pos++;
4625
4626           var end = getLastPosition(content, line, column, 1);
4627           return newNode(type, content, line, column, end);
4628         }
4629
4630         /**
4631          * (1) `[panda]`
4632          */
4633         function checkAttributeSelector2(i) {
4634           var start = i;
4635
4636           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
4637
4638           var l = void 0;
4639           if (l = checkSC(i)) i += l;
4640
4641           if (l = checkAttributeName(i)) i += l;else return 0;
4642
4643           if (l = checkSC(i)) i += l;
4644
4645           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
4646
4647           return i - start;
4648         }
4649
4650         function getAttributeSelector2() {
4651           var type = NodeType.AttributeSelectorType;
4652           var token = tokens[pos];
4653           var line = token.ln;
4654           var column = token.col;
4655           var content = [];
4656
4657           // Skip `[`.
4658           pos++;
4659
4660           content = content.concat(getSC(), getAttributeName(), getSC());
4661
4662           // Skip `]`.
4663           pos++;
4664
4665           var end = getLastPosition(content, line, column, 1);
4666           return newNode(type, content, line, column, end);
4667         }
4668
4669         function checkAttributeName(i) {
4670           var start = i;
4671           var l = void 0;
4672
4673           if (l = checkNamePrefix(i)) i += l;
4674
4675           if (l = checkIdent(i)) i += l;else return 0;
4676
4677           return i - start;
4678         }
4679
4680         function getAttributeName() {
4681           var type = NodeType.AttributeNameType;
4682           var token = tokens[pos];
4683           var line = token.ln;
4684           var column = token.col;
4685           var content = [];
4686
4687           if (checkNamePrefix(pos)) content.push(getNamePrefix());
4688           content.push(getIdent());
4689
4690           return newNode(type, content, line, column);
4691         }
4692
4693         function checkAttributeMatch(i) {
4694           var l = void 0;
4695           if (l = checkAttributeMatch1(i)) tokens[i].attributeMatchType = 1;else if (l = checkAttributeMatch2(i)) tokens[i].attributeMatchType = 2;
4696
4697           return l;
4698         }
4699
4700         function getAttributeMatch() {
4701           var type = tokens[pos].attributeMatchType;
4702           if (type === 1) return getAttributeMatch1();else return getAttributeMatch2();
4703         }
4704
4705         function checkAttributeMatch1(i) {
4706           var start = i;
4707
4708           var type = tokens[i].type;
4709           if (type === TokenType.Tilde || type === TokenType.VerticalLine || type === TokenType.CircumflexAccent || type === TokenType.DollarSign || type === TokenType.Asterisk) i++;else return 0;
4710
4711           if (tokens[i].type === TokenType.EqualsSign) i++;else return 0;
4712
4713           return i - start;
4714         }
4715
4716         function getAttributeMatch1() {
4717           var type = NodeType.AttributeMatchType;
4718           var token = tokens[pos];
4719           var line = token.ln;
4720           var column = token.col;
4721           var content = tokens[pos].value + tokens[pos + 1].value;
4722           pos += 2;
4723
4724           return newNode(type, content, line, column);
4725         }
4726
4727         function checkAttributeMatch2(i) {
4728           if (tokens[i].type === TokenType.EqualsSign) return 1;else return 0;
4729         }
4730
4731         function getAttributeMatch2() {
4732           var type = NodeType.AttributeMatchType;
4733           var token = tokens[pos];
4734           var line = token.ln;
4735           var column = token.col;
4736           var content = '=';
4737
4738           pos++;
4739           return newNode(type, content, line, column);
4740         }
4741
4742         function checkAttributeValue(i) {
4743           return checkString(i) || checkIdent(i);
4744         }
4745
4746         function getAttributeValue() {
4747           var type = NodeType.AttributeValueType;
4748           var token = tokens[pos];
4749           var line = token.ln;
4750           var column = token.col;
4751           var content = [];
4752
4753           if (checkString(pos)) content.push(getString());else content.push(getIdent());
4754
4755           return newNode(type, content, line, column);
4756         }
4757
4758         function checkAttributeFlags(i) {
4759           return checkIdent(i);
4760         }
4761
4762         function getAttributeFlags() {
4763           var type = NodeType.AttributeFlagsType;
4764           var token = tokens[pos];
4765           var line = token.ln;
4766           var column = token.col;
4767           var content = [getIdent()];
4768
4769           return newNode(type, content, line, column);
4770         }
4771
4772         function checkNamePrefix(i) {
4773           if (i >= tokensLength) return 0;
4774
4775           var l = void 0;
4776           if (l = checkNamePrefix1(i)) tokens[i].namePrefixType = 1;else if (l = checkNamePrefix2(i)) tokens[i].namePrefixType = 2;
4777
4778           return l;
4779         }
4780
4781         function getNamePrefix() {
4782           var type = tokens[pos].namePrefixType;
4783           if (type === 1) return getNamePrefix1();else return getNamePrefix2();
4784         }
4785
4786         /**
4787          * (1) `panda|`
4788          * (2) `panda<comment>|`
4789          */
4790         function checkNamePrefix1(i) {
4791           var start = i;
4792           var l = void 0;
4793
4794           if (l = checkNamespacePrefix(i)) i += l;else return 0;
4795
4796           if (l = checkCommentML(i)) i += l;
4797
4798           if (l = checkNamespaceSeparator(i)) i += l;else return 0;
4799
4800           return i - start;
4801         }
4802
4803         function getNamePrefix1() {
4804           var type = NodeType.NamePrefixType;
4805           var token = tokens[pos];
4806           var line = token.ln;
4807           var column = token.col;
4808           var content = [];
4809
4810           content.push(getNamespacePrefix());
4811
4812           if (checkCommentML(pos)) content.push(getCommentML());
4813
4814           content.push(getNamespaceSeparator());
4815
4816           return newNode(type, content, line, column);
4817         }
4818
4819         /**
4820          * (1) `|`
4821          */
4822         function checkNamePrefix2(i) {
4823           return checkNamespaceSeparator(i);
4824         }
4825
4826         function getNamePrefix2() {
4827           var type = NodeType.NamePrefixType;
4828           var token = tokens[pos];
4829           var line = token.ln;
4830           var column = token.col;
4831           var content = [getNamespaceSeparator()];
4832
4833           return newNode(type, content, line, column);
4834         }
4835
4836         /**
4837          * (1) `*`
4838          * (2) `panda`
4839          */
4840         function checkNamespacePrefix(i) {
4841           if (i >= tokensLength) return 0;
4842
4843           var l = void 0;
4844
4845           if (tokens[i].type === TokenType.Asterisk) return 1;else if (l = checkIdent(i)) return l;else return 0;
4846         }
4847
4848         function getNamespacePrefix() {
4849           var type = NodeType.NamespacePrefixType;
4850           var token = tokens[pos];
4851           var line = token.ln;
4852           var column = token.col;
4853           var content = [];
4854
4855           if (token.type === TokenType.Asterisk) {
4856             var asteriskNode = newNode(NodeType.IdentType, '*', line, column);
4857             content.push(asteriskNode);
4858             pos++;
4859           } else if (checkIdent(pos)) content.push(getIdent());
4860
4861           return newNode(type, content, line, column);
4862         }
4863
4864         /**
4865          * (1) `|`
4866          */
4867         function checkNamespaceSeparator(i) {
4868           if (i >= tokensLength) return 0;
4869
4870           if (tokens[i].type !== TokenType.VerticalLine) return 0;
4871
4872           // Return false if `|=` - [attr|=value]
4873           if (tokens[i + 1] && tokens[i + 1].type === TokenType.EqualsSign) return 0;
4874
4875           return 1;
4876         }
4877
4878         function getNamespaceSeparator() {
4879           var type = NodeType.NamespaceSeparatorType;
4880           var token = tokens[pos];
4881           var line = token.ln;
4882           var column = token.col;
4883           var content = '|';
4884
4885           pos++;
4886           return newNode(type, content, line, column);
4887         }
4888
4889         module.exports = function (_tokens, context) {
4890           tokens = _tokens;
4891           tokensLength = tokens.length;
4892           pos = 0;
4893
4894           return contexts[context]();
4895         };
4896
4897 /***/ }),
4898 /* 15 */
4899 /***/ (function(module, exports) {
4900
4901         'use strict';
4902
4903         module.exports = {
4904           ArgumentsType: 'arguments',
4905           AtkeywordType: 'atkeyword',
4906           AtruleType: 'atrule',
4907           AttributeSelectorType: 'attributeSelector',
4908           AttributeNameType: 'attributeName',
4909           AttributeFlagsType: 'attributeFlags',
4910           AttributeMatchType: 'attributeMatch',
4911           AttributeValueType: 'attributeValue',
4912           BlockType: 'block',
4913           BracketsType: 'brackets',
4914           ClassType: 'class',
4915           CombinatorType: 'combinator',
4916           CommentMLType: 'multilineComment',
4917           CommentSLType: 'singlelineComment',
4918           ConditionType: 'condition',
4919           ConditionalStatementType: 'conditionalStatement',
4920           CustomPropertyType: 'customProperty',
4921           DeclarationType: 'declaration',
4922           DeclDelimType: 'declarationDelimiter',
4923           DefaultType: 'default',
4924           DelimType: 'delimiter',
4925           DimensionType: 'dimension',
4926           EscapedStringType: 'escapedString',
4927           ExtendType: 'extend',
4928           ExpressionType: 'expression',
4929           FunctionType: 'function',
4930           FunctionsListType: 'functionsList',
4931           GlobalType: 'global',
4932           IdentType: 'ident',
4933           ImportantType: 'important',
4934           IncludeType: 'include',
4935           InterpolationType: 'interpolation',
4936           InterpolatedVariableType: 'interpolatedVariable',
4937           KeyframesSelectorType: 'keyframesSelector',
4938           LoopType: 'loop',
4939           MixinType: 'mixin',
4940           NamePrefixType: 'namePrefix',
4941           NamespacePrefixType: 'namespacePrefix',
4942           NamespaceSeparatorType: 'namespaceSeparator',
4943           NumberType: 'number',
4944           OperatorType: 'operator',
4945           OptionalType: 'optional',
4946           ParenthesesType: 'parentheses',
4947           ParentSelectorType: 'parentSelector',
4948           ParentSelectorExtensionType: 'parentSelectorExtension',
4949           PercentageType: 'percentage',
4950           PlaceholderType: 'placeholder',
4951           ProgidType: 'progid',
4952           PropertyType: 'property',
4953           PropertyDelimType: 'propertyDelimiter',
4954           PseudocType: 'pseudoClass',
4955           PseudoeType: 'pseudoElement',
4956           RawType: 'raw',
4957           RulesetType: 'ruleset',
4958           SType: 'space',
4959           SelectorType: 'selector',
4960           ShashType: 'id',
4961           StringType: 'string',
4962           StylesheetType: 'stylesheet',
4963           TypeSelectorType: 'typeSelector',
4964           UnicodeRangeType: 'unicodeRange',
4965           UniversalSelectorType: 'universalSelector',
4966           UriType: 'uri',
4967           UrangeType: 'urange',
4968           ValueType: 'value',
4969           VariableType: 'variable',
4970           VariablesListType: 'variablesList',
4971           VhashType: 'color'
4972         };
4973
4974 /***/ }),
4975 /* 16 */
4976 /***/ (function(module, exports, __webpack_require__) {
4977
4978         'use strict';
4979
4980         module.exports = function (css, tabSize) {
4981           var TokenType = __webpack_require__(13);
4982
4983           var tokens = [];
4984           var urlMode = false;
4985           var blockMode = 0;
4986           var pos = 0;
4987           var tn = 0;
4988           var ln = 1;
4989           var col = 1;
4990           var cssLength = 0;
4991
4992           var Punctuation = {
4993             ' ': TokenType.Space,
4994             '\n': TokenType.Newline,
4995             '\r': TokenType.Newline,
4996             '\t': TokenType.Tab,
4997             '!': TokenType.ExclamationMark,
4998             '"': TokenType.QuotationMark,
4999             '#': TokenType.NumberSign,
5000             '$': TokenType.DollarSign,
5001             '%': TokenType.PercentSign,
5002             '&': TokenType.Ampersand,
5003             '\'': TokenType.Apostrophe,
5004             '(': TokenType.LeftParenthesis,
5005             ')': TokenType.RightParenthesis,
5006             '*': TokenType.Asterisk,
5007             '+': TokenType.PlusSign,
5008             ',': TokenType.Comma,
5009             '-': TokenType.HyphenMinus,
5010             '.': TokenType.FullStop,
5011             '/': TokenType.Solidus,
5012             ':': TokenType.Colon,
5013             ';': TokenType.Semicolon,
5014             '<': TokenType.LessThanSign,
5015             '=': TokenType.EqualsSign,
5016             '>': TokenType.GreaterThanSign,
5017             '?': TokenType.QuestionMark,
5018             '@': TokenType.CommercialAt,
5019             '[': TokenType.LeftSquareBracket,
5020             ']': TokenType.RightSquareBracket,
5021             '^': TokenType.CircumflexAccent,
5022             '_': TokenType.LowLine,
5023             '{': TokenType.LeftCurlyBracket,
5024             '|': TokenType.VerticalLine,
5025             '}': TokenType.RightCurlyBracket,
5026             '~': TokenType.Tilde
5027           };
5028
5029           /**
5030            * Add a token to the token list
5031            * @param {string} type
5032            * @param {string} value
5033            */
5034           function pushToken(type, value, column) {
5035             tokens.push({
5036               tn: tn++,
5037               ln: ln,
5038               col: column,
5039               type: type,
5040               value: value
5041             });
5042           }
5043
5044           /**
5045            * Check if a character is a decimal digit
5046            * @param {string} c Character
5047            * @returns {boolean}
5048            */
5049           function isDecimalDigit(c) {
5050             return '0123456789'.indexOf(c) >= 0;
5051           }
5052
5053           /**
5054            * Parse spaces
5055            * @param {string} css Unparsed part of CSS string
5056            */
5057           function parseSpaces(css) {
5058             var start = pos;
5059
5060             // Read the string until we meet a non-space character:
5061             for (; pos < cssLength; pos++) {
5062               if (css.charAt(pos) !== ' ') break;
5063             }
5064
5065             // Add a substring containing only spaces to tokens:
5066             pushToken(TokenType.Space, css.substring(start, pos--), col);
5067             col += pos - start;
5068           }
5069
5070           /**
5071            * Parse a string within quotes
5072            * @param {string} css Unparsed part of CSS string
5073            * @param {string} q Quote (either `'` or `"`)
5074            */
5075           function parseString(css, q) {
5076             var start = pos;
5077
5078             // Read the string until we meet a matching quote:
5079             for (pos++; pos < cssLength; pos++) {
5080               // Skip escaped quotes:
5081               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) === q) break;
5082             }
5083
5084             // Add the string (including quotes) to tokens:
5085             pushToken(q === '"' ? TokenType.StringDQ : TokenType.StringSQ, css.substring(start, pos + 1), col);
5086             col += pos - start;
5087           }
5088
5089           /**
5090            * Parse numbers
5091            * @param {string} css Unparsed part of CSS string
5092            */
5093           function parseDecimalNumber(css) {
5094             var start = pos;
5095
5096             // Read the string until we meet a character that's not a digit:
5097             for (; pos < cssLength; pos++) {
5098               if (!isDecimalDigit(css.charAt(pos))) break;
5099             }
5100
5101             // Add the number to tokens:
5102             pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col);
5103             col += pos - start;
5104           }
5105
5106           /**
5107            * Parse identifier
5108            * @param {string} css Unparsed part of CSS string
5109            */
5110           function parseIdentifier(css) {
5111             var start = pos;
5112
5113             // Skip all opening slashes:
5114             while (css.charAt(pos) === '/') {
5115               pos++;
5116             } // Read the string until we meet a punctuation mark:
5117             for (; pos < cssLength; pos++) {
5118               // Skip all '\':
5119               if (css.charAt(pos) === '\\') pos++;else if (Punctuation[css.charAt(pos)]) break;
5120             }
5121
5122             var ident = css.substring(start, pos--);
5123
5124             // Enter url mode if parsed substring is `url`:
5125             urlMode = urlMode || ident === 'url';
5126
5127             // Add identifier to tokens:
5128             pushToken(TokenType.Identifier, ident, col);
5129             col += pos - start;
5130           }
5131
5132           /**
5133           * Parse a multiline comment
5134           * @param {string} css Unparsed part of CSS string
5135           */
5136           function parseMLComment(css) {
5137             var start = pos;
5138
5139             // Read the string until we meet `*/`.
5140             // Since we already know first 2 characters (`/*`), start reading
5141             // from `pos + 2`:
5142             for (pos = pos + 2; pos < cssLength; pos++) {
5143               if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') {
5144                 pos++;
5145                 break;
5146               }
5147             }
5148
5149             // Add full comment (including `/*` and `*/`) to the list of tokens:
5150             var comment = css.substring(start, pos + 1);
5151             pushToken(TokenType.CommentML, comment, col);
5152
5153             var newlines = comment.split('\n');
5154             if (newlines.length > 1) {
5155               ln += newlines.length - 1;
5156               col = newlines[newlines.length - 1].length;
5157             } else {
5158               col += pos - start;
5159             }
5160           }
5161
5162           function parseSLComment(css) {
5163             var start = pos;
5164
5165             // Read the string until we meet line break.
5166             // Since we already know first 2 characters (`//`), start reading
5167             // from `pos + 2`:
5168             for (pos += 2; pos < cssLength; pos++) {
5169               if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') {
5170                 break;
5171               }
5172             }
5173
5174             // Add comment (including `//` and line break) to the list of tokens:
5175             pushToken(TokenType.CommentSL, css.substring(start, pos--), col);
5176             col += pos - start;
5177           }
5178
5179           /**
5180            * Convert a CSS string to a list of tokens
5181            * @param {string} css CSS string
5182            * @returns {Array} List of tokens
5183            * @private
5184            */
5185           function getTokens(css) {
5186             var c; // Current character
5187             var cn; // Next character
5188
5189             cssLength = css.length;
5190
5191             // Parse string, character by character:
5192             for (pos = 0; pos < cssLength; col++, pos++) {
5193               c = css.charAt(pos);
5194               cn = css.charAt(pos + 1);
5195
5196               // If we meet `/*`, it's a start of a multiline comment.
5197               // Parse following characters as a multiline comment:
5198               if (c === '/' && cn === '*') {
5199                 parseMLComment(css);
5200               }
5201
5202               // If we meet `//` and it is not a part of url:
5203               else if (!urlMode && c === '/' && cn === '/') {
5204                   // If we're currently inside a block, treat `//` as a start
5205                   // of identifier. Else treat `//` as a start of a single-line
5206                   // comment:
5207                   if (blockMode > 0) parseIdentifier(css);else parseSLComment(css);
5208                 }
5209
5210                 // If current character is a double or single quote, it's a start
5211                 // of a string:
5212                 else if (c === '"' || c === "'") {
5213                     parseString(css, c);
5214                   }
5215
5216                   // If current character is a space:
5217                   else if (c === ' ') {
5218                       parseSpaces(css);
5219                     }
5220
5221                     // If current character is a punctuation mark:
5222                     else if (Punctuation[c]) {
5223                         // Add it to the list of tokens:
5224                         pushToken(Punctuation[c], c, col);
5225                         if (c === '\n' || c === '\r') {
5226                           ln++;
5227                           col = 0;
5228                         } // Go to next line
5229                         else if (c === ')') urlMode = false; // Exit url mode
5230                           else if (c === '{') blockMode++; // Enter a block
5231                             else if (c === '}') blockMode--; // Exit a block
5232                               else if (c === '\t' && tabSize > 1) col += tabSize - 1;
5233                       }
5234
5235                       // If current character is a decimal digit:
5236                       else if (isDecimalDigit(c)) {
5237                           parseDecimalNumber(css);
5238                         }
5239
5240                         // If current character is anything else:
5241                         else {
5242                             parseIdentifier(css);
5243                           }
5244             }
5245
5246             return tokens;
5247           }
5248
5249           return getTokens(css);
5250         };
5251
5252 /***/ }),
5253 /* 17 */
5254 /***/ (function(module, exports, __webpack_require__) {
5255
5256         'use strict';
5257
5258         exports.__esModule = true;
5259         exports.default = {
5260           mark: __webpack_require__(18),
5261           parse: __webpack_require__(19),
5262           stringify: __webpack_require__(4),
5263           tokenizer: __webpack_require__(20)
5264         };
5265         module.exports = exports['default'];
5266
5267 /***/ }),
5268 /* 18 */
5269 /***/ (function(module, exports, __webpack_require__) {
5270
5271         'use strict';
5272
5273         var TokenType = __webpack_require__(13);
5274
5275         module.exports = function () {
5276           /**
5277           * Mark whitespaces and comments
5278           */
5279           function markSC(tokens) {
5280             var tokensLength = tokens.length;
5281             var ws = -1; // Flag for whitespaces
5282             var sc = -1; // Flag for whitespaces and comments
5283             var t = void 0; // Current token
5284
5285             // For every token in the token list, mark spaces and line breaks
5286             // as spaces (set both `ws` and `sc` flags). Mark multiline comments
5287             // with `sc` flag.
5288             // If there are several spaces or tabs or line breaks or multiline
5289             // comments in a row, group them: take the last one's index number
5290             // and save it to the first token in the group as a reference:
5291             // e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9`
5292             // for a group of whitespaces and comments.
5293             for (var i = 0; i < tokensLength; i++) {
5294               t = tokens[i];
5295               switch (t.type) {
5296                 case TokenType.Space:
5297                 case TokenType.Tab:
5298                 case TokenType.Newline:
5299                   t.ws = true;
5300                   t.sc = true;
5301
5302                   if (ws === -1) ws = i;
5303                   if (sc === -1) sc = i;
5304
5305                   break;
5306                 case TokenType.CommentML:
5307                 case TokenType.CommentSL:
5308                   if (ws !== -1) {
5309                     tokens[ws].ws_last = i - 1;
5310                     ws = -1;
5311                   }
5312
5313                   t.sc = true;
5314
5315                   break;
5316                 default:
5317                   if (ws !== -1) {
5318                     tokens[ws].ws_last = i - 1;
5319                     ws = -1;
5320                   }
5321
5322                   if (sc !== -1) {
5323                     tokens[sc].sc_last = i - 1;
5324                     sc = -1;
5325                   }
5326               }
5327             }
5328
5329             if (ws !== -1) tokens[ws].ws_last = i - 1;
5330             if (sc !== -1) tokens[sc].sc_last = i - 1;
5331           }
5332
5333           /**
5334           * Pair brackets
5335           */
5336           function markBrackets(tokens) {
5337             var tokensLength = tokens.length;
5338             var ps = []; // Parentheses
5339             var sbs = []; // Square brackets
5340             var cbs = []; // Curly brackets
5341             var t = void 0; // Current token
5342
5343             // For every token in the token list, if we meet an opening (left)
5344             // bracket, push its index number to a corresponding array.
5345             // If we then meet a closing (right) bracket, look at the corresponding
5346             // array. If there are any elements (records about previously met
5347             // left brackets), take a token of the last left bracket (take
5348             // the last index number from the array and find a token with
5349             // this index number) and save right bracket's index as a reference:
5350             for (var i = 0; i < tokensLength; i++) {
5351               t = tokens[i];
5352               switch (t.type) {
5353                 case TokenType.LeftParenthesis:
5354                   ps.push(i);
5355                   break;
5356                 case TokenType.RightParenthesis:
5357                   if (ps.length) {
5358                     t.left = ps.pop();
5359                     tokens[t.left].right = i;
5360                   }
5361                   break;
5362                 case TokenType.LeftSquareBracket:
5363                   sbs.push(i);
5364                   break;
5365                 case TokenType.RightSquareBracket:
5366                   if (sbs.length) {
5367                     t.left = sbs.pop();
5368                     tokens[t.left].right = i;
5369                   }
5370                   break;
5371                 case TokenType.LeftCurlyBracket:
5372                   cbs.push(i);
5373                   break;
5374                 case TokenType.RightCurlyBracket:
5375                   if (cbs.length) {
5376                     t.left = cbs.pop();
5377                     tokens[t.left].right = i;
5378                   }
5379                   break;
5380               }
5381             }
5382           }
5383
5384           return function (tokens) {
5385             markBrackets(tokens);
5386             markSC(tokens);
5387           };
5388         }();
5389
5390 /***/ }),
5391 /* 19 */
5392 /***/ (function(module, exports, __webpack_require__) {
5393
5394         'use strict';
5395
5396         var Node = __webpack_require__(1);
5397         var NodeType = __webpack_require__(15);
5398         var TokenType = __webpack_require__(13);
5399
5400         var tokens = void 0;
5401         var tokensLength = void 0;
5402         var pos = void 0;
5403
5404         var contexts = {
5405           'arguments': function _arguments() {
5406             return checkArguments(pos) && getArguments();
5407           },
5408           'atkeyword': function atkeyword() {
5409             return checkAtkeyword(pos) && getAtkeyword();
5410           },
5411           'atrule': function atrule() {
5412             return checkAtrule(pos) && getAtrule();
5413           },
5414           'attributeSelector': function attributeSelector() {
5415             return checkAttributeSelector(pos) && getAttributeSelector();
5416           },
5417           'block': function block() {
5418             return checkBlock(pos) && getBlock();
5419           },
5420           'brackets': function brackets() {
5421             return checkBrackets(pos) && getBrackets();
5422           },
5423           'class': function _class() {
5424             return checkClass(pos) && getClass();
5425           },
5426           'combinator': function combinator() {
5427             return checkCombinator(pos) && getCombinator();
5428           },
5429           'commentML': function commentML() {
5430             return checkCommentML(pos) && getCommentML();
5431           },
5432           'commentSL': function commentSL() {
5433             return checkCommentSL(pos) && getCommentSL();
5434           },
5435           'condition': function condition() {
5436             return checkCondition(pos) && getCondition();
5437           },
5438           'declaration': function declaration() {
5439             return checkDeclaration(pos) && getDeclaration();
5440           },
5441           'declDelim': function declDelim() {
5442             return checkDeclDelim(pos) && getDeclDelim();
5443           },
5444           'delim': function delim() {
5445             return checkDelim(pos) && getDelim();
5446           },
5447           'dimension': function dimension() {
5448             return checkDimension(pos) && getDimension();
5449           },
5450           'escapedString': function escapedString() {
5451             return checkEscapedString(pos) && getEscapedString();
5452           },
5453           'expression': function expression() {
5454             return checkExpression(pos) && getExpression();
5455           },
5456           'extend': function extend() {
5457             return checkExtend(pos) && getExtend();
5458           },
5459           'function': function _function() {
5460             return checkFunction(pos) && getFunction();
5461           },
5462           'ident': function ident() {
5463             return checkIdent(pos) && getIdent();
5464           },
5465           'important': function important() {
5466             return checkImportant(pos) && getImportant();
5467           },
5468           'include': function include() {
5469             return checkInclude(pos) && getInclude();
5470           },
5471           'interpolatedVariable': function interpolatedVariable() {
5472             return checkInterpolatedVariable(pos) && getInterpolatedVariable();
5473           },
5474           'mixin': function mixin() {
5475             return checkMixin(pos) && getMixin();
5476           },
5477           'namespace': function namespace() {
5478             return checkNamespace(pos) && getNamespace();
5479           },
5480           'number': function number() {
5481             return checkNumber(pos) && getNumber();
5482           },
5483           'operator': function operator() {
5484             return checkOperator(pos) && getOperator();
5485           },
5486           'parentheses': function parentheses() {
5487             return checkParentheses(pos) && getParentheses();
5488           },
5489           'parentselector': function parentselector() {
5490             return checkParentSelector(pos) && getParentSelector();
5491           },
5492           'percentage': function percentage() {
5493             return checkPercentage(pos) && getPercentage();
5494           },
5495           'progid': function progid() {
5496             return checkProgid(pos) && getProgid();
5497           },
5498           'property': function property() {
5499             return checkProperty(pos) && getProperty();
5500           },
5501           'propertyDelim': function propertyDelim() {
5502             return checkPropertyDelim(pos) && getPropertyDelim();
5503           },
5504           'pseudoc': function pseudoc() {
5505             return checkPseudoc(pos) && getPseudoc();
5506           },
5507           'pseudoe': function pseudoe() {
5508             return checkPseudoe(pos) && getPseudoe();
5509           },
5510           'ruleset': function ruleset() {
5511             return checkRuleset(pos) && getRuleset();
5512           },
5513           's': function s() {
5514             return checkS(pos) && getS();
5515           },
5516           'selector': function selector() {
5517             return checkSelector(pos) && getSelector();
5518           },
5519           'shash': function shash() {
5520             return checkShash(pos) && getShash();
5521           },
5522           'string': function string() {
5523             return checkString(pos) && getString();
5524           },
5525           'stylesheet': function stylesheet() {
5526             return checkStylesheet(pos) && getStylesheet();
5527           },
5528           'unary': function unary() {
5529             return checkUnary(pos) && getUnary();
5530           },
5531           'unicodeRange': function unicodeRange() {
5532             return checkUnicodeRange(pos) && getUnicodeRange();
5533           },
5534           'universalSelector': function universalSelector() {
5535             return checkUniversalSelector(pos) && getUniversalSelector();
5536           },
5537           'urange': function urange() {
5538             return checkUrange(pos) && getUrange();
5539           },
5540           'uri': function uri() {
5541             return checkUri(pos) && getUri();
5542           },
5543           'value': function value() {
5544             return checkValue(pos) && getValue();
5545           },
5546           'variable': function variable() {
5547             return checkVariable(pos) && getVariable();
5548           },
5549           'variableslist': function variableslist() {
5550             return checkVariablesList(pos) && getVariablesList();
5551           },
5552           'vhash': function vhash() {
5553             return checkVhash(pos) && getVhash();
5554           }
5555         };
5556
5557         /**
5558          * Stop parsing and display error
5559          * @param {Number=} i Token's index number
5560          */
5561         function throwError(i) {
5562           var ln = tokens[i].ln;
5563
5564           throw { line: ln, syntax: 'less' };
5565         }
5566
5567         /**
5568          * @param {Object} exclude
5569          * @param {Number} i Token's index number
5570          * @returns {Number}
5571          */
5572         function checkExcluding(exclude, i) {
5573           var start = i;
5574
5575           while (i < tokensLength) {
5576             if (exclude[tokens[i++].type]) break;
5577           }
5578
5579           return i - start - 2;
5580         }
5581
5582         /**
5583          * @param {Number} start
5584          * @param {Number} finish
5585          * @returns {String}
5586          */
5587         function joinValues(start, finish) {
5588           var s = '';
5589
5590           for (var i = start; i < finish + 1; i++) {
5591             s += tokens[i].value;
5592           }
5593
5594           return s;
5595         }
5596
5597         /**
5598          * @param {Number} start
5599          * @param {Number} num
5600          * @returns {String}
5601          */
5602         function joinValues2(start, num) {
5603           if (start + num - 1 >= tokensLength) return;
5604
5605           var s = '';
5606
5607           for (var i = 0; i < num; i++) {
5608             s += tokens[start + i].value;
5609           }
5610
5611           return s;
5612         }
5613
5614         function getLastPosition(content, line, column, colOffset) {
5615           return typeof content === 'string' ? getLastPositionForString(content, line, column, colOffset) : getLastPositionForArray(content, line, column, colOffset);
5616         }
5617
5618         function getLastPositionForString(content, line, column, colOffset) {
5619           var position = [];
5620
5621           if (!content) {
5622             position = [line, column];
5623             if (colOffset) position[1] += colOffset - 1;
5624             return position;
5625           }
5626
5627           var lastLinebreak = content.lastIndexOf('\n');
5628           var endsWithLinebreak = lastLinebreak === content.length - 1;
5629           var splitContent = content.split('\n');
5630           var linebreaksCount = splitContent.length - 1;
5631           var prevLinebreak = linebreaksCount === 0 || linebreaksCount === 1 ? -1 : content.length - splitContent[linebreaksCount - 1].length - 2;
5632
5633           // Line:
5634           var offset = endsWithLinebreak ? linebreaksCount - 1 : linebreaksCount;
5635           position[0] = line + offset;
5636
5637           // Column:
5638           if (endsWithLinebreak) {
5639             offset = prevLinebreak !== -1 ? content.length - prevLinebreak : content.length - 1;
5640           } else {
5641             offset = linebreaksCount !== 0 ? content.length - lastLinebreak - column - 1 : content.length - 1;
5642           }
5643           position[1] = column + offset;
5644
5645           if (!colOffset) return position;
5646
5647           if (endsWithLinebreak) {
5648             position[0]++;
5649             position[1] = colOffset;
5650           } else {
5651             position[1] += colOffset;
5652           }
5653
5654           return position;
5655         }
5656
5657         function getLastPositionForArray(content, line, column, colOffset) {
5658           var position = void 0;
5659
5660           if (content.length === 0) {
5661             position = [line, column];
5662           } else {
5663             var c = content[content.length - 1];
5664             if (c.hasOwnProperty('end')) {
5665               position = [c.end.line, c.end.column];
5666             } else {
5667               position = getLastPosition(c.content, line, column);
5668             }
5669           }
5670
5671           if (!colOffset) return position;
5672
5673           if (tokens[pos - 1] && tokens[pos - 1].type !== 'Newline') {
5674             position[1] += colOffset;
5675           } else {
5676             position[0]++;
5677             position[1] = 1;
5678           }
5679
5680           return position;
5681         }
5682
5683         function newNode(type, content, line, column, end) {
5684           if (!end) end = getLastPosition(content, line, column);
5685           return new Node({
5686             type: type,
5687             content: content,
5688             start: {
5689               line: line,
5690               column: column
5691             },
5692             end: {
5693               line: end[0],
5694               column: end[1]
5695             },
5696             syntax: 'less'
5697           });
5698         }
5699
5700         /**
5701          * @param {Number} i Token's index number
5702          * @returns {Number}
5703          */
5704         function checkAny(i) {
5705           var l = void 0;
5706
5707           if (l = checkBrackets(i)) tokens[i].any_child = 1;else if (l = checkParentheses(i)) tokens[i].any_child = 2;else if (l = checkString(i)) tokens[i].any_child = 3;else if (l = checkVariablesList(i)) tokens[i].any_child = 4;else if (l = checkVariable(i)) tokens[i].any_child = 5;else if (l = checkPercentage(i)) tokens[i].any_child = 6;else if (l = checkDimension(i)) tokens[i].any_child = 7;else if (l = checkUnicodeRange(i)) tokens[i].any_child = 15;else if (l = checkNumber(i)) tokens[i].any_child = 8;else if (l = checkUri(i)) tokens[i].any_child = 9;else if (l = checkExpression(i)) tokens[i].any_child = 10;else if (l = checkFunction(i)) tokens[i].any_child = 11;else if (l = checkIdent(i)) tokens[i].any_child = 12;else if (l = checkClass(i)) tokens[i].any_child = 13;else if (l = checkUnary(i)) tokens[i].any_child = 14;
5708
5709           return l;
5710         }
5711
5712         /**
5713          * @returns {Array}
5714          */
5715         function getAny() {
5716           var childType = tokens[pos].any_child;
5717
5718           if (childType === 1) return getBrackets();
5719           if (childType === 2) return getParentheses();
5720           if (childType === 3) return getString();
5721           if (childType === 4) return getVariablesList();
5722           if (childType === 5) return getVariable();
5723           if (childType === 6) return getPercentage();
5724           if (childType === 7) return getDimension();
5725           if (childType === 15) return getUnicodeRange();
5726           if (childType === 8) return getNumber();
5727           if (childType === 9) return getUri();
5728           if (childType === 10) return getExpression();
5729           if (childType === 11) return getFunction();
5730           if (childType === 12) return getIdent();
5731           if (childType === 13) return getClass();
5732           if (childType === 14) return getUnary();
5733         }
5734
5735         /**
5736          * Check if token is part of mixin's arguments.
5737          * @param {Number} i Token's index number
5738          * @returns {Number}
5739          */
5740         function checkArguments(i) {
5741           var start = i;
5742           var l = void 0;
5743
5744           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
5745
5746           // Skip `(`.
5747           i++;
5748
5749           while (i < tokens[start].right) {
5750             if (l = checkArgument(i)) i += l;else return 0;
5751           }
5752
5753           return tokens[start].right - start + 1;
5754         }
5755
5756         /**
5757          * @returns {Array}
5758          */
5759         function getArguments() {
5760           var type = NodeType.ArgumentsType;
5761           var token = tokens[pos];
5762           var line = token.ln;
5763           var column = token.col;
5764           var content = [];
5765           var body = void 0;
5766
5767           // Skip `(`.
5768           pos++;
5769
5770           while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) {
5771             if (checkDeclaration(pos)) content.push(getDeclaration());else if (checkArgument(pos)) {
5772               body = getArgument();
5773               if (typeof body.content === 'string') content.push(body);else content = content.concat(body);
5774             } else if (checkClass(pos)) content.push(getClass());else throwError(pos);
5775           }
5776
5777           var end = getLastPosition(content, line, column, 1);
5778
5779           // Skip `)`.
5780           pos++;
5781
5782           return newNode(type, content, line, column, end);
5783         }
5784
5785         /**
5786          * Check if token is valid to be part of arguments list.
5787          * @param {Number} i Token's index number
5788          * @returns {Number}
5789          */
5790         function checkArgument(i) {
5791           var l = void 0;
5792
5793           if (l = checkEscapedString(i)) tokens[i].argument_child = 1;else if (l = checkDeclaration(i)) tokens[i].argument_child = 2;else if (l = checkVariablesList(i)) tokens[i].argument_child = 3;else if (l = checkVariable(i)) tokens[i].argument_child = 4;else if (l = checkSC(i)) tokens[i].argument_child = 5;else if (l = checkUnary(i)) tokens[i].argument_child = 6;else if (l = checkOperator(i)) tokens[i].argument_child = 7;else if (l = checkDelim(i)) tokens[i].argument_child = 8;else if (l = checkDeclDelim(i)) tokens[i].argument_child = 9;else if (l = checkString(i)) tokens[i].argument_child = 10;else if (l = checkPercentage(i)) tokens[i].argument_child = 11;else if (l = checkDimension(i)) tokens[i].argument_child = 12;else if (l = checkNumber(i)) tokens[i].argument_child = 13;else if (l = checkUri(i)) tokens[i].argument_child = 14;else if (l = checkFunction(i)) tokens[i].argument_child = 15;else if (l = checkIdent(i)) tokens[i].argument_child = 16;else if (l = checkVhash(i)) tokens[i].argument_child = 17;else if (l = checkBlock(i)) tokens[i].argument_child = 18;else if (l = checkParentheses(i)) tokens[i].argument_child = 19;
5794
5795           return l;
5796         }
5797
5798         /**
5799          * @returns {Array} Node that is part of arguments list.
5800          */
5801         function getArgument() {
5802           var childType = tokens[pos].argument_child;
5803
5804           if (childType === 1) return getEscapedString();
5805           if (childType === 2) return getDeclaration();
5806           if (childType === 3) return getVariablesList();
5807           if (childType === 4) return getVariable();
5808           if (childType === 5) return getSC();
5809           if (childType === 6) return getUnary();
5810           if (childType === 7) return getOperator();
5811           if (childType === 8) return getDelim();
5812           if (childType === 9) return getDeclDelim();
5813           if (childType === 10) return getString();
5814           if (childType === 11) return getPercentage();
5815           if (childType === 12) return getDimension();
5816           if (childType === 13) return getNumber();
5817           if (childType === 14) return getUri();
5818           if (childType === 15) return getFunction();
5819           if (childType === 16) return getIdent();
5820           if (childType === 17) return getVhash();
5821           if (childType === 18) return getBlock();
5822           if (childType === 19) return getParentheses();
5823         }
5824
5825         /**
5826          * Check if token is part of an @-word (e.g. `@import`, `@include`)
5827          * @param {Number} i Token's index number
5828          * @returns {Number}
5829          */
5830         function checkAtkeyword(i) {
5831           var l = void 0;
5832
5833           // Check that token is `@`:
5834           if (i >= tokensLength || tokens[i++].type !== TokenType.CommercialAt) return 0;
5835
5836           return (l = checkIdent(i)) ? l + 1 : 0;
5837         }
5838
5839         /**
5840          * Get node with @-word
5841          * @returns {Array} `['atkeyword', ['ident', x]]` where `x` is
5842          *      an identifier without
5843          *      `@` (e.g. `import`, `include`)
5844          */
5845         function getAtkeyword() {
5846           var type = NodeType.AtkeywordType;
5847           var token = tokens[pos];
5848           var line = token.ln;
5849           var column = token.col;
5850
5851           // Skip `@`.
5852           pos++;
5853
5854           var content = [getIdent()];
5855
5856           return newNode(type, content, line, column);
5857         }
5858
5859         /**
5860          * Check if token is a part of an @-rule
5861          * @param {Number} i Token's index number
5862          * @returns {Number} Length of @-rule
5863          */
5864         function checkAtrule(i) {
5865           var l = void 0;
5866
5867           if (i >= tokensLength) return 0;
5868
5869           // If token already has a record of being part of an @-rule,
5870           // return the @-rule's length:
5871           if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l;
5872
5873           // If token is part of an @-rule, save the rule's type to token.
5874           if (l = checkKeyframesRule(i)) tokens[i].atrule_type = 4;
5875           // @-rule with ruleset:
5876           else if (l = checkAtruler(i)) tokens[i].atrule_type = 1;
5877             // Block @-rule:
5878             else if (l = checkAtruleb(i)) tokens[i].atrule_type = 2;
5879               // Single-line @-rule:
5880               else if (l = checkAtrules(i)) tokens[i].atrule_type = 3;else return 0;
5881
5882           // If token is part of an @-rule, save the rule's length to token:
5883           tokens[i].atrule_l = l;
5884
5885           return l;
5886         }
5887
5888         /**
5889          * Get node with @-rule
5890          * @returns {Array}
5891          */
5892         function getAtrule() {
5893           var childType = tokens[pos].atrule_type;
5894
5895           if (childType === 1) return getAtruler(); // @-rule with ruleset
5896           if (childType === 2) return getAtruleb(); // Block @-rule
5897           if (childType === 3) return getAtrules(); // Single-line @-rule
5898           if (childType === 4) return getKeyframesRule();
5899         }
5900
5901         /**
5902          * Check if token is part of a block @-rule
5903          * @param {Number} i Token's index number
5904          * @returns {Number} Length of the @-rule
5905          */
5906         function checkAtruleb(i) {
5907           var start = i;
5908           var l = void 0;
5909
5910           if (i >= tokensLength) return 0;
5911
5912           if (l = checkAtkeyword(i)) i += l;else return 0;
5913
5914           if (l = checkTsets(i)) i += l;
5915
5916           if (l = checkBlock(i)) i += l;else return 0;
5917
5918           return i - start;
5919         }
5920
5921         /**
5922          * Get node with a block @-rule
5923          * @returns {Array} `['atruleb', ['atkeyword', x], y, ['block', z]]`
5924          */
5925         function getAtruleb() {
5926           var type = NodeType.AtruleType;
5927           var token = tokens[pos];
5928           var line = token.ln;
5929           var column = token.col;
5930           var content = [].concat(getAtkeyword(), getTsets(), getBlock());
5931
5932           return newNode(type, content, line, column);
5933         }
5934
5935         /**
5936          * Check if token is part of an @-rule with ruleset
5937          * @param {Number} i Token's index number
5938          * @returns {Number} Length of the @-rule
5939          */
5940         function checkAtruler(i) {
5941           var start = i;
5942           var l = void 0;
5943
5944           if (i >= tokensLength) return 0;
5945
5946           if (l = checkAtkeyword(i)) i += l;else return 0;
5947
5948           if (l = checkTsets(i)) i += l;
5949
5950           if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;else return 0;
5951
5952           if (l = checkAtrulers(i)) i += l;
5953
5954           if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;else return 0;
5955
5956           return i - start;
5957         }
5958
5959         /**
5960          * Get node with an @-rule with ruleset
5961          * @returns {Array} ['atruler', ['atkeyword', x], y, z]
5962          */
5963         function getAtruler() {
5964           var type = NodeType.AtruleType;
5965           var token = tokens[pos];
5966           var line = token.ln;
5967           var column = token.col;
5968           var content = [].concat(getAtkeyword(), getTsets(), getAtrulers());
5969
5970           return newNode(type, content, line, column);
5971         }
5972
5973         /**
5974          * @param {Number} i Token's index number
5975          * @returns {Number}
5976          */
5977         function checkAtrulers(i) {
5978           var start = i;
5979           var l = void 0;
5980
5981           if (i >= tokensLength) return 0;
5982
5983           if (l = checkSC(i)) i += l;
5984
5985           while (i < tokensLength) {
5986             if (l = checkSC(i)) tokens[i].atrulers_child = 1;else if (l = checkAtrule(i)) tokens[i].atrulers_child = 2;else if (l = checkRuleset(i)) tokens[i].atrulers_child = 3;else break;
5987             i += l;
5988           }
5989
5990           if (i < tokensLength) tokens[i].atrulers_end = 1;
5991
5992           if (l = checkSC(i)) i += l;
5993
5994           return i - start;
5995         }
5996
5997         /**
5998          * @returns {Array} `['atrulers', x]`
5999          */
6000         function getAtrulers() {
6001           var type = NodeType.BlockType;
6002           var token = tokens[pos];
6003           var line = token.ln;
6004           var column = token.col;
6005           var content = [];
6006
6007           // Skip `{`.
6008           pos++;
6009
6010           content = content.concat(getSC());
6011
6012           while (pos < tokensLength && !tokens[pos].atrulers_end) {
6013             var childType = tokens[pos].atrulers_child;
6014             if (childType === 1) content = content.concat(getSC());else if (childType === 2) content.push(getAtrule());else if (childType === 3) content.push(getRuleset());else break;
6015           }
6016
6017           content = content.concat(getSC());
6018
6019           var end = getLastPosition(content, line, column, 1);
6020
6021           // Skip `}`.
6022           pos++;
6023
6024           return newNode(type, content, line, column, end);
6025         }
6026
6027         /**
6028          * @param {Number} i Token's index number
6029          * @returns {Number}
6030          */
6031         function checkAtrules(i) {
6032           var start = i;
6033           var l = void 0;
6034
6035           if (i >= tokensLength) return 0;
6036
6037           if (l = checkAtkeyword(i)) i += l;else return 0;
6038
6039           if (l = checkTsets(i)) i += l;
6040
6041           return i - start;
6042         }
6043
6044         /**
6045          * @returns {Array} `['atrules', ['atkeyword', x], y]`
6046          */
6047         function getAtrules() {
6048           var type = NodeType.AtruleType;
6049           var token = tokens[pos];
6050           var line = token.ln;
6051           var column = token.col;
6052           var content = [].concat(getAtkeyword(), getTsets());
6053
6054           return newNode(type, content, line, column);
6055         }
6056
6057         /**
6058          * Check if token is part of a block (e.g. `{...}`).
6059          * @param {Number} i Token's index number
6060          * @returns {Number} Length of the block
6061          */
6062         function checkBlock(i) {
6063           return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? tokens[i].right - i + 1 : 0;
6064         }
6065
6066         /**
6067          * Get node with a block
6068          * @returns {Array} `['block', x]`
6069          */
6070         function getBlock() {
6071           var type = NodeType.BlockType;
6072           var token = tokens[pos];
6073           var line = token.ln;
6074           var column = token.col;
6075           var end = tokens[pos].right;
6076           var content = [];
6077
6078           // Skip `{`.
6079           pos++;
6080
6081           while (pos < end) {
6082             if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());else throwError(pos);
6083           }
6084
6085           var end_ = getLastPosition(content, line, column, 1);
6086           pos = end + 1;
6087
6088           return newNode(type, content, line, column, end_);
6089         }
6090
6091         /**
6092          * Check if token is part of a declaration (property-value pair)
6093          * @param {Number} i Token's index number
6094          * @returns {Number} Length of the declaration
6095          */
6096         function checkBlockdecl(i) {
6097           var l = void 0;
6098
6099           if (i >= tokensLength) return 0;
6100
6101           if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1;else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2;else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3;else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4;else return 0;
6102
6103           return l;
6104         }
6105
6106         /**
6107          * @returns {Array}
6108          */
6109         function getBlockdecl() {
6110           var childType = tokens[pos].bd_type;
6111
6112           if (childType === 1) return getBlockdecl1();
6113           if (childType === 2) return getBlockdecl2();
6114           if (childType === 3) return getBlockdecl3();
6115           if (childType === 4) return getBlockdecl4();
6116         }
6117
6118         /**
6119          * @param {Number} i Token's index number
6120          * @returns {Number}
6121          */
6122         function checkBlockdecl1(i) {
6123           var start = i;
6124           var l = void 0;
6125
6126           if (l = checkSC(i)) i += l;
6127
6128           if (l = checkCondition(i)) tokens[i].bd_kind = 1;else if (l = checkExtend(i)) tokens[i].bd_kind = 6;else if (l = checkRuleset(i)) tokens[i].bd_kind = 2;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 3;else if (l = checkAtrule(i)) tokens[i].bd_kind = 4;else if (l = checkInclude(i)) tokens[i].bd_kind = 5;else return 0;
6129
6130           i += l;
6131
6132           if (i < tokensLength && (l = checkDeclDelim(i))) i += l;else return 0;
6133
6134           if (l = checkSC(i)) i += l;else return 0;
6135
6136           return i - start;
6137         }
6138
6139         /**
6140          * @returns {Array}
6141          */
6142         function getBlockdecl1() {
6143           var sc = getSC();
6144           var content = void 0;
6145
6146           switch (tokens[pos].bd_kind) {
6147             case 1:
6148               content = getCondition();
6149               break;
6150             case 2:
6151               content = getRuleset();
6152               break;
6153             case 3:
6154               content = getDeclaration();
6155               break;
6156             case 4:
6157               content = getAtrule();
6158               break;
6159             case 5:
6160               content = getInclude();
6161               break;
6162             case 6:
6163               content = getExtend();
6164               break;
6165           }
6166
6167           return sc.concat(content, getDeclDelim(), getSC());
6168         }
6169
6170         /**
6171          * @param {Number} i Token's index number
6172          * @returns {Number}
6173          */
6174         function checkBlockdecl2(i) {
6175           var start = i;
6176           var l = void 0;
6177
6178           if (l = checkSC(i)) i += l;
6179
6180           if (l = checkCondition(i)) tokens[i].bd_kind = 1;else if (l = checkExtend(i)) tokens[i].bd_kind = 3;else if (l = checkRuleset(i)) tokens[i].bd_kind = 6;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 4;else if (l = checkAtrule(i)) tokens[i].bd_kind = 5;else if (l = checkInclude(i)) tokens[i].bd_kind = 2;else return 0;
6181
6182           i += l;
6183
6184           if (l = checkSC(i)) i += l;
6185
6186           return i - start;
6187         }
6188
6189         /**
6190          * @returns {Array}
6191          */
6192         function getBlockdecl2() {
6193           var sc = getSC();
6194           var content = void 0;
6195
6196           switch (tokens[pos].bd_kind) {
6197             case 1:
6198               content = getCondition();
6199               break;
6200             case 2:
6201               content = getInclude();
6202               break;
6203             case 3:
6204               content = getExtend();
6205               break;
6206             case 4:
6207               content = getDeclaration();
6208               break;
6209             case 5:
6210               content = getAtrule();
6211               break;
6212             case 6:
6213               content = getRuleset();
6214               break;
6215           }
6216
6217           return sc.concat(content, getSC());
6218         }
6219
6220         /**
6221          * @param {Number} i Token's index number
6222          * @returns {Number}
6223          */
6224         function checkBlockdecl3(i) {
6225           var start = i;
6226           var l = void 0;
6227
6228           if (l = checkSC(i)) i += l;
6229
6230           if (l = checkDeclDelim(i)) i += l;else return 0;
6231
6232           if (l = checkSC(i)) i += l;
6233
6234           return i - start;
6235         }
6236
6237         /**
6238          * @returns {Array} `[s0, ['declDelim'], s1]` where `s0` and `s1` are
6239          *      are optional whitespaces.
6240          */
6241         function getBlockdecl3() {
6242           return [].concat(getSC(), getDeclDelim(), getSC());
6243         }
6244
6245         /**
6246          * @param {Number} i Token's index number
6247          * @returns {Number}
6248          */
6249         function checkBlockdecl4(i) {
6250           return checkSC(i);
6251         }
6252
6253         /**
6254          * @returns {Array}
6255          */
6256         function getBlockdecl4() {
6257           return getSC();
6258         }
6259
6260         /**
6261          * Check if token is part of text inside square brackets, e.g. `[1]`
6262          * @param {Number} i Token's index number
6263          * @returns {Number}
6264          */
6265         function checkBrackets(i) {
6266           if (i >= tokensLength) return 0;
6267
6268           var start = i;
6269
6270           // Skip `[`.
6271           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
6272
6273           if (i < tokens[start].right) {
6274             var l = checkTsets(i);
6275             if (l) i += l;else return 0;
6276           }
6277
6278           // Skip `]`.
6279           i++;
6280
6281           return i - start;
6282         }
6283
6284         /**
6285          * Get node with text inside square brackets, e.g. `[1]`
6286          * @returns {Node}
6287          */
6288         function getBrackets() {
6289           var type = NodeType.BracketsType;
6290           var token = tokens[pos];
6291           var line = token.ln;
6292           var column = token.col;
6293           var right = token.right;
6294           var content = [];
6295
6296           // Skip `[`.
6297           pos++;
6298
6299           if (pos < right) {
6300             content = getTsets();
6301           }
6302
6303           var end = getLastPosition(content, line, column, 1);
6304
6305           // Skip `]`.
6306           pos++;
6307
6308           return newNode(type, content, line, column, end);
6309         }
6310
6311         /**
6312          * Check if token is part of a class selector (e.g. `.abc`)
6313          * @param {Number} i Token's index number
6314          * @returns {Number} Length of the class selector
6315          */
6316         function checkClass(i) {
6317           var l = void 0;
6318
6319           if (i >= tokensLength) return 0;
6320
6321           if (tokens[i].class_l) return tokens[i].class_l;
6322
6323           if (tokens[i++].type === TokenType.FullStop) {
6324             if (l = checkInterpolatedVariable(i)) tokens[i].class_child = 1;else if (l = checkIdent(i)) tokens[i].class_child = 2;else return 0;
6325
6326             tokens[i].class_l = l + 1;
6327             return l + 1;
6328           }
6329
6330           return 0;
6331         }
6332
6333         /**
6334          * Get node with a class selector
6335          * @returns {Array} `['class', ['ident', x]]` where x is a class's
6336          *      identifier (without `.`, e.g. `abc`).
6337          */
6338         function getClass() {
6339           var type = NodeType.ClassType;
6340           var token = tokens[pos];
6341           var line = token.ln;
6342           var column = token.col;
6343           var content = [];
6344
6345           // Skip `.`
6346           pos++;
6347
6348           var childType = tokens[pos].class_child;
6349           if (childType === 1) content.push(getInterpolatedVariable());else content.push(getIdent());
6350
6351           return newNode(type, content, line, column);
6352         }
6353
6354         function checkCombinator(i) {
6355           if (i >= tokensLength) return 0;
6356
6357           var l = void 0;
6358           if (l = checkCombinator1(i)) tokens[i].combinatorType = 1;else if (l = checkCombinator2(i)) tokens[i].combinatorType = 2;else if (l = checkCombinator3(i)) tokens[i].combinatorType = 3;else if (l = checkCombinator4(i)) tokens[i].combinatorType = 4;
6359
6360           return l;
6361         }
6362
6363         function getCombinator() {
6364           var type = tokens[pos].combinatorType;
6365           if (type === 1) return getCombinator1();
6366           if (type === 2) return getCombinator2();
6367           if (type === 3) return getCombinator3();
6368           if (type === 4) return getCombinator4();
6369         }
6370
6371         /**
6372          * (1) `>>>`
6373          *
6374          * @param {Number} i
6375          * @return {Number}
6376          */
6377         function checkCombinator1(i) {
6378           if (i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign) return 3;
6379
6380           return 0;
6381         }
6382
6383         /**
6384          * @return {Node}
6385          */
6386         function getCombinator1() {
6387           var type = NodeType.CombinatorType;
6388           var token = tokens[pos];
6389           var line = token.ln;
6390           var column = token.col;
6391           var content = '>>>';
6392
6393           // Skip combinator
6394           pos += 3;
6395
6396           return newNode(type, content, line, column);
6397         }
6398
6399         /**
6400          * (1) `||`
6401          * (2) `>>`
6402          *
6403          * @param {Number} i
6404          * @return {Number}
6405          */
6406         function checkCombinator2(i) {
6407           if (i + 1 >= tokensLength) return 0;
6408
6409           if (tokens[i].type === TokenType.VerticalLine && tokens[i + 1].type === TokenType.VerticalLine) return 2;
6410
6411           if (tokens[i].type === TokenType.GreaterThanSign && tokens[i + 1].type === TokenType.GreaterThanSign) return 2;
6412
6413           return 0;
6414         }
6415
6416         /**
6417          * @return {Node}
6418          */
6419         function getCombinator2() {
6420           var type = NodeType.CombinatorType;
6421           var token = tokens[pos];
6422           var line = token.ln;
6423           var column = token.col;
6424           var content = '' + token.value + tokens[pos + 1].value;
6425
6426           // Skip combinator
6427           pos += 2;
6428
6429           return newNode(type, content, line, column);
6430         }
6431
6432         /**
6433          * (1) `>`
6434          * (2) `+`
6435          * (3) `~`
6436          *
6437          * @param {Number} i
6438          * @return {Number}
6439          */
6440         function checkCombinator3(i) {
6441           var type = tokens[i].type;
6442           if (type === TokenType.PlusSign || type === TokenType.GreaterThanSign || type === TokenType.Tilde) return 1;else return 0;
6443         }
6444
6445         /**
6446          * @return {Node}
6447          */
6448         function getCombinator3() {
6449           var type = NodeType.CombinatorType;
6450           var token = tokens[pos];
6451           var line = token.ln;
6452           var column = token.col;
6453           var content = token.value;
6454
6455           // Skip combinator
6456           pos++;
6457
6458           return newNode(type, content, line, column);
6459         }
6460
6461         /**
6462          * (1) `/panda/`
6463          */
6464         function checkCombinator4(i) {
6465           var start = i;
6466
6467           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
6468
6469           var l = void 0;
6470           if (l = checkIdent(i)) i += l;else return 0;
6471
6472           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
6473
6474           return i - start;
6475         }
6476
6477         /**
6478          * @return {Node}
6479          */
6480         function getCombinator4() {
6481           var type = NodeType.CombinatorType;
6482           var token = tokens[pos];
6483           var line = token.ln;
6484           var column = token.col;
6485
6486           // Skip `/`.
6487           pos++;
6488
6489           var ident = getIdent();
6490
6491           // Skip `/`.
6492           pos++;
6493
6494           var content = '/' + ident.content + '/';
6495
6496           return newNode(type, content, line, column);
6497         }
6498
6499         /**
6500          * Check if token is a multiline comment.
6501          * @param {Number} i Token's index number
6502          * @returns {Number} `1` if token is a multiline comment, otherwise `0`
6503          */
6504         function checkCommentML(i) {
6505           return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0;
6506         }
6507
6508         /**
6509          * Get node with a multiline comment
6510          * @returns {Array} `['commentML', x]` where `x`
6511          *      is the comment's text (without `/*` and `* /`).
6512          */
6513         function getCommentML() {
6514           var type = NodeType.CommentMLType;
6515           var token = tokens[pos];
6516           var line = token.ln;
6517           var column = token.col;
6518           var content = tokens[pos].value.substring(2);
6519           var l = content.length;
6520
6521           if (content.charAt(l - 2) === '*' && content.charAt(l - 1) === '/') content = content.substring(0, l - 2);
6522
6523           var end = getLastPosition(content, line, column, 2);
6524           if (end[0] === line) end[1] += 2;
6525           pos++;
6526
6527           return newNode(type, content, line, column, end);
6528         }
6529
6530         /**
6531          * Check if token is part of a single-line comment.
6532          * @param {Number} i Token's index number
6533          * @returns {Number} `1` if token is a single-line comment, otherwise `0`
6534          */
6535         function checkCommentSL(i) {
6536           return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0;
6537         }
6538
6539         /**
6540          * Get node with a single-line comment.
6541          * @returns {Array}
6542          */
6543         function getCommentSL() {
6544           var type = NodeType.CommentSLType;
6545           var token = tokens[pos];
6546           var line = token.ln;
6547           var column = token.col;
6548           var content = tokens[pos++].value.substring(2);
6549           var end = getLastPosition(content, line, column + 2);
6550
6551           return newNode(type, content, line, column, end);
6552         }
6553
6554         /**
6555          * Check if token is part of a condition.
6556          * @param {Number} i Token's index number
6557          * @return {Number} Length of the condition
6558          */
6559         function checkCondition(i) {
6560           var start = i;
6561           var l = void 0;
6562
6563           if (i >= tokensLength) return 0;
6564
6565           if ((l = checkIdent(i)) && tokens[i].value === 'when') i += l;else return 0;
6566
6567           while (i < tokensLength) {
6568             if (l = checkBlock(i)) {
6569               tokens[i].condition_child = 0;
6570               break;
6571             } else if (l = checkFunction(i)) tokens[i].condition_child = 1;else if (l = checkBrackets(i)) tokens[i].condition_child = 2;else if (l = checkParentheses(i)) tokens[i].condition_child = 3;else if (l = checkVariable(i)) tokens[i].condition_child = 4;else if (l = checkIdent(i)) tokens[i].condition_child = 5;else if (l = checkNumber(i)) tokens[i].condition_child = 6;else if (l = checkDelim(i)) tokens[i].condition_child = 7;else if (l = checkOperator(i)) tokens[i].condition_child = 8;else if (l = checkCombinator(i)) tokens[i].condition_child = 9;else if (l = checkSC(i)) tokens[i].condition_child = 10;else if (l = checkString(i)) tokens[i].condition_child = 11;else return 0;
6572
6573             i += l;
6574           }
6575
6576           return i - start;
6577         }
6578
6579         /**
6580          * Get node with a condition.
6581          * @returns {Array} `['condition', x]`
6582          */
6583         function getCondition() {
6584           var type = NodeType.ConditionType;
6585           var token = tokens[pos];
6586           var line = token.ln;
6587           var column = token.col;
6588           var content = [];
6589
6590           content.push(getIdent());
6591
6592           while (pos < tokensLength) {
6593             var childType = tokens[pos].condition_child;
6594
6595             if (childType === 0) break;else if (childType === 1) content.push(getFunction());else if (childType === 2) content.push(getBrackets());else if (childType === 3) content.push(getParentheses());else if (childType === 4) content.push(getVariable());else if (childType === 5) content.push(getIdent());else if (childType === 6) content.push(getNumber());else if (childType === 7) content.push(getDelim());else if (childType === 8) content.push(getOperator());else if (childType === 9) content.push(getCombinator());else if (childType === 10) content = content.concat(getSC());else if (childType === 11) content.push(getString());
6596           }
6597
6598           return newNode(type, content, line, column);
6599         }
6600
6601         /**
6602          * Check if token is part of a declaration (property-value pair)
6603          * @param {Number} i Token's index number
6604          * @returns {Number} Length of the declaration
6605          */
6606         function checkDeclaration(i) {
6607           var start = i;
6608           var l = void 0;
6609
6610           if (i >= tokensLength) return 0;
6611
6612           if (l = checkProperty(i)) i += l;else return 0;
6613
6614           if (l = checkSC(i)) i += l;
6615
6616           if (l = checkPropertyDelim(i)) i++;else return 0;
6617
6618           if (l = checkSC(i)) i += l;
6619
6620           if (l = checkValue(i)) i += l;else return 0;
6621
6622           return i - start;
6623         }
6624
6625         /**
6626          * Get node with a declaration
6627          * @returns {Array} `['declaration', ['property', x], ['propertyDelim'],
6628          *       ['value', y]]`
6629          */
6630         function getDeclaration() {
6631           var type = NodeType.DeclarationType;
6632           var token = tokens[pos];
6633           var line = token.ln;
6634           var column = token.col;
6635           var content = [].concat(getProperty(), getSC(), getPropertyDelim(), getSC(), getValue());
6636
6637           return newNode(type, content, line, column);
6638         }
6639
6640         /**
6641          * Check if token is a semicolon
6642          * @param {Number} i Token's index number
6643          * @returns {Number} `1` if token is a semicolon, otherwise `0`
6644          */
6645         function checkDeclDelim(i) {
6646           return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0;
6647         }
6648
6649         /**
6650          * Get node with a semicolon
6651          * @returns {Array} `['declDelim']`
6652          */
6653         function getDeclDelim() {
6654           var type = NodeType.DeclDelimType;
6655           var token = tokens[pos];
6656           var line = token.ln;
6657           var column = token.col;
6658           var content = ';';
6659
6660           pos++;
6661
6662           return newNode(type, content, line, column);
6663         }
6664
6665         /**
6666          * Check if token is a comma
6667          * @param {Number} i Token's index number
6668          * @returns {Number} `1` if token is a comma, otherwise `0`
6669          */
6670         function checkDelim(i) {
6671           return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0;
6672         }
6673
6674         /**
6675          * Get node with a comma
6676          * @returns {Array} `['delim']`
6677          */
6678         function getDelim() {
6679           var type = NodeType.DelimType;
6680           var token = tokens[pos];
6681           var line = token.ln;
6682           var column = token.col;
6683           var content = ',';
6684
6685           pos++;
6686
6687           return newNode(type, content, line, column);
6688         }
6689
6690         /**
6691          * Check if token is part of a number with dimension unit (e.g. `10px`)
6692          * @param {Number} i Token's index number
6693          * @returns {Number}
6694          */
6695         function checkDimension(i) {
6696           var ln = checkNumber(i);
6697           var li = void 0;
6698
6699           if (i >= tokensLength || !ln || i + ln >= tokensLength) return 0;
6700
6701           return (li = checkUnit(i + ln)) ? ln + li : 0;
6702         }
6703
6704         /**
6705          * Get node of a number with dimension unit
6706          * @return {Node}
6707          */
6708         function getDimension() {
6709           var type = NodeType.DimensionType;
6710           var token = tokens[pos];
6711           var line = token.ln;
6712           var column = token.col;
6713           var content = [getNumber(), getUnit()];
6714
6715           return newNode(type, content, line, column);
6716         }
6717
6718         /**
6719          * Check if token is part of an escaped string (e.g. `~"ms:something"`).
6720          * @param {Number} i Token's index number
6721          * @returns {Number} Length of the string (including `~` and quotes)
6722          */
6723         function checkEscapedString(i) {
6724           var start = i;
6725           var l = void 0;
6726
6727           if (i >= tokensLength) return 0;
6728
6729           if (tokens[i].type === TokenType.Tilde && (l = checkString(i + 1))) return i + l - start;else return 0;
6730         }
6731
6732         /**
6733          * Get node with an escaped string
6734          * @returns {Array} `['escapedString', ['string', x]]` where `x` is a string
6735          *      without `~` but with quotes
6736          */
6737         function getEscapedString() {
6738           var type = NodeType.EscapedStringType;
6739           var token = tokens[pos];
6740           var line = token.ln;
6741           var column = token.col;
6742
6743           pos++;
6744
6745           var content = tokens[pos].value;
6746           var end = getLastPosition(content, line, column + 1);
6747
6748           pos++;
6749
6750           return newNode(type, content, line, column, end);
6751         }
6752
6753         /**
6754          * @param {Number} i Token's index number
6755          * @returns {Number}
6756          */
6757         function checkExpression(i) {
6758           var start = i;
6759
6760           if (i >= tokensLength || tokens[i++].value !== 'expression' || i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) {
6761             return 0;
6762           }
6763
6764           return tokens[i].right - start + 1;
6765         }
6766
6767         /**
6768          * @returns {Array}
6769          */
6770         function getExpression() {
6771           var type = NodeType.ExpressionType;
6772           var token = tokens[pos];
6773           var line = token.ln;
6774           var column = token.col;
6775
6776           pos++;
6777
6778           var content = joinValues(pos + 1, tokens[pos].right - 1);
6779           var end = getLastPosition(content, line, column, 1);
6780
6781           if (end[0] === line) end[1] += 11;
6782           pos = tokens[pos].right + 1;
6783
6784           return newNode(type, content, line, column, end);
6785         }
6786
6787         function checkExtend(i) {
6788           if (i >= tokensLength) return 0;
6789
6790           var l = void 0;
6791
6792           if (l = checkExtend1(i)) tokens[i].extendType = 1;else if (l = checkExtend2(i)) tokens[i].extendType = 2;else return 0;
6793
6794           return l;
6795         }
6796
6797         function getExtend() {
6798           var childType = tokens[pos].extendType;
6799
6800           if (childType === 1) return getExtend1();
6801           if (childType === 2) return getExtend2();
6802         }
6803
6804         /**
6805          * (1) `selector:extend(selector) {...}`
6806          */
6807         function checkExtend1(i) {
6808           var start = i;
6809           var l = void 0;
6810
6811           if (i >= tokensLength) return 0;
6812
6813           if (l = checkExtendSelector(i)) i += l;else return 0;
6814
6815           if (tokens[i + 1] && tokens[i + 1].value === 'extend' && (l = checkPseudoc(i))) i += l;else return 0;
6816
6817           if (l = checkSC(i)) i += l;
6818
6819           if (l = checkBlock(i)) i += l;else return 0;
6820
6821           return i - start;
6822         }
6823
6824         function getExtend1() {
6825           var type = NodeType.ExtendType;
6826           var token = tokens[pos];
6827           var line = token.ln;
6828           var column = token.col;
6829           var content = [].concat(getExtendSelector(), getPseudoc(), getSC(), getBlock());
6830
6831           return newNode(type, content, line, column);
6832         }
6833
6834         /**
6835          * (1) `selector:extend(selector)`
6836          */
6837         function checkExtend2(i) {
6838           var start = i;
6839           var l = void 0;
6840
6841           if (i >= tokensLength) return 0;
6842
6843           if (l = checkExtendSelector(i)) i += l;else return 0;
6844
6845           if (tokens[i + 1] && tokens[i + 1].value === 'extend' && (l = checkPseudoc(i))) i += l;else return 0;
6846
6847           return i - start;
6848         }
6849
6850         function getExtend2() {
6851           var type = NodeType.ExtendType;
6852           var token = tokens[pos];
6853           var line = token.ln;
6854           var column = token.col;
6855           var content = [].concat(getExtendSelector(), getPseudoc());
6856
6857           return newNode(type, content, line, column);
6858         }
6859
6860         function checkExtendSelector(i) {
6861           var l = void 0;
6862
6863           if (l = checkParentSelectorWithExtension(i)) tokens[i].extend_type = 1;else if (l = checkIdent(i)) tokens[i].extend_type = 2;else if (l = checkClass(i)) tokens[i].extend_type = 3;else if (l = checkShash(i)) tokens[i].extend_type = 4;
6864
6865           return l;
6866         }
6867
6868         function getExtendSelector() {
6869           var childType = tokens[pos].extend_type;
6870
6871           if (childType === 1) return getParentSelectorWithExtension();
6872           if (childType === 2) return [getIdent()];
6873           if (childType === 3) return [getClass()];
6874           if (childType === 4) return [getShash()];
6875         }
6876
6877         /**
6878          * @param {Number} i Token's index number
6879          * @returns {Number}
6880          */
6881         function checkFunction(i) {
6882           var start = i;
6883           var l = void 0;
6884
6885           if (i >= tokensLength) return 0;
6886
6887           if (l = checkIdent(i)) i += l;else return 0;
6888
6889           return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? tokens[i].right - start + 1 : 0;
6890         }
6891
6892         /**
6893          * @returns {Array}
6894          */
6895         function getFunction() {
6896           var type = NodeType.FunctionType;
6897           var token = tokens[pos];
6898           var line = token.ln;
6899           var column = token.col;
6900           var content = [].concat(getIdent(), getArguments());
6901
6902           return newNode(type, content, line, column);
6903         }
6904
6905         /**
6906          * Check if token is part of an identifier
6907          * @param {Number} i Token's index number
6908          * @returns {Number} Length of the identifier
6909          */
6910         function checkIdent(i) {
6911           var start = i;
6912
6913           if (i >= tokensLength) return 0;
6914
6915           if (tokens[i].type === TokenType.HyphenMinus) i++;
6916
6917           if (tokens[i].type === TokenType.LowLine || tokens[i].type === TokenType.Identifier) i++;else return 0;
6918
6919           for (; i < tokensLength; i++) {
6920             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
6921           }
6922
6923           tokens[start].ident_last = i - 1;
6924
6925           return i - start;
6926         }
6927
6928         /**
6929          * Get node with an identifier
6930          * @returns {Array} `['ident', x]` where `x` is identifier's name
6931          */
6932         function getIdent() {
6933           var type = NodeType.IdentType;
6934           var token = tokens[pos];
6935           var line = token.ln;
6936           var column = token.col;
6937           var content = joinValues(pos, tokens[pos].ident_last);
6938
6939           pos = tokens[pos].ident_last + 1;
6940
6941           return newNode(type, content, line, column);
6942         }
6943
6944         /**
6945          * @param {number} i Token's index number
6946          * @returns {number} Length of the identifier
6947          */
6948         function checkPartialIdent(i) {
6949           var start = i;
6950
6951           if (i >= tokensLength) return 0;
6952
6953           for (; i < tokensLength; i++) {
6954             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
6955           }
6956
6957           tokens[start].ident_last = i - 1;
6958
6959           return i - start;
6960         }
6961
6962         /**
6963          * Check if token is part of `!important` word
6964          * @param {Number} i Token's index number
6965          * @returns {Number}
6966          */
6967         function checkImportant(i) {
6968           var start = i;
6969           var l = void 0;
6970
6971           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
6972
6973           if (l = checkSC(i)) i += l;
6974
6975           if (tokens[i].value === 'important') {
6976             tokens[start].importantEnd = i;
6977             return i - start + 1;
6978           } else {
6979             return 0;
6980           }
6981         }
6982
6983         /**
6984          * Get node with `!important` word
6985          * @returns {Array} `['important', sc]` where `sc` is optional whitespace
6986          */
6987         function getImportant() {
6988           var token = tokens[pos];
6989           var line = token.ln;
6990           var column = token.col;
6991           var content = joinValues(pos, token.importantEnd);
6992
6993           pos = token.importantEnd + 1;
6994
6995           return newNode(NodeType.ImportantType, content, line, column);
6996         }
6997
6998         /**
6999          * Check if token is part of an include (`@include` or `@extend` directive).
7000          * @param {Number} i Token's index number
7001          * @returns {Number}
7002          */
7003         function checkInclude(i) {
7004           var l = void 0;
7005
7006           if (i >= tokensLength) return 0;
7007
7008           if (l = checkInclude1(i)) tokens[i].include_type = 1;else if (l = checkInclude2(i)) tokens[i].include_type = 2;
7009
7010           return l;
7011         }
7012
7013         /**
7014          * Get node with included mixin
7015          * @returns {Array} `['include', x]`
7016          */
7017         function getInclude() {
7018           var type = tokens[pos].include_type;
7019
7020           if (type === 1) return getInclude1();
7021           if (type === 2) return getInclude2();
7022         }
7023
7024         /**
7025          * @param {Number} i Token's index number
7026          * @returns {Number}
7027          */
7028         function checkInclude1(i) {
7029           var start = i;
7030           var l = void 0;
7031
7032           if (l = checkClass(i) || checkShash(i)) i += l;else return 0;
7033
7034           while (i < tokensLength) {
7035             if (l = checkClass(i) || checkShash(i) || checkSC(i)) i += l;else if (tokens[i].type === TokenType.GreaterThanSign) i++;else break;
7036           }
7037
7038           if (l = checkArguments(i)) i += l;else return 0;
7039
7040           if (i < tokensLength && (l = checkSC(i))) i += l;
7041
7042           if (i < tokensLength && (l = checkImportant(i))) i += l;
7043
7044           return i - start;
7045         }
7046
7047         /**
7048          * @returns {Array} `['include', x]`
7049          */
7050         function getInclude1() {
7051           var type = NodeType.IncludeType;
7052           var token = tokens[pos];
7053           var line = token.ln;
7054           var column = token.col;
7055           var content = [];
7056
7057           content.push(checkClass(pos) ? getClass() : getShash());
7058
7059           while (pos < tokensLength) {
7060             if (checkClass(pos)) content.push(getClass());else if (checkShash(pos)) content.push(getShash());else if (checkSC(pos)) content = content.concat(getSC());else if (checkOperator(pos)) content.push(getOperator());else break;
7061           }
7062
7063           content.push(getArguments());
7064
7065           content = content.concat(getSC());
7066
7067           if (checkImportant(pos)) content.push(getImportant());
7068
7069           return newNode(type, content, line, column);
7070         }
7071
7072         /**
7073          * @param {Number} i Token's index number
7074          * @returns {Number}
7075          */
7076         function checkInclude2(i) {
7077           var start = i;
7078           var l = void 0;
7079
7080           if (l = checkClass(i) || checkShash(i)) i += l;else return 0;
7081
7082           while (i < tokensLength) {
7083             if (l = checkClass(i) || checkShash(i) || checkSC(i)) i += l;else if (tokens[i].type === TokenType.GreaterThanSign) i++;else break;
7084           }
7085
7086           return i - start;
7087         }
7088
7089         /**
7090          * @returns {Array} `['include', x]`
7091          */
7092         function getInclude2() {
7093           var type = NodeType.IncludeType;
7094           var token = tokens[pos];
7095           var line = token.ln;
7096           var column = token.col;
7097           var content = [];
7098
7099           content.push(checkClass(pos) ? getClass() : getShash());
7100
7101           while (pos < tokensLength) {
7102             if (checkClass(pos)) content.push(getClass());else if (checkShash(pos)) content.push(getShash());else if (checkSC(pos)) content = content.concat(getSC());else if (checkOperator(pos)) content.push(getOperator());else break;
7103           }
7104
7105           return newNode(type, content, line, column);
7106         }
7107
7108         /**
7109          * Check if token is part of LESS interpolated variable
7110          * @param {Number} i Token's index number
7111          * @returns {Number}
7112          */
7113         function checkInterpolatedVariable(i) {
7114           var start = i;
7115           var l = void 0;
7116
7117           if (i >= tokensLength) return 0;
7118
7119           if (tokens[i].type !== TokenType.CommercialAt || !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket) {
7120             return 0;
7121           }
7122
7123           i += 2;
7124
7125           if (l = checkIdent(i)) i += l;else return 0;
7126
7127           return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0;
7128         }
7129
7130         /**
7131          * Get node with LESS interpolated variable
7132          * @returns {Array} `['interpolatedVariable', x]`
7133          */
7134         function getInterpolatedVariable() {
7135           var type = NodeType.InterpolatedVariableType;
7136           var token = tokens[pos];
7137           var line = token.ln;
7138           var column = token.col;
7139           var content = [];
7140
7141           // Skip `@{`:
7142           pos += 2;
7143
7144           content.push(getIdent());
7145
7146           var end = getLastPosition(content, line, column, 1);
7147
7148           // Skip `}`:
7149           pos++;
7150
7151           return newNode(type, content, line, column, end);
7152         }
7153
7154         function checkKeyframesBlock(i) {
7155           var start = i;
7156           var l = void 0;
7157
7158           if (i >= tokensLength) return 0;
7159
7160           if (l = checkKeyframesSelector(i)) i += l;else return 0;
7161
7162           if (l = checkSC(i)) i += l;
7163
7164           if (l = checkBlock(i)) i += l;else return 0;
7165
7166           return i - start;
7167         }
7168
7169         function getKeyframesBlock() {
7170           var type = NodeType.RulesetType;
7171           var token = tokens[pos];
7172           var line = token.ln;
7173           var column = token.col;
7174           var content = [].concat(getKeyframesSelector(), getSC(), getBlock());
7175
7176           return newNode(type, content, line, column);
7177         }
7178
7179         function checkKeyframesBlocks(i) {
7180           var start = i;
7181           var l = void 0;
7182
7183           if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;else return 0;
7184
7185           if (l = checkSC(i)) i += l;
7186
7187           if (l = checkKeyframesBlock(i)) i += l;else return 0;
7188
7189           while (tokens[i].type !== TokenType.RightCurlyBracket) {
7190             if (l = checkSC(i)) i += l;else if (l = checkKeyframesBlock(i)) i += l;else break;
7191           }
7192
7193           if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;else return 0;
7194
7195           return i - start;
7196         }
7197
7198         function getKeyframesBlocks() {
7199           var type = NodeType.BlockType;
7200           var token = tokens[pos];
7201           var line = token.ln;
7202           var column = token.col;
7203           var keyframesBlocksEnd = token.right;
7204           var content = [];
7205
7206           // Skip `{`.
7207           pos++;
7208
7209           while (pos < keyframesBlocksEnd) {
7210             if (checkSC(pos)) content = content.concat(getSC());else if (checkKeyframesBlock(pos)) content.push(getKeyframesBlock());
7211           }
7212
7213           var end = getLastPosition(content, line, column, 1);
7214
7215           // Skip `}`.
7216           pos++;
7217
7218           return newNode(type, content, line, column, end);
7219         }
7220
7221         /**
7222          * Check if token is part of a @keyframes rule.
7223          * @param {Number} i Token's index number
7224          * @return {Number} Length of the @keyframes rule
7225          */
7226         function checkKeyframesRule(i) {
7227           var start = i;
7228           var l = void 0;
7229
7230           if (i >= tokensLength) return 0;
7231
7232           if (l = checkAtkeyword(i)) i += l;else return 0;
7233
7234           var atruleName = joinValues2(i - l, l);
7235           if (atruleName.toLowerCase().indexOf('keyframes') === -1) return 0;
7236
7237           if (l = checkSC(i)) i += l;else return 0;
7238
7239           if (l = checkIdent(i)) i += l;else return 0;
7240
7241           if (l = checkSC(i)) i += l;
7242
7243           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
7244
7245           return i - start;
7246         }
7247
7248         /**
7249          * @return {Node}
7250          */
7251         function getKeyframesRule() {
7252           var type = NodeType.AtruleType;
7253           var token = tokens[pos];
7254           var line = token.ln;
7255           var column = token.col;
7256           var content = [].concat(getAtkeyword(), getSC(), getIdent(), getSC(), getKeyframesBlocks());
7257
7258           return newNode(type, content, line, column);
7259         }
7260
7261         function checkKeyframesSelector(i) {
7262           var start = i;
7263           var l = void 0;
7264
7265           if (i >= tokensLength) return 0;
7266
7267           if (l = checkIdent(i)) {
7268             // Valid selectors are only `from` and `to`.
7269             var selector = joinValues2(i, l);
7270             if (selector !== 'from' && selector !== 'to') return 0;
7271
7272             i += l;
7273             tokens[start].keyframesSelectorType = 1;
7274           } else if (l = checkPercentage(i)) {
7275             i += l;
7276             tokens[start].keyframesSelectorType = 2;
7277           } else {
7278             return 0;
7279           }
7280
7281           return i - start;
7282         }
7283
7284         function getKeyframesSelector() {
7285           var keyframesSelectorType = NodeType.KeyframesSelectorType;
7286           var selectorType = NodeType.SelectorType;
7287           var token = tokens[pos];
7288           var line = token.ln;
7289           var column = token.col;
7290           var content = [];
7291
7292           if (token.keyframesSelectorType === 1) {
7293             content.push(getIdent());
7294           } else {
7295             content.push(getPercentage());
7296           }
7297
7298           var keyframesSelector = newNode(keyframesSelectorType, content, line, column);
7299
7300           return newNode(selectorType, [keyframesSelector], line, column);
7301         }
7302
7303         /**
7304          * Check if token is part of a LESS mixin
7305          * @param {Number} i Token's index number
7306          * @returns {Number} Length of the mixin
7307          */
7308         function checkMixin(i) {
7309           var l = void 0;
7310
7311           if (i >= tokensLength) return 0;
7312
7313           if (l = checkMixin1(i)) tokens[i].mixin_type = 1;else if (l = checkMixin2(i)) tokens[i].mixin_type = 2;else return 0;
7314
7315           return l;
7316         }
7317
7318         /**
7319          * @returns {Array}
7320          */
7321         function getMixin() {
7322           var type = tokens[pos].mixin_type;
7323
7324           if (type === 1) return getMixin1();
7325           if (type === 2) return getMixin2();
7326         }
7327
7328         function checkMixin1(i) {
7329           var start = i;
7330           var l = void 0;
7331
7332           if (i >= tokensLength) return 0;
7333
7334           if (l = checkClass(i) || checkShash(i)) i += l;else return 0;
7335
7336           if (l = checkSC(i)) i += l;
7337
7338           if (l = checkArguments(i)) i += l;
7339
7340           if (l = checkSC(i)) i += l;
7341
7342           if (l = checkBlock(i)) i += l;else return 0;
7343
7344           return i - start;
7345         }
7346
7347         /**
7348          * Get node with a mixin
7349          * @returns {Array} `['mixin', x]`
7350          */
7351         function getMixin1() {
7352           var type = NodeType.MixinType;
7353           var token = tokens[pos];
7354           var line = token.ln;
7355           var column = token.col;
7356           var content = [];
7357
7358           content.push(checkClass(pos) ? getClass() : getShash());
7359
7360           content = content.concat(getSC());
7361
7362           if (checkArguments(pos)) content.push(getArguments());
7363
7364           content = content.concat(getSC());
7365
7366           if (checkBlock(pos)) content.push(getBlock());
7367
7368           return newNode(type, content, line, column);
7369         }
7370
7371         /**
7372          * Check if token is part of a LESS mixin
7373          * @param {Number} i Token's index number
7374          * @returns {Number} Length of the mixin
7375          */
7376         function checkMixin2(i) {
7377           var start = i;
7378           var l = void 0;
7379
7380           if (i >= tokensLength) return 0;
7381
7382           if (l = checkClass(i) || checkShash(i)) i += l;else return 0;
7383
7384           if (l = checkSC(i)) i += l;
7385
7386           if (l = checkArguments(i)) i += l;
7387
7388           return i - start;
7389         }
7390
7391         /**
7392          * Get node with a mixin
7393          * @returns {Array} `['mixin', x]`
7394          */
7395         function getMixin2() {
7396           var type = NodeType.MixinType;
7397           var token = tokens[pos];
7398           var line = token.ln;
7399           var column = token.col;
7400           var content = [];
7401
7402           content.push(checkClass(pos) ? getClass() : getShash());
7403
7404           content = content.concat(getSC());
7405
7406           if (checkArguments(pos)) content.push(getArguments());
7407
7408           return newNode(type, content, line, column);
7409         }
7410
7411         /**
7412          * Check if token is a namespace sign (`|`)
7413          * @param {Number} i Token's index number
7414          * @returns {Number} `1` if token is `|`, `0` if not
7415          */
7416         function checkNamespace(i) {
7417           return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0;
7418         }
7419
7420         /**
7421          * Get node with a namespace sign
7422          * @returns {Array} `['namespace']`
7423          */
7424         function getNamespace() {
7425           var type = NodeType.NamespaceType;
7426           var token = tokens[pos];
7427           var line = token.ln;
7428           var column = token.col;
7429           var content = '|';
7430
7431           pos++;
7432
7433           return newNode(type, content, line, column);
7434         }
7435
7436         /**
7437          * @param {Number} i Token's index number
7438          * @returns {Number}
7439          */
7440         function checkNmName2(i) {
7441           if (tokens[i].type === TokenType.Identifier) return 1;else if (tokens[i].type !== TokenType.DecimalNumber) return 0;
7442
7443           i++;
7444
7445           return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1;
7446         }
7447
7448         /**
7449          * @returns {String}
7450          */
7451         function getNmName2() {
7452           var s = tokens[pos].value;
7453
7454           if (tokens[pos++].type === TokenType.DecimalNumber && pos < tokensLength && tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value;
7455
7456           return s;
7457         }
7458
7459         /**
7460          * Check if token is part of a number
7461          * @param {Number} i Token's index number
7462          * @returns {Number} Length of number
7463          */
7464         function checkNumber(i) {
7465           if (i >= tokensLength) return 0;
7466
7467           if (tokens[i].number_l) return tokens[i].number_l;
7468
7469           // `10`:
7470           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && (!tokens[i + 1] || tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop)) {
7471             tokens[i].number_l = 1;
7472             return 1;
7473           }
7474
7475           // `10.`:
7476           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && (!tokens[i + 2] || tokens[i + 2].type !== TokenType.DecimalNumber)) {
7477             tokens[i].number_l = 2;
7478             return 2;
7479           }
7480
7481           // `.10`:
7482           if (i < tokensLength && tokens[i].type === TokenType.FullStop && tokens[i + 1].type === TokenType.DecimalNumber) {
7483             tokens[i].number_l = 2;
7484             return 2;
7485           }
7486
7487           // `10.10`:
7488           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) {
7489             tokens[i].number_l = 3;
7490             return 3;
7491           }
7492
7493           return 0;
7494         }
7495
7496         /**
7497          * Get node with number
7498          * @returns {Array} `['number', x]` where `x` is a number converted
7499          *      to string.
7500          */
7501         function getNumber() {
7502           var type = NodeType.NumberType;
7503           var token = tokens[pos];
7504           var line = token.ln;
7505           var column = token.col;
7506           var l = tokens[pos].number_l;
7507           var content = '';
7508
7509           for (var j = 0; j < l; j++) {
7510             content += tokens[pos + j].value;
7511           }
7512
7513           pos += l;
7514
7515           return newNode(type, content, line, column);
7516         }
7517
7518         /**
7519          * Check if token is an operator (`/`, `,`, `:`, `=`, `>`, `<` or `*`)
7520          * @param {Number} i Token's index number
7521          * @returns {Number} `1` if token is an operator, otherwise `0`
7522          */
7523         function checkOperator(i) {
7524           if (i >= tokensLength) return 0;
7525
7526           switch (tokens[i].type) {
7527             case TokenType.Solidus:
7528             case TokenType.Comma:
7529             case TokenType.Colon:
7530             case TokenType.EqualsSign:
7531             case TokenType.LessThanSign:
7532             case TokenType.GreaterThanSign:
7533             case TokenType.Asterisk:
7534               return 1;
7535           }
7536
7537           return 0;
7538         }
7539
7540         /**
7541          * Get node with an operator
7542          * @returns {Array} `['operator', x]` where `x` is an operator converted
7543          *      to string.
7544          */
7545         function getOperator() {
7546           var type = NodeType.OperatorType;
7547           var token = tokens[pos];
7548           var line = token.ln;
7549           var column = token.col;
7550           var content = token.value;
7551
7552           pos++;
7553
7554           return newNode(type, content, line, column);
7555         }
7556
7557         /**
7558          * Check if token is part of text inside parentheses, e.g. `(1)`
7559          * @param {Number} i Token's index number
7560          * @return {Number}
7561          */
7562         function checkParentheses(i) {
7563           if (i >= tokensLength) return 0;
7564
7565           var start = i;
7566           var right = tokens[i].right;
7567
7568           // Skip `(`.
7569           if (tokens[i].type === TokenType.LeftParenthesis) i++;else return 0;
7570
7571           if (i < right) {
7572             var l = checkTsets(i);
7573             if (l) i += l;else return 0;
7574           }
7575
7576           // Skip `)`.
7577           i++;
7578
7579           return i - start;
7580         }
7581
7582         /**
7583          * Get node with text inside parentheses, e.g. `(1)`
7584          * @return {Node}
7585          */
7586         function getParentheses() {
7587           var type = NodeType.ParenthesesType;
7588           var token = tokens[pos];
7589           var line = token.ln;
7590           var column = token.col;
7591           var right = token.right;
7592           var content = [];
7593
7594           // Skip `(`.
7595           pos++;
7596
7597           if (pos < right) {
7598             content = getTsets();
7599           }
7600
7601           var end = getLastPosition(content, line, column, 1);
7602
7603           // Skip `)`.
7604           pos++;
7605
7606           return newNode(type, content, line, column, end);
7607         }
7608
7609         /**
7610          * Check if token is a parent selector (`&`).
7611          * @param {Number} i Token's index number
7612          * @returns {Number}
7613          */
7614         function checkParentSelector(i) {
7615           return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0;
7616         }
7617
7618         /**
7619          * Get node with a parent selector
7620          * @returns {Array} `['parentSelector']`
7621          */
7622         function getParentSelector() {
7623           var type = NodeType.ParentSelectorType;
7624           var token = tokens[pos];
7625           var line = token.ln;
7626           var column = token.col;
7627           var content = '&';
7628
7629           pos++;
7630
7631           return newNode(type, content, line, column);
7632         }
7633
7634         function checkParentSelectorExtension(i) {
7635           var start = i;
7636           var l = void 0;
7637
7638           if (i >= tokensLength) return 0;
7639
7640           while (i < tokensLength) {
7641             if (l = checkNumber(i) || checkPartialIdent(i)) i += l;else break;
7642           }
7643
7644           return i - start;
7645         }
7646
7647         function getParentSelectorExtension() {
7648           var type = NodeType.ParentSelectorExtensionType;
7649           var token = tokens[pos];
7650           var line = token.ln;
7651           var column = token.col;
7652           var content = [];
7653
7654           while (pos < tokensLength) {
7655             if (checkNumber(pos)) {
7656               content.push(getNumber());
7657             } else if (checkPartialIdent(pos)) {
7658               content.push(getIdent());
7659             } else break;
7660           }
7661
7662           return newNode(type, content, line, column);
7663         }
7664
7665         function checkParentSelectorWithExtension(i) {
7666           var start = i;
7667           var l = void 0;
7668
7669           if (i >= tokensLength) return 0;
7670
7671           if (l = checkParentSelector(i)) i += l;else return 0;
7672
7673           if (l = checkParentSelectorExtension(i)) i += l;
7674
7675           return i - start;
7676         }
7677
7678         function getParentSelectorWithExtension() {
7679           var content = [getParentSelector()];
7680
7681           if (checkParentSelectorExtension(pos)) content.push(getParentSelectorExtension());
7682
7683           return content;
7684         }
7685
7686         /**
7687          * Check if token is part of a number with percent sign (e.g. `10%`)
7688          * @param {Number} i Token's index number
7689          * @returns {Number}
7690          */
7691         function checkPercentage(i) {
7692           var start = i;
7693           var l = void 0;
7694
7695           if (i >= tokensLength) return 0;
7696
7697           if (l = checkNumber(i)) i += l;else return 0;
7698
7699           if (i >= tokensLength) return 0;
7700
7701           // Skip `%`.
7702           if (tokens[i].type === TokenType.PercentSign) i++;else return 0;
7703
7704           return i - start;
7705         }
7706
7707         /**
7708          * Get node of number with percent sign
7709          * @returns {Array} `['percentage', ['number', x]]` where `x` is a number
7710          *      (without percent sign) converted to string.
7711          */
7712         function getPercentage() {
7713           var type = NodeType.PercentageType;
7714           var token = tokens[pos];
7715           var line = token.ln;
7716           var column = token.col;
7717           var content = [getNumber()];
7718           var end = getLastPosition(content, line, column, 1);
7719
7720           // Skip `%`.
7721           pos++;
7722
7723           return newNode(type, content, line, column, end);
7724         }
7725
7726         /**
7727          * @param {Number} i Token's index number
7728          * @returns {Number}
7729          */
7730         function checkProgid(i) {
7731           var start = i;
7732           var l = void 0;
7733
7734           if (i >= tokensLength) return 0;
7735
7736           if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6;else return 0;
7737
7738           if (l = checkIdent(i)) i += l;else return 0;
7739
7740           if (l = checkSC(i)) i += l;
7741
7742           if (tokens[i].type === TokenType.LeftParenthesis) {
7743             tokens[start].progid_end = tokens[i].right;
7744             i = tokens[i].right + 1;
7745           } else return 0;
7746
7747           return i - start;
7748         }
7749
7750         /**
7751          * @returns {Array}
7752          */
7753         function getProgid() {
7754           var type = NodeType.ProgidType;
7755           var token = tokens[pos];
7756           var line = token.ln;
7757           var column = token.col;
7758           var progid_end = token.progid_end;
7759           var content = joinValues(pos, progid_end);
7760
7761           pos = progid_end + 1;
7762
7763           return newNode(type, content, line, column);
7764         }
7765
7766         /**
7767          * Check if token is part of a property
7768          * @param {Number} i Token's index number
7769          * @returns {Number} Length of the property
7770          */
7771         function checkProperty(i) {
7772           var start = i;
7773           var l = void 0;
7774
7775           if (i >= tokensLength) return 0;
7776
7777           if (l = checkVariable(i) || checkIdent(i)) i += l;else return 0;
7778
7779           return i - start;
7780         }
7781
7782         /**
7783          * Get node with a property
7784          * @returns {Array} `['property', x]`
7785          */
7786         function getProperty() {
7787           var type = NodeType.PropertyType;
7788           var token = tokens[pos];
7789           var line = token.ln;
7790           var column = token.col;
7791           var content = [];
7792
7793           if (checkVariable(pos)) {
7794             content.push(getVariable());
7795           } else {
7796             content.push(getIdent());
7797           }
7798
7799           return newNode(type, content, line, column);
7800         }
7801
7802         /**
7803          * Check if token is a colon
7804          * @param {Number} i Token's index number
7805          * @returns {Number} `1` if token is a colon, otherwise `0`
7806          */
7807         function checkPropertyDelim(i) {
7808           return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0;
7809         }
7810
7811         /**
7812          * Get node with a colon
7813          * @returns {Array} `['propertyDelim']`
7814          */
7815         function getPropertyDelim() {
7816           var type = NodeType.PropertyDelimType;
7817           var token = tokens[pos];
7818           var line = token.ln;
7819           var column = token.col;
7820           var content = ':';
7821
7822           // Skip `:`.
7823           pos++;
7824
7825           return newNode(type, content, line, column);
7826         }
7827
7828         /**
7829          * @param {Number} i Token's index number
7830          * @returns {Number}
7831          */
7832         function checkPseudo(i) {
7833           return checkPseudoe(i) || checkPseudoc(i);
7834         }
7835
7836         /**
7837          * @returns {Array}
7838          */
7839         function getPseudo() {
7840           if (checkPseudoe(pos)) return getPseudoe();
7841           if (checkPseudoc(pos)) return getPseudoc();
7842         }
7843
7844         /**
7845          * @param {Number} i Token's index number
7846          * @returns {Number}
7847          */
7848         function checkPseudoe(i) {
7849           var l = void 0;
7850
7851           // Check `::`
7852           if (i >= tokensLength || tokens[i].type !== TokenType.Colon || i + 1 >= tokensLength || tokens[i + 1].type !== TokenType.Colon) return 0;
7853
7854           if (l = checkPseudoElement1(i)) tokens[i].pseudoElementType = 1;else if (l = checkPseudoElement2(i)) tokens[i].pseudoElementType = 2;else return 0;
7855
7856           return l;
7857         }
7858
7859         /**
7860          * @returns {Node}
7861          */
7862         function getPseudoe() {
7863           var childType = tokens[pos].pseudoElementType;
7864           if (childType === 1) return getPseudoElement1();
7865           if (childType === 2) return getPseudoElement2();
7866         }
7867
7868         /**
7869          * (1) `::slotted(selector)`
7870          * (2) `::slotted(selector, selector)`
7871          */
7872         function checkPseudoElement1(i) {
7873           var start = i;
7874           var l = void 0;
7875
7876           // Skip `::`.
7877           i += 2;
7878
7879           if (i >= tokensLength) return 0;
7880
7881           if (l = checkIdent(i)) i += l;else return 0;
7882
7883           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
7884
7885           var right = tokens[i].right;
7886
7887           // Skip `(`.
7888           i++;
7889
7890           if (l = checkSC(i)) i += l;
7891
7892           if (l = checkSelectorsGroup(i)) i += l;else return 0;
7893
7894           if (l = checkSC(i)) i += l;
7895
7896           if (i !== right) return 0;
7897
7898           // Skip `)`.
7899           i++;
7900
7901           return i - start;
7902         }
7903
7904         /**
7905          * (1) `::slotted(selector)`
7906          * (2) `::slotted(selector, selector)`
7907          */
7908         function getPseudoElement1() {
7909           var type = NodeType.PseudoeType;
7910           var token = tokens[pos];
7911           var line = token.ln;
7912           var column = token.col;
7913           var content = [];
7914
7915           // Skip `::`.
7916           pos += 2;
7917
7918           content.push(getIdent());
7919
7920           {
7921             var _type = NodeType.ArgumentsType;
7922             var _token = tokens[pos];
7923             var _line = _token.ln;
7924             var _column = _token.col;
7925
7926             // Skip `(`.
7927             pos++;
7928
7929             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
7930
7931             var end = getLastPosition(selectorContent, _line, _column, 1);
7932             var args = newNode(_type, selectorContent, _line, _column, end);
7933             content.push(args);
7934
7935             // Skip `)`.
7936             pos++;
7937           }
7938
7939           return newNode(type, content, line, column);
7940         }
7941
7942         function checkPseudoElement2(i) {
7943           var start = i;
7944           var l = void 0;
7945
7946           // Skip `::`.
7947           i += 2;
7948
7949           if (l = checkInterpolatedVariable(i) || checkIdent(i)) i += l;else return 0;
7950
7951           return i - start;
7952         }
7953
7954         /**
7955          * @returns {Array}
7956          */
7957         function getPseudoElement2() {
7958           var type = NodeType.PseudoeType;
7959           var token = tokens[pos];
7960           var line = token.ln;
7961           var column = token.col;
7962
7963           // Skip `::`.
7964           pos += 2;
7965
7966           var content = [];
7967
7968           if (checkInterpolatedVariable(pos)) {
7969             content.push(getInterpolatedVariable());
7970           } else {
7971             content.push(getIdent());
7972           }
7973
7974           return newNode(type, content, line, column);
7975         }
7976
7977         /**
7978          * @param {Number} i Token's index number
7979          * @returns {Number}
7980          */
7981         function checkPseudoc(i) {
7982           var l = void 0;
7983
7984           if (i >= tokensLength || tokens[i].type !== TokenType.Colon) return 0;
7985
7986           if (l = checkPseudoClass3(i)) tokens[i].pseudoClassType = 3;else if (l = checkPseudoClass4(i)) tokens[i].pseudoClassType = 4;else if (l = checkPseudoClass5(i)) tokens[i].pseudoClassType = 5;else if (l = checkPseudoClass1(i)) tokens[i].pseudoClassType = 1;else if (l = checkPseudoClass2(i)) tokens[i].pseudoClassType = 2;else if (l = checkPseudoClass6(i)) tokens[i].pseudoClassType = 6;else return 0;
7987
7988           return l;
7989         }
7990
7991         function getPseudoc() {
7992           var childType = tokens[pos].pseudoClassType;
7993           if (childType === 1) return getPseudoClass1();
7994           if (childType === 2) return getPseudoClass2();
7995           if (childType === 3) return getPseudoClass3();
7996           if (childType === 4) return getPseudoClass4();
7997           if (childType === 5) return getPseudoClass5();
7998           if (childType === 6) return getPseudoClass6();
7999         }
8000
8001         /**
8002          * (1) `:not(selector)`
8003          * (2) `:extend(selector, selector)`
8004          */
8005         function checkPseudoClass1(i) {
8006           var start = i;
8007           var l = void 0;
8008
8009           // Skip `:`.
8010           i++;
8011
8012           if (i >= tokensLength) return 0;
8013
8014           if (l = checkIdent(i)) i += l;else return 0;
8015
8016           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
8017
8018           var right = tokens[i].right;
8019
8020           // Skip `(`.
8021           i++;
8022
8023           if (l = checkSC(i)) i += l;
8024
8025           if (l = checkSelectorsGroup(i)) i += l;else return 0;
8026
8027           if (l = checkSC(i)) i += l;
8028
8029           if (i !== right) return 0;
8030
8031           // Skip `)`.
8032           i++;
8033
8034           return i - start;
8035         }
8036
8037         /**
8038          * (-) `:not(panda)`
8039          */
8040         function getPseudoClass1() {
8041           var type = NodeType.PseudocType;
8042           var token = tokens[pos];
8043           var line = token.ln;
8044           var column = token.col;
8045           var content = [];
8046
8047           // Skip `:`.
8048           pos++;
8049
8050           content.push(getIdent());
8051
8052           {
8053             var _type2 = NodeType.ArgumentsType;
8054             var _token2 = tokens[pos];
8055             var _line2 = _token2.ln;
8056             var _column2 = _token2.col;
8057
8058             // Skip `(`.
8059             pos++;
8060
8061             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
8062
8063             var end = getLastPosition(selectorContent, _line2, _column2, 1);
8064             var args = newNode(_type2, selectorContent, _line2, _column2, end);
8065             content.push(args);
8066
8067             // Skip `)`.
8068             pos++;
8069           }
8070
8071           return newNode(type, content, line, column);
8072         }
8073
8074         /**
8075          * (1) `:nth-child(odd)`
8076          * (2) `:nth-child(even)`
8077          * (3) `:lang(de-DE)`
8078          */
8079         function checkPseudoClass2(i) {
8080           var start = i;
8081           var l = 0;
8082
8083           // Skip `:`.
8084           i++;
8085
8086           if (i >= tokensLength) return 0;
8087
8088           if (l = checkIdent(i)) i += l;else return 0;
8089
8090           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
8091
8092           var right = tokens[i].right;
8093
8094           // Skip `(`.
8095           i++;
8096
8097           if (l = checkSC(i)) i += l;
8098
8099           if (l = checkIdent(i)) i += l;else return 0;
8100
8101           if (l = checkSC(i)) i += l;
8102
8103           if (i !== right) return 0;
8104
8105           // Skip `)`.
8106           i++;
8107
8108           return i - start;
8109         }
8110
8111         function getPseudoClass2() {
8112           var type = NodeType.PseudocType;
8113           var token = tokens[pos];
8114           var line = token.ln;
8115           var column = token.col;
8116           var content = [];
8117
8118           // Skip `:`.
8119           pos++;
8120
8121           content.push(getIdent());
8122
8123           {
8124             // Skip `(`.
8125             pos++;
8126
8127             var l = tokens[pos].ln;
8128             var c = tokens[pos].col;
8129             var value = [].concat(getSC(), getIdent(), getSC());
8130
8131             var end = getLastPosition(value, l, c, 1);
8132             var args = newNode(NodeType.ArgumentsType, value, l, c, end);
8133             content.push(args);
8134
8135             // Skip `)`.
8136             pos++;
8137           }
8138
8139           return newNode(type, content, line, column);
8140         }
8141
8142         /**
8143          * (-) `:nth-child(-3n + 2)`
8144          */
8145         function checkPseudoClass3(i) {
8146           var start = i;
8147           var l = 0;
8148
8149           // Skip `:`.
8150           i++;
8151
8152           if (i >= tokensLength) return 0;
8153
8154           if (l = checkIdent(i)) i += l;else return 0;
8155
8156           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
8157
8158           var right = tokens[i].right;
8159
8160           // Skip `(`.
8161           i++;
8162
8163           if (l = checkSC(i)) i += l;
8164
8165           if (l = checkUnary(i)) i += l;
8166
8167           if (i >= tokensLength) return 0;
8168           if (tokens[i].type === TokenType.DecimalNumber) i++;
8169
8170           if (i >= tokensLength) return 0;
8171           if (tokens[i].value === 'n') i++;else return 0;
8172
8173           if (l = checkSC(i)) i += l;
8174
8175           if (i >= tokensLength) return 0;
8176           if (tokens[i].value === '+' || tokens[i].value === '-') i++;else return 0;
8177
8178           if (l = checkSC(i)) i += l;
8179
8180           if (tokens[i].type === TokenType.DecimalNumber) i++;else return 0;
8181
8182           if (l = checkSC(i)) i += l;
8183
8184           if (i !== right) return 0;
8185
8186           // Skip `)`.
8187           i++;
8188
8189           return i - start;
8190         }
8191
8192         function getPseudoClass3() {
8193           var type = NodeType.PseudocType;
8194           var token = tokens[pos];
8195           var line = token.ln;
8196           var column = token.col;
8197           var content = [];
8198
8199           // Skip `:`.
8200           pos++;
8201
8202           content.push(getIdent());
8203
8204           var l = tokens[pos].ln;
8205           var c = tokens[pos].col;
8206           var value = [];
8207
8208           // Skip `(`.
8209           pos++;
8210
8211           value = value.concat(getSC());
8212
8213           if (checkUnary(pos)) value.push(getUnary());
8214           if (checkNumber(pos)) value.push(getNumber());
8215
8216           {
8217             var _l = tokens[pos].ln;
8218             var _c = tokens[pos].col;
8219             var _content = tokens[pos].value;
8220             var ident = newNode(NodeType.IdentType, _content, _l, _c);
8221             value.push(ident);
8222             pos++;
8223           }
8224
8225           value = value.concat(getSC());
8226
8227           if (checkUnary(pos)) value.push(getUnary());
8228
8229           value = value.concat(getSC());
8230
8231           if (checkNumber(pos)) value.push(getNumber());
8232
8233           value = value.concat(getSC());
8234
8235           var end = getLastPosition(value, l, c, 1);
8236           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
8237           content.push(args);
8238
8239           // Skip `)`.
8240           pos++;
8241
8242           return newNode(type, content, line, column);
8243         }
8244
8245         /**
8246          * (-) `:nth-child(-3n)`
8247          */
8248         function checkPseudoClass4(i) {
8249           var start = i;
8250           var l = 0;
8251
8252           // Skip `:`.
8253           i++;
8254
8255           if (i >= tokensLength) return 0;
8256
8257           if (l = checkIdent(i)) i += l;else return 0;
8258
8259           if (i >= tokensLength) return 0;
8260           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
8261
8262           var right = tokens[i].right;
8263
8264           // Skip `(`.
8265           i++;
8266
8267           if (l = checkSC(i)) i += l;
8268
8269           if (l = checkUnary(i)) i += l;
8270           if (tokens[i].type === TokenType.DecimalNumber) i++;
8271
8272           if (tokens[i].value === 'n') i++;else return 0;
8273
8274           if (l = checkSC(i)) i += l;
8275
8276           if (i !== right) return 0;
8277
8278           // Skip `)`.
8279           i++;
8280
8281           return i - start;
8282         }
8283
8284         function getPseudoClass4() {
8285           var type = NodeType.PseudocType;
8286           var token = tokens[pos];
8287           var line = token.ln;
8288           var column = token.col;
8289           var content = [];
8290
8291           // Skip `:`.
8292           pos++;
8293
8294           content.push(getIdent());
8295
8296           var l = tokens[pos].ln;
8297           var c = tokens[pos].col;
8298           var value = [];
8299
8300           // Skip `(`.
8301           pos++;
8302
8303           value = value.concat(getSC());
8304
8305           if (checkUnary(pos)) value.push(getUnary());
8306           if (checkNumber(pos)) value.push(getNumber());
8307           if (checkIdent(pos)) value.push(getIdent());
8308
8309           value = value.concat(getSC());
8310
8311           var end = getLastPosition(value, l, c, 1);
8312           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
8313           content.push(args);
8314
8315           // Skip `)`.
8316           pos++;
8317
8318           return newNode(type, content, line, column);
8319         }
8320
8321         /**
8322          * (-) `:nth-child(+8)`
8323          */
8324         function checkPseudoClass5(i) {
8325           var start = i;
8326           var l = 0;
8327
8328           // Skip `:`.
8329           i++;
8330
8331           if (i >= tokensLength) return 0;
8332
8333           if (l = checkIdent(i)) i += l;else return 0;
8334
8335           if (i >= tokensLength) return 0;
8336           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
8337
8338           var right = tokens[i].right;
8339
8340           // Skip `(`.
8341           i++;
8342
8343           if (l = checkSC(i)) i += l;
8344
8345           if (l = checkUnary(i)) i += l;
8346           if (tokens[i].type === TokenType.DecimalNumber) i++;else return 0;
8347
8348           if (l = checkSC(i)) i += l;
8349
8350           if (i !== right) return 0;
8351
8352           // Skip `)`.
8353           i++;
8354
8355           return i - start;
8356         }
8357
8358         function getPseudoClass5() {
8359           var type = NodeType.PseudocType;
8360           var token = tokens[pos];
8361           var line = token.ln;
8362           var column = token.col;
8363           var content = [];
8364
8365           // Skip `:`.
8366           pos++;
8367
8368           content.push(getIdent());
8369
8370           var l = tokens[pos].ln;
8371           var c = tokens[pos].col;
8372           var value = [];
8373
8374           // Skip `(`.
8375           pos++;
8376
8377           value = value.concat(getSC());
8378
8379           if (checkUnary(pos)) value.push(getUnary());
8380           if (checkNumber(pos)) value.push(getNumber());
8381
8382           value = value.concat(getSC());
8383
8384           var end = getLastPosition(value, l, c, 1);
8385           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
8386           content.push(args);
8387
8388           // Skip `)`.
8389           pos++;
8390
8391           return newNode(type, content, line, column);
8392         }
8393
8394         /**
8395          * (-) `:checked`
8396          */
8397         function checkPseudoClass6(i) {
8398           var start = i;
8399           var l = 0;
8400
8401           // Skip `:`.
8402           i++;
8403
8404           if (i >= tokensLength) return 0;
8405
8406           if (l = checkInterpolatedVariable(i)) i += l;else if (l = checkIdent(i)) i += l;else return 0;
8407
8408           return i - start;
8409         }
8410
8411         function getPseudoClass6() {
8412           var type = NodeType.PseudocType;
8413           var token = tokens[pos];
8414           var line = token.ln;
8415           var column = token.col;
8416           var content = [];
8417
8418           // Skip `:`.
8419           pos++;
8420
8421           var ident = checkInterpolatedVariable(pos) ? getInterpolatedVariable() : getIdent();
8422           content.push(ident);
8423
8424           return newNode(type, content, line, column);
8425         }
8426
8427         /**
8428          * @param {Number} i Token's index number
8429          * @returns {Number}
8430          */
8431         function checkRuleset(i) {
8432           var start = i;
8433           var l = void 0;
8434
8435           if (i >= tokensLength) return 0;
8436
8437           if (l = checkSelectorsGroup(i)) i += l;else return 0;
8438
8439           if (l = checkSC(i)) i += l;
8440
8441           if (l = checkBlock(i)) i += l;else return 0;
8442
8443           return i - start;
8444         }
8445
8446         function getRuleset() {
8447           var type = NodeType.RulesetType;
8448           var token = tokens[pos];
8449           var line = token.ln;
8450           var column = token.col;
8451           var content = [].concat(getSelectorsGroup(), getSC(), getBlock());
8452
8453           return newNode(type, content, line, column);
8454         }
8455
8456         /**
8457          * Check if token is marked as a space (if it's a space or a tab
8458          *      or a line break).
8459          * @param {Number} i
8460          * @returns {Number} Number of spaces in a row starting with the given token.
8461          */
8462         function checkS(i) {
8463           return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0;
8464         }
8465
8466         /**
8467          * Get node with spaces
8468          * @returns {Array} `['s', x]` where `x` is a string containing spaces
8469          */
8470         function getS() {
8471           var type = NodeType.SType;
8472           var token = tokens[pos];
8473           var line = token.ln;
8474           var column = token.col;
8475           var content = joinValues(pos, tokens[pos].ws_last);
8476
8477           pos = tokens[pos].ws_last + 1;
8478
8479           return newNode(type, content, line, column);
8480         }
8481
8482         /**
8483          * Check if token is a space or a comment.
8484          * @param {Number} i Token's index number
8485          * @returns {Number} Number of similar (space or comment) tokens
8486          *      in a row starting with the given token.
8487          */
8488         function checkSC(i) {
8489           if (i >= tokensLength) return 0;
8490
8491           var l = void 0;
8492           var lsc = 0;
8493
8494           while (i < tokensLength) {
8495             if (!(l = checkS(i)) && !(l = checkCommentML(i)) && !(l = checkCommentSL(i))) break;
8496             i += l;
8497             lsc += l;
8498           }
8499
8500           return lsc || 0;
8501         }
8502
8503         /**
8504          * Get node with spaces and comments
8505          * @returns {Array} Array containing nodes with spaces (if there are any)
8506          *      and nodes with comments (if there are any):
8507          *      `[['s', x]*, ['comment', y]*]` where `x` is a string of spaces
8508          *      and `y` is a comment's text (without `/*` and `* /`).
8509          */
8510         function getSC() {
8511           var sc = [];
8512
8513           if (pos >= tokensLength) return sc;
8514
8515           while (pos < tokensLength) {
8516             if (checkS(pos)) sc.push(getS());else if (checkCommentML(pos)) sc.push(getCommentML());else if (checkCommentSL(pos)) sc.push(getCommentSL());else break;
8517           }
8518
8519           return sc;
8520         }
8521
8522         /**
8523          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside
8524          *      a simple selector
8525          * @param {Number} i Token's index number
8526          * @returns {Number}
8527          */
8528         function checkShash(i) {
8529           var l = void 0;
8530
8531           if (i >= tokensLength || tokens[i].type !== TokenType.NumberSign) return 0;
8532
8533           if (l = checkInterpolatedVariable(i + 1) || checkIdent(i + 1)) return l + 1;else return 0;
8534         }
8535
8536         /**
8537          * Get node with a hexadecimal number (e.g. `#fff`) inside a simple
8538          *      selector
8539          * @returns {Array} `['shash', x]` where `x` is a hexadecimal number
8540          *      converted to string (without `#`, e.g. `fff`)
8541          */
8542         function getShash() {
8543           var type = NodeType.ShashType;
8544           var token = tokens[pos];
8545           var line = token.ln;
8546           var column = token.col;
8547           var content = [];
8548
8549           // Skip `#`.
8550           pos++;
8551
8552           if (checkInterpolatedVariable(pos)) content.push(getInterpolatedVariable());else content.push(getIdent());
8553
8554           return newNode(type, content, line, column);
8555         }
8556
8557         /**
8558          * Check if token is part of a string (text wrapped in quotes)
8559          * @param {Number} i Token's index number
8560          * @returns {Number} `1` if token is part of a string, `0` if not
8561          */
8562         function checkString(i) {
8563           if (i >= tokensLength) {
8564             return 0;
8565           }
8566
8567           if (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) {
8568             return 1;
8569           }
8570
8571           return 0;
8572         }
8573
8574         /**
8575          * Get string's node
8576          * @returns {Array} `['string', x]` where `x` is a string (including
8577          *      quotes).
8578          */
8579         function getString() {
8580           var type = NodeType.StringType;
8581           var token = tokens[pos];
8582           var line = token.ln;
8583           var column = token.col;
8584           var content = token.value;
8585
8586           pos++;
8587
8588           return newNode(type, content, line, column);
8589         }
8590
8591         /**
8592          * Validate stylesheet: it should consist of any number (0 or more) of
8593          * rulesets (sets of rules with selectors), @-rules, whitespaces or
8594          * comments.
8595          * @param {Number} i Token's index number
8596          * @returns {Number}
8597          */
8598         function checkStylesheet(i) {
8599           var start = i;
8600           var l = void 0;
8601
8602           // Check every token:
8603           while (i < tokensLength) {
8604             if (l = checkSC(i) || checkRuleset(i) || checkDeclaration(i) || checkDeclDelim(i) || checkAtrule(i) || checkMixin(i)) i += l;else throwError(i);
8605           }
8606
8607           return i - start;
8608         }
8609
8610         /**
8611          * @returns {Array} `['stylesheet', x]` where `x` is all stylesheet's
8612          *      nodes.
8613          */
8614         function getStylesheet() {
8615           var type = NodeType.StylesheetType;
8616           var token = tokens[pos];
8617           var line = token.ln;
8618           var column = token.col;
8619           var content = [];
8620
8621           while (pos < tokensLength) {
8622             if (checkSC(pos)) content = content.concat(getSC());else if (checkRuleset(pos)) content.push(getRuleset());else if (checkDeclaration(pos)) content.push(getDeclaration());else if (checkDeclDelim(pos)) content.push(getDeclDelim());else if (checkAtrule(pos)) content.push(getAtrule());else if (checkMixin(pos)) content.push(getMixin());else throwError(pos);
8623           }
8624
8625           return newNode(type, content, line, column);
8626         }
8627
8628         /**
8629          * @param {Number} i Token's index number
8630          * @returns {Number}
8631          */
8632         function checkTset(i) {
8633           var l = void 0;
8634
8635           if (l = checkVhash(i)) tokens[i].tset_child = 1;else if (l = checkAny(i)) tokens[i].tset_child = 2;else if (l = checkSC(i)) tokens[i].tset_child = 3;else if (l = checkOperator(i)) tokens[i].tset_child = 4;
8636
8637           return l;
8638         }
8639
8640         /**
8641          * @returns {Array}
8642          */
8643         function getTset() {
8644           var childType = tokens[pos].tset_child;
8645
8646           if (childType === 1) return getVhash();
8647           if (childType === 2) return getAny();
8648           if (childType === 3) return getSC();
8649           if (childType === 4) return getOperator();
8650         }
8651
8652         /**
8653          * @param {Number} i Token's index number
8654          * @returns {Number}
8655          */
8656         function checkTsets(i) {
8657           var start = i;
8658           var l = void 0;
8659
8660           if (i >= tokensLength) return 0;
8661
8662           while (l = checkTset(i)) {
8663             i += l;
8664           }
8665
8666           return i - start;
8667         }
8668
8669         /**
8670          * @returns {Array}
8671          */
8672         function getTsets() {
8673           var content = [];
8674           var t = void 0;
8675
8676           while (checkTset(pos)) {
8677             t = getTset();
8678             if (typeof t.content === 'string') content.push(t);else content = content.concat(t);
8679           }
8680
8681           return content;
8682         }
8683
8684         /**
8685          * Check if token is an unary (arithmetical) sign (`+` or `-`)
8686          * @param {Number} i Token's index number
8687          * @returns {Number} `1` if token is an unary sign, `0` if not
8688          */
8689         function checkUnary(i) {
8690           if (i >= tokensLength) return 0;
8691
8692           if (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) {
8693             return 1;
8694           }
8695
8696           return 0;
8697         }
8698
8699         /**
8700          * Get node with an unary (arithmetical) sign (`+` or `-`)
8701          * @returns {Array} `['unary', x]` where `x` is an unary sign
8702          *      converted to string.
8703          */
8704         function getUnary() {
8705           var type = NodeType.OperatorType;
8706           var token = tokens[pos];
8707           var line = token.ln;
8708           var column = token.col;
8709           var content = token.value;
8710
8711           pos++;
8712
8713           return newNode(type, content, line, column);
8714         }
8715
8716         /**
8717          * Check if token is a unicode range (single or multiple <urange> nodes)
8718          * @param {number} i Token's index
8719          * @return {number} Unicode range node's length
8720          */
8721         function checkUnicodeRange(i) {
8722           var start = i;
8723           var l = void 0;
8724
8725           if (i >= tokensLength) return 0;
8726
8727           if (l = checkUrange(i)) i += l;else return 0;
8728
8729           while (i < tokensLength) {
8730             var spaceBefore = checkSC(i);
8731             var comma = checkDelim(i + spaceBefore);
8732             if (!comma) break;
8733
8734             var spaceAfter = checkSC(i + spaceBefore + comma);
8735             if (l = checkUrange(i + spaceBefore + comma + spaceAfter)) {
8736               i += spaceBefore + comma + spaceAfter + l;
8737             } else break;
8738           }
8739
8740           return i - start;
8741         }
8742
8743         /**
8744          * Get a unicode range node
8745          * @return {Node}
8746          */
8747         function getUnicodeRange() {
8748           var type = NodeType.UnicodeRangeType;
8749           var token = tokens[pos];
8750           var line = token.ln;
8751           var column = token.col;
8752           var content = [];
8753
8754           while (pos < tokensLength) {
8755             if (checkSC(pos)) content = content.concat(getSC());else if (checkDelim(pos)) content.push(getDelim());else if (checkUrange(pos)) content.push(getUrange());else break;
8756           }
8757
8758           return newNode(type, content, line, column);
8759         }
8760
8761         /**
8762          * Check if token is unit
8763          * @param {Number} i Token's index number
8764          * @return {Number}
8765          */
8766         function checkUnit(i) {
8767           var units = ['em', 'ex', 'ch', 'rem', 'vh', 'vw', 'vmin', 'vmax', 'px', 'mm', 'q', 'cm', 'in', 'pt', 'pc', 'deg', 'grad', 'rad', 'turn', 's', 'ms', 'Hz', 'kHz', 'dpi', 'dpcm', 'dppx'];
8768
8769           return units.indexOf(tokens[i].value) !== -1 ? 1 : 0;
8770         }
8771
8772         /**
8773          * Get unit node of type ident
8774          * @return {Node} An ident node containing the unit value
8775          */
8776         function getUnit() {
8777           var type = NodeType.IdentType;
8778           var token = tokens[pos];
8779           var line = token.ln;
8780           var column = token.col;
8781           var content = token.value;
8782
8783           pos++;
8784
8785           return newNode(type, content, line, column);
8786         }
8787
8788         /**
8789          * Check if token is a u-range (part of a unicode-range)
8790          * (1) `U+416`
8791          * (2) `U+400-4ff`
8792          * (3) `U+4??`
8793          * @param {number} i Token's index
8794          * @return {number} Urange node's length
8795          */
8796         function checkUrange(i) {
8797           var start = i;
8798           var l = void 0;
8799
8800           if (i >= tokensLength) return 0;
8801
8802           // Check for unicode prefix (u+ or U+)
8803           if (tokens[i].value === 'U' || tokens[i].value === 'u') i += 1;else return 0;
8804
8805           if (i >= tokensLength) return 0;
8806
8807           if (tokens[i].value === '+') i += 1;else return 0;
8808
8809           while (i < tokensLength) {
8810             if (l = checkIdent(i)) i += l;else if (l = checkNumber(i)) i += l;else if (l = checkUnary(i)) i += l;else if (l = _checkUnicodeWildcard(i)) i += l;else break;
8811           }
8812
8813           tokens[start].urangeEnd = i - 1;
8814
8815           return i - start;
8816         }
8817
8818         /**
8819          * Get a u-range node (part of a unicode-range)
8820          * @return {Node}
8821          */
8822         function getUrange() {
8823           var startPos = pos;
8824           var type = NodeType.UrangeType;
8825           var token = tokens[pos];
8826           var line = token.ln;
8827           var column = token.col;
8828           var content = [];
8829
8830           content = joinValues(startPos, tokens[startPos].urangeEnd);
8831           pos = tokens[startPos].urangeEnd + 1;
8832
8833           return newNode(type, content, line, column);
8834         }
8835
8836         /**
8837          * Check for unicode wildcard characters `?`
8838          * @param {number} i Token's index
8839          * @return {number} Wildcard length
8840          */
8841         function _checkUnicodeWildcard(i) {
8842           var start = i;
8843
8844           if (i >= tokensLength) return 0;
8845
8846           while (i < tokensLength) {
8847             if (tokens[i].type === TokenType.QuestionMark) i += 1;else break;
8848           }
8849
8850           return i - start;
8851         }
8852
8853         /**
8854          * Check if token is part of URI (e.g. `url('/css/styles.css')`)
8855          * @param {Number} i Token's index number
8856          * @returns {Number} Length of URI
8857          */
8858         function checkUri(i) {
8859           var start = i;
8860
8861           if (i >= tokensLength || tokens[i++].value !== 'url' || i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
8862
8863           return tokens[i].right - start + 1;
8864         }
8865
8866         /**
8867          * Get node with URI
8868          * @returns {Array} `['uri', x]` where `x` is URI's nodes (without `url`
8869          *      and braces, e.g. `['string', ''/css/styles.css'']`).
8870          */
8871         function getUri() {
8872           var startPos = pos;
8873           var uriExcluding = {};
8874           var uri = void 0;
8875           var token = void 0;
8876           var l = void 0;
8877           var raw = void 0;
8878
8879           pos += 2;
8880
8881           uriExcluding[TokenType.Space] = 1;
8882           uriExcluding[TokenType.Tab] = 1;
8883           uriExcluding[TokenType.Newline] = 1;
8884           uriExcluding[TokenType.LeftParenthesis] = 1;
8885           uriExcluding[TokenType.RightParenthesis] = 1;
8886
8887           if (checkUri1(pos)) {
8888             uri = [].concat(getSC()).concat([getString()]).concat(getSC());
8889           } else {
8890             uri = getSC();
8891             l = checkExcluding(uriExcluding, pos);
8892             token = tokens[pos];
8893             raw = newNode(NodeType.RawType, joinValues(pos, pos + l), token.ln, token.col);
8894
8895             uri.push(raw);
8896
8897             pos += l + 1;
8898
8899             uri = uri.concat(getSC());
8900           }
8901
8902           token = tokens[startPos];
8903           var line = token.ln;
8904           var column = token.col;
8905           var end = getLastPosition(uri, line, column, 1);
8906           pos++;
8907
8908           return newNode(NodeType.UriType, uri, line, column, end);
8909         }
8910
8911         /**
8912          * @param {Number} i Token's index number
8913          * @returns {Number}
8914          */
8915         function checkUri1(i) {
8916           var start = i;
8917           var l = void 0;
8918
8919           if (i >= tokensLength) return 0;
8920
8921           if (l = checkSC(i)) i += l;
8922
8923           if (tokens[i].type !== TokenType.StringDQ && tokens[i].type !== TokenType.StringSQ) {
8924             return 0;
8925           }
8926
8927           i++;
8928
8929           if (l = checkSC(i)) i += l;
8930
8931           return i - start;
8932         }
8933
8934         /**
8935          * Check if token is part of a value
8936          * @param {Number} i Token's index number
8937          * @returns {Number} Length of the value
8938          */
8939         function checkValue(i) {
8940           var start = i;
8941           var l = void 0;
8942           var s = void 0;
8943           var _i = void 0;
8944
8945           while (i < tokensLength) {
8946             s = checkSC(i);
8947             _i = i + s;
8948
8949             if (l = _checkValue(_i)) i += l + s;
8950             if (!l || checkBlock(_i)) break;
8951           }
8952
8953           tokens[start].value_end = i;
8954
8955           return i - start;
8956         }
8957
8958         /**
8959          * @returns {Array}
8960          */
8961         function getValue() {
8962           var type = NodeType.ValueType;
8963           var token = tokens[pos];
8964           var line = token.ln;
8965           var column = token.col;
8966           var end = tokens[pos].value_end;
8967           var content = [];
8968           var _pos = void 0;
8969           var s = void 0;
8970
8971           while (pos < end) {
8972             s = checkSC(pos);
8973             _pos = pos + s;
8974
8975             if (!_checkValue(_pos)) break;
8976
8977             if (s) content = content.concat(getSC());
8978             content.push(_getValue());
8979           }
8980
8981           return newNode(type, content, line, column);
8982         }
8983
8984         /**
8985          * @param {Number} i Token's index number
8986          * @returns {Number}
8987          */
8988         function _checkValue(i) {
8989           var l = void 0;
8990
8991           if (l = checkEscapedString(i)) tokens[i].value_child = 1;else if (l = checkInterpolatedVariable(i)) tokens[i].value_child = 2;else if (l = checkVariable(i)) tokens[i].value_child = 3;else if (l = checkVhash(i)) tokens[i].value_child = 4;else if (l = checkBlock(i)) tokens[i].value_child = 5;else if (l = checkProgid(i)) tokens[i].value_child = 6;else if (l = checkAny(i)) tokens[i].value_child = 7;else if (l = checkAtkeyword(i)) tokens[i].value_child = 8;else if (l = checkOperator(i)) tokens[i].value_child = 9;else if (l = checkImportant(i)) tokens[i].value_child = 10;
8992
8993           return l;
8994         }
8995
8996         /**
8997          * @returns {Array}
8998          */
8999         function _getValue() {
9000           var childType = tokens[pos].value_child;
9001           if (childType === 1) return getEscapedString();
9002           if (childType === 2) return getInterpolatedVariable();
9003           if (childType === 3) return getVariable();
9004           if (childType === 4) return getVhash();
9005           if (childType === 5) return getBlock();
9006           if (childType === 6) return getProgid();
9007           if (childType === 7) return getAny();
9008           if (childType === 8) return getAtkeyword();
9009           if (childType === 9) return getOperator();
9010           if (childType === 10) return getImportant();
9011         }
9012
9013         /**
9014          * Check if token is part of LESS variable
9015          * @param {Number} i Token's index number
9016          * @returns {Number} Length of the variable
9017          */
9018         function checkVariable(i) {
9019           var l = void 0;
9020
9021           if (i >= tokensLength || tokens[i].type !== TokenType.CommercialAt) return 0;
9022
9023           if (tokens[i - 1] && tokens[i - 1].type === TokenType.CommercialAt && tokens[i - 2] && tokens[i - 2].type === TokenType.CommercialAt) return 0;
9024
9025           return (l = checkVariable(i + 1) || checkIdent(i + 1)) ? l + 1 : 0;
9026         }
9027
9028         /**
9029          * Get node with a variable
9030          * @returns {Array} `['variable', ['ident', x]]` where `x` is
9031          *      a variable name.
9032          */
9033         function getVariable() {
9034           var type = NodeType.VariableType;
9035           var token = tokens[pos];
9036           var line = token.ln;
9037           var column = token.col;
9038           var content = [];
9039
9040           // Skip `$`.
9041           pos++;
9042
9043           if (checkVariable(pos)) content.push(getVariable());else content.push(getIdent());
9044
9045           return newNode(type, content, line, column);
9046         }
9047
9048         /**
9049          * Check if token is part of a variables list (e.g. `@rest...`).
9050          * @param {Number} i Token's index number
9051          * @returns {Number}
9052          */
9053         function checkVariablesList(i) {
9054           var d = 0; // Number of dots
9055           var l = void 0;
9056
9057           if (i >= tokensLength) return 0;
9058
9059           if (l = checkVariable(i)) i += l;else return 0;
9060
9061           while (tokens[i] && tokens[i].type === TokenType.FullStop) {
9062             d++;
9063             i++;
9064           }
9065
9066           return d === 3 ? l + d : 0;
9067         }
9068
9069         /**
9070          * Get node with a variables list
9071          * @returns {Array} `['variableslist', ['variable', ['ident', x]]]` where
9072          *      `x` is a variable name.
9073          */
9074         function getVariablesList() {
9075           var type = NodeType.VariablesListType;
9076           var token = tokens[pos];
9077           var line = token.ln;
9078           var column = token.col;
9079           var content = [getVariable()];
9080           var end = getLastPosition(content, line, column, 3);
9081
9082           // Skip `...`.
9083           pos += 3;
9084
9085           return newNode(type, content, line, column, end);
9086         }
9087
9088         /**
9089          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside
9090          *      some value
9091          * @param {Number} i Token's index number
9092          * @returns {Number}
9093          */
9094         function checkVhash(i) {
9095           var start = i;
9096           var l = void 0;
9097
9098           if (i >= tokensLength) return 0;
9099
9100           // Skip `#`.
9101           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
9102
9103           if (l = checkNmName2(i)) i += l;else return 0;
9104
9105           return i - start;
9106         }
9107
9108         /**
9109          * Get node with a hexadecimal number (e.g. `#fff`) inside some value
9110          * @returns {Array} `['vhash', x]` where `x` is a hexadecimal number
9111          *      converted to string (without `#`, e.g. `'fff'`).
9112          */
9113         function getVhash() {
9114           var type = NodeType.VhashType;
9115           var token = tokens[pos];
9116           var line = token.ln;
9117           var column = token.col;
9118
9119           // Skip `#`.
9120           pos++;
9121
9122           var content = getNmName2();
9123           var end = getLastPosition(content, line, column + 1);
9124           return newNode(type, content, line, column, end);
9125         }
9126
9127         function checkSelectorsGroup(i) {
9128           if (i >= tokensLength) return 0;
9129
9130           var start = i;
9131           var l = void 0;
9132
9133           if (l = checkSelector(i)) i += l;else return 0;
9134
9135           while (i < tokensLength) {
9136             var spaceBefore = checkSC(i);
9137             var comma = checkDelim(i + spaceBefore);
9138             if (!comma) break;
9139
9140             var spaceAfter = checkSC(i + spaceBefore + comma);
9141             if (l = checkSelector(i + spaceBefore + comma + spaceAfter)) {
9142               i += spaceBefore + comma + spaceAfter + l;
9143             } else break;
9144           }
9145
9146           tokens[start].selectorsGroupEnd = i;
9147           return i - start;
9148         }
9149
9150         function getSelectorsGroup() {
9151           var selectorsGroup = [];
9152           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
9153
9154           selectorsGroup.push(getSelector());
9155
9156           while (pos < selectorsGroupEnd) {
9157             selectorsGroup = selectorsGroup.concat(getSC(), getDelim(), getSC(), getSelector());
9158           }
9159
9160           return selectorsGroup;
9161         }
9162
9163         function checkSelector(i) {
9164           var l = void 0;
9165
9166           if (l = checkSelector1(i)) tokens[i].selectorType = 1;else if (l = checkSelector2(i)) tokens[i].selectorType = 2;
9167
9168           return l;
9169         }
9170
9171         function getSelector() {
9172           var selectorType = tokens[pos].selectorType;
9173           if (selectorType === 1) return getSelector1();else return getSelector2();
9174         }
9175
9176         /**
9177          * Checks for selector which starts with a compound selector.
9178          */
9179         function checkSelector1(i) {
9180           if (i >= tokensLength) return 0;
9181
9182           var start = i;
9183           var l = void 0;
9184
9185           if (l = checkCompoundSelector(i)) i += l;else return 0;
9186
9187           while (i < tokensLength) {
9188             var space = checkSC(i);
9189             var comma = checkCombinator(i + space);
9190             if (!space && !comma) break;
9191
9192             if (comma) {
9193               i += space + comma;
9194               space = checkSC(i);
9195             }
9196
9197             if (l = checkCompoundSelector(i + space)) i += space + l;else break;
9198           }
9199
9200           tokens[start].selectorEnd = i;
9201           return i - start;
9202         }
9203
9204         function getSelector1() {
9205           var type = NodeType.SelectorType;
9206           var token = tokens[pos];
9207           var line = token.ln;
9208           var column = token.col;
9209           var selectorEnd = token.selectorEnd;
9210           var content = getCompoundSelector();
9211
9212           while (pos < selectorEnd) {
9213             if (checkSC(pos)) content = content.concat(getSC());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkCompoundSelector(pos)) content = content.concat(getCompoundSelector());
9214           }
9215
9216           return newNode(type, content, line, column);
9217         }
9218
9219         /**
9220          * Checks for a selector that starts with a combinator.
9221          */
9222         function checkSelector2(i) {
9223           if (i >= tokensLength) return 0;
9224
9225           var start = i;
9226           var l = void 0;
9227
9228           if (l = checkCombinator(i)) i += l;else return 0;
9229
9230           while (i < tokensLength) {
9231             var spaceBefore = checkSC(i);
9232             if (l = checkCompoundSelector(i + spaceBefore)) i += spaceBefore + l;else break;
9233
9234             var spaceAfter = checkSC(i);
9235             var comma = checkCombinator(i + spaceAfter);
9236             if (!spaceAfter && !comma) break;
9237             if (comma) {
9238               i += spaceAfter + comma;
9239             }
9240           }
9241
9242           tokens[start].selectorEnd = i;
9243           return i - start;
9244         }
9245
9246         function getSelector2() {
9247           var type = NodeType.SelectorType;
9248           var token = tokens[pos];
9249           var line = token.ln;
9250           var column = token.col;
9251           var selectorEnd = token.selectorEnd;
9252           var content = [getCombinator()];
9253
9254           while (pos < selectorEnd) {
9255             if (checkSC(pos)) content = content.concat(getSC());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkCompoundSelector(pos)) content = content.concat(getCompoundSelector());
9256           }
9257
9258           return newNode(type, content, line, column);
9259         }
9260
9261         function checkCompoundSelector(i) {
9262           var l = void 0;
9263
9264           if (l = checkCompoundSelector1(i)) {
9265             tokens[i].compoundSelectorType = 1;
9266           } else if (l = checkCompoundSelector2(i)) {
9267             tokens[i].compoundSelectorType = 2;
9268           }
9269
9270           return l;
9271         }
9272
9273         function getCompoundSelector() {
9274           var type = tokens[pos].compoundSelectorType;
9275           if (type === 1) return getCompoundSelector1();
9276           if (type === 2) return getCompoundSelector2();
9277         }
9278
9279         function checkCompoundSelector1(i) {
9280           if (i >= tokensLength) return 0;
9281
9282           var start = i;
9283           var l = void 0;
9284
9285           if (l = checkUniversalSelector(i) || checkTypeSelector(i) || checkParentSelectorWithExtension(i)) i += l;else return 0;
9286
9287           while (i < tokensLength) {
9288             var _l2 = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i);
9289             if (_l2) i += _l2;else break;
9290           }
9291
9292           tokens[start].compoundSelectorEnd = i;
9293
9294           return i - start;
9295         }
9296
9297         function getCompoundSelector1() {
9298           var sequence = [];
9299           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
9300
9301           if (checkUniversalSelector(pos)) sequence.push(getUniversalSelector());else if (checkTypeSelector(pos)) sequence.push(getTypeSelector());else if (checkParentSelectorWithExtension(pos)) sequence = sequence.concat(getParentSelectorWithExtension());
9302
9303           while (pos < compoundSelectorEnd) {
9304             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());
9305           }
9306
9307           return sequence;
9308         }
9309
9310         function checkCompoundSelector2(i) {
9311           if (i >= tokensLength) return 0;
9312
9313           var start = i;
9314
9315           while (i < tokensLength) {
9316             var l = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i);
9317             if (l) i += l;else break;
9318           }
9319
9320           tokens[start].compoundSelectorEnd = i;
9321
9322           return i - start;
9323         }
9324
9325         function getCompoundSelector2() {
9326           var sequence = [];
9327           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
9328
9329           while (pos < compoundSelectorEnd) {
9330             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());
9331           }
9332
9333           return sequence;
9334         }
9335
9336         function checkUniversalSelector(i) {
9337           if (i >= tokensLength) return 0;
9338
9339           var start = i;
9340           var l = void 0;
9341
9342           if (l = checkNamePrefix(i)) i += l;
9343
9344           if (tokens[i].type === TokenType.Asterisk) i++;else return 0;
9345
9346           return i - start;
9347         }
9348
9349         function getUniversalSelector() {
9350           var type = NodeType.UniversalSelectorType;
9351           var token = tokens[pos];
9352           var line = token.ln;
9353           var column = token.col;
9354           var content = [];
9355           var end = void 0;
9356
9357           if (checkNamePrefix(pos)) {
9358             content.push(getNamePrefix());
9359             end = getLastPosition(content, line, column, 1);
9360           }
9361
9362           pos++;
9363
9364           return newNode(type, content, line, column, end);
9365         }
9366
9367         function checkTypeSelector(i) {
9368           if (i >= tokensLength) return 0;
9369
9370           var start = i;
9371           var l = void 0;
9372
9373           if (l = checkNamePrefix(i)) i += l;
9374
9375           if (l = checkIdent(i)) i += l;else return 0;
9376
9377           return i - start;
9378         }
9379
9380         function getTypeSelector() {
9381           var type = NodeType.TypeSelectorType;
9382           var token = tokens[pos];
9383           var line = token.ln;
9384           var column = token.col;
9385           var content = [];
9386
9387           if (checkNamePrefix(pos)) content.push(getNamePrefix());
9388
9389           content.push(getIdent());
9390
9391           return newNode(type, content, line, column);
9392         }
9393
9394         function checkAttributeSelector(i) {
9395           var l = void 0;
9396           if (l = checkAttributeSelector1(i)) tokens[i].attributeSelectorType = 1;else if (l = checkAttributeSelector2(i)) tokens[i].attributeSelectorType = 2;
9397
9398           return l;
9399         }
9400
9401         function getAttributeSelector() {
9402           var type = tokens[pos].attributeSelectorType;
9403           if (type === 1) return getAttributeSelector1();else return getAttributeSelector2();
9404         }
9405
9406         /**
9407          * (1) `[panda=nani]`
9408          * (2) `[panda='nani']`
9409          * (3) `[panda='nani' i]`
9410          *
9411          */
9412         function checkAttributeSelector1(i) {
9413           var start = i;
9414
9415           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
9416
9417           var l = void 0;
9418           if (l = checkSC(i)) i += l;
9419
9420           if (l = checkAttributeName(i)) i += l;else return 0;
9421
9422           if (l = checkSC(i)) i += l;
9423
9424           if (l = checkAttributeMatch(i)) i += l;else return 0;
9425
9426           if (l = checkSC(i)) i += l;
9427
9428           if (l = checkAttributeValue(i)) i += l;else return 0;
9429
9430           if (l = checkSC(i)) i += l;
9431
9432           if (l = checkAttributeFlags(i)) {
9433             i += l;
9434             if (l = checkSC(i)) i += l;
9435           }
9436
9437           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
9438
9439           return i - start;
9440         }
9441
9442         function getAttributeSelector1() {
9443           var type = NodeType.AttributeSelectorType;
9444           var token = tokens[pos];
9445           var line = token.ln;
9446           var column = token.col;
9447           var content = [];
9448
9449           // Skip `[`.
9450           pos++;
9451
9452           content = content.concat(getSC(), getAttributeName(), getSC(), getAttributeMatch(), getSC(), getAttributeValue(), getSC());
9453
9454           if (checkAttributeFlags(pos)) {
9455             content.push(getAttributeFlags());
9456             content = content.concat(getSC());
9457           }
9458
9459           // Skip `]`.
9460           pos++;
9461
9462           var end = getLastPosition(content, line, column, 1);
9463           return newNode(type, content, line, column, end);
9464         }
9465
9466         /**
9467          * (1) `[panda]`
9468          */
9469         function checkAttributeSelector2(i) {
9470           var start = i;
9471
9472           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
9473
9474           var l = void 0;
9475           if (l = checkSC(i)) i += l;
9476
9477           if (l = checkAttributeName(i)) i += l;else return 0;
9478
9479           if (l = checkSC(i)) i += l;
9480
9481           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
9482
9483           return i - start;
9484         }
9485
9486         function getAttributeSelector2() {
9487           var type = NodeType.AttributeSelectorType;
9488           var token = tokens[pos];
9489           var line = token.ln;
9490           var column = token.col;
9491           var content = [];
9492
9493           // Skip `[`.
9494           pos++;
9495
9496           content = content.concat(getSC(), getAttributeName(), getSC());
9497
9498           // Skip `]`.
9499           pos++;
9500
9501           var end = getLastPosition(content, line, column, 1);
9502           return newNode(type, content, line, column, end);
9503         }
9504
9505         function checkAttributeName(i) {
9506           var start = i;
9507           var l = void 0;
9508
9509           if (l = checkNamePrefix(i)) i += l;
9510
9511           if (l = checkIdent(i)) i += l;else return 0;
9512
9513           return i - start;
9514         }
9515
9516         function getAttributeName() {
9517           var type = NodeType.AttributeNameType;
9518           var token = tokens[pos];
9519           var line = token.ln;
9520           var column = token.col;
9521           var content = [];
9522
9523           if (checkNamePrefix(pos)) content.push(getNamePrefix());
9524           content.push(getIdent());
9525
9526           return newNode(type, content, line, column);
9527         }
9528
9529         function checkAttributeMatch(i) {
9530           var l = void 0;
9531           if (l = checkAttributeMatch1(i)) tokens[i].attributeMatchType = 1;else if (l = checkAttributeMatch2(i)) tokens[i].attributeMatchType = 2;
9532
9533           return l;
9534         }
9535
9536         function getAttributeMatch() {
9537           var type = tokens[pos].attributeMatchType;
9538           if (type === 1) return getAttributeMatch1();else return getAttributeMatch2();
9539         }
9540
9541         function checkAttributeMatch1(i) {
9542           var start = i;
9543
9544           var type = tokens[i].type;
9545           if (type === TokenType.Tilde || type === TokenType.VerticalLine || type === TokenType.CircumflexAccent || type === TokenType.DollarSign || type === TokenType.Asterisk) i++;else return 0;
9546
9547           if (tokens[i].type === TokenType.EqualsSign) i++;else return 0;
9548
9549           return i - start;
9550         }
9551
9552         function getAttributeMatch1() {
9553           var type = NodeType.AttributeMatchType;
9554           var token = tokens[pos];
9555           var line = token.ln;
9556           var column = token.col;
9557           var content = tokens[pos].value + tokens[pos + 1].value;
9558           pos += 2;
9559
9560           return newNode(type, content, line, column);
9561         }
9562
9563         function checkAttributeMatch2(i) {
9564           if (tokens[i].type === TokenType.EqualsSign) return 1;else return 0;
9565         }
9566
9567         function getAttributeMatch2() {
9568           var type = NodeType.AttributeMatchType;
9569           var token = tokens[pos];
9570           var line = token.ln;
9571           var column = token.col;
9572           var content = '=';
9573
9574           pos++;
9575           return newNode(type, content, line, column);
9576         }
9577
9578         function checkAttributeValue(i) {
9579           return checkString(i) || checkIdent(i);
9580         }
9581
9582         function getAttributeValue() {
9583           var type = NodeType.AttributeValueType;
9584           var token = tokens[pos];
9585           var line = token.ln;
9586           var column = token.col;
9587           var content = [];
9588
9589           if (checkString(pos)) content.push(getString());else content.push(getIdent());
9590
9591           return newNode(type, content, line, column);
9592         }
9593
9594         function checkAttributeFlags(i) {
9595           return checkIdent(i);
9596         }
9597
9598         function getAttributeFlags() {
9599           var type = NodeType.AttributeFlagsType;
9600           var token = tokens[pos];
9601           var line = token.ln;
9602           var column = token.col;
9603           var content = [getIdent()];
9604
9605           return newNode(type, content, line, column);
9606         }
9607
9608         function checkNamePrefix(i) {
9609           if (i >= tokensLength) return 0;
9610
9611           var l = void 0;
9612           if (l = checkNamePrefix1(i)) tokens[i].namePrefixType = 1;else if (l = checkNamePrefix2(i)) tokens[i].namePrefixType = 2;
9613
9614           return l;
9615         }
9616
9617         function getNamePrefix() {
9618           var type = tokens[pos].namePrefixType;
9619           if (type === 1) return getNamePrefix1();else return getNamePrefix2();
9620         }
9621
9622         /**
9623          * (1) `panda|`
9624          * (2) `panda<comment>|`
9625          */
9626         function checkNamePrefix1(i) {
9627           var start = i;
9628           var l = void 0;
9629
9630           if (l = checkNamespacePrefix(i)) i += l;else return 0;
9631
9632           if (l = checkCommentML(i)) i += l;
9633
9634           if (l = checkNamespaceSeparator(i)) i += l;else return 0;
9635
9636           return i - start;
9637         }
9638
9639         function getNamePrefix1() {
9640           var type = NodeType.NamePrefixType;
9641           var token = tokens[pos];
9642           var line = token.ln;
9643           var column = token.col;
9644           var content = [];
9645
9646           content.push(getNamespacePrefix());
9647
9648           if (checkCommentML(pos)) content.push(getCommentML());
9649
9650           content.push(getNamespaceSeparator());
9651
9652           return newNode(type, content, line, column);
9653         }
9654
9655         /**
9656          * (1) `|`
9657          */
9658         function checkNamePrefix2(i) {
9659           return checkNamespaceSeparator(i);
9660         }
9661
9662         function getNamePrefix2() {
9663           var type = NodeType.NamePrefixType;
9664           var token = tokens[pos];
9665           var line = token.ln;
9666           var column = token.col;
9667           var content = [getNamespaceSeparator()];
9668
9669           return newNode(type, content, line, column);
9670         }
9671
9672         /**
9673          * (1) `*`
9674          * (2) `panda`
9675          */
9676         function checkNamespacePrefix(i) {
9677           if (i >= tokensLength) return 0;
9678
9679           var l = void 0;
9680
9681           if (tokens[i].type === TokenType.Asterisk) return 1;else if (l = checkIdent(i)) return l;else return 0;
9682         }
9683
9684         function getNamespacePrefix() {
9685           var type = NodeType.NamespacePrefixType;
9686           var token = tokens[pos];
9687           var line = token.ln;
9688           var column = token.col;
9689           var content = [];
9690
9691           if (token.type === TokenType.Asterisk) {
9692             var asteriskNode = newNode(NodeType.IdentType, '*', line, column);
9693             content.push(asteriskNode);
9694             pos++;
9695           } else if (checkIdent(pos)) content.push(getIdent());
9696
9697           return newNode(type, content, line, column);
9698         }
9699
9700         /**
9701          * (1) `|`
9702          */
9703         function checkNamespaceSeparator(i) {
9704           if (i >= tokensLength) return 0;
9705
9706           if (tokens[i].type !== TokenType.VerticalLine) return 0;
9707
9708           // Return false if `|=` - [attr|=value]
9709           if (tokens[i + 1] && tokens[i + 1].type === TokenType.EqualsSign) return 0;
9710
9711           return 1;
9712         }
9713
9714         function getNamespaceSeparator() {
9715           var type = NodeType.NamespaceSeparatorType;
9716           var token = tokens[pos];
9717           var line = token.ln;
9718           var column = token.col;
9719           var content = '|';
9720
9721           pos++;
9722           return newNode(type, content, line, column);
9723         }
9724
9725         module.exports = function (_tokens, context) {
9726           tokens = _tokens;
9727           tokensLength = tokens.length;
9728           pos = 0;
9729
9730           return contexts[context]();
9731         };
9732
9733 /***/ }),
9734 /* 20 */
9735 /***/ (function(module, exports, __webpack_require__) {
9736
9737         'use strict';
9738
9739         module.exports = function (css, tabSize) {
9740           var TokenType = __webpack_require__(13);
9741
9742           var tokens = [];
9743           var urlMode = false;
9744           var c = void 0; // Current character
9745           var cn = void 0; // Next character
9746           var pos = 0;
9747           var tn = 0;
9748           var ln = 1;
9749           var col = 1;
9750
9751           var Punctuation = {
9752             ' ': TokenType.Space,
9753             '\n': TokenType.Newline,
9754             '\r': TokenType.Newline,
9755             '\t': TokenType.Tab,
9756             '!': TokenType.ExclamationMark,
9757             '"': TokenType.QuotationMark,
9758             '#': TokenType.NumberSign,
9759             '$': TokenType.DollarSign,
9760             '%': TokenType.PercentSign,
9761             '&': TokenType.Ampersand,
9762             '\'': TokenType.Apostrophe,
9763             '(': TokenType.LeftParenthesis,
9764             ')': TokenType.RightParenthesis,
9765             '*': TokenType.Asterisk,
9766             '+': TokenType.PlusSign,
9767             ',': TokenType.Comma,
9768             '-': TokenType.HyphenMinus,
9769             '.': TokenType.FullStop,
9770             '/': TokenType.Solidus,
9771             ':': TokenType.Colon,
9772             ';': TokenType.Semicolon,
9773             '<': TokenType.LessThanSign,
9774             '=': TokenType.EqualsSign,
9775             '>': TokenType.GreaterThanSign,
9776             '?': TokenType.QuestionMark,
9777             '@': TokenType.CommercialAt,
9778             '[': TokenType.LeftSquareBracket,
9779             ']': TokenType.RightSquareBracket,
9780             '^': TokenType.CircumflexAccent,
9781             '_': TokenType.LowLine,
9782             '{': TokenType.LeftCurlyBracket,
9783             '|': TokenType.VerticalLine,
9784             '}': TokenType.RightCurlyBracket,
9785             '~': TokenType.Tilde
9786           };
9787
9788           /**
9789            * Add a token to the token list
9790            * @param {string} type
9791            * @param {string} value
9792            */
9793           function pushToken(type, value, column) {
9794             tokens.push({
9795               tn: tn++,
9796               ln: ln,
9797               col: column,
9798               type: type,
9799               value: value
9800             });
9801           }
9802
9803           /**
9804            * Check if a character is a decimal digit
9805            * @param {string} c Character
9806            * @returns {boolean}
9807            */
9808           function isDecimalDigit(c) {
9809             return '0123456789'.indexOf(c) >= 0;
9810           }
9811
9812           /**
9813            * Parse spaces
9814            * @param {string} css Unparsed part of CSS string
9815            */
9816           function parseSpaces(css) {
9817             var start = pos;
9818
9819             // Read the string until we meet a non-space character:
9820             for (; pos < css.length; pos++) {
9821               if (css.charAt(pos) !== ' ') break;
9822             }
9823
9824             // Add a substring containing only spaces to tokens:
9825             pushToken(TokenType.Space, css.substring(start, pos--), col);
9826             col += pos - start;
9827           }
9828
9829           /**
9830            * Parse a string within quotes
9831            * @param {string} css Unparsed part of CSS string
9832            * @param {string} q Quote (either `'` or `"`)
9833            */
9834           function parseString(css, q) {
9835             var start = pos;
9836
9837             // Read the string until we meet a matching quote:
9838             for (pos++; pos < css.length; pos++) {
9839               // Skip escaped quotes:
9840               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) === q) break;
9841             }
9842
9843             // Add the string (including quotes) to tokens:
9844             var type = q === '"' ? TokenType.StringDQ : TokenType.StringSQ;
9845             pushToken(type, css.substring(start, pos + 1), col);
9846             col += pos - start;
9847           }
9848
9849           /**
9850            * Parse numbers
9851            * @param {string} css Unparsed part of CSS string
9852            */
9853           function parseDecimalNumber(css) {
9854             var start = pos;
9855
9856             // Read the string until we meet a character that's not a digit:
9857             for (; pos < css.length; pos++) {
9858               if (!isDecimalDigit(css.charAt(pos))) break;
9859             }
9860
9861             // Add the number to tokens:
9862             pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col);
9863             col += pos - start;
9864           }
9865
9866           /**
9867            * Parse identifier
9868            * @param {string} css Unparsed part of CSS string
9869            */
9870           function parseIdentifier(css) {
9871             var start = pos;
9872
9873             // Skip all opening slashes:
9874             while (css.charAt(pos) === '/') {
9875               pos++;
9876             } // Read the string until we meet a punctuation mark:
9877             for (; pos < css.length; pos++) {
9878               // Skip all '\':
9879               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) in Punctuation) break;
9880             }
9881
9882             var ident = css.substring(start, pos--);
9883
9884             // Enter url mode if parsed substring is `url`:
9885             if (!urlMode && ident === 'url' && css.charAt(pos + 1) === '(') {
9886               urlMode = true;
9887             }
9888
9889             // Add identifier to tokens:
9890             pushToken(TokenType.Identifier, ident, col);
9891             col += pos - start;
9892           }
9893
9894           /**
9895           * Parse a multiline comment
9896           * @param {string} css Unparsed part of CSS string
9897           */
9898           function parseMLComment(css) {
9899             var start = pos;
9900
9901             // Read the string until we meet `*/`.
9902             // Since we already know first 2 characters (`/*`), start reading
9903             // from `pos + 2`:
9904             for (pos = pos + 2; pos < css.length; pos++) {
9905               if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') {
9906                 pos++;
9907                 break;
9908               }
9909             }
9910
9911             // Add full comment (including `/*` and `*/`) to the list of tokens:
9912             var comment = css.substring(start, pos + 1);
9913             pushToken(TokenType.CommentML, comment, col);
9914
9915             var newlines = comment.split('\n');
9916             if (newlines.length > 1) {
9917               ln += newlines.length - 1;
9918               col = newlines[newlines.length - 1].length;
9919             } else {
9920               col += pos - start;
9921             }
9922           }
9923
9924           /**
9925           * Parse a single line comment
9926           * @param {string} css Unparsed part of CSS string
9927           */
9928           function parseSLComment(css) {
9929             var start = pos;
9930
9931             // Read the string until we meet line break.
9932             // Since we already know first 2 characters (`//`), start reading
9933             // from `pos + 2`:
9934             for (pos += 2; pos < css.length; pos++) {
9935               if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') {
9936                 break;
9937               }
9938             }
9939
9940             // Add comment (including `//` and line break) to the list of tokens:
9941             pushToken(TokenType.CommentSL, css.substring(start, pos--), col);
9942             col += pos - start;
9943           }
9944
9945           /**
9946            * Convert a CSS string to a list of tokens
9947            * @param {string} css CSS string
9948            * @returns {Array} List of tokens
9949            * @private
9950            */
9951           function getTokens(css) {
9952             // Parse string, character by character:
9953             for (pos = 0; pos < css.length; col++, pos++) {
9954               c = css.charAt(pos);
9955               cn = css.charAt(pos + 1);
9956
9957               // If we meet `/*`, it's a start of a multiline comment.
9958               // Parse following characters as a multiline comment:
9959               if (c === '/' && cn === '*') {
9960                 parseMLComment(css);
9961               }
9962
9963               // If we meet `//` and it is not a part of url:
9964               else if (!urlMode && c === '/' && cn === '/') {
9965                   // If we're currently inside a block, treat `//` as a start
9966                   // of identifier. Else treat `//` as a start of a single-line
9967                   // comment:
9968                   parseSLComment(css);
9969                 }
9970
9971                 // If current character is a double or single quote, it's a start
9972                 // of a string:
9973                 else if (c === '"' || c === "'") {
9974                     parseString(css, c);
9975                   }
9976
9977                   // If current character is a space:
9978                   else if (c === ' ') {
9979                       parseSpaces(css);
9980                     }
9981
9982                     // If current character is a punctuation mark:
9983                     else if (c in Punctuation) {
9984                         // Add it to the list of tokens:
9985                         pushToken(Punctuation[c], c, col);
9986                         if (c === '\n' || c === '\r') {
9987                           ln++;
9988                           col = 0;
9989                         } // Go to next line
9990                         if (c === ')') urlMode = false; // Exit url mode
9991                         else if (c === '\t' && tabSize > 1) col += tabSize - 1;
9992                       }
9993
9994                       // If current character is a decimal digit:
9995                       else if (isDecimalDigit(c)) {
9996                           parseDecimalNumber(css);
9997                         }
9998
9999                         // If current character is anything else:
10000                         else {
10001                             parseIdentifier(css);
10002                           }
10003             }
10004
10005             return tokens;
10006           }
10007
10008           return getTokens(css);
10009         };
10010
10011 /***/ }),
10012 /* 21 */
10013 /***/ (function(module, exports, __webpack_require__) {
10014
10015         'use strict';
10016
10017         exports.__esModule = true;
10018         exports.default = {
10019           mark: __webpack_require__(22),
10020           parse: __webpack_require__(23),
10021           stringify: __webpack_require__(5),
10022           tokenizer: __webpack_require__(24)
10023         };
10024         module.exports = exports['default'];
10025
10026 /***/ }),
10027 /* 22 */
10028 /***/ (function(module, exports, __webpack_require__) {
10029
10030         'use strict';
10031
10032         var TokenType = __webpack_require__(13);
10033
10034         module.exports = function () {
10035           /**
10036           * Mark whitespaces and comments
10037           */
10038           function markSC(tokens) {
10039             var tokensLength = tokens.length;
10040             var ws = -1; // Flag for whitespaces
10041             var sc = -1; // Flag for whitespaces and comments
10042             var t = void 0; // Current token
10043
10044             // For every token in the token list, mark spaces and line breaks
10045             // as spaces (set both `ws` and `sc` flags). Mark multiline comments
10046             // with `sc` flag.
10047             // If there are several spaces or tabs or line breaks or multiline
10048             // comments in a row, group them: take the last one's index number
10049             // and save it to the first token in the group as a reference:
10050             // e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9`
10051             // for a group of whitespaces and comments.
10052             for (var i = 0; i < tokensLength; i++) {
10053               t = tokens[i];
10054               switch (t.type) {
10055                 case TokenType.Space:
10056                 case TokenType.Tab:
10057                   t.ws = true;
10058                   t.sc = true;
10059
10060                   if (ws === -1) ws = i;
10061                   if (sc === -1) sc = i;
10062
10063                   break;
10064                 case TokenType.Newline:
10065                   t.ws = true;
10066                   t.sc = true;
10067
10068                   ws = ws === -1 ? i : ws;
10069                   sc = sc === -1 ? i : ws;
10070
10071                   tokens[ws].ws_last = i - 1;
10072                   tokens[sc].sc_last = i - 1;
10073                   tokens[i].ws_last = i;
10074                   tokens[i].sc_last = i;
10075
10076                   ws = -1;
10077                   sc = -1;
10078
10079                   break;
10080                 case TokenType.CommentML:
10081                 case TokenType.CommentSL:
10082                   if (ws !== -1) {
10083                     tokens[ws].ws_last = i - 1;
10084                     ws = -1;
10085                   }
10086
10087                   t.sc = true;
10088
10089                   break;
10090                 default:
10091                   if (ws !== -1) {
10092                     tokens[ws].ws_last = i - 1;
10093                     ws = -1;
10094                   }
10095
10096                   if (sc !== -1) {
10097                     tokens[sc].sc_last = i - 1;
10098                     sc = -1;
10099                   }
10100               }
10101             }
10102
10103             if (ws !== -1) tokens[ws].ws_last = i - 1;
10104             if (sc !== -1) tokens[sc].sc_last = i - 1;
10105           }
10106
10107           /**
10108           * Pair brackets
10109           */
10110           function markBrackets(tokens) {
10111             var tokensLength = tokens.length;
10112             var ps = []; // Parentheses
10113             var sbs = []; // Square brackets
10114             var cbs = []; // Curly brackets
10115             var t = void 0; // Current token
10116
10117             // For every token in the token list, if we meet an opening (left)
10118             // bracket, push its index number to a corresponding array.
10119             // If we then meet a closing (right) bracket, look at the corresponding
10120             // array. If there are any elements (records about previously met
10121             // left brackets), take a token of the last left bracket (take
10122             // the last index number from the array and find a token with
10123             // this index number) and save right bracket's index as a reference:
10124             for (var i = 0; i < tokensLength; i++) {
10125               t = tokens[i];
10126               switch (t.type) {
10127                 case TokenType.LeftParenthesis:
10128                   ps.push(i);
10129                   break;
10130                 case TokenType.RightParenthesis:
10131                   if (ps.length) {
10132                     t.left = ps.pop();
10133                     tokens[t.left].right = i;
10134                   }
10135                   break;
10136                 case TokenType.LeftSquareBracket:
10137                   sbs.push(i);
10138                   break;
10139                 case TokenType.RightSquareBracket:
10140                   if (sbs.length) {
10141                     t.left = sbs.pop();
10142                     tokens[t.left].right = i;
10143                   }
10144                   break;
10145                 case TokenType.LeftCurlyBracket:
10146                   cbs.push(i);
10147                   break;
10148                 case TokenType.RightCurlyBracket:
10149                   if (cbs.length) {
10150                     t.left = cbs.pop();
10151                     tokens[t.left].right = i;
10152                   }
10153                   break;
10154               }
10155             }
10156           }
10157
10158           function markBlocks(tokens) {
10159             var i = 0;
10160             var l = tokens.length;
10161             var lines = [];
10162             var whitespaceOnlyLines = [];
10163
10164             for (i = 0; i < l; i++) {
10165               var lineStart = i;
10166               var currentLineIndent = 0;
10167
10168               // Get all spaces.
10169               while (i < l && (tokens[i].type === TokenType.Space || tokens[i].type === TokenType.Tab)) {
10170                 currentLineIndent += tokens[i].value.length;
10171                 i++;
10172               }
10173
10174               lines.push([lineStart, currentLineIndent]);
10175
10176               var x = i;
10177               while (i < l && tokens[i].type !== TokenType.Newline) {
10178                 i++;
10179               }
10180
10181               if (x === i) {
10182                 whitespaceOnlyLines.push(lines.length - 1);
10183               }
10184             }
10185
10186             var levels = [0];
10187             var blockStarts = [];
10188
10189             for (i = 0; i < lines.length; i++) {
10190               var line = lines[i];
10191               var token = line[0];
10192               var indent = line[1];
10193               var lastLevel = levels[levels.length - 1];
10194
10195               if (indent > lastLevel) {
10196                 blockStarts.push(token);
10197                 levels.push(indent);
10198               } else {
10199                 // Check if line is whitespace-only.
10200                 var p = i;
10201
10202                 while (true) {
10203                   if (whitespaceOnlyLines.indexOf(p) === -1) break;
10204                   p++;
10205                 }
10206
10207                 if (i === p && indent === lastLevel) continue;
10208
10209                 if (!lines[p]) {
10210                   continue;
10211                 }
10212
10213                 indent = lines[p][1];
10214
10215                 if (indent === lastLevel) {
10216                   i = p;
10217                   continue;
10218                 }
10219
10220                 if (indent > lastLevel) {
10221                   blockStarts.push(token);
10222                   levels.push(lines[p][1]);
10223                   i = p;
10224                   continue;
10225                 }
10226
10227                 while (true) {
10228                   var _lastLevel = levels.pop();
10229                   if (indent < _lastLevel) {
10230                     var start = blockStarts.pop();
10231                     tokens[start].block_end = token - 1;
10232                   } else {
10233                     levels.push(indent);
10234                     break;
10235                   }
10236                 }
10237               }
10238             }
10239
10240             blockStarts.forEach(function (start) {
10241               tokens[start].block_end = tokens.length - 1;
10242             });
10243           }
10244
10245           return function (tokens) {
10246             markBrackets(tokens);
10247             markSC(tokens);
10248             markBlocks(tokens);
10249           };
10250         }();
10251
10252 /***/ }),
10253 /* 23 */
10254 /***/ (function(module, exports, __webpack_require__) {
10255
10256         'use strict';
10257
10258         var Node = __webpack_require__(1);
10259         var NodeType = __webpack_require__(15);
10260         var TokenType = __webpack_require__(13);
10261
10262         var tokens = void 0;
10263         var tokensLength = void 0;
10264         var pos = void 0;
10265
10266         var contexts = {
10267           'arguments': function _arguments() {
10268             return checkArguments(pos) && getArguments();
10269           },
10270           'atkeyword': function atkeyword() {
10271             return checkAtkeyword(pos) && getAtkeyword();
10272           },
10273           'atrule': function atrule() {
10274             return checkAtrule(pos) && getAtrule();
10275           },
10276           'attributeSelector': function attributeSelector() {
10277             return checkAttributeSelector(pos) && getAttributeSelector();
10278           },
10279           'block': function block() {
10280             return checkBlock(pos) && getBlock();
10281           },
10282           'brackets': function brackets() {
10283             return checkBrackets(pos) && getBrackets();
10284           },
10285           'class': function _class() {
10286             return checkClass(pos) && getClass();
10287           },
10288           'combinator': function combinator() {
10289             return checkCombinator(pos) && getCombinator();
10290           },
10291           'commentML': function commentML() {
10292             return checkCommentML(pos) && getCommentML();
10293           },
10294           'commentSL': function commentSL() {
10295             return checkCommentSL(pos) && getCommentSL();
10296           },
10297           'condition': function condition() {
10298             return checkCondition(pos) && getCondition();
10299           },
10300           'conditionalStatement': function conditionalStatement() {
10301             return checkConditionalStatement(pos) && getConditionalStatement();
10302           },
10303           'declaration': function declaration() {
10304             return checkDeclaration(pos) && getDeclaration();
10305           },
10306           'declDelim': function declDelim() {
10307             return checkDeclDelim(pos) && getDeclDelim();
10308           },
10309           'default': function _default() {
10310             return checkDefault(pos) && getDefault();
10311           },
10312           'delim': function delim() {
10313             return checkDelim(pos) && getDelim();
10314           },
10315           'dimension': function dimension() {
10316             return checkDimension(pos) && getDimension();
10317           },
10318           'expression': function expression() {
10319             return checkExpression(pos) && getExpression();
10320           },
10321           'extend': function extend() {
10322             return checkExtend(pos) && getExtend();
10323           },
10324           'function': function _function() {
10325             return checkFunction(pos) && getFunction();
10326           },
10327           'global': function global() {
10328             return checkGlobal(pos) && getGlobal();
10329           },
10330           'ident': function ident() {
10331             return checkIdent(pos) && getIdent();
10332           },
10333           'important': function important() {
10334             return checkImportant(pos) && getImportant();
10335           },
10336           'include': function include() {
10337             return checkInclude(pos) && getInclude();
10338           },
10339           'interpolation': function interpolation() {
10340             return checkInterpolation(pos) && getInterpolation();
10341           },
10342           'loop': function loop() {
10343             return checkLoop(pos) && getLoop();
10344           },
10345           'mixin': function mixin() {
10346             return checkMixin(pos) && getMixin();
10347           },
10348           'namespace': function namespace() {
10349             return checkNamespace(pos) && getNamespace();
10350           },
10351           'number': function number() {
10352             return checkNumber(pos) && getNumber();
10353           },
10354           'operator': function operator() {
10355             return checkOperator(pos) && getOperator();
10356           },
10357           'optional': function optional() {
10358             return checkOptional(pos) && getOptional();
10359           },
10360           'parentheses': function parentheses() {
10361             return checkParentheses(pos) && getParentheses();
10362           },
10363           'parentselector': function parentselector() {
10364             return checkParentSelector(pos) && getParentSelector();
10365           },
10366           'percentage': function percentage() {
10367             return checkPercentage(pos) && getPercentage();
10368           },
10369           'placeholder': function placeholder() {
10370             return checkPlaceholder(pos) && getPlaceholder();
10371           },
10372           'progid': function progid() {
10373             return checkProgid(pos) && getProgid();
10374           },
10375           'property': function property() {
10376             return checkProperty(pos) && getProperty();
10377           },
10378           'propertyDelim': function propertyDelim() {
10379             return checkPropertyDelim(pos) && getPropertyDelim();
10380           },
10381           'pseudoc': function pseudoc() {
10382             return checkPseudoc(pos) && getPseudoc();
10383           },
10384           'pseudoe': function pseudoe() {
10385             return checkPseudoe(pos) && getPseudoe();
10386           },
10387           'ruleset': function ruleset() {
10388             return checkRuleset(pos) && getRuleset();
10389           },
10390           's': function s() {
10391             return checkS(pos) && getS();
10392           },
10393           'selector': function selector() {
10394             return checkSelector(pos) && getSelector();
10395           },
10396           'shash': function shash() {
10397             return checkShash(pos) && getShash();
10398           },
10399           'string': function string() {
10400             return checkString(pos) && getString();
10401           },
10402           'stylesheet': function stylesheet() {
10403             return checkStylesheet(pos) && getStylesheet();
10404           },
10405           'typeSelector': function typeSelector() {
10406             return checkTypeSelector(pos) && getTypeSelector();
10407           },
10408           'unary': function unary() {
10409             return checkUnary(pos) && getUnary();
10410           },
10411           'unicodeRange': function unicodeRange() {
10412             return checkUnicodeRange(pos) && getUnicodeRange();
10413           },
10414           'universalSelector': function universalSelector() {
10415             return checkUniversalSelector(pos) && getUniversalSelector();
10416           },
10417           'urange': function urange() {
10418             return checkUrange(pos) && getUrange();
10419           },
10420           'uri': function uri() {
10421             return checkUri(pos) && getUri();
10422           },
10423           'value': function value() {
10424             return checkValue(pos) && getValue();
10425           },
10426           'variable': function variable() {
10427             return checkVariable(pos) && getVariable();
10428           },
10429           'variableslist': function variableslist() {
10430             return checkVariablesList(pos) && getVariablesList();
10431           },
10432           'vhash': function vhash() {
10433             return checkVhash(pos) && getVhash();
10434           }
10435         };
10436
10437         /**
10438          * Stops parsing and display error.
10439          *
10440          * @param {number=} i Token's index number
10441          */
10442         function throwError(i) {
10443           var ln = tokens[i].ln;
10444
10445           throw { line: ln, syntax: 'sass' };
10446         }
10447
10448         /**
10449          * @param {number} start
10450          * @param {number} finish
10451          * @return {string}
10452          */
10453         function joinValues(start, finish) {
10454           var s = '';
10455
10456           for (var i = start; i < finish + 1; i++) {
10457             s += tokens[i].value;
10458           }
10459
10460           return s;
10461         }
10462
10463         /**
10464          * @param {number} start
10465          * @param {number} num
10466          * @return {string}
10467          */
10468         function joinValues2(start, num) {
10469           if (start + num - 1 >= tokensLength) return;
10470
10471           var s = '';
10472
10473           for (var i = 0; i < num; i++) {
10474             s += tokens[start + i].value;
10475           }
10476
10477           return s;
10478         }
10479
10480         /**
10481          * @param {string|!Array} content
10482          * @param {number} line
10483          * @param {number} column
10484          * @param {number} colOffset
10485          */
10486         function getLastPosition(content, line, column, colOffset) {
10487           return typeof content === 'string' ? getLastPositionForString(content, line, column, colOffset) : getLastPositionForArray(content, line, column, colOffset);
10488         }
10489
10490         /**
10491          * @param {string} content
10492          * @param {number} line
10493          * @param {number} column
10494          * @param {number} colOffset
10495          */
10496         function getLastPositionForString(content, line, column, colOffset) {
10497           var position = [];
10498
10499           if (!content) {
10500             position = [line, column];
10501             if (colOffset) position[1] += colOffset - 1;
10502             return position;
10503           }
10504
10505           var lastLinebreak = content.lastIndexOf('\n');
10506           var endsWithLinebreak = lastLinebreak === content.length - 1;
10507           var splitContent = content.split('\n');
10508           var linebreaksCount = splitContent.length - 1;
10509           var prevLinebreak = linebreaksCount === 0 || linebreaksCount === 1 ? -1 : content.length - splitContent[linebreaksCount - 1].length - 2;
10510
10511           // Line:
10512           var offset = endsWithLinebreak ? linebreaksCount - 1 : linebreaksCount;
10513           position[0] = line + offset;
10514
10515           // Column:
10516           if (endsWithLinebreak) {
10517             offset = prevLinebreak !== -1 ? content.length - prevLinebreak : content.length - 1;
10518           } else {
10519             offset = linebreaksCount !== 0 ? content.length - lastLinebreak - column - 1 : content.length - 1;
10520           }
10521           position[1] = column + offset;
10522
10523           if (!colOffset) return position;
10524
10525           if (endsWithLinebreak) {
10526             position[0]++;
10527             position[1] = colOffset;
10528           } else {
10529             position[1] += colOffset;
10530           }
10531
10532           return position;
10533         }
10534
10535         /**
10536          * @param {!Array} content
10537          * @param {number} line
10538          * @param {number} column
10539          * @param {number} colOffset
10540          */
10541         function getLastPositionForArray(content, line, column, colOffset) {
10542           var position = void 0;
10543
10544           if (content.length === 0) {
10545             position = [line, column];
10546           } else {
10547             var c = content[content.length - 1];
10548             if (c.hasOwnProperty('end')) {
10549               position = [c.end.line, c.end.column];
10550             } else {
10551               position = getLastPosition(c.content, line, column);
10552             }
10553           }
10554
10555           if (!colOffset) return position;
10556
10557           if (tokens[pos - 1] && tokens[pos - 1].type !== 'Newline') {
10558             position[1] += colOffset;
10559           } else {
10560             position[0]++;
10561             position[1] = 1;
10562           }
10563
10564           return position;
10565         }
10566
10567         /**
10568          * @param {string} type
10569          * @param {string|!Array} content
10570          * @param {number} line
10571          * @param {number} column
10572          * @param {!Array} end
10573          */
10574         function newNode(type, content, line, column, end) {
10575           if (!end) end = getLastPosition(content, line, column);
10576           return new Node({
10577             type: type,
10578             content: content,
10579             start: {
10580               line: line,
10581               column: column
10582             },
10583             end: {
10584               line: end[0],
10585               column: end[1]
10586             },
10587             syntax: 'sass'
10588           });
10589         }
10590
10591         /**
10592          * @param {number} i Token's index number
10593          * @return {number}
10594          */
10595         function checkAny(i) {
10596           var l = void 0;
10597
10598           if (l = checkBrackets(i)) tokens[i].any_child = 1;else if (l = checkParentheses(i)) tokens[i].any_child = 2;else if (l = checkString(i)) tokens[i].any_child = 3;else if (l = checkVariablesList(i)) tokens[i].any_child = 4;else if (l = checkVariable(i)) tokens[i].any_child = 5;else if (l = checkPlaceholder(i)) tokens[i].any_child = 6;else if (l = checkPercentage(i)) tokens[i].any_child = 7;else if (l = checkDimension(i)) tokens[i].any_child = 8;else if (l = checkUnicodeRange(i)) tokens[i].any_child = 9;else if (l = checkNumber(i)) tokens[i].any_child = 10;else if (l = checkUri(i)) tokens[i].any_child = 11;else if (l = checkExpression(i)) tokens[i].any_child = 12;else if (l = checkFunctionsList(i)) tokens[i].any_child = 13;else if (l = checkFunction(i)) tokens[i].any_child = 14;else if (l = checkInterpolation(i)) tokens[i].any_child = 15;else if (l = checkIdent(i)) tokens[i].any_child = 16;else if (l = checkClass(i)) tokens[i].any_child = 17;else if (l = checkUnary(i)) tokens[i].any_child = 18;else if (l = checkParentSelector(i)) tokens[i].any_child = 19;else if (l = checkImportant(i)) tokens[i].any_child = 20;else if (l = checkGlobal(i)) tokens[i].any_child = 21;else if (l = checkDefault(i)) tokens[i].any_child = 22;else if (l = checkOptional(i)) tokens[i].any_child = 23;
10599
10600           return l;
10601         }
10602
10603         /**
10604          * @return {!Node}
10605          */
10606         function getAny() {
10607           var childType = tokens[pos].any_child;
10608
10609           if (childType === 1) return getBrackets();
10610           if (childType === 2) return getParentheses();
10611           if (childType === 3) return getString();
10612           if (childType === 4) return getVariablesList();
10613           if (childType === 5) return getVariable();
10614           if (childType === 6) return getPlaceholder();
10615           if (childType === 7) return getPercentage();
10616           if (childType === 8) return getDimension();
10617           if (childType === 9) return getUnicodeRange();
10618           if (childType === 10) return getNumber();
10619           if (childType === 11) return getUri();
10620           if (childType === 12) return getExpression();
10621           if (childType === 13) return getFunctionsList();
10622           if (childType === 14) return getFunction();
10623           if (childType === 15) return getInterpolation();
10624           if (childType === 16) return getIdent();
10625           if (childType === 17) return getClass();
10626           if (childType === 18) return getUnary();
10627           if (childType === 19) return getParentSelector();
10628           if (childType === 20) return getImportant();
10629           if (childType === 21) return getGlobal();
10630           if (childType === 22) return getDefault();
10631           if (childType === 23) return getOptional();
10632         }
10633
10634         /**
10635          * Checks if token is part of mixin's arguments.
10636          *
10637          * @param {number} i Token's index number
10638          * @return {number} Length of arguments
10639          */
10640         function checkArguments(i) {
10641           var start = i;
10642           var l = void 0;
10643
10644           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
10645
10646           // Skip `(`.
10647           i++;
10648
10649           while (i < tokens[start].right) {
10650             if (l = checkArgument(i)) i += l;else return 0;
10651           }
10652
10653           return tokens[start].right - start + 1;
10654         }
10655
10656         /**
10657          * @return {Array}
10658          */
10659         function getArguments() {
10660           var type = NodeType.ArgumentsType;
10661           var token = tokens[pos];
10662           var line = token.ln;
10663           var column = token.col;
10664           var content = [];
10665           var body = void 0;
10666
10667           // Skip `(`.
10668           pos++;
10669
10670           while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) {
10671             if (checkSingleValueDeclaration(pos)) {
10672               content.push(getSingleValueDeclaration());
10673             } else if (checkArgument(pos)) {
10674               body = getArgument();
10675               if (typeof body.content === 'string') content.push(body);else content = content.concat(body);
10676             } else if (checkClass(pos)) content.push(getClass());else throwError(pos);
10677           }
10678
10679           var end = getLastPosition(content, line, column, 1);
10680
10681           // Skip `)`.
10682           pos++;
10683
10684           return newNode(type, content, line, column, end);
10685         }
10686
10687         /**
10688          * Checks if token is valid to be part of arguments list
10689          * @param {number} i Token's index number
10690          * @return {number} Length of argument
10691          */
10692         function checkArgument(i) {
10693           var l = void 0;
10694
10695           if (l = checkBrackets(i)) tokens[i].argument_child = 1;else if (l = checkParentheses(i)) tokens[i].argument_child = 2;else if (l = checkSingleValueDeclaration(i)) tokens[i].argument_child = 3;else if (l = checkFunctionsList(i)) tokens[i].argument_child = 4;else if (l = checkFunction(i)) tokens[i].argument_child = 5;else if (l = checkVariablesList(i)) tokens[i].argument_child = 6;else if (l = checkVariable(i)) tokens[i].argument_child = 7;else if (l = checkSC(i)) tokens[i].argument_child = 8;else if (l = checkDelim(i)) tokens[i].argument_child = 9;else if (l = checkDeclDelim(i)) tokens[i].argument_child = 10;else if (l = checkString(i)) tokens[i].argument_child = 11;else if (l = checkPercentage(i)) tokens[i].argument_child = 12;else if (l = checkDimension(i)) tokens[i].argument_child = 13;else if (l = checkNumber(i)) tokens[i].argument_child = 14;else if (l = checkUri(i)) tokens[i].argument_child = 15;else if (l = checkInterpolation(i)) tokens[i].argument_child = 16;else if (l = checkIdent(i)) tokens[i].argument_child = 17;else if (l = checkVhash(i)) tokens[i].argument_child = 18;else if (l = checkCustomProperty(i)) tokens[i].argument_child = 19;else if (l = checkOperator(i)) tokens[i].argument_child = 20;else if (l = checkUnary(i)) tokens[i].argument_child = 21;else if (l = checkParentSelector(i)) tokens[i].argument_child = 22;else if (l = checkImportant(i)) tokens[i].argument_child = 23;else if (l = checkGlobal(i)) tokens[i].argument_child = 24;else if (l = checkDefault(i)) tokens[i].argument_child = 25;else if (l = checkOptional(i)) tokens[i].argument_child = 26;
10696
10697           return l;
10698         }
10699
10700         /**
10701          * @return {!Node}
10702          */
10703         function getArgument() {
10704           var childType = tokens[pos].argument_child;
10705
10706           if (childType === 1) return getBrackets();
10707           if (childType === 2) return getParentheses();
10708           if (childType === 3) return getSingleValueDeclaration();
10709           if (childType === 4) return getFunctionsList();
10710           if (childType === 5) return getFunction();
10711           if (childType === 6) return getVariablesList();
10712           if (childType === 7) return getVariable();
10713           if (childType === 8) return getSC();
10714           if (childType === 9) return getDelim();
10715           if (childType === 10) return getDeclDelim();
10716           if (childType === 11) return getString();
10717           if (childType === 12) return getPercentage();
10718           if (childType === 13) return getDimension();
10719           if (childType === 14) return getNumber();
10720           if (childType === 15) return getUri();
10721           if (childType === 16) return getInterpolation();
10722           if (childType === 17) return getIdent();
10723           if (childType === 18) return getVhash();
10724           if (childType === 19) return getCustomProperty();
10725           if (childType === 20) return getOperator();
10726           if (childType === 21) return getUnary();
10727           if (childType === 22) return getParentSelector();
10728           if (childType === 23) return getImportant();
10729           if (childType === 24) return getGlobal();
10730           if (childType === 25) return getDefault();
10731           if (childType === 26) return getOptional();
10732         }
10733
10734         /**
10735          * Checks if token is part of an @-word (e.g. `@import`, `@include`).
10736          *
10737          * @param {number} i Token's index number
10738          * @return {number}
10739          */
10740         function checkAtkeyword(i) {
10741           var l = void 0;
10742
10743           // Check that token is `@`:
10744           if (i >= tokensLength || tokens[i++].type !== TokenType.CommercialAt) return 0;
10745
10746           return (l = checkIdentOrInterpolation(i)) ? l + 1 : 0;
10747         }
10748
10749         /**
10750          * Gets node with @-word.
10751          *
10752          * @return {!Node}
10753          */
10754         function getAtkeyword() {
10755           var type = NodeType.AtkeywordType;
10756           var token = tokens[pos];
10757           var line = token.ln;
10758           var column = token.col;
10759
10760           // Skip `@`.
10761           pos++;
10762
10763           var content = getIdentOrInterpolation();
10764
10765           return newNode(type, content, line, column);
10766         }
10767
10768         /**
10769          * Checks if token is a part of an @-rule.
10770          *
10771          * @param {number} i Token's index number
10772          * @return {number} Length of @-rule
10773          */
10774         function checkAtrule(i) {
10775           var l = void 0;
10776
10777           if (i >= tokensLength) return 0;
10778
10779           // If token already has a record of being part of an @-rule,
10780           // return the @-rule's length:
10781           if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l;
10782
10783           // If token is part of an @-rule, save the rule's type to token.
10784           // @keyframes:
10785           if (l = checkKeyframesRule(i)) tokens[i].atrule_type = 4;
10786           // @-rule with ruleset:
10787           else if (l = checkAtruler(i)) tokens[i].atrule_type = 1;
10788             // Block @-rule:
10789             else if (l = checkAtruleb(i)) tokens[i].atrule_type = 2;
10790               // Single-line @-rule:
10791               else if (l = checkAtrules(i)) tokens[i].atrule_type = 3;else return 0;
10792
10793           // If token is part of an @-rule, save the rule's length to token:
10794           tokens[i].atrule_l = l;
10795
10796           return l;
10797         }
10798
10799         /**
10800          * Gets node with @-rule.
10801          *
10802          * @return {!Node}
10803          */
10804         function getAtrule() {
10805           var childType = tokens[pos].atrule_type;
10806
10807           if (childType === 1) return getAtruler(); // @-rule with ruleset
10808           if (childType === 2) return getAtruleb(); // Block @-rule
10809           if (childType === 3) return getAtrules(); // Single-line @-rule
10810           if (childType === 4) return getKeyframesRule();
10811         }
10812
10813         /**
10814          * Checks if token is part of a block @-rule.
10815          *
10816          * @param {number} i Token's index number
10817          * @return {number} Length of the @-rule
10818          */
10819         function checkAtruleb(i) {
10820           var start = i;
10821           var l = void 0;
10822
10823           if (i >= tokensLength) return 0;
10824
10825           if (l = checkAtkeyword(i)) i += l;else return 0;
10826
10827           if (l = checkTsets(i)) i += l;
10828
10829           if (l = checkBlock(i)) i += l;else return 0;
10830
10831           return i - start;
10832         }
10833
10834         /**
10835          * Gets node with a block @-rule.
10836          *
10837          * @return {!Node}
10838          */
10839         function getAtruleb() {
10840           var type = NodeType.AtruleType;
10841           var token = tokens[pos];
10842           var line = token.ln;
10843           var column = token.col;
10844           var content = [].concat(getAtkeyword(), getTsets(), getBlock());
10845
10846           return newNode(type, content, line, column);
10847         }
10848
10849         /**
10850          * Checks if token is part of an @-rule with ruleset.
10851          *
10852          * @param {number} i Token's index number
10853          * @return {number} Length of the @-rule
10854          */
10855         function checkAtruler(i) {
10856           var start = i;
10857           var l = void 0;
10858
10859           if (i >= tokensLength) return 0;
10860
10861           if (l = checkAtkeyword(i)) i += l;else return 0;
10862
10863           if (l = checkTsets(i)) i += l;
10864
10865           if (l = checkAtrulers(i)) i += l;else return 0;
10866
10867           return i - start;
10868         }
10869
10870         /**
10871          * Gets node with an @-rule with ruleset.
10872          *
10873          * @return {!Node}
10874          */
10875         function getAtruler() {
10876           var type = NodeType.AtruleType;
10877           var token = tokens[pos];
10878           var line = token.ln;
10879           var column = token.col;
10880           var content = [].concat(getAtkeyword(), getTsets(), getAtrulers());
10881
10882           return newNode(type, content, line, column);
10883         }
10884
10885         /**
10886          * @param {number} i Token's index number
10887          * @return {number}
10888          */
10889         function checkAtrulers(i) {
10890           var start = i;
10891           var l = void 0;
10892
10893           if (i >= tokensLength) return 0;
10894
10895           var blockEnd = tokens[i].block_end;
10896           if (!blockEnd) return 0;
10897
10898           while (i < blockEnd) {
10899             if (l = checkSC(i)) tokens[i].atrulers_child = 1;else if (l = checkAtrule(i)) tokens[i].atrulers_child = 2;else if (l = checkRuleset(i)) tokens[i].atrulers_child = 3;else return 0;
10900             i += l;
10901           }
10902
10903           if (i < tokensLength) tokens[i].atrulers_end = 1;
10904
10905           return i - start;
10906         }
10907
10908         /**
10909          * @return {!Node}
10910          */
10911         function getAtrulers() {
10912           var type = NodeType.BlockType;
10913           var token = tokens[pos];
10914           var line = token.ln;
10915           var column = token.col;
10916           var content = getSC();
10917
10918           while (pos < tokensLength && !tokens[pos].atrulers_end) {
10919             var childType = tokens[pos].atrulers_child;
10920             if (childType === 1) content = content.concat(getSC());else if (childType === 2) content.push(getAtrule());else if (childType === 3) content.push(getRuleset());else break;
10921           }
10922
10923           var end = getLastPosition(content, line, column);
10924
10925           return newNode(type, content, line, column, end);
10926         }
10927
10928         /**
10929          * @param {number} i Token's index number
10930          * @return {number}
10931          */
10932         function checkAtrules(i) {
10933           var start = i;
10934           var l = void 0;
10935
10936           if (i >= tokensLength) return 0;
10937
10938           if (l = checkAtkeyword(i)) i += l;else return 0;
10939
10940           if (l = checkTsets(i)) i += l;
10941
10942           return i - start;
10943         }
10944
10945         /**
10946          * @return {!Node}
10947          */
10948         function getAtrules() {
10949           var type = NodeType.AtruleType;
10950           var token = tokens[pos];
10951           var line = token.ln;
10952           var column = token.col;
10953           var content = [].concat(getAtkeyword(), getTsets());
10954
10955           return newNode(type, content, line, column);
10956         }
10957
10958         /**
10959          * Checks if token is part of a block (e.g. `{...}`).
10960          *
10961          * @param {number} i Token's index number
10962          * @return {number} Length of the block
10963          */
10964         function checkBlock(i) {
10965           return i < tokensLength && tokens[i].block_end ? tokens[i].block_end - i + 1 : 0;
10966         }
10967
10968         /**
10969          * Gets node with a block.
10970          *
10971          * @return {!Node}
10972          */
10973         function getBlock() {
10974           var type = NodeType.BlockType;
10975           var token = tokens[pos];
10976           var line = token.ln;
10977           var column = token.col;
10978           var end = tokens[pos].block_end;
10979           var content = [];
10980
10981           while (pos < end) {
10982             if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());else throwError(pos);
10983           }
10984
10985           return newNode(type, content, line, column);
10986         }
10987
10988         /**
10989          * Checks if token is part of a declaration (property-value pair).
10990          *
10991          * @param {number} i Token's index number
10992          * @return {number} Length of the declaration
10993          */
10994         function checkBlockdecl(i) {
10995           var l = void 0;
10996
10997           if (i >= tokensLength) return 0;
10998
10999           if (l = checkBlockdecl7(i)) tokens[i].bd_type = 7;else if (l = checkBlockdecl5(i)) tokens[i].bd_type = 5;else if (l = checkBlockdecl6(i)) tokens[i].bd_type = 6;else if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1;else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2;else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3;else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4;else return 0;
11000
11001           return l;
11002         }
11003
11004         /**
11005          * @return {!Array}
11006          */
11007         function getBlockdecl() {
11008           var childType = tokens[pos].bd_type;
11009
11010           if (childType === 1) return getBlockdecl1();
11011           if (childType === 2) return getBlockdecl2();
11012           if (childType === 3) return getBlockdecl3();
11013           if (childType === 4) return getBlockdecl4();
11014           if (childType === 5) return getBlockdecl5();
11015           if (childType === 6) return getBlockdecl6();
11016           if (childType === 7) return getBlockdecl7();
11017         }
11018
11019         /**
11020          * @param {number} i Token's index number
11021          * @return {number}
11022          */
11023         function checkBlockdecl1(i) {
11024           var start = i;
11025           var l = void 0;
11026
11027           if (l = checkInclude(i)) tokens[i].bd_kind = 2;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 5;else if (l = checkAtrule(i)) tokens[i].bd_kind = 6;else return 0;
11028
11029           i += l;
11030
11031           if (tokens[start].bd_kind === 2 && [2, 4, 6, 8].indexOf(tokens[start].include_type) === -1) return 0;
11032
11033           if (tokens[start].bd_kind === 6 && tokens[start].atrule_type === 3) return 0;
11034
11035           while (i < tokensLength) {
11036             if (l = checkDeclDelim(i)) return i + l - start;
11037
11038             if (l = checkS(i)) i += l;else if (l = checkCommentSL(i)) i += l;else break;
11039           }
11040
11041           return 0;
11042         }
11043
11044         /**
11045          * @return {!Array}
11046          */
11047         function getBlockdecl1() {
11048           var content = [];
11049           var _content = [];
11050
11051           switch (tokens[pos].bd_kind) {
11052             case 2:
11053               content.push(getInclude());
11054               break;
11055             case 5:
11056               content.push(getDeclaration());
11057               break;
11058             case 6:
11059               content.push(getAtrule());
11060               break;
11061           }
11062
11063           while (pos < tokensLength) {
11064             var _pos = pos;
11065             if (checkDeclDelim(pos)) {
11066               _content.push(getDeclDelim());
11067               content = content.concat(_content);
11068               break;
11069             }
11070
11071             if (checkS(pos)) _content.push(getS());else if (checkCommentSL(pos)) _content.push(getCommentSL());else {
11072               pos = _pos;
11073               break;
11074             }
11075           }
11076
11077           return content;
11078         }
11079
11080         /**
11081          * @param {number} i Token's index number
11082          * @return {number}
11083          */
11084         function checkBlockdecl2(i) {
11085           var start = i;
11086           var l = void 0;
11087
11088           if (l = checkConditionalStatement(i)) tokens[i].bd_kind = 1;else if (l = checkInclude(i)) tokens[i].bd_kind = 2;else if (l = checkExtend(i)) tokens[i].bd_kind = 4;else if (l = checkMixin(i)) tokens[i].bd_kind = 8;else if (l = checkLoop(i)) tokens[i].bd_kind = 3;else if (l = checkRuleset(i)) tokens[i].bd_kind = 7;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 5;else if (l = checkAtrule(i)) tokens[i].bd_kind = 6;else return 0;
11089
11090           i += l;
11091
11092           while (i < tokensLength) {
11093             if (l = checkS(i)) i += l;else if (l = checkCommentSL(i)) i += l;else break;
11094           }
11095
11096           return i - start;
11097         }
11098
11099         /**
11100          * @return {!Array}
11101          */
11102         function getBlockdecl2() {
11103           var content = [];
11104
11105           switch (tokens[pos].bd_kind) {
11106             case 1:
11107               content.push(getConditionalStatement());
11108               break;
11109             case 2:
11110               content.push(getInclude());
11111               break;
11112             case 3:
11113               content.push(getLoop());
11114               break;
11115             case 4:
11116               content.push(getExtend());
11117               break;
11118             case 5:
11119               content.push(getDeclaration());
11120               break;
11121             case 6:
11122               content.push(getAtrule());
11123               break;
11124             case 7:
11125               content.push(getRuleset());
11126               break;
11127             case 8:
11128               content.push(getMixin());
11129               break;
11130           }
11131
11132           while (pos < tokensLength) {
11133             if (checkS(pos)) content.push(getS());else if (checkCommentSL(pos)) content.push(getCommentSL());else break;
11134           }
11135
11136           return content;
11137         }
11138
11139         /**
11140          * @param {number} i Token's index number
11141          * @return {number}
11142          */
11143         function checkBlockdecl3(i) {
11144           var start = i;
11145           var l = void 0;
11146
11147           if (l = checkConditionalStatement(i)) tokens[i].bd_kind = 1;else if (l = checkInclude(i)) tokens[i].bd_kind = 2;else if (l = checkExtend(i)) tokens[i].bd_kind = 4;else if (l = checkLoop(i)) tokens[i].bd_kind = 3;else if (l = checkRuleset(i)) tokens[i].bd_kind = 7;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 5;else if (l = checkAtrule(i)) tokens[i].bd_kind = 6;else return 0;
11148
11149           i += l;
11150
11151           return i - start;
11152         }
11153
11154         /**
11155          * @return {!Array}
11156          */
11157         function getBlockdecl3() {
11158           var content = void 0;
11159
11160           switch (tokens[pos].bd_kind) {
11161             case 1:
11162               content = getConditionalStatement();
11163               break;
11164             case 2:
11165               content = getInclude();
11166               break;
11167             case 3:
11168               content = getLoop();
11169               break;
11170             case 4:
11171               content = getExtend();
11172               break;
11173             case 5:
11174               content = getDeclaration();
11175               break;
11176             case 6:
11177               content = getAtrule();
11178               break;
11179             case 7:
11180               content = getRuleset();
11181               break;
11182           }
11183
11184           return [content];
11185         }
11186
11187         /**
11188          * @param {number} i Token's index number
11189          * @return {number}
11190          */
11191         function checkBlockdecl4(i) {
11192           return checkSC(i);
11193         }
11194
11195         /**
11196          * @return {!Array}
11197          */
11198         function getBlockdecl4() {
11199           return getSC();
11200         }
11201
11202         /**
11203          * @param {number} i Token's index number
11204          * @return {number}
11205          */
11206         function checkBlockdecl5(i) {
11207           var start = i;
11208           var l = void 0;
11209
11210           if (l = checkInclude(i)) i += l;else if (l = checkRuleset(i)) i += l;else return 0;
11211
11212           while (i < tokensLength) {
11213             if (l = checkS(i)) i += l;else if (l = checkCommentSL(i)) i += l;else break;
11214           }
11215
11216           return i - start;
11217         }
11218
11219         /**
11220          * @return {!Array}
11221          */
11222         function getBlockdecl5() {
11223           var content = [];
11224
11225           if (checkInclude(pos)) content.push(getInclude());else content.push(getRuleset());
11226
11227           while (pos < tokensLength) {
11228             if (checkS(pos)) content.push(getS());else if (checkCommentSL(pos)) content.push(getCommentSL());else break;
11229           }
11230
11231           return content;
11232         }
11233
11234         /**
11235          * @param {number} i Token's index number
11236          * @return {number}
11237          */
11238         function checkBlockdecl6(i) {
11239           var start = i;
11240           var l = void 0;
11241
11242           if (l = checkInclude(i)) i += l;else if (l = checkRuleset(i)) i += l;else return 0;
11243
11244           return i - start;
11245         }
11246
11247         /**
11248          * @return {!Array}
11249          */
11250         function getBlockdecl6() {
11251           var content = void 0;
11252
11253           if (checkInclude(pos)) content = getInclude();else content = getRuleset();
11254
11255           return [content];
11256         }
11257
11258         /**
11259          * @param {number} i Token's index number
11260          * @return {number}
11261          */
11262         function checkBlockdecl7(i) {
11263           var start = i;
11264           var l = void 0;
11265
11266           if (l = checkInclude(i)) i += l;else return 0;
11267
11268           if ([2, 4, 6, 8].indexOf(tokens[start].include_type) === -1) return 0;
11269
11270           while (i < tokensLength) {
11271             if (l = checkDeclDelim(i)) return i + l - start;
11272
11273             if (l = checkS(i)) i += l;else if (l = checkCommentSL(i)) i += l;else break;
11274           }
11275
11276           return 0;
11277         }
11278
11279         /**
11280          * @return {!Array}
11281          */
11282         function getBlockdecl7() {
11283           var content = [];
11284           var _content = [];
11285
11286           content.push(getInclude());
11287
11288           while (pos < tokensLength) {
11289             var _pos = pos;
11290             if (checkDeclDelim(pos)) {
11291               _content.push(getDeclDelim());
11292               content = content.concat(_content);
11293               break;
11294             }
11295
11296             if (checkS(pos)) _content.push(getS());else if (checkCommentSL(pos)) _content.push(getCommentSL());else {
11297               pos = _pos;
11298               break;
11299             }
11300           }
11301
11302           return content;
11303         }
11304
11305         /**
11306          * Checks if token is part of text inside square brackets, e.g. `[1]`.
11307          *
11308          * @param {number} i Token's index number
11309          * @return {number}
11310          */
11311         function checkBrackets(i) {
11312           if (i >= tokensLength) return 0;
11313
11314           var start = i;
11315
11316           // Skip `[`.
11317           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
11318
11319           if (i < tokens[start].right) {
11320             var l = checkTsets(i);
11321             if (l) i += l;else return 0;
11322           }
11323
11324           // Skip `]`.
11325           i++;
11326
11327           return i - start;
11328         }
11329
11330         /**
11331          * Gets node with text inside square brackets, e.g. `[1]`.
11332          *
11333          * @return {!Node}
11334          */
11335         function getBrackets() {
11336           var type = NodeType.BracketsType;
11337           var token = tokens[pos];
11338           var line = token.ln;
11339           var column = token.col;
11340           var right = token.right;
11341           var content = [];
11342
11343           // Skip `[`.
11344           pos++;
11345
11346           if (pos < right) {
11347             content = getTsets();
11348           }
11349
11350           var end = getLastPosition(content, line, column, 1);
11351
11352           // Skip `]`.
11353           pos++;
11354
11355           return newNode(type, content, line, column, end);
11356         }
11357
11358         /**
11359          * Checks if token is part of a class selector (e.g. `.abc`).
11360          *
11361          * @param {number} i Token's index number
11362          * @return {number} Length of the class selector
11363          */
11364         function checkClass(i) {
11365           var start = i;
11366           var l = void 0;
11367
11368           if (i >= tokensLength) return 0;
11369
11370           if (tokens[i].class_l) return tokens[i].class_l;
11371
11372           // Skip `.`.
11373           if (tokens[i].type === TokenType.FullStop) i++;else return 0;
11374
11375           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
11376
11377           while (i < tokensLength) {
11378             if (l = checkIdentOrInterpolation(i)) {
11379               tokens[start].class_l = l + 1;
11380               i += l;
11381             } else break;
11382           }
11383
11384           tokens[start].classEnd = i;
11385
11386           return i - start;
11387         }
11388
11389         /**
11390          * Gets node with a class selector.
11391          *
11392          * @return {!Node}
11393          */
11394         function getClass() {
11395           var type = NodeType.ClassType;
11396           var token = tokens[pos];
11397           var line = token.ln;
11398           var column = token.col;
11399           var end = token.classEnd;
11400           var content = [];
11401
11402           // Skip `.`
11403           pos++;
11404
11405           while (pos < end) {
11406             if (checkIdentOrInterpolation(pos)) {
11407               content = content.concat(getIdentOrInterpolation());
11408             } else break;
11409           }
11410
11411           return newNode(type, content, line, column);
11412         }
11413
11414         /**
11415          * @param {number} i
11416          * @return {number}
11417          */
11418         function checkCombinator(i) {
11419           if (i >= tokensLength) return 0;
11420
11421           var l = void 0;
11422           if (l = checkCombinator1(i)) tokens[i].combinatorType = 1;else if (l = checkCombinator2(i)) tokens[i].combinatorType = 2;else if (l = checkCombinator3(i)) tokens[i].combinatorType = 3;else if (l = checkCombinator4(i)) tokens[i].combinatorType = 4;
11423
11424           return l;
11425         }
11426
11427         /**
11428          * @return {!Node}
11429          */
11430         function getCombinator() {
11431           var type = tokens[pos].combinatorType;
11432           if (type === 1) return getCombinator1();
11433           if (type === 2) return getCombinator2();
11434           if (type === 3) return getCombinator3();
11435           if (type === 4) return getCombinator4();
11436         }
11437
11438         /**
11439          * (1) `>>>`
11440          *
11441          * @param {Number} i
11442          * @return {Number}
11443          */
11444         function checkCombinator1(i) {
11445           if (i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign) return 3;
11446
11447           return 0;
11448         }
11449
11450         /**
11451          * @return {Node}
11452          */
11453         function getCombinator1() {
11454           var type = NodeType.CombinatorType;
11455           var token = tokens[pos];
11456           var line = token.ln;
11457           var column = token.col;
11458           var content = '>>>';
11459
11460           // Skip combinator
11461           pos += 3;
11462
11463           return newNode(type, content, line, column);
11464         }
11465
11466         /**
11467          * (1) `||`
11468          * (2) `>>`
11469          *
11470          * @param {number} i
11471          * @return {number}
11472          */
11473         function checkCombinator2(i) {
11474           if (i + 1 >= tokensLength) return 0;
11475
11476           if (tokens[i].type === TokenType.VerticalLine && tokens[i + 1].type === TokenType.VerticalLine) return 2;
11477
11478           if (tokens[i].type === TokenType.GreaterThanSign && tokens[i + 1].type === TokenType.GreaterThanSign) return 2;
11479
11480           return 0;
11481         }
11482
11483         /**
11484          * @return {!Node}
11485          */
11486         function getCombinator2() {
11487           var type = NodeType.CombinatorType;
11488           var token = tokens[pos];
11489           var line = token.ln;
11490           var column = token.col;
11491           var content = '' + token.value + tokens[pos + 1].value;
11492
11493           // Skip combinator
11494           pos += 2;
11495
11496           return newNode(type, content, line, column);
11497         }
11498
11499         /**
11500          * (1) `>`
11501          * (2) `+`
11502          * (3) `~`
11503          *
11504          * @param {number} i
11505          * @return {number}
11506          */
11507         function checkCombinator3(i) {
11508           var type = tokens[i].type;
11509           if (type === TokenType.PlusSign || type === TokenType.GreaterThanSign || type === TokenType.Tilde) return 1;else return 0;
11510         }
11511
11512         /**
11513          * @return {Node}
11514          */
11515         function getCombinator3() {
11516           var type = NodeType.CombinatorType;
11517           var token = tokens[pos];
11518           var line = token.ln;
11519           var column = token.col;
11520           var content = token.value;
11521
11522           // Skip combinator
11523           pos++;
11524
11525           return newNode(type, content, line, column);
11526         }
11527
11528         /**
11529          * (1) `/panda/`
11530          */
11531         function checkCombinator4(i) {
11532           var start = i;
11533
11534           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
11535
11536           var l = void 0;
11537           if (l = checkIdent(i)) i += l;else return 0;
11538
11539           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
11540
11541           return i - start;
11542         }
11543
11544         /**
11545          * @return {Node}
11546          */
11547         function getCombinator4() {
11548           var type = NodeType.CombinatorType;
11549           var token = tokens[pos];
11550           var line = token.ln;
11551           var column = token.col;
11552
11553           // Skip `/`.
11554           pos++;
11555
11556           var ident = getIdent();
11557
11558           // Skip `/`.
11559           pos++;
11560
11561           var content = '/' + ident.content + '/';
11562
11563           return newNode(type, content, line, column);
11564         }
11565
11566         /**
11567          * Check if token is a multiline comment.
11568          * @param {number} i Token's index number
11569          * @return {number} `1` if token is a multiline comment, otherwise `0`
11570          */
11571         function checkCommentML(i) {
11572           return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0;
11573         }
11574
11575         /**
11576          * Get node with a multiline comment
11577          * @return {Array} `['commentML', x]` where `x`
11578          *      is the comment's text (without `/*` and `* /`).
11579          */
11580         function getCommentML() {
11581           var type = NodeType.CommentMLType;
11582           var token = tokens[pos];
11583           var line = token.ln;
11584           var column = token.col;
11585           var content = tokens[pos].value.substring(2);
11586
11587           var end = getLastPosition(content, line, column + 2);
11588
11589           if (content.endsWith('*/')) {
11590             content = content.substring(0, content.length - 2);
11591           }
11592
11593           pos++;
11594
11595           return newNode(type, content, line, column, end);
11596         }
11597
11598         /**
11599          * Check if token is part of a single-line comment.
11600          * @param {number} i Token's index number
11601          * @return {number} `1` if token is a single-line comment, otherwise `0`
11602          */
11603         function checkCommentSL(i) {
11604           return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0;
11605         }
11606
11607         /**
11608          * Get node with a single-line comment.
11609          * @return {Array} `['commentSL', x]` where `x` is comment's message
11610          *      (without `//`)
11611          */
11612         function getCommentSL() {
11613           var type = NodeType.CommentSLType;
11614           var token = tokens[pos];
11615           var line = token.ln;
11616           var column = token.col;
11617           var content = tokens[pos++].value.substring(2);
11618           var end = !content ? [line, column + 1] : getLastPosition(content, line, column + 2);
11619
11620           return newNode(type, content, line, column, end);
11621         }
11622
11623         /**
11624          * Check if token is part of a condition
11625          * (e.g. `@if ...`, `@else if ...` or `@else ...`).
11626          * @param {number} i Token's index number
11627          * @return {number} Length of the condition
11628          */
11629         function checkCondition(i) {
11630           var start = i;
11631           var l = void 0;
11632           var _i = void 0;
11633           var s = void 0;
11634
11635           if (i >= tokensLength) return 0;
11636
11637           if (l = checkAtkeyword(i)) i += l;else return 0;
11638
11639           if (['if', 'else'].indexOf(tokens[start + 1].value) < 0) return 0;
11640
11641           while (i < tokensLength) {
11642             if (l = checkBlock(i)) break;
11643
11644             s = checkSC(i);
11645             _i = i + s;
11646
11647             if (l = _checkCondition(_i)) i += l + s;else break;
11648           }
11649
11650           return i - start;
11651         }
11652
11653         function _checkCondition(i) {
11654           return checkVariable(i) || checkNumber(i) || checkInterpolation(i) || checkIdent(i) || checkOperator(i) || checkCombinator(i) || checkString(i);
11655         }
11656
11657         /**
11658          * Get node with a condition.
11659          * @return {Array} `['condition', x]`
11660          */
11661         function getCondition() {
11662           var type = NodeType.ConditionType;
11663           var token = tokens[pos];
11664           var line = token.ln;
11665           var column = token.col;
11666           var content = [];
11667           var s = void 0;
11668           var _pos = void 0;
11669
11670           content.push(getAtkeyword());
11671
11672           while (pos < tokensLength) {
11673             if (checkBlock(pos)) break;
11674
11675             s = checkSC(pos);
11676             _pos = pos + s;
11677
11678             if (!_checkCondition(_pos)) break;
11679
11680             if (s) content = content.concat(getSC());
11681             content.push(_getCondition());
11682           }
11683
11684           return newNode(type, content, line, column);
11685         }
11686
11687         function _getCondition() {
11688           if (checkVariable(pos)) return getVariable();
11689           if (checkNumber(pos)) return getNumber();
11690           if (checkInterpolation(pos)) return getInterpolation();
11691           if (checkIdent(pos)) return getIdent();
11692           if (checkOperator(pos)) return getOperator();
11693           if (checkCombinator(pos)) return getCombinator();
11694           if (checkString(pos)) return getString();
11695         }
11696
11697         /**
11698          * Check if token is part of a conditional statement
11699          * (e.g. `@if ... {} @else if ... {} @else ... {}`).
11700          * @param {number} i Token's index number
11701          * @return {number} Length of the condition
11702          */
11703         function checkConditionalStatement(i) {
11704           var start = i;
11705           var l = void 0;
11706
11707           if (i >= tokensLength) return 0;
11708
11709           if (l = checkCondition(i)) i += l;else return 0;
11710
11711           if (l = checkSC(i)) i += l;
11712
11713           if (l = checkBlock(i)) i += l;else return 0;
11714
11715           return i - start;
11716         }
11717
11718         /**
11719          * Get node with a condition.
11720          * @return {Array} `['condition', x]`
11721          */
11722         function getConditionalStatement() {
11723           var type = NodeType.ConditionalStatementType;
11724           var token = tokens[pos];
11725           var line = token.ln;
11726           var column = token.col;
11727           var content = [].concat(getCondition(), getSC(), getBlock());
11728
11729           return newNode(type, content, line, column);
11730         }
11731
11732         /**
11733          * Check if token is part of a declaration (property-value pair)
11734          * @param {number} i Token's index number
11735          * @return {number} Length of the declaration
11736          */
11737         function checkDeclaration(i) {
11738           return checkDeclaration1(i) || checkDeclaration2(i);
11739         }
11740
11741         /**
11742          * Get node with a declaration
11743          * @return {Array} `['declaration', ['property', x], ['propertyDelim'],
11744          *       ['value', y]]`
11745          */
11746         function getDeclaration() {
11747           return checkDeclaration1(pos) ? getDeclaration1() : getDeclaration2();
11748         }
11749
11750         /**
11751          * Check if token is part of a declaration (property-value pair)
11752          * @param {number} i Token's index number
11753          * @return {number} Length of the declaration
11754          */
11755         function checkDeclaration1(i) {
11756           var start = i;
11757           var l = void 0;
11758
11759           if (i >= tokensLength) return 0;
11760
11761           if (l = checkProperty(i)) i += l;else return 0;
11762
11763           if (l = checkSC(i)) i += l;
11764
11765           if (l = checkPropertyDelim(i)) i++;else return 0;
11766
11767           if (l = checkValue(i)) return i + l - start;
11768
11769           if (l = checkS(i)) i += l;
11770
11771           if (l = checkValue(i)) i += l;else return 0;
11772
11773           return i - start;
11774         }
11775
11776         /**
11777          * Get node with a declaration
11778          * @return {Array} `['declaration', ['property', x], ['propertyDelim'],
11779          *       ['value', y]]`
11780          */
11781         function getDeclaration1() {
11782           var type = NodeType.DeclarationType;
11783           var token = tokens[pos];
11784           var line = token.ln;
11785           var column = token.col;
11786           var content = [];
11787
11788           content.push(getProperty());
11789           if (checkS(pos)) content.push(getS());
11790           content.push(getPropertyDelim());
11791           if (checkS(pos)) content.push(getS());
11792           content.push(getValue());
11793
11794           return newNode(type, content, line, column);
11795         }
11796
11797         /**
11798          * Check if token is part of a declaration (property-value pair)
11799          * @param {number} i Token's index number
11800          * @return {number} Length of the declaration
11801          */
11802         function checkDeclaration2(i) {
11803           var start = i;
11804           var l = void 0;
11805
11806           if (i >= tokensLength) return 0;
11807
11808           if (l = checkPropertyDelim(i)) i++;else return 0;
11809
11810           if (l = checkProperty(i)) i += l;else return 0;
11811
11812           if (l = checkValue(i)) return i + l - start;
11813
11814           if (l = checkSC(i)) i += l;
11815
11816           if (l = checkValue(i)) i += l;else return 0;
11817
11818           return i - start;
11819         }
11820
11821         /**
11822          * Get node with a declaration
11823          * @return {Array} `['declaration', ['propertyDelim'], ['property', x],
11824          *       ['value', y]]`
11825          */
11826         function getDeclaration2() {
11827           var type = NodeType.DeclarationType;
11828           var token = tokens[pos];
11829           var line = token.ln;
11830           var column = token.col;
11831           var content = [].concat(getPropertyDelim(), getProperty(), getSC(), getValue());
11832
11833           return newNode(type, content, line, column);
11834         }
11835
11836         /**
11837          * @param {number} i Token's index number
11838          * @returns {number} Length of the declaration
11839          */
11840         function checkSingleValueDeclaration(i) {
11841           var start = i;
11842           var l = void 0;
11843
11844           if (i >= tokensLength) return 0;
11845
11846           if (l = checkProperty(i)) i += l;else return 0;
11847
11848           if (l = checkSC(i)) i += l;
11849
11850           if (l = checkPropertyDelim(i)) i++;else return 0;
11851
11852           if (l = checkSC(i)) i += l;
11853
11854           if (l = checkSingleValue(i)) i += l;else return 0;
11855
11856           return i - start;
11857         }
11858
11859         /**
11860          * Get node with a declaration
11861          * @returns {Array} `['declaration', ['property', x], ['propertyDelim'],
11862          *       ['value', y]]`
11863          */
11864         function getSingleValueDeclaration() {
11865           var type = NodeType.DeclarationType;
11866           var token = tokens[pos];
11867           var line = token.ln;
11868           var column = token.col;
11869           var content = [].concat(getProperty(), getSC(), getPropertyDelim(), getSC(), getSingleValue());
11870
11871           return newNode(type, content, line, column);
11872         }
11873
11874         /**
11875          * Check if token is a semicolon
11876          * @param {number} i Token's index number
11877          * @return {number} `1` if token is a semicolon, otherwise `0`
11878          */
11879         function checkDeclDelim(i) {
11880           if (i >= tokensLength) return 0;
11881
11882           return tokens[i].type === TokenType.Newline || tokens[i].type === TokenType.Semicolon ? 1 : 0;
11883         }
11884
11885         /**
11886          * Get node with a semicolon
11887          * @return {Array} `['declDelim']`
11888          */
11889         function getDeclDelim() {
11890           var type = NodeType.DeclDelimType;
11891           var token = tokens[pos];
11892           var line = token.ln;
11893           var column = token.col;
11894           var content = '\n';
11895
11896           pos++;
11897
11898           return newNode(type, content, line, column);
11899         }
11900
11901         /**
11902          * Check if token if part of `!default` word.
11903          * @param {number} i Token's index number
11904          * @return {number} Length of the `!default` word
11905          */
11906         function checkDefault(i) {
11907           var start = i;
11908           var l = void 0;
11909
11910           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
11911
11912           if (l = checkSC(i)) i += l;
11913
11914           if (tokens[i].value === 'default') {
11915             tokens[start].defaultEnd = i;
11916             return i - start + 1;
11917           } else {
11918             return 0;
11919           }
11920         }
11921
11922         /**
11923          * Get node with a `!default` word
11924          * @return {Array} `['default', sc]` where `sc` is optional whitespace
11925          */
11926         function getDefault() {
11927           var type = NodeType.DefaultType;
11928           var token = tokens[pos];
11929           var line = token.ln;
11930           var column = token.col;
11931           var content = joinValues(pos, token.defaultEnd);
11932
11933           pos = token.defaultEnd + 1;
11934
11935           return newNode(type, content, line, column);
11936         }
11937
11938         /**
11939          * Check if token is a comma
11940          * @param {number} i Token's index number
11941          * @return {number} `1` if token is a comma, otherwise `0`
11942          */
11943         function checkDelim(i) {
11944           return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0;
11945         }
11946
11947         /**
11948          * Get node with a comma
11949          * @return {Array} `['delim']`
11950          */
11951         function getDelim() {
11952           var type = NodeType.DelimType;
11953           var token = tokens[pos];
11954           var line = token.ln;
11955           var column = token.col;
11956           var content = ',';
11957
11958           pos++;
11959
11960           return newNode(type, content, line, column);
11961         }
11962
11963         /**
11964          * Check if token is part of a number with dimension unit (e.g. `10px`)
11965          * @param {Number} i Token's index number
11966          * @return {Number}
11967          */
11968         function checkDimension(i) {
11969           var ln = checkNumber(i);
11970           var li = void 0;
11971
11972           if (i >= tokensLength || !ln || i + ln >= tokensLength) return 0;
11973
11974           return (li = checkUnit(i + ln)) ? ln + li : 0;
11975         }
11976
11977         /**
11978          * Get node of a number with dimension unit
11979          * @return {Node}
11980          */
11981         function getDimension() {
11982           var type = NodeType.DimensionType;
11983           var token = tokens[pos];
11984           var line = token.ln;
11985           var column = token.col;
11986           var content = [getNumber(), getUnit()];
11987
11988           return newNode(type, content, line, column);
11989         }
11990
11991         /**
11992          * @param {number} i Token's index number
11993          * @return {number}
11994          */
11995         function checkExpression(i) {
11996           var start = i;
11997
11998           if (i >= tokensLength || tokens[i++].value !== 'expression' || i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) {
11999             return 0;
12000           }
12001
12002           return tokens[i].right - start + 1;
12003         }
12004
12005         /**
12006          * @return {Array}
12007          */
12008         function getExpression() {
12009           var type = NodeType.ExpressionType;
12010           var token = tokens[pos];
12011           var line = token.ln;
12012           var column = token.col;
12013
12014           pos++;
12015
12016           var content = joinValues(pos + 1, tokens[pos].right - 1);
12017           var end = getLastPosition(content, line, column, 1);
12018
12019           if (end[0] === line) end[1] += 11;
12020           pos = tokens[pos].right + 1;
12021
12022           return newNode(type, content, line, column, end);
12023         }
12024
12025         function checkExtend(i) {
12026           if (i >= tokensLength) return 0;
12027
12028           var l = void 0;
12029
12030           if (l = checkExtend1(i)) tokens[i].extend_child = 1;else if (l = checkExtend2(i)) tokens[i].extend_child = 2;
12031
12032           return l;
12033         }
12034
12035         function getExtend() {
12036           var childType = tokens[pos].extend_child;
12037
12038           if (childType === 1) return getExtend1();
12039           if (childType === 2) return getExtend2();
12040         }
12041
12042         /**
12043          * Checks if token is part of an extend with `!optional` flag.
12044          * @param {number} i
12045          */
12046         function checkExtend1(i) {
12047           var start = i;
12048           var l = void 0;
12049
12050           if (i >= tokensLength) return 0;
12051
12052           if (l = checkAtkeyword(i)) i += l;else return 0;
12053
12054           if (tokens[start + 1].value !== 'extend') return 0;
12055
12056           if (l = checkSC(i)) i += l;else return 0;
12057
12058           if (l = checkSelectorsGroup(i)) i += l;else return 0;
12059
12060           if (l = checkSC(i)) i += l;else return 0;
12061
12062           if (l = checkOptional(i)) i += l;else return 0;
12063
12064           return i - start;
12065         }
12066
12067         function getExtend1() {
12068           var type = NodeType.ExtendType;
12069           var token = tokens[pos];
12070           var line = token.ln;
12071           var column = token.col;
12072           var content = [].concat(getAtkeyword(), getSC(), getSelectorsGroup(), getSC(), getOptional());
12073
12074           return newNode(type, content, line, column);
12075         }
12076
12077         /**
12078          * Checks if token is part of an extend without `!optional` flag.
12079          * @param {number} i
12080          */
12081         function checkExtend2(i) {
12082           var start = i;
12083           var l = void 0;
12084
12085           if (i >= tokensLength) return 0;
12086
12087           if (l = checkAtkeyword(i)) i += l;else return 0;
12088
12089           if (tokens[start + 1].value !== 'extend') return 0;
12090
12091           if (l = checkSC(i)) i += l;else return 0;
12092
12093           if (l = checkSelectorsGroup(i)) i += l;else return 0;
12094
12095           return i - start;
12096         }
12097
12098         function getExtend2() {
12099           var type = NodeType.ExtendType;
12100           var token = tokens[pos];
12101           var line = token.ln;
12102           var column = token.col;
12103           var content = [].concat(getAtkeyword(), getSC(), getSelectorsGroup());
12104
12105           return newNode(type, content, line, column);
12106         }
12107
12108         /**
12109          * @param {number} i Token's index number
12110          * @return {number}
12111          */
12112         function checkFunction(i) {
12113           var start = i;
12114           var l = void 0;
12115
12116           if (i >= tokensLength) return 0;
12117
12118           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12119
12120           return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? tokens[i].right - start + 1 : 0;
12121         }
12122
12123         /**
12124          * @return {Array}
12125          */
12126         function getFunction() {
12127           var type = NodeType.FunctionType;
12128           var token = tokens[pos];
12129           var line = token.ln;
12130           var column = token.col;
12131           var content = [].concat(getIdentOrInterpolation(), getArguments());
12132
12133           return newNode(type, content, line, column);
12134         }
12135
12136         /**
12137          * Check if token is part of a functions list (e.g. `function(value)...`).
12138          * @param {Number} i Token's index number
12139          * @returns {Number}
12140          */
12141         function checkFunctionsList(i) {
12142           var d = 0; // Number of dots
12143           var l = void 0;
12144
12145           if (i >= tokensLength) return 0;
12146
12147           if (l = checkFunction(i)) i += l;else return 0;
12148
12149           while (i < tokensLength && tokens[i].type === TokenType.FullStop) {
12150             d++;
12151             i++;
12152           }
12153
12154           return d === 3 ? l + d : 0;
12155         }
12156
12157         /**
12158          * Get node with a functions list
12159          * @returns {Array}
12160          */
12161         function getFunctionsList() {
12162           var type = NodeType.FunctionsListType;
12163           var token = tokens[pos];
12164           var line = token.ln;
12165           var column = token.col;
12166           var content = [getFunction()];
12167           var end = getLastPosition(content, line, column, 3);
12168
12169           // Skip `...`.
12170           pos += 3;
12171
12172           return newNode(type, content, line, column, end);
12173         }
12174
12175         /**
12176          * Check if token is part of `!global` word
12177          * @param {number} i Token's index number
12178          * @return {number}
12179          */
12180         function checkGlobal(i) {
12181           var start = i;
12182           var l = void 0;
12183
12184           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
12185
12186           if (l = checkSC(i)) i += l;
12187
12188           if (tokens[i].value === 'global') {
12189             tokens[start].globalEnd = i;
12190             return i - start + 1;
12191           } else {
12192             return 0;
12193           }
12194         }
12195
12196         /**
12197          * Get node with `!global` word
12198          */
12199         function getGlobal() {
12200           var type = NodeType.GlobalType;
12201           var token = tokens[pos];
12202           var line = token.ln;
12203           var column = token.col;
12204           var content = joinValues(pos, token.globalEnd);
12205
12206           pos = token.globalEnd + 1;
12207
12208           return newNode(type, content, line, column);
12209         }
12210
12211         /**
12212          * Check if token is part of an identifier
12213          * @param {number} i Token's index number
12214          * @return {number} Length of the identifier
12215          */
12216         function checkIdent(i) {
12217           var start = i;
12218
12219           if (i >= tokensLength) return 0;
12220
12221           // Check if token is part of a negative number
12222           if (tokens[i].type === TokenType.HyphenMinus && tokens[i + 1].type === TokenType.DecimalNumber) return 0;
12223
12224           if (tokens[i].type === TokenType.HyphenMinus) i++;
12225
12226           if (checkInterpolation(i)) {
12227             tokens[start].ident_last = i - 1;
12228             return i - start;
12229           }
12230
12231           if (tokens[i].type === TokenType.LowLine || tokens[i].type === TokenType.Identifier) i++;else return 0;
12232
12233           for (; i < tokensLength; i++) {
12234             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
12235           }
12236
12237           tokens[start].ident_last = i - 1;
12238
12239           return i - start;
12240         }
12241
12242         /**
12243          * Get node with an identifier
12244          * @return {Array} `['ident', x]` where `x` is identifier's name
12245          */
12246         function getIdent() {
12247           var type = NodeType.IdentType;
12248           var token = tokens[pos];
12249           var line = token.ln;
12250           var column = token.col;
12251           var content = joinValues(pos, tokens[pos].ident_last);
12252
12253           pos = tokens[pos].ident_last + 1;
12254
12255           return newNode(type, content, line, column);
12256         }
12257
12258         /**
12259          * @param {number} i Token's index number
12260          * @returns {number} Length of the identifier
12261          */
12262         function checkPartialIdent(i) {
12263           var start = i;
12264
12265           if (i >= tokensLength) return 0;
12266
12267           for (; i < tokensLength; i++) {
12268             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
12269           }
12270
12271           tokens[start].ident_last = i - 1;
12272
12273           return i - start;
12274         }
12275
12276         /**
12277          * @param {number} i Token's index number
12278          * @returns {number} Length of the identifier
12279          */
12280         function checkIdentOrInterpolation(i) {
12281           var start = i;
12282           var l = void 0;
12283           var prevIsInterpolation = false;
12284
12285           while (i < tokensLength) {
12286             if (l = checkInterpolation(i)) {
12287               tokens[i].ii_type = 1;
12288               i += l;
12289               prevIsInterpolation = true;
12290             } else if (l = checkIdent(i)) {
12291               tokens[i].ii_type = 2;
12292               i += l;
12293               prevIsInterpolation = false;
12294             } else if (prevIsInterpolation && (l = checkPartialIdent(i))) {
12295               tokens[i].ii_type = 3;
12296               i += l;
12297               prevIsInterpolation = false;
12298             } else break;
12299           }
12300
12301           return i - start;
12302         }
12303
12304         function getIdentOrInterpolation() {
12305           var content = [];
12306
12307           while (pos < tokensLength) {
12308             var tokenType = tokens[pos].ii_type;
12309
12310             if (tokenType === 1) {
12311               content.push(getInterpolation());
12312             } else if (tokenType === 2 || tokenType === 3) {
12313               content.push(getIdent());
12314             } else break;
12315           }
12316
12317           return content;
12318         }
12319
12320         /**
12321          * Check if token is part of `!important` word
12322          * @param {number} i Token's index number
12323          * @return {number}
12324          */
12325         function checkImportant(i) {
12326           var start = i;
12327           var l = void 0;
12328
12329           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
12330
12331           if (l = checkSC(i)) i += l;
12332
12333           if (tokens[i].value === 'important') {
12334             tokens[start].importantEnd = i;
12335             return i - start + 1;
12336           } else {
12337             return 0;
12338           }
12339         }
12340
12341         /**
12342          * Get node with `!important` word
12343          * @return {Array} `['important', sc]` where `sc` is optional whitespace
12344          */
12345         function getImportant() {
12346           var type = NodeType.ImportantType;
12347           var token = tokens[pos];
12348           var line = token.ln;
12349           var column = token.col;
12350           var content = joinValues(pos, token.importantEnd);
12351
12352           pos = token.importantEnd + 1;
12353
12354           return newNode(type, content, line, column);
12355         }
12356
12357         /**
12358          * Check if token is part of an included mixin (`@include` or `@extend`
12359          *      directive).
12360          * @param {number} i Token's index number
12361          * @return {number} Length of the included mixin
12362          */
12363         function checkInclude(i) {
12364           var l = void 0;
12365
12366           if (i >= tokensLength) return 0;
12367
12368           if (l = checkIncludeWithKeyframes1(i)) tokens[i].include_type = 9;else if (l = checkInclude1(i)) tokens[i].include_type = 1;else if (l = checkInclude2(i)) tokens[i].include_type = 2;else if (l = checkInclude3(i)) tokens[i].include_type = 3;else if (l = checkInclude4(i)) tokens[i].include_type = 4;else if (l = checkIncludeWithKeyframes2(i)) tokens[i].include_type = 10;else if (l = checkInclude5(i)) tokens[i].include_type = 5;else if (l = checkInclude6(i)) tokens[i].include_type = 6;else if (l = checkInclude7(i)) tokens[i].include_type = 7;else if (l = checkInclude8(i)) tokens[i].include_type = 8;
12369
12370           return l;
12371         }
12372
12373         /**
12374          * Get node with included mixin
12375          * @return {Array} `['include', x]`
12376          */
12377         function getInclude() {
12378           var type = tokens[pos].include_type;
12379
12380           if (type === 1) return getInclude1();
12381           if (type === 2) return getInclude2();
12382           if (type === 3) return getInclude3();
12383           if (type === 4) return getInclude4();
12384           if (type === 5) return getInclude5();
12385           if (type === 6) return getInclude6();
12386           if (type === 7) return getInclude7();
12387           if (type === 8) return getInclude8();
12388           if (type === 9) return getIncludeWithKeyframes1();
12389           if (type === 10) return getIncludeWithKeyframes2();
12390         }
12391
12392         /**
12393          * Check if token is part of an included mixin like `@include nani(foo) {...}`
12394          * @param {number} i Token's index number
12395          * @return {number} Length of the include
12396          */
12397         function checkInclude1(i) {
12398           var start = i;
12399           var l = void 0;
12400
12401           if (l = checkAtkeyword(i)) i += l;else return 0;
12402
12403           if (tokens[start + 1].value !== 'include') return 0;
12404
12405           if (l = checkSC(i)) i += l;else return 0;
12406
12407           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12408
12409           if (l = checkSC(i)) i += l;
12410
12411           if (l = checkArguments(i)) i += l;else return 0;
12412
12413           if (l = checkSC(i)) i += l;
12414
12415           if (l = checkBlock(i)) i += l;else return 0;
12416
12417           return i - start;
12418         }
12419
12420         /**
12421          * Get node with included mixin like `@include nani(foo) {...}`
12422          * @return {Array} `['include', ['atkeyword', x], sc, ['selector', y], sc,
12423          *      ['arguments', z], sc, ['block', q], sc` where `x` is `include` or
12424          *      `extend`, `y` is mixin's identifier (selector), `z` are arguments
12425          *      passed to the mixin, `q` is block passed to the mixin and `sc`
12426          *      are optional whitespaces
12427          */
12428         function getInclude1() {
12429           var type = NodeType.IncludeType;
12430           var token = tokens[pos];
12431           var line = token.ln;
12432           var column = token.col;
12433           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getArguments(), getSC(), getBlock());
12434
12435           return newNode(type, content, line, column);
12436         }
12437
12438         /**
12439          * Check if token is part of an included mixin like `@include nani(foo)`
12440          * @param {number} i Token's index number
12441          * @return {number} Length of the include
12442          */
12443         function checkInclude2(i) {
12444           var start = i;
12445           var l = void 0;
12446
12447           if (l = checkAtkeyword(i)) i += l;else return 0;
12448
12449           if (tokens[start + 1].value !== 'include') return 0;
12450
12451           if (l = checkSC(i)) i += l;else return 0;
12452
12453           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12454
12455           if (l = checkSC(i)) i += l;
12456
12457           if (l = checkArguments(i)) i += l;else return 0;
12458
12459           return i - start;
12460         }
12461
12462         /**
12463          * Get node with included mixin like `@include nani(foo)`
12464          * @return {Array} `['include', ['atkeyword', x], sc, ['selector', y], sc,
12465          *      ['arguments', z], sc]` where `x` is `include` or `extend`, `y` is
12466          *      mixin's identifier (selector), `z` are arguments passed to the
12467          *      mixin and `sc` are optional whitespaces
12468          */
12469         function getInclude2() {
12470           var type = NodeType.IncludeType;
12471           var token = tokens[pos];
12472           var line = token.ln;
12473           var column = token.col;
12474           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getArguments());
12475
12476           return newNode(type, content, line, column);
12477         }
12478
12479         /**
12480          * Check if token is part of an included mixin with a content block passed
12481          *      as an argument (e.g. `@include nani {...}`)
12482          * @param {number} i Token's index number
12483          * @return {number} Length of the mixin
12484          */
12485         function checkInclude3(i) {
12486           var start = i;
12487           var l = void 0;
12488
12489           if (l = checkAtkeyword(i)) i += l;else return 0;
12490
12491           if (tokens[start + 1].value !== 'include') return 0;
12492
12493           if (l = checkSC(i)) i += l;else return 0;
12494
12495           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12496
12497           if (l = checkSC(i)) i += l;
12498
12499           if (l = checkBlock(i)) i += l;else return 0;
12500
12501           return i - start;
12502         }
12503
12504         /**
12505          * Get node with an included mixin with a content block passed
12506          *      as an argument (e.g. `@include nani {...}`)
12507          * @return {Array} `['include', x]`
12508          */
12509         function getInclude3() {
12510           var type = NodeType.IncludeType;
12511           var token = tokens[pos];
12512           var line = token.ln;
12513           var column = token.col;
12514           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getBlock());
12515
12516           return newNode(type, content, line, column);
12517         }
12518
12519         /**
12520          * @param {number} i Token's index number
12521          * @return {number}
12522          */
12523         function checkInclude4(i) {
12524           var start = i;
12525           var l = void 0;
12526
12527           if (l = checkAtkeyword(i)) i += l;else return 0;
12528
12529           if (tokens[start + 1].value !== 'include') return 0;
12530
12531           if (l = checkSC(i)) i += l;else return 0;
12532
12533           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12534
12535           return i - start;
12536         }
12537
12538         /**
12539          * @return {Array} `['include', x]`
12540          */
12541         function getInclude4() {
12542           var type = NodeType.IncludeType;
12543           var token = tokens[pos];
12544           var line = token.ln;
12545           var column = token.col;
12546           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation());
12547
12548           return newNode(type, content, line, column);
12549         }
12550
12551         /**
12552          * Check if token is part of an included mixin like `+nani(foo) {...}`
12553          * @param {number} i Token's index number
12554          * @return {number} Length of the include
12555          */
12556         function checkInclude5(i) {
12557           var start = i;
12558           var l = void 0;
12559
12560           if (tokens[i].type === TokenType.PlusSign) i++;else return 0;
12561
12562           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12563
12564           if (l = checkSC(i)) i += l;
12565
12566           if (l = checkArguments(i)) i += l;else return 0;
12567
12568           if (l = checkSC(i)) i += l;
12569
12570           if (l = checkBlock(i)) i += l;else return 0;
12571
12572           return i - start;
12573         }
12574
12575         /**
12576          * Get node with included mixin like `+nani(foo) {...}`
12577          * @return {Array} `['include', ['operator', '+'], ['selector', x], sc,
12578          *      ['arguments', y], sc, ['block', z], sc` where `x` is
12579          *      mixin's identifier (selector), `y` are arguments passed to the
12580          *      mixin, `z` is block passed to mixin and `sc` are optional whitespaces
12581          */
12582         function getInclude5() {
12583           var type = NodeType.IncludeType;
12584           var token = tokens[pos];
12585           var line = token.ln;
12586           var column = token.col;
12587           var content = [].concat(getOperator(), getIdentOrInterpolation(), getSC(), getArguments(), getSC(), getBlock());
12588
12589           return newNode(type, content, line, column);
12590         }
12591
12592         /**
12593          * Check if token is part of an included mixin like `+nani(foo)`
12594          * @param {number} i Token's index number
12595          * @return {number} Length of the include
12596          */
12597         function checkInclude6(i) {
12598           var start = i;
12599           var l = void 0;
12600
12601           if (tokens[i].type === TokenType.PlusSign) i++;else return 0;
12602
12603           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12604
12605           if (l = checkSC(i)) i += l;
12606
12607           if (l = checkArguments(i)) i += l;else return 0;
12608
12609           return i - start;
12610         }
12611
12612         /**
12613          * Get node with included mixin like `+nani(foo)`
12614          * @return {Array} `['include', ['operator', '+'], ['selector', y], sc,
12615          *      ['arguments', z], sc]` where `y` is
12616          *      mixin's identifier (selector), `z` are arguments passed to the
12617          *      mixin and `sc` are optional whitespaces
12618          */
12619         function getInclude6() {
12620           var type = NodeType.IncludeType;
12621           var token = tokens[pos];
12622           var line = token.ln;
12623           var column = token.col;
12624           var content = [].concat(getOperator(), getIdentOrInterpolation(), getSC(), getArguments());
12625
12626           return newNode(type, content, line, column);
12627         }
12628
12629         /**
12630          * Check if token is part of an included mixin with a content block passed
12631          *      as an argument (e.g. `+nani {...}`)
12632          * @param {number} i Token's index number
12633          * @return {number} Length of the mixin
12634          */
12635         function checkInclude7(i) {
12636           var start = i;
12637           var l = void 0;
12638
12639           if (tokens[i].type === TokenType.PlusSign) i++;else return 0;
12640
12641           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12642
12643           if (l = checkSC(i)) i += l;
12644
12645           if (l = checkBlock(i)) i += l;else return 0;
12646
12647           return i - start;
12648         }
12649
12650         /**
12651          * Get node with an included mixin with a content block passed
12652          *      as an argument (e.g. `+nani {...}`)
12653          * @return {Array} `['include', x]`
12654          */
12655         function getInclude7() {
12656           var type = NodeType.IncludeType;
12657           var token = tokens[pos];
12658           var line = token.ln;
12659           var column = token.col;
12660           var content = [].concat(getOperator(), getIdentOrInterpolation(), getSC(), getBlock());
12661
12662           return newNode(type, content, line, column);
12663         }
12664
12665         /**
12666          * @param {number} i Token's index number
12667          * @return {number}
12668          */
12669         function checkInclude8(i) {
12670           var start = i;
12671           var l = void 0;
12672
12673           if (tokens[i].type === TokenType.PlusSign) i++;else return 0;
12674
12675           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12676
12677           return i - start;
12678         }
12679
12680         /**
12681          * @return {Array} `['include', x]`
12682          */
12683         function getInclude8() {
12684           var type = NodeType.IncludeType;
12685           var token = tokens[pos];
12686           var line = token.ln;
12687           var column = token.col;
12688           var content = [].concat(getOperator(), getIdentOrInterpolation());
12689
12690           return newNode(type, content, line, column);
12691         }
12692
12693         /**
12694          * Get node with included mixin with keyfames selector like
12695          * `@include nani(foo) { 0% {}}`
12696          * @param {number} i Token's index number
12697          * @returns {number} Length of the include
12698          */
12699         function checkIncludeWithKeyframes1(i) {
12700           var start = i;
12701           var l = void 0;
12702
12703           if (l = checkAtkeyword(i)) i += l;else return 0;
12704
12705           if (tokens[start + 1].value !== 'include') return 0;
12706
12707           if (l = checkSC(i)) i += l;else return 0;
12708
12709           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12710
12711           if (l = checkSC(i)) i += l;
12712
12713           if (l = checkArguments(i)) i += l;else return 0;
12714
12715           if (l = checkSC(i)) i += l;
12716
12717           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
12718
12719           return i - start;
12720         }
12721
12722         /**
12723          * Get node with included mixin with keyfames selector like
12724          * `@include nani(foo) { 0% {}}`
12725          * @return {!Node}
12726          */
12727         function getIncludeWithKeyframes1() {
12728           var type = NodeType.IncludeType;
12729           var token = tokens[pos];
12730           var line = token.ln;
12731           var column = token.col;
12732           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getArguments(), getSC(), getKeyframesBlocks());
12733
12734           return newNode(type, content, line, column);
12735         }
12736
12737         /**
12738          * Get node with included mixin with keyfames selector like
12739          * `+nani(foo) { 0% {}}`
12740          * @param {number} i Token's index number
12741          * @returns {number} Length of the include
12742          */
12743         function checkIncludeWithKeyframes2(i) {
12744           var start = i;
12745           var l = void 0;
12746
12747           if (tokens[i].type === TokenType.PlusSign) i++;else return 0;
12748
12749           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
12750
12751           if (l = checkSC(i)) i += l;
12752
12753           if (l = checkArguments(i)) i += l;else return 0;
12754
12755           if (l = checkSC(i)) i += l;
12756
12757           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
12758
12759           return i - start;
12760         }
12761
12762         /**
12763          * Get node with included mixin with keyfames selector like
12764          * `+nani(foo) { 0% {}}`
12765          * @return {!Node}
12766          */
12767         function getIncludeWithKeyframes2() {
12768           var type = NodeType.IncludeType;
12769           var token = tokens[pos];
12770           var line = token.ln;
12771           var column = token.col;
12772           var content = [].concat(getOperator(), getIdentOrInterpolation(), getSC(), getArguments(), getSC(), getKeyframesBlocks());
12773
12774           return newNode(type, content, line, column);
12775         }
12776
12777         /**
12778          * Check if token is part of an interpolated variable (e.g. `#{$nani}`).
12779          * @param {number} i Token's index number
12780          * @return {number}
12781          */
12782         function checkInterpolation(i) {
12783           var start = i;
12784           var l = void 0;
12785
12786           if (i >= tokensLength) return 0;
12787
12788           if (tokens[i].type !== TokenType.NumberSign || !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket) return 0;
12789
12790           i += 2;
12791
12792           while (tokens[i].type !== TokenType.RightCurlyBracket) {
12793             if (l = checkArgument(i)) i += l;else return 0;
12794           }
12795
12796           return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0;
12797         }
12798
12799         /**
12800          * Get node with an interpolated variable
12801          * @return {Array} `['interpolation', x]`
12802          */
12803         function getInterpolation() {
12804           var type = NodeType.InterpolationType;
12805           var token = tokens[pos];
12806           var line = token.ln;
12807           var column = token.col;
12808           var content = [];
12809
12810           // Skip `#{`:
12811           pos += 2;
12812
12813           while (pos < tokensLength && tokens[pos].type !== TokenType.RightCurlyBracket) {
12814             var body = getArgument();
12815             if (typeof body.content === 'string') content.push(body);else content = content.concat(body);
12816           }
12817
12818           var end = getLastPosition(content, line, column, 1);
12819
12820           // Skip `}`:
12821           pos++;
12822
12823           return newNode(type, content, line, column, end);
12824         }
12825
12826         /**
12827          * Check a single keyframe block - `5% {}`
12828          * @param {number} i
12829          * @return {number}
12830          */
12831         function checkKeyframesBlock(i) {
12832           var start = i;
12833           var l = void 0;
12834
12835           if (i >= tokensLength) return 0;
12836
12837           if (l = checkKeyframesSelectorsGroup(i)) i += l;else return 0;
12838
12839           if (l = checkSC(i)) i += l;
12840
12841           if (l = checkBlock(i)) i += l;else return 0;
12842
12843           return i - start;
12844         }
12845
12846         /**
12847          * Get a single keyframe block - `5% {}`
12848          * @return {Node}
12849          */
12850         function getKeyframesBlock() {
12851           var type = NodeType.RulesetType;
12852           var token = tokens[pos];
12853           var line = token.ln;
12854           var column = token.col;
12855           var content = [].concat(getKeyframesSelectorsGroup(), getSC(), getBlock());
12856
12857           return newNode(type, content, line, column);
12858         }
12859
12860         /**
12861          * Check all keyframe blocks - `5% {} 100% {}`
12862          * @param {number} i
12863          * @return {number}
12864          */
12865         function checkKeyframesBlocks(i) {
12866           if (i >= tokensLength) return 0;
12867
12868           var blockEnd = tokens[i].block_end;
12869           var start = i;
12870           var l = void 0;
12871
12872           if (!blockEnd) return 0;
12873
12874           if (l = checkSC(i)) i += l;
12875
12876           if (l = checkKeyframesBlock(i)) i += l;
12877
12878           while (i < blockEnd) {
12879             if (l = checkSC(i)) i += l;else if (l = checkKeyframesBlock(i)) i += l;else if (l = checkAtrule(i)) i += l;else break;
12880           }
12881
12882           if (i !== blockEnd + 1) return 0;
12883
12884           return blockEnd + 1 - start;
12885         }
12886
12887         /**
12888          * Get all keyframe blocks - `5% {} 100% {}`
12889          * @return {Node}
12890          */
12891         function getKeyframesBlocks() {
12892           var type = NodeType.BlockType;
12893           var token = tokens[pos];
12894           var line = token.ln;
12895           var column = token.col;
12896           var keyframesBlocksEnd = token.block_end;
12897           var content = [];
12898
12899           while (pos < keyframesBlocksEnd) {
12900             if (checkSC(pos)) content = content.concat(getSC());else if (checkKeyframesBlock(pos)) content.push(getKeyframesBlock());else if (checkAtrule(pos)) content.push(getAtrule()); // @content
12901             else break;
12902           }
12903
12904           return newNode(type, content, line, column);
12905         }
12906
12907         /**
12908          * Check if token is part of a @keyframes rule.
12909          * @param {number} i Token's index number
12910          * @return {number} Length of the @keyframes rule
12911          */
12912         function checkKeyframesRule(i) {
12913           var start = i;
12914           var l = void 0;
12915
12916           if (i >= tokensLength) return 0;
12917
12918           if (l = checkAtkeyword(i)) i += l;else return 0;
12919
12920           var atruleName = joinValues2(i - l, l);
12921           if (atruleName.toLowerCase().indexOf('keyframes') === -1) return 0;
12922
12923           if (l = checkSC(i)) i += l;else return 0;
12924
12925           if (l = checkIdentOrInterpolation(i) || checkPseudoc(i)) i += l;else return 0;
12926
12927           if (l = checkSC(i)) i += l;
12928
12929           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
12930
12931           return i - start;
12932         }
12933
12934         /**
12935          * @return {Node}
12936          */
12937         function getKeyframesRule() {
12938           var type = NodeType.AtruleType;
12939           var token = tokens[pos];
12940           var line = token.ln;
12941           var column = token.col;
12942           var content = [].concat(getAtkeyword(), getSC());
12943
12944           if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());else if (checkPseudoc(pos)) {
12945             content = content.concat(getPseudoc());
12946           }
12947
12948           content = content.concat(getSC(), getKeyframesBlocks());
12949
12950           return newNode(type, content, line, column);
12951         }
12952
12953         /**
12954          * Check a single keyframe selector - `5%`, `from` etc
12955          * @param {Number} i
12956          * @return {Number}
12957          */
12958         function checkKeyframesSelector(i) {
12959           var start = i;
12960           var l = void 0;
12961
12962           if (i >= tokensLength) return 0;
12963
12964           if (l = checkIdent(i)) {
12965             // Valid selectors are only `from` and `to`.
12966             var selector = joinValues2(i, l);
12967             if (selector !== 'from' && selector !== 'to') return 0;
12968
12969             i += l;
12970             tokens[start].keyframesSelectorType = 1;
12971           } else if (l = checkPercentage(i)) {
12972             i += l;
12973             tokens[start].keyframesSelectorType = 2;
12974           } else if (l = checkInterpolation(i)) {
12975             i += l;
12976             tokens[start].keyframesSelectorType = 3;
12977           } else {
12978             return 0;
12979           }
12980
12981           return i - start;
12982         }
12983
12984         /**
12985          * Get a single keyframe selector
12986          * @return {Node}
12987          */
12988         function getKeyframesSelector() {
12989           var keyframesSelectorType = NodeType.KeyframesSelectorType;
12990           var selectorType = NodeType.SelectorType;
12991           var token = tokens[pos];
12992           var line = token.ln;
12993           var column = token.col;
12994           var content = [];
12995
12996           if (token.keyframesSelectorType === 1) {
12997             content.push(getIdent());
12998           } else if (token.keyframesSelectorType === 2) {
12999             content.push(getPercentage());
13000           } else if (token.keyframesSelectorType === 3) {
13001             content.push(getInterpolation());
13002           }
13003
13004           var keyframesSelector = newNode(keyframesSelectorType, content, line, column);
13005
13006           return newNode(selectorType, [keyframesSelector], line, column);
13007         }
13008
13009         /**
13010          * Check the keyframe's selector groups
13011          * @param {number} i
13012          * @return {number}
13013          */
13014         function checkKeyframesSelectorsGroup(i) {
13015           var start = i;
13016           var l = void 0;
13017
13018           if (l = checkKeyframesSelector(i)) i += l;else return 0;
13019
13020           // Check for trailing space
13021           if (l = checkSC(i) && tokens[i].type !== TokenType.Newline) i += l;
13022
13023           while (i < tokensLength) {
13024             var tempStart = i;
13025             var tempIndex = i;
13026             var tempLength = void 0;
13027
13028             if (tempLength = checkDelim(tempIndex)) tempIndex += tempLength;else break;
13029
13030             // Check for maxmimum space usage - 'space', '\n', 'space'
13031             if (tempLength = checkSC(tempIndex)) tempIndex += tempLength;
13032             if (tempLength = checkSC(tempIndex)) tempIndex += tempLength;
13033             if (tempLength = checkSC(tempIndex)) tempIndex += tempLength;
13034
13035             if (tempLength = checkKeyframesSelector(tempIndex)) tempIndex += tempLength;else break;
13036
13037             // Check for trailing space
13038             if (tempLength = checkSC(tempIndex) && tokens[tempIndex].type !== TokenType.Newline) {
13039               tempIndex += tempLength;
13040             }
13041
13042             i += tempIndex - tempStart;
13043           }
13044
13045           tokens[start].selectorsGroupEnd = i;
13046
13047           return i - start;
13048         }
13049
13050         /**
13051          * Get the keyframe's selector groups
13052          * @return {Array} An array of keyframe selectors
13053          */
13054         function getKeyframesSelectorsGroup() {
13055           var selectorsGroup = [];
13056           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
13057
13058           selectorsGroup.push(getKeyframesSelector());
13059
13060           if (checkSC(pos) && tokens[pos].type !== TokenType.Newline) {
13061             selectorsGroup = selectorsGroup.concat(getSC());
13062           }
13063
13064           while (pos < selectorsGroupEnd) {
13065             selectorsGroup = selectorsGroup.concat(getDelim(), getSC(), getSC(), getSC(), getKeyframesSelector());
13066
13067             if (checkSC(pos) && tokens[pos].type !== TokenType.Newline) {
13068               selectorsGroup = selectorsGroup.concat(getSC());
13069             }
13070           }
13071
13072           return selectorsGroup;
13073         }
13074
13075         /**
13076          * Check if token is part of a loop.
13077          * @param {number} i Token's index number
13078          * @return {number} Length of the loop
13079          */
13080         function checkLoop(i) {
13081           var start = i;
13082           var l = void 0;
13083
13084           if (i >= tokensLength) return 0;
13085
13086           if (l = checkAtkeyword(i)) i += l;else return 0;
13087
13088           if (['for', 'each', 'while'].indexOf(tokens[start + 1].value) < 0) return 0;
13089
13090           while (i < tokensLength) {
13091             if (l = checkBlock(i)) {
13092               i += l;
13093               break;
13094             } else if (l = checkVariable(i) || checkNumber(i) || checkInterpolation(i) || checkIdent(i) || checkSC(i) || checkOperator(i) || checkCombinator(i) || checkString(i)) i += l;else return 0;
13095           }
13096
13097           return i - start;
13098         }
13099
13100         /**
13101          * Get node with a loop.
13102          * @return {Array} `['loop', x]`
13103          */
13104         function getLoop() {
13105           var type = NodeType.LoopType;
13106           var token = tokens[pos];
13107           var line = token.ln;
13108           var column = token.col;
13109           var content = [];
13110
13111           content.push(getAtkeyword());
13112
13113           while (pos < tokensLength) {
13114             if (checkBlock(pos)) {
13115               content.push(getBlock());
13116               break;
13117             } else if (checkVariable(pos)) content.push(getVariable());else if (checkNumber(pos)) content.push(getNumber());else if (checkInterpolation(pos)) content.push(getInterpolation());else if (checkIdent(pos)) content.push(getIdent());else if (checkOperator(pos)) content.push(getOperator());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkSC(pos)) content = content.concat(getSC());else if (checkString(pos)) content.push(getString());
13118           }
13119
13120           return newNode(type, content, line, column);
13121         }
13122
13123         /**
13124          * Check if token is part of a mixin
13125          * @param {number} i Token's index number
13126          * @return {number} Length of the mixin
13127          */
13128         function checkMixin(i) {
13129           return checkMixin1(i) || checkMixin2(i);
13130         }
13131
13132         /**
13133          * Get node with a mixin
13134          * @return {Array} `['mixin', x]`
13135          */
13136         function getMixin() {
13137           return checkMixin1(pos) ? getMixin1() : getMixin2();
13138         }
13139
13140         /**
13141          * Check if token is part of a mixin
13142          * @param {number} i Token's index number
13143          * @return {number} Length of the mixin
13144          */
13145         function checkMixin1(i) {
13146           var start = i;
13147           var l = void 0;
13148
13149           if (i >= tokensLength) return 0;
13150
13151           if ((l = checkAtkeyword(i)) && tokens[i + 1].value === 'mixin') i += l;else return 0;
13152
13153           if (l = checkSC(i)) i += l;
13154
13155           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
13156
13157           if (l = checkSC(i)) i += l;
13158
13159           if (l = checkBlock(i)) i += l;else {
13160             if (l = checkArguments(i)) i += l;
13161
13162             if (l = checkSC(i)) i += l;
13163
13164             if (l = checkBlock(i)) i += l;else return 0;
13165           }
13166
13167           return i - start;
13168         }
13169
13170         /**
13171          * Get node with a mixin
13172          * @return {Array} `['mixin', x]`
13173          */
13174         function getMixin1() {
13175           var type = NodeType.MixinType;
13176           var token = tokens[pos];
13177           var line = token.ln;
13178           var column = token.col;
13179           var content = [].concat(getAtkeyword(), getSC());
13180
13181           if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());
13182
13183           content = content.concat(getSC());
13184
13185           if (checkBlock(pos)) content.push(getBlock());else {
13186             if (checkArguments(pos)) content.push(getArguments());
13187
13188             content = content.concat(getSC());
13189
13190             content.push(getBlock());
13191           }
13192
13193           return newNode(type, content, line, column);
13194         }
13195
13196         /**
13197          * Check if token is part of a mixin
13198          * @param {number} i Token's index number
13199          * @return {number} Length of the mixin
13200          */
13201         function checkMixin2(i) {
13202           var start = i;
13203           var l = void 0;
13204
13205           if (i >= tokensLength) return 0;
13206
13207           if (tokens[i].type === TokenType.EqualsSign) i++;else return 0;
13208
13209           if (l = checkSC(i)) i += l;
13210
13211           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
13212
13213           if (l = checkSC(i)) i += l;
13214
13215           if (l = checkBlock(i)) i += l;else {
13216             if (l = checkArguments(i)) i += l;
13217
13218             if (l = checkSC(i)) i += l;
13219
13220             if (l = checkBlock(i)) i += l;else return 0;
13221           }
13222
13223           return i - start;
13224         }
13225
13226         /**
13227         * Get node with a mixin
13228         * @return {Array} `['mixin', x]`
13229         */
13230         function getMixin2() {
13231           var type = NodeType.MixinType;
13232           var token = tokens[pos];
13233           var line = token.ln;
13234           var column = token.col;
13235           var content = [].concat(getOperator(), getSC());
13236
13237           if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());
13238
13239           content = content.concat(getSC());
13240
13241           if (checkBlock(pos)) content.push(getBlock());else {
13242             if (checkArguments(pos)) content.push(getArguments());
13243
13244             content = content.concat(getSC());
13245
13246             content.push(getBlock());
13247           }
13248
13249           return newNode(type, content, line, column);
13250         }
13251
13252         /**
13253          * Check if token is a namespace sign (`|`)
13254          * @param {number} i Token's index number
13255          * @return {number} `1` if token is `|`, `0` if not
13256          */
13257         function checkNamespace(i) {
13258           return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0;
13259         }
13260
13261         /**
13262          * Get node with a namespace sign
13263          * @return {Array} `['namespace']`
13264          */
13265         function getNamespace() {
13266           var type = NodeType.NamespaceType;
13267           var token = tokens[pos];
13268           var line = token.ln;
13269           var column = token.col;
13270           var content = '|';
13271
13272           pos++;
13273
13274           return newNode(type, content, line, column);
13275         }
13276
13277         /**
13278          * @param {number} i Token's index number
13279          * @return {number}
13280          */
13281         function checkNmName2(i) {
13282           if (tokens[i].type === TokenType.Identifier) return 1;else if (tokens[i].type !== TokenType.DecimalNumber) return 0;
13283
13284           i++;
13285
13286           return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1;
13287         }
13288
13289         /**
13290          * @return {string}
13291          */
13292         function getNmName2() {
13293           var s = tokens[pos].value;
13294
13295           if (tokens[pos++].type === TokenType.DecimalNumber && pos < tokensLength && tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value;
13296
13297           return s;
13298         }
13299
13300         /**
13301          * Check if token is part of a number
13302          * @param {number} i Token's index number
13303          * @return {number} Length of number
13304          */
13305         function checkNumber(i) {
13306           if (i >= tokensLength) return 0;
13307
13308           if (tokens[i].number_l) return tokens[i].number_l;
13309
13310           // `10`:
13311           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && (!tokens[i + 1] || tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop)) {
13312             tokens[i].number_l = 1;
13313             return 1;
13314           }
13315
13316           // `10.`:
13317           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && (!tokens[i + 2] || tokens[i + 2].type !== TokenType.DecimalNumber)) {
13318             tokens[i].number_l = 2;
13319             return 2;
13320           }
13321
13322           // `.10`:
13323           if (i < tokensLength && tokens[i].type === TokenType.FullStop && tokens[i + 1].type === TokenType.DecimalNumber) {
13324             tokens[i].number_l = 2;
13325             return 2;
13326           }
13327
13328           // `10.10`:
13329           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) {
13330             tokens[i].number_l = 3;
13331             return 3;
13332           }
13333
13334           return 0;
13335         }
13336
13337         /**
13338          * Get node with number
13339          * @return {Array} `['number', x]` where `x` is a number converted
13340          *      to string.
13341          */
13342         function getNumber() {
13343           var type = NodeType.NumberType;
13344           var token = tokens[pos];
13345           var line = token.ln;
13346           var column = token.col;
13347           var l = tokens[pos].number_l;
13348           var content = '';
13349
13350           for (var j = 0; j < l; j++) {
13351             content += tokens[pos + j].value;
13352           }
13353
13354           pos += l;
13355
13356           return newNode(type, content, line, column);
13357         }
13358
13359         /**
13360          * Check if token is an operator (`/`, `%`, `,`, `:` or `=`).
13361          * @param {number} i Token's index number
13362          * @return {number} `1` if token is an operator, otherwise `0`
13363          */
13364         function checkOperator(i) {
13365           if (i >= tokensLength) return 0;
13366
13367           switch (tokens[i].type) {
13368             case TokenType.Solidus:
13369             case TokenType.PercentSign:
13370             case TokenType.Comma:
13371             case TokenType.Colon:
13372             case TokenType.EqualsSign:
13373             case TokenType.EqualitySign:
13374             case TokenType.InequalitySign:
13375             case TokenType.LessThanSign:
13376             case TokenType.GreaterThanSign:
13377             case TokenType.Asterisk:
13378               return 1;
13379           }
13380
13381           return 0;
13382         }
13383
13384         /**
13385          * Get node with an operator
13386          * @return {Array} `['operator', x]` where `x` is an operator converted
13387          *      to string.
13388          */
13389         function getOperator() {
13390           var type = NodeType.OperatorType;
13391           var token = tokens[pos];
13392           var line = token.ln;
13393           var column = token.col;
13394           var content = token.value;
13395
13396           pos++;
13397
13398           return newNode(type, content, line, column);
13399         }
13400
13401         /**
13402          * Check if token is part of `!optional` word
13403          * @param {number} i Token's index number
13404          * @return {number}
13405          */
13406         function checkOptional(i) {
13407           var start = i;
13408           var l = void 0;
13409
13410           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
13411
13412           if (l = checkSC(i)) i += l;
13413
13414           if (tokens[i].value === 'optional') {
13415             tokens[start].optionalEnd = i;
13416             return i - start + 1;
13417           } else {
13418             return 0;
13419           }
13420         }
13421
13422         /**
13423          * Get node with `!optional` word
13424          */
13425         function getOptional() {
13426           var type = NodeType.OptionalType;
13427           var token = tokens[pos];
13428           var line = token.ln;
13429           var column = token.col;
13430           var content = joinValues(pos, token.optionalEnd);
13431
13432           pos = token.optionalEnd + 1;
13433
13434           return newNode(type, content, line, column);
13435         }
13436
13437         /**
13438          * Check if token is part of text inside parentheses, e.g. `(1)`
13439          * @param {number} i Token's index number
13440          * @return {number}
13441          */
13442         function checkParentheses(i) {
13443           if (i >= tokensLength) return 0;
13444
13445           var start = i;
13446           var right = tokens[i].right;
13447           var l = void 0;
13448
13449           // Skip `(`.
13450           if (tokens[i].type === TokenType.LeftParenthesis) i++;else return 0;
13451
13452           if (i < right) {
13453             if (l = checkTsets(i)) i += l;else return 0;
13454           }
13455
13456           // Skip `)`.
13457           i++;
13458
13459           return i - start;
13460         }
13461
13462         /**
13463          * Get node with text inside parentheses, e.g. `(1)`
13464          * @return {Node}
13465          */
13466         function getParentheses() {
13467           var type = NodeType.ParenthesesType;
13468           var token = tokens[pos];
13469           var line = token.ln;
13470           var column = token.col;
13471           var right = token.right;
13472           var content = [];
13473
13474           // Skip `(`.
13475           pos++;
13476
13477           if (pos < right) {
13478             content = getTsets();
13479           }
13480
13481           var end = getLastPosition(content, line, column, 1);
13482
13483           // Skip `)`.
13484           pos++;
13485
13486           return newNode(type, content, line, column, end);
13487         }
13488
13489         /**
13490          * Check if token is a parent selector, e.g. `&`
13491          * @param {number} i Token's index number
13492          * @return {number}
13493          */
13494         function checkParentSelector(i) {
13495           return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0;
13496         }
13497
13498         /**
13499          * Get node with a parent selector
13500          * @return {Node}
13501          */
13502         function getParentSelector() {
13503           var type = NodeType.ParentSelectorType;
13504           var token = tokens[pos];
13505           var line = token.ln;
13506           var column = token.col;
13507           var content = '&';
13508
13509           pos++;
13510
13511           return newNode(type, content, line, column);
13512         }
13513
13514         /**
13515          * Check if token is a parent selector extension, e.g. `&--foo-bar`
13516          * @param {number} i Token's index number
13517          * @returns {number} Length of the parent selector extension
13518          */
13519         function checkParentSelectorExtension(i) {
13520           var start = i;
13521           var l = void 0;
13522
13523           if (i >= tokensLength) return 0;
13524
13525           while (i < tokensLength) {
13526             if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;else break;
13527           }
13528
13529           return i - start;
13530         }
13531
13532         /**
13533          * Get parent selector extension node
13534          * @return {Node}
13535          */
13536         function getParentSelectorExtension() {
13537           var type = NodeType.ParentSelectorExtensionType;
13538           var token = tokens[pos];
13539           var line = token.ln;
13540           var column = token.col;
13541           var content = [];
13542
13543           while (pos < tokensLength) {
13544             if (checkIdentOrInterpolation(pos)) {
13545               content = content.concat(getIdentOrInterpolation());
13546             } else if (checkPartialIdent(pos)) {
13547               content.push(getIdent());
13548             } else break;
13549           }
13550
13551           return newNode(type, content, line, column);
13552         }
13553
13554         /**
13555          * Check if token is a parent selector with an extension or not
13556          * @param {number} i Token's index number
13557          * @return {number} Length of the parent selector and extension if applicable
13558          */
13559         function checkParentSelectorWithExtension(i) {
13560           var start = i;
13561           var l = void 0;
13562
13563           if (i >= tokensLength) return 0;
13564
13565           if (l = checkParentSelector(i)) i += l;else return 0;
13566
13567           if (l = checkParentSelectorExtension(i)) i += l;
13568
13569           return i - start;
13570         }
13571
13572         /**
13573          * Get parent selector node and extension node if applicable
13574          * @return {Array}
13575          */
13576         function getParentSelectorWithExtension() {
13577           var content = [getParentSelector()];
13578
13579           if (checkParentSelectorExtension(pos)) content.push(getParentSelectorExtension());
13580
13581           return content;
13582         }
13583
13584         /**
13585          * Check if token is part of a number or an interpolation with a percent sign
13586          * (e.g. `10%`).
13587          * @param {number} i Token's index number
13588          * @return {number}
13589          */
13590         function checkPercentage(i) {
13591           var start = i;
13592           var l = void 0;
13593
13594           if (i >= tokensLength) return 0;
13595
13596           if (l = checkNumberOrInterpolation(i)) i += l;else return 0;
13597
13598           if (i >= tokensLength) return 0;
13599
13600           // Skip `%`.
13601           if (tokens[i].type === TokenType.PercentSign) i++;else return 0;
13602
13603           return i - start;
13604         }
13605
13606         /**
13607          * Get a percentage node that contains either a number or an interpolation
13608          * @return {Object} The percentage node
13609          */
13610         function getPercentage() {
13611           var type = NodeType.PercentageType;
13612           var token = tokens[pos];
13613           var line = token.ln;
13614           var column = token.col;
13615           var content = getNumberOrInterpolation();
13616           var end = getLastPosition(content, line, column, 1);
13617
13618           // Skip `%`.
13619           pos++;
13620
13621           return newNode(type, content, line, column, end);
13622         }
13623
13624         /**
13625          * Check if token is a number or an interpolation
13626          * @param {number} i Token's index number
13627          * @return {number}
13628          */
13629         function checkNumberOrInterpolation(i) {
13630           var start = i;
13631           var l = void 0;
13632
13633           while (i < tokensLength) {
13634             if (l = checkInterpolation(i) || checkNumber(i)) i += l;else break;
13635           }
13636
13637           return i - start;
13638         }
13639
13640         /**
13641          * Get a number and/or interpolation node
13642          * @return {Array} An array containing a single or multiple nodes
13643          */
13644         function getNumberOrInterpolation() {
13645           var content = [];
13646
13647           while (pos < tokensLength) {
13648             if (checkInterpolation(pos)) content.push(getInterpolation());else if (checkNumber(pos)) content.push(getNumber());else break;
13649           }
13650
13651           return content;
13652         }
13653
13654         /**
13655          * Check if token is part of a placeholder selector (e.g. `%abc`).
13656          * @param {number} i Token's index number
13657          * @return {number} Length of the selector
13658          */
13659         function checkPlaceholder(i) {
13660           var start = i;
13661           var l = void 0;
13662
13663           if (i >= tokensLength) return 0;
13664
13665           if (tokens[start].placeholder_l) return tokens[start].placeholder_l;
13666
13667           // Skip `%`.
13668           if (tokens[i].type === TokenType.PercentSign) i++;else return 0;
13669
13670           if (l = checkIdentOrInterpolation(i)) {
13671             i += l;
13672             tokens[start].placeholder_l = i - start;
13673           } else return 0;
13674
13675           return i - start;
13676         }
13677
13678         /**
13679          * Get node with a placeholder selector
13680          * @return {Array} `['placeholder', ['ident', x]]` where x is a placeholder's
13681          *      identifier (without `%`, e.g. `abc`).
13682          */
13683         function getPlaceholder() {
13684           var type = NodeType.PlaceholderType;
13685           var token = tokens[pos];
13686           var line = token.ln;
13687           var column = token.col;
13688           var content = [];
13689
13690           // Skip `%`.
13691           pos++;
13692
13693           content = content.concat(getIdentOrInterpolation());
13694
13695           return newNode(type, content, line, column);
13696         }
13697
13698         /**
13699          * @param {number} i Token's index number
13700          * @return {number}
13701          */
13702         function checkProgid(i) {
13703           var start = i;
13704           var l = void 0;
13705
13706           if (i >= tokensLength) return 0;
13707
13708           if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6;else return 0;
13709
13710           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
13711
13712           if (l = checkSC(i)) i += l;
13713
13714           if (tokens[i].type === TokenType.LeftParenthesis) {
13715             tokens[start].progid_end = tokens[i].right;
13716             i = tokens[i].right + 1;
13717           } else return 0;
13718
13719           return i - start;
13720         }
13721
13722         /**
13723          * @return {Array}
13724          */
13725         function getProgid() {
13726           var type = NodeType.ProgidType;
13727           var token = tokens[pos];
13728           var line = token.ln;
13729           var column = token.col;
13730           var progid_end = token.progid_end;
13731           var content = joinValues(pos, progid_end);
13732
13733           pos = progid_end + 1;
13734
13735           return newNode(type, content, line, column);
13736         }
13737
13738         /**
13739          * Check if token is part of a property
13740          * @param {Number} i Token's index number
13741          * @return {Number} Length of the property
13742          */
13743         function checkProperty(i) {
13744           var start = i;
13745           var l = void 0;
13746
13747           if (l = checkProperty1(i)) tokens[start].propertyType = 1;else if (l = checkProperty2(i)) tokens[start].propertyType = 2;else if (l = checkProperty3(i)) tokens[start].propertyType = 3;
13748
13749           return l;
13750         }
13751
13752         /**
13753          * Get node with a property
13754          * @return {!Node}
13755          */
13756         function getProperty() {
13757           var type = tokens[pos].propertyType;
13758
13759           if (type === 1) return getProperty1();
13760           if (type === 2) return getProperty2();
13761           if (type === 3) return getProperty3();
13762         }
13763
13764         /**
13765          * Check if token is part of a property
13766          * (1) `foo`
13767          * (2) `#{$foo}`
13768          * @param {Number} i Token's index number
13769          * @returns {Number} Length of the property
13770          */
13771         function checkProperty1(i) {
13772           var start = i;
13773           var l = void 0;
13774
13775           if (i >= tokensLength) return 0;
13776
13777           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
13778
13779           return i - start;
13780         }
13781
13782         /**
13783          * Get node with a property
13784          * @returns {Array}
13785          */
13786         function getProperty1() {
13787           var type = NodeType.PropertyType;
13788           var token = tokens[pos];
13789           var line = token.ln;
13790           var column = token.col;
13791           var content = getIdentOrInterpolation();
13792
13793           return newNode(type, content, line, column);
13794         }
13795
13796         /**
13797          * Check if token is part of a custom property
13798          * (1) `--foo-bar`
13799          * @param {Number} i Token's index number
13800          * @return {Number} Length of the property
13801          */
13802         function checkProperty2(i) {
13803           return checkCustomProperty(i);
13804         }
13805
13806         /**
13807          * Get node with a custom property
13808          * @return {Node}
13809          */
13810         function getProperty2() {
13811           return getCustomProperty();
13812         }
13813
13814         /**
13815          * Check if token is part of a property
13816          * (1) `$foo`
13817          * @param {Number} i Token's index number
13818          * @returns {Number} Length of the property
13819          */
13820         function checkProperty3(i) {
13821           var start = i;
13822           var l = void 0;
13823
13824           if (i >= tokensLength) return 0;
13825
13826           if (l = checkVariable(i)) i += l;else return 0;
13827
13828           return i - start;
13829         }
13830
13831         /**
13832          * Get node with a property
13833          * @returns {Array} `['property', x]`
13834          */
13835         function getProperty3() {
13836           var type = NodeType.PropertyType;
13837           var token = tokens[pos];
13838           var line = token.ln;
13839           var column = token.col;
13840           var content = [getVariable()];
13841
13842           return newNode(type, content, line, column);
13843         }
13844
13845         /**
13846          * Check if token is part of a custom property
13847          * @param {Number} i Token's index number
13848          * @return {Number} Length of the property
13849          */
13850         function checkCustomProperty(i) {
13851           var start = i;
13852           var l = void 0;
13853
13854           if (i >= tokensLength) return 0;
13855
13856           if (tokens[i].type !== TokenType.HyphenMinus || tokens[i + 1] && tokens[i + 1].type !== TokenType.HyphenMinus) return 0;
13857
13858           // Skip `--`
13859           i += 2;
13860
13861           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
13862
13863           return i - start;
13864         }
13865
13866         /**
13867          * Get node with a custom property
13868          * @return {Node}
13869          */
13870         function getCustomProperty() {
13871           var type = NodeType.CustomPropertyType;
13872           var token = tokens[pos];
13873           var line = token.ln;
13874           var column = token.col;
13875
13876           // Skip `--`
13877           pos += 2;
13878
13879           var content = getIdentOrInterpolation();
13880
13881           return newNode(type, content, line, column);
13882         }
13883
13884         /**
13885          * Check if token is a colon
13886          * @param {number} i Token's index number
13887          * @return {number} `1` if token is a colon, otherwise `0`
13888          */
13889         function checkPropertyDelim(i) {
13890           return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0;
13891         }
13892
13893         /**
13894          * Get node with a colon
13895          * @return {Array} `['propertyDelim']`
13896          */
13897         function getPropertyDelim() {
13898           var type = NodeType.PropertyDelimType;
13899           var token = tokens[pos];
13900           var line = token.ln;
13901           var column = token.col;
13902           var content = ':';
13903
13904           // Skip `:`.
13905           pos++;
13906
13907           return newNode(type, content, line, column);
13908         }
13909
13910         /**
13911          * @param {number} i Token's index number
13912          * @return {number}
13913          */
13914         function checkPseudo(i) {
13915           return checkPseudoe(i) || checkPseudoc(i);
13916         }
13917
13918         /**
13919          * @return {Array}
13920          */
13921         function getPseudo() {
13922           if (checkPseudoe(pos)) return getPseudoe();
13923           if (checkPseudoc(pos)) return getPseudoc();
13924         }
13925
13926         /**
13927          * @param {Number} i Token's index number
13928          * @return {Number}
13929          */
13930         function checkPseudoe(i) {
13931           var l = void 0;
13932
13933           // Check `::`
13934           if (i >= tokensLength || tokens[i].type !== TokenType.Colon || i + 1 >= tokensLength || tokens[i + 1].type !== TokenType.Colon) return 0;
13935
13936           if (l = checkPseudoElement1(i)) tokens[i].pseudoElementType = 1;else if (l = checkPseudoElement2(i)) tokens[i].pseudoElementType = 2;else return 0;
13937
13938           return l;
13939         }
13940
13941         /**
13942          * @return {Node}
13943          */
13944         function getPseudoe() {
13945           var childType = tokens[pos].pseudoElementType;
13946           if (childType === 1) return getPseudoElement1();
13947           if (childType === 2) return getPseudoElement2();
13948         }
13949
13950         /**
13951          * (1) `::slotted(selector)`
13952          * (2) `::slotted(selector, selector)`
13953          */
13954         function checkPseudoElement1(i) {
13955           var start = i;
13956           var l = void 0;
13957
13958           // Skip `::`.
13959           i += 2;
13960
13961           if (i >= tokensLength) return 0;
13962
13963           if (l = checkIdent(i)) i += l;else return 0;
13964
13965           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
13966
13967           var right = tokens[i].right;
13968
13969           // Skip `(`.
13970           i++;
13971
13972           if (l = checkSC(i)) i += l;
13973
13974           if (l = checkSelectorsGroup(i)) i += l;else return 0;
13975
13976           if (l = checkSC(i)) i += l;
13977
13978           if (i !== right) return 0;
13979
13980           // Skip `)`.
13981           i++;
13982
13983           return i - start;
13984         }
13985
13986         /**
13987          * (1) `::slotted(selector)`
13988          * (2) `::slotted(selector, selector)`
13989          */
13990         function getPseudoElement1() {
13991           var type = NodeType.PseudoeType;
13992           var token = tokens[pos];
13993           var line = token.ln;
13994           var column = token.col;
13995           var content = [];
13996
13997           // Skip `::`.
13998           pos += 2;
13999
14000           content.push(getIdent());
14001
14002           {
14003             var _type = NodeType.ArgumentsType;
14004             var _token = tokens[pos];
14005             var _line = _token.ln;
14006             var _column = _token.col;
14007
14008             // Skip `(`.
14009             pos++;
14010
14011             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
14012
14013             var end = getLastPosition(selectorContent, _line, _column, 1);
14014             var args = newNode(_type, selectorContent, _line, _column, end);
14015             content.push(args);
14016
14017             // Skip `)`.
14018             pos++;
14019           }
14020
14021           return newNode(type, content, line, column);
14022         }
14023
14024         function checkPseudoElement2(i) {
14025           var start = i;
14026           var l = void 0;
14027
14028           // Skip `::`.
14029           i += 2;
14030
14031           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14032
14033           return i - start;
14034         }
14035
14036         /**
14037          * @return {Node}
14038          */
14039         function getPseudoElement2() {
14040           var type = NodeType.PseudoeType;
14041           var token = tokens[pos];
14042           var line = token.ln;
14043           var column = token.col;
14044
14045           // Skip `::`.
14046           pos += 2;
14047
14048           var content = getIdentOrInterpolation();
14049
14050           return newNode(type, content, line, column);
14051         }
14052
14053         /**
14054          * @param {number} i Token's index number
14055          * @return {number}
14056          */
14057         function checkPseudoc(i) {
14058           var l = void 0;
14059
14060           if (i >= tokensLength || tokens[i].type !== TokenType.Colon) return 0;
14061
14062           if (l = checkPseudoClass3(i)) tokens[i].pseudoClassType = 3;else if (l = checkPseudoClass4(i)) tokens[i].pseudoClassType = 4;else if (l = checkPseudoClass5(i)) tokens[i].pseudoClassType = 5;else if (l = checkPseudoClass1(i)) tokens[i].pseudoClassType = 1;else if (l = checkPseudoClass2(i)) tokens[i].pseudoClassType = 2;else if (l = checkPseudoClass6(i)) tokens[i].pseudoClassType = 6;else return 0;
14063
14064           return l;
14065         }
14066
14067         /**
14068          * @return {Array}
14069          */
14070         function getPseudoc() {
14071           var childType = tokens[pos].pseudoClassType;
14072           if (childType === 1) return getPseudoClass1();
14073           if (childType === 2) return getPseudoClass2();
14074           if (childType === 3) return getPseudoClass3();
14075           if (childType === 4) return getPseudoClass4();
14076           if (childType === 5) return getPseudoClass5();
14077           if (childType === 6) return getPseudoClass6();
14078         }
14079
14080         /**
14081          * (-) `:not(panda)`
14082          */
14083         function checkPseudoClass1(i) {
14084           var start = i;
14085           var l = void 0;
14086
14087           // Skip `:`.
14088           i++;
14089
14090           if (i >= tokensLength) return 0;
14091
14092           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14093
14094           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
14095
14096           var right = tokens[i].right;
14097
14098           // Skip `(`.
14099           i++;
14100
14101           if (l = checkSC(i)) i += l;
14102
14103           if (l = checkSelectorsGroup(i)) i += l;else return 0;
14104
14105           if (l = checkSC(i)) i += l;
14106
14107           if (i !== right) return 0;
14108
14109           // Skip `)`.
14110           i++;
14111
14112           return i - start;
14113         }
14114
14115         /**
14116          * (-) `:not(panda)`
14117          */
14118         function getPseudoClass1() {
14119           var type = NodeType.PseudocType;
14120           var token = tokens[pos];
14121           var line = token.ln;
14122           var column = token.col;
14123           var content = [];
14124
14125           // Skip `:`.
14126           pos++;
14127
14128           content = content.concat(getIdentOrInterpolation());
14129
14130           {
14131             var _type2 = NodeType.ArgumentsType;
14132             var _token2 = tokens[pos];
14133             var _line2 = _token2.ln;
14134             var _column2 = _token2.col;
14135
14136             // Skip `(`.
14137             pos++;
14138
14139             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
14140
14141             var end = getLastPosition(selectorContent, _line2, _column2, 1);
14142             var args = newNode(_type2, selectorContent, _line2, _column2, end);
14143             content.push(args);
14144
14145             // Skip `)`.
14146             pos++;
14147           }
14148
14149           return newNode(type, content, line, column);
14150         }
14151
14152         /**
14153          * (1) `:nth-child(odd)`
14154          * (2) `:nth-child(even)`
14155          * (3) `:lang(de-DE)`
14156          */
14157         function checkPseudoClass2(i) {
14158           var start = i;
14159           var l = void 0;
14160
14161           // Skip `:`.
14162           i++;
14163
14164           if (i >= tokensLength) return 0;
14165
14166           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14167
14168           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
14169
14170           var right = tokens[i].right;
14171
14172           // Skip `(`.
14173           i++;
14174
14175           if (l = checkSC(i)) i += l;
14176
14177           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14178
14179           if (l = checkSC(i)) i += l;
14180
14181           if (i !== right) return 0;
14182
14183           // Skip `)`.
14184           i++;
14185
14186           return i - start;
14187         }
14188
14189         function getPseudoClass2() {
14190           var type = NodeType.PseudocType;
14191           var token = tokens[pos];
14192           var line = token.ln;
14193           var column = token.col;
14194           var content = [];
14195
14196           // Skip `:`.
14197           pos++;
14198
14199           content = content.concat(getIdentOrInterpolation());
14200
14201           var l = tokens[pos].ln;
14202           var c = tokens[pos].col;
14203
14204           // Skip `(`.
14205           pos++;
14206
14207           var value = [].concat(getSC(), getIdentOrInterpolation(), getSC());
14208
14209           var end = getLastPosition(value, l, c, 1);
14210           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
14211           content.push(args);
14212
14213           // Skip `)`.
14214           pos++;
14215
14216           return newNode(type, content, line, column);
14217         }
14218
14219         /**
14220          * (-) `:nth-child(-3n + 2)`
14221          */
14222         function checkPseudoClass3(i) {
14223           var start = i;
14224           var l = void 0;
14225
14226           // Skip `:`.
14227           i++;
14228
14229           if (i >= tokensLength) return 0;
14230
14231           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14232
14233           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
14234
14235           var right = tokens[i].right;
14236
14237           // Skip `(`.
14238           i++;
14239
14240           if (l = checkSC(i)) i += l;
14241
14242           if (l = checkUnary(i)) i += l;
14243
14244           if (l = checkNumberOrInterpolation(i)) i += l;
14245
14246           if (i >= tokensLength) return 0;
14247
14248           if (tokens[i].value === 'n') i++;
14249
14250           if (l = checkSC(i)) i += l;
14251
14252           if (i >= tokensLength) return 0;
14253
14254           if (tokens[i].type === TokenType.PlusSign || tokens[i].type === TokenType.HyphenMinus) i++;else return 0;
14255
14256           if (l = checkSC(i)) i += l;
14257
14258           if (l = checkNumberOrInterpolation(i)) i += l;else return 0;
14259
14260           if (l = checkSC(i)) i += l;
14261
14262           if (i !== right) return 0;
14263
14264           // Skip `)`.
14265           i++;
14266
14267           return i - start;
14268         }
14269
14270         function getPseudoClass3() {
14271           var type = NodeType.PseudocType;
14272           var token = tokens[pos];
14273           var line = token.ln;
14274           var column = token.col;
14275           var content = [];
14276
14277           // Skip `:`.
14278           pos++;
14279
14280           content = content.concat(getIdentOrInterpolation());
14281
14282           var l = tokens[pos].ln;
14283           var c = tokens[pos].col;
14284           var value = [];
14285
14286           // Skip `(`.
14287           pos++;
14288
14289           value = value.concat(getSC());
14290
14291           if (checkUnary(pos)) value.push(getUnary());
14292           if (checkNumberOrInterpolation(pos)) value = value.concat(getNumberOrInterpolation());
14293
14294           {
14295             var _token3 = tokens[pos];
14296
14297             if (_token3.value === 'n') {
14298               var _l = _token3.ln;
14299               var _c = _token3.col;
14300               var _content2 = _token3.value;
14301               var ident = newNode(NodeType.IdentType, _content2, _l, _c);
14302               value.push(ident);
14303               pos++;
14304             }
14305           }
14306
14307           value = value.concat(getSC());
14308
14309           if (checkUnary(pos)) value.push(getUnary());
14310
14311           value = value.concat(getSC());
14312
14313           if (checkNumberOrInterpolation(pos)) value = value.concat(getNumberOrInterpolation());
14314
14315           value = value.concat(getSC());
14316
14317           var end = getLastPosition(value, l, c, 1);
14318           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
14319           content.push(args);
14320
14321           // Skip `)`.
14322           pos++;
14323
14324           return newNode(type, content, line, column);
14325         }
14326
14327         /**
14328          * (-) `:nth-child(-3n)`
14329          */
14330         function checkPseudoClass4(i) {
14331           var start = i;
14332           var l = void 0;
14333
14334           // Skip `:`.
14335           i++;
14336
14337           if (i >= tokensLength) return 0;
14338
14339           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14340
14341           if (i >= tokensLength) return 0;
14342           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
14343
14344           var right = tokens[i].right;
14345
14346           // Skip `(`.
14347           i++;
14348
14349           if (l = checkSC(i)) i += l;
14350
14351           if (l = checkUnary(i)) i += l;
14352
14353           if (l = checkInterpolation(i)) i += l;
14354
14355           if (tokens[i].type === TokenType.DecimalNumber) i++;
14356
14357           if (tokens[i].value === 'n') i++;else return 0;
14358
14359           if (l = checkSC(i)) i += l;
14360
14361           if (i !== right) return 0;
14362
14363           // Skip `)`.
14364           i++;
14365
14366           return i - start;
14367         }
14368
14369         function getPseudoClass4() {
14370           var type = NodeType.PseudocType;
14371           var token = tokens[pos];
14372           var line = token.ln;
14373           var column = token.col;
14374           var content = [];
14375
14376           // Skip `:`.
14377           pos++;
14378
14379           content = content.concat(getIdentOrInterpolation());
14380
14381           var l = tokens[pos].ln;
14382           var c = tokens[pos].col;
14383           var value = [];
14384
14385           // Skip `(`.
14386           pos++;
14387
14388           value = value.concat(getSC());
14389
14390           if (checkUnary(pos)) value.push(getUnary());
14391           if (checkInterpolation(pos)) value.push(getInterpolation());
14392           if (checkNumber(pos)) value.push(getNumber());
14393           if (checkIdent(pos)) value.push(getIdent());
14394
14395           value = value.concat(getSC());
14396
14397           var end = getLastPosition(value, l, c, 1);
14398           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
14399           content.push(args);
14400
14401           // Skip `)`.
14402           pos++;
14403
14404           return newNode(type, content, line, column);
14405         }
14406
14407         /**
14408          * (-) `:nth-child(+8)`
14409          */
14410         function checkPseudoClass5(i) {
14411           var start = i;
14412           var l = void 0;
14413
14414           // Skip `:`.
14415           i++;
14416
14417           if (i >= tokensLength) return 0;
14418
14419           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14420
14421           if (i >= tokensLength) return 0;
14422           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
14423
14424           var right = tokens[i].right;
14425
14426           // Skip `(`.
14427           i++;
14428
14429           if (l = checkSC(i)) i += l;
14430
14431           if (l = checkUnary(i)) i += l;
14432           if (tokens[i].type === TokenType.DecimalNumber) i++;else return 0;
14433
14434           if (l = checkSC(i)) i += l;
14435
14436           if (i !== right) return 0;
14437
14438           // Skip `)`.
14439           i++;
14440
14441           return i - start;
14442         }
14443
14444         function getPseudoClass5() {
14445           var type = NodeType.PseudocType;
14446           var token = tokens[pos];
14447           var line = token.ln;
14448           var column = token.col;
14449           var content = [];
14450
14451           // Skip `:`.
14452           pos++;
14453
14454           content = content.concat(getIdentOrInterpolation());
14455
14456           var l = tokens[pos].ln;
14457           var c = tokens[pos].col;
14458           var value = [];
14459
14460           // Skip `(`.
14461           pos++;
14462
14463           value = value.concat(getSC());
14464
14465           if (checkUnary(pos)) value.push(getUnary());
14466           if (checkNumber(pos)) value.push(getNumber());
14467
14468           value = value.concat(getSC());
14469
14470           var end = getLastPosition(value, l, c, 1);
14471           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
14472           content.push(args);
14473
14474           // Skip `)`.
14475           pos++;
14476
14477           return newNode(type, content, line, column);
14478         }
14479
14480         /**
14481          * (-) `:checked`
14482          */
14483         function checkPseudoClass6(i) {
14484           var start = i;
14485           var l = void 0;
14486
14487           // Skip `:`.
14488           i++;
14489
14490           if (i >= tokensLength) return 0;
14491
14492           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
14493
14494           return i - start;
14495         }
14496
14497         function getPseudoClass6() {
14498           var type = NodeType.PseudocType;
14499           var token = tokens[pos];
14500           var line = token.ln;
14501           var column = token.col;
14502
14503           // Skip `:`.
14504           pos++;
14505
14506           var content = getIdentOrInterpolation();
14507
14508           return newNode(type, content, line, column);
14509         }
14510
14511         /**
14512          * @param {number} i Token's index number
14513          * @return {number}
14514          */
14515         function checkRuleset(i) {
14516           var start = i;
14517           var l = void 0;
14518
14519           if (i >= tokensLength) return 0;
14520
14521           if (l = checkSelectorsGroup(i)) i += l;else return 0;
14522
14523           if (l = checkSC(i)) i += l;
14524
14525           if (l = checkBlock(i)) {
14526             i += l;
14527           } else if (l = checkSC(i)) {
14528             i += l;
14529             if (l = checkBlock(i)) i += l;else return 0;
14530           } else return 0;
14531
14532           return i - start;
14533         }
14534
14535         function getRuleset() {
14536           var type = NodeType.RulesetType;
14537           var token = tokens[pos];
14538           var line = token.ln;
14539           var column = token.col;
14540           var content = [].concat(getSelectorsGroup(), getSC());
14541
14542           if (checkBlock(pos)) {
14543             content.push(getBlock());
14544           } else {
14545             content = content.concat(getSC(), getBlock());
14546           }
14547
14548           return newNode(type, content, line, column);
14549         }
14550
14551         /**
14552          * Check if token is marked as a space (if it's a space or a tab
14553          *      or a line break).
14554          * @param {number} i
14555          * @return {number} Number of spaces in a row starting with the given token.
14556          */
14557         function checkS(i) {
14558           return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0;
14559         }
14560
14561         /**
14562          * Get node with spaces
14563          * @return {Array} `['s', x]` where `x` is a string containing spaces
14564          */
14565         function getS() {
14566           var type = NodeType.SType;
14567           var token = tokens[pos];
14568           var line = token.ln;
14569           var column = token.col;
14570           var content = joinValues(pos, tokens[pos].ws_last);
14571
14572           pos = tokens[pos].ws_last + 1;
14573
14574           return newNode(type, content, line, column);
14575         }
14576
14577         /**
14578          * Check if token is a space, newline, or a comment.
14579          * @param {number} i Token's index number
14580          * @return {number} Number of similar (space, newline, or comment) tokens
14581          *      in a row starting with the given token.
14582          */
14583         function checkMultilineSC(i) {
14584           if (!tokens[i]) return 0;
14585
14586           var l = void 0;
14587           var lsc = 0;
14588
14589           while (i < tokensLength) {
14590             if (!(l = checkS(i)) && !(l = checkCommentML(i)) && !(l = checkCommentSL(i))) break;
14591
14592             i += l;
14593             lsc += l;
14594           }
14595
14596           return lsc || 0;
14597         }
14598
14599         /**
14600          * Get node with spaces newlines and comments
14601          * @return {!Node}
14602          */
14603         function getMultilineSC() {
14604           var sc = [];
14605
14606           if (pos >= tokensLength) return sc;
14607
14608           while (pos < tokensLength) {
14609             if (checkS(pos)) sc.push(getS());else if (checkCommentML(pos)) sc.push(getCommentML());else if (checkCommentSL(pos)) sc.push(getCommentSL());else break;
14610           }
14611
14612           return sc;
14613         }
14614
14615         /**
14616          * Check if token is a space or a comment.
14617          * @param {number} i Token's index number
14618          * @return {number} Number of similar (space or comment) tokens
14619          *      in a row starting with the given token.
14620          */
14621         function checkSC(i) {
14622           if (i >= tokensLength) return 0;
14623
14624           var l = void 0;
14625           var lsc = 0;
14626           var ln = tokens[i].ln;
14627
14628           while (i < tokensLength) {
14629             if (tokens[i].ln !== ln) break;
14630
14631             if (l = checkS(i)) tokens[i].sc_child = 1;else if (l = checkCommentML(i)) tokens[i].sc_child = 2;else if (l = checkCommentSL(i)) tokens[i].sc_child = 3;else break;
14632
14633             i += l;
14634             lsc += l;
14635
14636             if (tokens[i] && tokens[i].type === TokenType.Newline) break;
14637           }
14638
14639           return lsc || 0;
14640         }
14641
14642         /**
14643          * Get node with spaces and comments
14644          * @return {Array} Array containing nodes with spaces (if there are any)
14645          *      and nodes with comments (if there are any):
14646          *      `[['s', x]*, ['comment', y]*]` where `x` is a string of spaces
14647          *      and `y` is a comment's text (without `/*` and `* /`).
14648          */
14649         function getSC() {
14650           var sc = [];
14651
14652           if (pos >= tokensLength) return sc;
14653
14654           var ln = tokens[pos].ln;
14655
14656           while (pos < tokensLength) {
14657             if (tokens[pos].ln !== ln) break;else if (checkS(pos)) sc.push(getS());else if (checkCommentML(pos)) sc.push(getCommentML());else if (checkCommentSL(pos)) sc.push(getCommentSL());else break;
14658
14659             if (tokens[pos] && tokens[pos].type === TokenType.Newline) break;
14660           }
14661
14662           return sc;
14663         }
14664
14665         /**
14666          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside a simple
14667          * selector
14668          * @param {number} i Token's index number
14669          * @return {number}
14670          */
14671         function checkShash(i) {
14672           var start = i;
14673           var l = void 0;
14674
14675           if (i >= tokensLength) return 0;
14676
14677           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
14678
14679           if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;else return 0;
14680
14681           while (i < tokensLength) {
14682             if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;else break;
14683           }
14684
14685           tokens[start].shashEnd = i;
14686
14687           return i - start;
14688         }
14689
14690         /**
14691          * Get node with a hexadecimal number (e.g. `#fff`) inside a simple selector
14692          * @return {Node}
14693          */
14694         function getShash() {
14695           var type = NodeType.ShashType;
14696           var token = tokens[pos];
14697           var line = token.ln;
14698           var column = token.col;
14699           var end = token.shashEnd;
14700           var content = [];
14701
14702           // Skip `#`.
14703           pos++;
14704
14705           while (pos < end) {
14706             if (checkIdentOrInterpolation(pos)) {
14707               content = content.concat(getIdentOrInterpolation());
14708             } else if (checkPartialIdent(pos)) {
14709               content.push(getIdent());
14710             } else break;
14711           }
14712
14713           return newNode(type, content, line, column);
14714         }
14715
14716         /**
14717          * Check if token is part of a string (text wrapped in quotes)
14718          * @param {number} i Token's index number
14719          * @return {number} `1` if token is part of a string, `0` if not
14720          */
14721         function checkString(i) {
14722           if (i >= tokensLength) return 0;
14723
14724           if (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) {
14725             return 1;
14726           }
14727
14728           return 0;
14729         }
14730
14731         /**
14732          * Get string's node
14733          * @return {Array} `['string', x]` where `x` is a string (including
14734          *      quotes).
14735          */
14736         function getString() {
14737           var type = NodeType.StringType;
14738           var token = tokens[pos];
14739           var line = token.ln;
14740           var column = token.col;
14741           var content = token.value;
14742
14743           pos++;
14744
14745           return newNode(type, content, line, column);
14746         }
14747
14748         /**
14749          * Validate stylesheet: it should consist of any number (0 or more) of
14750          * rulesets (sets of rules with selectors), @-rules, whitespaces or
14751          * comments.
14752          * @param {number} i Token's index number
14753          * @return {number}
14754          */
14755         function checkStylesheet(i) {
14756           var start = i;
14757           var l = void 0;
14758
14759           while (i < tokensLength) {
14760             if (l = checkSC(i) || checkDeclaration(i) || checkDeclDelim(i) || checkInclude(i) || checkExtend(i) || checkMixin(i) || checkLoop(i) || checkConditionalStatement(i) || checkAtrule(i) || checkRuleset(i)) i += l;else throwError(i);
14761           }
14762
14763           return i - start;
14764         }
14765
14766         /**
14767          * @return {Array} `['stylesheet', x]` where `x` is all stylesheet's
14768          *      nodes.
14769          */
14770         function getStylesheet() {
14771           var type = NodeType.StylesheetType;
14772           var token = tokens[pos];
14773           var line = token.ln;
14774           var column = token.col;
14775           var content = [];
14776           var node = void 0;
14777           var wasDeclaration = false;
14778
14779           while (pos < tokensLength) {
14780             if (wasDeclaration && checkDeclDelim(pos)) node = getDeclDelim();else if (checkSC(pos)) node = getSC();else if (checkRuleset(pos)) node = getRuleset();else if (checkInclude(pos)) node = getInclude();else if (checkExtend(pos)) node = getExtend();else if (checkMixin(pos)) node = getMixin();else if (checkLoop(pos)) node = getLoop();else if (checkConditionalStatement(pos)) node = getConditionalStatement();else if (checkAtrule(pos)) node = getAtrule();else if (checkDeclaration(pos)) node = getDeclaration();else throwError(pos);
14781
14782             wasDeclaration = node.type === NodeType.DeclarationType;
14783             if (Array.isArray(node)) content = content.concat(node);else content.push(node);
14784           }
14785
14786           return newNode(type, content, line, column);
14787         }
14788
14789         /**
14790          * @param {Number} i Token's index number
14791          * @return {Number}
14792          */
14793         function checkTset(i) {
14794           return checkVhash(i) || checkOperator(i) || checkAny(i) || checkSC(i);
14795         }
14796
14797         /**
14798          * @return {Array}
14799          */
14800         function getTset() {
14801           if (checkVhash(pos)) return getVhash();else if (checkOperator(pos)) return getOperator();else if (checkAny(pos)) return getAny();else if (checkSC(pos)) return getSC();
14802         }
14803
14804         /**
14805          * @param {number} i Token's index number
14806          * @return {number}
14807          */
14808         function checkTsets(i) {
14809           var start = i;
14810           var l = void 0;
14811
14812           if (i >= tokensLength) return 0;
14813
14814           while (tokens[i - 1].type !== TokenType.Newline && (l = checkTset(i))) {
14815             i += l;
14816           }
14817
14818           return i - start;
14819         }
14820
14821         /**
14822          * @return {Array}
14823          */
14824         function getTsets() {
14825           var content = [];
14826           var t = void 0;
14827
14828           while (tokens[pos - 1].type !== TokenType.Newline && (t = getTset())) {
14829             if (typeof t.content === 'string') content.push(t);else content = content.concat(t);
14830           }
14831
14832           return content;
14833         }
14834
14835         /**
14836          * Check if token is an unary (arithmetical) sign (`+` or `-`)
14837          * @param {number} i Token's index number
14838          * @return {number} `1` if token is an unary sign, `0` if not
14839          */
14840         function checkUnary(i) {
14841           if (i >= tokensLength) return 0;
14842
14843           if (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) {
14844             return 1;
14845           }
14846
14847           return 0;
14848         }
14849
14850         /**
14851          * Get node with an unary (arithmetical) sign (`+` or `-`)
14852          * @return {Array} `['unary', x]` where `x` is an unary sign
14853          *      converted to string.
14854          */
14855         function getUnary() {
14856           var type = NodeType.OperatorType;
14857           var token = tokens[pos];
14858           var line = token.ln;
14859           var column = token.col;
14860           var content = token.value;
14861
14862           pos++;
14863
14864           return newNode(type, content, line, column);
14865         }
14866
14867         /**
14868          * Check if token is a unicode range (single or multiple <urange> nodes)
14869          * @param {number} i Token's index
14870          * @return {number} Unicode range node's length
14871          */
14872         function checkUnicodeRange(i) {
14873           var start = i;
14874           var l = void 0;
14875
14876           if (i >= tokensLength) return 0;
14877
14878           if (l = checkUrange(i)) i += l;else return 0;
14879
14880           while (i < tokensLength) {
14881             var spaceBefore = checkSC(i);
14882             var comma = checkDelim(i + spaceBefore);
14883             if (!comma) break;
14884
14885             var spaceAfter = checkSC(i + spaceBefore + comma);
14886             if (l = checkUrange(i + spaceBefore + comma + spaceAfter)) {
14887               i += spaceBefore + comma + spaceAfter + l;
14888             } else break;
14889           }
14890
14891           return i - start;
14892         }
14893
14894         /**
14895          * Get a unicode range node
14896          * @return {Node}
14897          */
14898         function getUnicodeRange() {
14899           var type = NodeType.UnicodeRangeType;
14900           var token = tokens[pos];
14901           var line = token.ln;
14902           var column = token.col;
14903           var content = [];
14904
14905           while (pos < tokensLength) {
14906             if (checkSC(pos)) content = content.concat(getSC());else if (checkDelim(pos)) content.push(getDelim());else if (checkUrange(pos)) content.push(getUrange());else break;
14907           }
14908
14909           return newNode(type, content, line, column);
14910         }
14911
14912         /**
14913          * Check if token is unit
14914          * @param {Number} i Token's index number
14915          * @return {Number}
14916          */
14917         function checkUnit(i) {
14918           var units = ['em', 'ex', 'ch', 'rem', 'vh', 'vw', 'vmin', 'vmax', 'px', 'mm', 'q', 'cm', 'in', 'pt', 'pc', 'deg', 'grad', 'rad', 'turn', 's', 'ms', 'Hz', 'kHz', 'dpi', 'dpcm', 'dppx'];
14919
14920           return units.indexOf(tokens[i].value) !== -1 ? 1 : 0;
14921         }
14922
14923         /**
14924          * Get unit node of type ident
14925          * @return {Node} An ident node containing the unit value
14926          */
14927         function getUnit() {
14928           var type = NodeType.IdentType;
14929           var token = tokens[pos];
14930           var line = token.ln;
14931           var column = token.col;
14932           var content = token.value;
14933
14934           pos++;
14935
14936           return newNode(type, content, line, column);
14937         }
14938
14939         /**
14940          * Check if token is a u-range (part of a unicode-range)
14941          * (1) `U+416`
14942          * (2) `U+400-4ff`
14943          * (3) `U+4??`
14944          * @param {number} i Token's index
14945          * @return {number} Urange node's length
14946          */
14947         function checkUrange(i) {
14948           var start = i;
14949           var l = void 0;
14950
14951           if (i >= tokensLength) return 0;
14952
14953           // Check for unicode prefix (u+ or U+)
14954           if (tokens[i].value === 'U' || tokens[i].value === 'u') i += 1;else return 0;
14955
14956           if (i >= tokensLength) return 0;
14957
14958           if (tokens[i].value === '+') i += 1;else return 0;
14959
14960           while (i < tokensLength) {
14961             if (l = checkIdent(i)) i += l;else if (l = checkNumber(i)) i += l;else if (l = checkUnary(i)) i += l;else if (l = _checkUnicodeWildcard(i)) i += l;else break;
14962           }
14963
14964           tokens[start].urangeEnd = i - 1;
14965
14966           return i - start;
14967         }
14968
14969         /**
14970          * Get a u-range node (part of a unicode-range)
14971          * @return {Node}
14972          */
14973         function getUrange() {
14974           var startPos = pos;
14975           var type = NodeType.UrangeType;
14976           var token = tokens[pos];
14977           var line = token.ln;
14978           var column = token.col;
14979           var content = [];
14980
14981           content = joinValues(startPos, tokens[startPos].urangeEnd);
14982           pos = tokens[startPos].urangeEnd + 1;
14983
14984           return newNode(type, content, line, column);
14985         }
14986
14987         /**
14988          * Check for unicode wildcard characters `?`
14989          * @param {number} i Token's index
14990          * @return {number} Wildcard length
14991          */
14992         function _checkUnicodeWildcard(i) {
14993           var start = i;
14994
14995           if (i >= tokensLength) return 0;
14996
14997           while (i < tokensLength) {
14998             if (tokens[i].type === TokenType.QuestionMark) i += 1;else break;
14999           }
15000
15001           return i - start;
15002         }
15003
15004         /**
15005          * Check if token is part of URI, e.g. `url('/css/styles.css')`
15006          * @param {number} i Token's index number
15007          * @returns {number} Length of URI
15008          */
15009         function checkUri(i) {
15010           var start = i;
15011           var l = void 0;
15012
15013           if (i >= tokensLength || tokens[i].value !== 'url') return 0;
15014
15015           // Skip `url`.
15016           i++;
15017
15018           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
15019
15020           // Store the opening parenthesis token as we will reference it's `right`
15021           // property to determine when the parentheses close
15022           var leftParenthesis = tokens[i];
15023
15024           // Skip `(`.
15025           i++;
15026
15027           // Determine the type of URI
15028           while (i < leftParenthesis.right) {
15029             if (l = checkUri1(i)) {
15030               i += l;
15031               tokens[start].uriType = 1; // Raw based URI (without quotes)
15032             } else if (l = checkUri2(i)) {
15033               i += l;
15034               tokens[start].uriType = 2; // Non-raw based URI (with quotes)
15035             } else return 0;
15036           }
15037
15038           // Skip `)`.
15039           i++;
15040
15041           return i - start;
15042         }
15043
15044         /**
15045          * Get specific type of URI node
15046          * @return {Node} Specific type of URI node
15047          */
15048         function getUri() {
15049           var startPos = pos;
15050           var type = NodeType.UriType;
15051           var token = tokens[startPos];
15052           var line = token.ln;
15053           var column = token.col;
15054           var content = [];
15055           var end = void 0;
15056
15057           var uriType = tokens[startPos].uriType;
15058
15059           // Skip `url` and `(`.
15060           pos += 2;
15061
15062           if (uriType === 1) content = content.concat(getUri1());else if (uriType === 2) content = content.concat(getUri2());else end = getLastPosition(content, line, column, 4);
15063
15064           if (!end) end = getLastPosition(content, line, column, 1);
15065
15066           // Skip `)`.
15067           pos++;
15068
15069           return newNode(type, content, line, column, end);
15070         }
15071
15072         /**
15073          * Check if token type is valid URI character
15074          * @param {number} i Token's index number
15075          * @return {number} Length of raw node
15076          */
15077         function checkUriRawCharacters(i) {
15078           var start = i;
15079           var l = void 0;
15080
15081           if (l = checkIdent(i)) i += l;else if (l = checkNumber(i)) i += l;else {
15082             switch (tokens[i].type) {
15083               case TokenType.ExclamationMark:
15084               case TokenType.NumberSign:
15085               case TokenType.DollarSign:
15086               case TokenType.PercentSign:
15087               case TokenType.Ampersand:
15088               case TokenType.Asterisk:
15089               case TokenType.PlusSign:
15090               case TokenType.Comma:
15091               case TokenType.HyphenMinus:
15092               case TokenType.FullStop:
15093               case TokenType.Solidus:
15094               case TokenType.Colon:
15095               case TokenType.Semicolon:
15096               case TokenType.LessThanSign:
15097               case TokenType.EqualsSign:
15098               case TokenType.GreaterThanSign:
15099               case TokenType.QuotationMark:
15100               case TokenType.CommercialAt:
15101               case TokenType.LeftSquareBracket:
15102               case TokenType.RightSquareBracket:
15103               case TokenType.CircumflexAccent:
15104               case TokenType.LowLine:
15105               case TokenType.LeftCurlyBracket:
15106               case TokenType.VerticalLine:
15107               case TokenType.RightCurlyBracket:
15108               case TokenType.Tilde:
15109                 i += 1;
15110                 break;
15111
15112               default:
15113                 return 0;
15114             }
15115           }
15116
15117           return i - start;
15118         }
15119
15120         /**
15121          * Check if content of URI can be contained within a raw node
15122          * @param {number} i Token's index number
15123          * @return {number} Length of raw node
15124          */
15125         function checkUriRaw(i) {
15126           var start = i;
15127           var l = void 0;
15128
15129           while (i < tokensLength) {
15130             if (checkInterpolation(i) || checkVariable(i)) break;else if (l = checkUriRawCharacters(i)) i += l;else break;
15131           }
15132
15133           tokens[start].uri_raw_end = i;
15134
15135           return i - start;
15136         }
15137
15138         /**
15139          * Get a raw node
15140          * @return {Node}
15141          */
15142         function getUriRaw() {
15143           var startPos = pos;
15144           var type = NodeType.RawType;
15145           var token = tokens[startPos];
15146           var line = token.ln;
15147           var column = token.col;
15148           var content = [];
15149           var l = void 0;
15150
15151           while (pos < tokens[startPos].uri_raw_end) {
15152             if (checkInterpolation(pos) || checkVariable(pos)) break;else if (l = checkUriRawCharacters(pos)) pos += l;else break;
15153           }
15154
15155           content = joinValues(startPos, pos - 1);
15156
15157           return newNode(type, content, line, column);
15158         }
15159
15160         /**
15161          * Check for a raw (without quotes) URI
15162          * (1) http://foo.com/bar.png
15163          * (2) http://foo.com/#{$bar}.png
15164          * (3) #{$foo}/bar.png
15165          * (4) #{$foo}
15166          * @param {number} i Token's index number
15167          * @return {number} Length of URI node
15168          */
15169         function checkUri1(i) {
15170           var start = i;
15171           var l = void 0;
15172
15173           if (l = checkSC(i)) i += l;
15174
15175           while (i < tokensLength) {
15176             if (l = checkInterpolation(i) || checkUriRaw(i)) i += l;else break;
15177           }
15178
15179           if (l = checkSC(i)) i += l;
15180
15181           // Check that we are at the end of the uri
15182           if (i < tokens[start - 1].right) return 0;
15183
15184           tokens[start].uri_end = i;
15185
15186           return i - start;
15187         }
15188
15189         /**
15190          * Get a raw (without quotes) URI
15191           node
15192          * @return {Array}
15193          */
15194         function getUri1() {
15195           var startPos = pos;
15196           var content = [];
15197
15198           if (checkSC(pos)) content = content.concat(getSC());
15199
15200           while (pos < tokens[startPos].uri_end) {
15201             if (checkInterpolation(pos)) content.push(getInterpolation());else if (checkUriRaw(pos)) content.push(getUriRaw());else break;
15202           }
15203
15204           if (checkSC(pos)) content = content.concat(getSC());
15205
15206           return content;
15207         }
15208
15209         /**
15210          * Check for a non-raw (with quotes) URI
15211          * (1) 'http://foo.com/bar.png'
15212          * (2) 'http://foo.com/'#{$bar}.png
15213          * (3) #{$foo}'/bar.png'
15214          * @param {number} i Token's index number
15215          * @return {number} Length of URI node
15216          */
15217         function checkUri2(i) {
15218           var start = i;
15219           var l = void 0;
15220
15221           while (i < tokensLength) {
15222             if (l = checkSC(i)) i += l;else if (l = checkString(i)) i += l;else if (l = checkFunction(i)) i += l;else if (l = checkUnary(i)) i += l;else if (l = checkIdentOrInterpolation(i)) i += l;else if (l = checkVariable(i)) i += l;else break;
15223           }
15224
15225           // Check that we are at the end of the uri
15226           if (i < tokens[start - 1].right) return 0;
15227
15228           tokens[start].uri_end = i;
15229
15230           return i - start;
15231         }
15232
15233         /**
15234          * Get a non-raw (with quotes) URI node
15235          * @return {Array}
15236          */
15237         function getUri2() {
15238           var startPos = pos;
15239           var content = [];
15240
15241           while (pos < tokens[startPos].uri_end) {
15242             if (checkSC(pos)) content = content.concat(getSC());else if (checkUnary(pos)) content.push(getUnary());else if (_checkValue(pos)) content.push(_getValue());else break;
15243           }
15244
15245           return content;
15246         }
15247
15248         /**
15249          * Check if token is part of a value
15250          * @param {number} i Token's index number
15251          * @return {number} Length of the value
15252          */
15253         function checkValue(i) {
15254           var start = i;
15255           var l = void 0;
15256           var s = void 0;
15257           var _i = void 0;
15258
15259           while (i < tokensLength) {
15260             if (checkDeclDelim(i)) break;
15261
15262             if (l = checkBlock(i)) {
15263               i += l;
15264               break;
15265             }
15266
15267             s = checkS(i);
15268             _i = i + s;
15269
15270             if (l = _checkValue(_i)) i += l + s;
15271             if (!l || checkBlock(i - l)) break;
15272           }
15273
15274           return i - start;
15275         }
15276
15277         /**
15278          * @return {Array}
15279          */
15280         function getValue() {
15281           var type = NodeType.ValueType;
15282           var token = tokens[pos];
15283           var line = token.ln;
15284           var column = token.col;
15285           var content = [];
15286           var _pos = void 0;
15287           var s = void 0;
15288
15289           while (pos < tokensLength) {
15290             if (checkDeclDelim(pos)) break;
15291
15292             s = checkS(pos);
15293             _pos = pos + s;
15294
15295             if (checkDeclDelim(_pos)) break;
15296
15297             if (checkBlock(pos)) {
15298               content.push(getBlock());
15299               break;
15300             }
15301
15302             if (!_checkValue(_pos)) break;
15303
15304             if (s) content.push(getS());
15305             content.push(_getValue());
15306
15307             if (checkBlock(_pos)) break;
15308           }
15309
15310           return newNode(type, content, line, column);
15311         }
15312
15313         /**
15314          * @param {number} i Token's index number
15315          * @return {number}
15316          */
15317         function _checkValue(i) {
15318           var l = void 0;
15319
15320           if (l = checkInterpolation(i)) tokens[i].value_child = 1;else if (l = checkVariable(i)) tokens[i].value_child = 2;else if (l = checkVhash(i)) tokens[i].value_child = 3;else if (l = checkBlock(i)) tokens[i].value_child = 4;else if (l = checkAtkeyword(i)) tokens[i].value_child = 5;else if (l = checkOperator(i)) tokens[i].value_child = 6;else if (l = checkImportant(i)) tokens[i].value_child = 7;else if (l = checkGlobal(i)) tokens[i].value_child = 8;else if (l = checkDefault(i)) tokens[i].value_child = 9;else if (l = checkProgid(i)) tokens[i].value_child = 10;else if (l = checkAny(i)) tokens[i].value_child = 11;else if (l = checkParentSelector(i)) tokens[i].value_child = 12;
15321
15322           return l;
15323         }
15324
15325         /**
15326          * @return {Array}
15327          */
15328         function _getValue() {
15329           var childType = tokens[pos].value_child;
15330           if (childType === 1) return getInterpolation();
15331           if (childType === 2) return getVariable();
15332           if (childType === 3) return getVhash();
15333           if (childType === 4) return getBlock();
15334           if (childType === 5) return getAtkeyword();
15335           if (childType === 6) return getOperator();
15336           if (childType === 7) return getImportant();
15337           if (childType === 8) return getGlobal();
15338           if (childType === 9) return getDefault();
15339           if (childType === 10) return getProgid();
15340           if (childType === 11) return getAny();
15341           if (childType === 12) return getParentSelector();
15342         }
15343
15344         /**
15345          * @param {number} i Token's index number
15346          * @returns {number} Length of the value
15347          */
15348         function checkSingleValue(i) {
15349           var start = i;
15350           var l = void 0;
15351           var s = void 0;
15352           var _i = void 0;
15353
15354           while (i < tokensLength) {
15355             if (checkDeclDelim(i) || checkDelim(i)) break;
15356
15357             if (l = checkBlock(i)) {
15358               i += l;
15359               break;
15360             }
15361
15362             s = checkSC(i);
15363             _i = i + s;
15364
15365             if (l = _checkValue(_i)) i += l + s;
15366             if (!l || checkBlock(i - l)) break;
15367           }
15368
15369           return i - start;
15370         }
15371
15372         /**
15373          * @returns {Array}
15374          */
15375         function getSingleValue() {
15376           var type = NodeType.ValueType;
15377           var token = tokens[pos];
15378           var line = token.ln;
15379           var column = token.col;
15380           var content = [];
15381           var _pos = void 0;
15382           var s = void 0;
15383
15384           while (pos < tokensLength) {
15385             if (checkDeclDelim(pos) || checkDelim(pos)) break;
15386
15387             s = checkSC(pos);
15388             _pos = pos + s;
15389
15390             if (checkDeclDelim(_pos) || checkDelim(_pos)) break;
15391
15392             if (checkBlock(pos)) {
15393               content.push(getBlock());
15394               break;
15395             }
15396
15397             if (!_checkValue(_pos)) break;
15398
15399             if (s) content.push(getS());
15400             content.push(_getValue());
15401
15402             if (checkBlock(_pos)) break;
15403           }
15404
15405           return newNode(type, content, line, column);
15406         }
15407
15408         /**
15409          * Check if token is part of a variable
15410          * @param {number} i Token's index number
15411          * @return {number} Length of the variable
15412          */
15413         function checkVariable(i) {
15414           var start = i;
15415           var l = void 0;
15416
15417           if (i >= tokensLength) return 0;
15418
15419           // Skip `$`.
15420           if (tokens[i].type === TokenType.DollarSign) i++;else return 0;
15421
15422           if (l = checkIdent(i)) i += l;else return 0;
15423
15424           return i - start;
15425         }
15426
15427         /**
15428          * Get node with a variable
15429          * @return {Array} `['variable', ['ident', x]]` where `x` is
15430          *      a variable name.
15431          */
15432         function getVariable() {
15433           var type = NodeType.VariableType;
15434           var token = tokens[pos];
15435           var line = token.ln;
15436           var column = token.col;
15437
15438           // Skip `$`.
15439           pos++;
15440
15441           var content = [getIdent()];
15442
15443           return newNode(type, content, line, column);
15444         }
15445
15446         /**
15447          * Check if token is part of a variables list (e.g. `$values...`).
15448          * @param {number} i Token's index number
15449          * @return {number}
15450          */
15451         function checkVariablesList(i) {
15452           var d = 0; // Number of dots
15453           var l = void 0;
15454
15455           if (i >= tokensLength) return 0;
15456
15457           if (l = checkVariable(i)) i += l;else return 0;
15458
15459           while (i < tokensLength && tokens[i].type === TokenType.FullStop) {
15460             d++;
15461             i++;
15462           }
15463
15464           return d === 3 ? l + d : 0;
15465         }
15466
15467         /**
15468          * Get node with a variables list
15469          * @return {Array} `['variableslist', ['variable', ['ident', x]]]` where
15470          *      `x` is a variable name.
15471          */
15472         function getVariablesList() {
15473           var type = NodeType.VariablesListType;
15474           var token = tokens[pos];
15475           var line = token.ln;
15476           var column = token.col;
15477           var content = [getVariable()];
15478           var end = getLastPosition(content, line, column, 3);
15479
15480           // Skip `...`.
15481           pos += 3;
15482
15483           return newNode(type, content, line, column, end);
15484         }
15485
15486         /**
15487          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside
15488          *      some value
15489          * @param {number} i Token's index number
15490          * @return {number}
15491          */
15492         function checkVhash(i) {
15493           var start = i;
15494           var l = void 0;
15495
15496           if (i >= tokensLength) return 0;
15497
15498           // Skip `#`.
15499           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
15500
15501           if (l = checkNmName2(i)) i += l;else return 0;
15502
15503           return i - start;
15504         }
15505
15506         /**
15507          * Get node with a hexadecimal number (e.g. `#fff`) inside some value
15508          * @return {Array} `['vhash', x]` where `x` is a hexadecimal number
15509          *      converted to string (without `#`, e.g. `'fff'`).
15510          */
15511         function getVhash() {
15512           var type = NodeType.VhashType;
15513           var token = tokens[pos];
15514           var line = token.ln;
15515           var column = token.col;
15516
15517           // Skip `#`.
15518           pos++;
15519
15520           var content = getNmName2();
15521           var end = getLastPosition(content, line, column + 1);
15522           return newNode(type, content, line, column, end);
15523         }
15524
15525         function checkSelectorsGroup(i) {
15526           if (i >= tokensLength) return 0;
15527
15528           var start = i;
15529           var l = void 0;
15530
15531           if (l = checkSelector(i)) i += l;else return 0;
15532
15533           while (i < tokensLength) {
15534             var spaceBefore = checkSC(i);
15535             var comma = checkDelim(i + spaceBefore);
15536             if (!comma) break;
15537
15538             var spaceAfter = checkMultilineSC(i + spaceBefore + comma);
15539             var spaceEnd = spaceAfter ? checkMultilineSC(i + spaceBefore + comma + spaceAfter) : 0;
15540
15541             if (l = checkSelector(i + spaceBefore + comma + spaceAfter + spaceEnd)) i += spaceBefore + comma + spaceAfter + spaceEnd + l;else break;
15542           }
15543
15544           tokens[start].selectorsGroupEnd = i;
15545           return i - start;
15546         }
15547
15548         function getSelectorsGroup() {
15549           var selectorsGroup = [];
15550           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
15551
15552           selectorsGroup.push(getSelector());
15553
15554           while (pos < selectorsGroupEnd) {
15555             selectorsGroup = selectorsGroup.concat(getMultilineSC(), getDelim(), getMultilineSC(), getSelector());
15556           }
15557
15558           return selectorsGroup;
15559         }
15560
15561         function checkSelector(i) {
15562           var l = void 0;
15563
15564           if (l = checkSelector1(i)) tokens[i].selectorType = 1;else if (l = checkSelector2(i)) tokens[i].selectorType = 2;
15565
15566           return l;
15567         }
15568
15569         function getSelector() {
15570           var selectorType = tokens[pos].selectorType;
15571           if (selectorType === 1) return getSelector1();else return getSelector2();
15572         }
15573
15574         /**
15575          * Checks for selector which starts with a compound selector.
15576          */
15577         function checkSelector1(i) {
15578           if (i >= tokensLength) return 0;
15579
15580           var start = i;
15581           var l = void 0;
15582
15583           if (l = checkCompoundSelector(i)) i += l;else return 0;
15584
15585           while (i < tokensLength) {
15586             var space = checkSC(i);
15587             var comma = checkCombinator(i + space);
15588             if (!space && !comma) break;
15589
15590             if (comma) {
15591               i += space + comma;
15592               space = checkSC(i);
15593             }
15594
15595             if (l = checkCompoundSelector(i + space)) i += space + l;else break;
15596           }
15597
15598           tokens[start].selectorEnd = i;
15599           return i - start;
15600         }
15601
15602         function getSelector1() {
15603           var type = NodeType.SelectorType;
15604           var token = tokens[pos];
15605           var line = token.ln;
15606           var column = token.col;
15607           var selectorEnd = token.selectorEnd;
15608           var content = getCompoundSelector();
15609
15610           while (pos < selectorEnd) {
15611             if (checkSC(pos)) content = content.concat(getSC());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkCompoundSelector(pos)) content = content.concat(getCompoundSelector());
15612           }
15613
15614           return newNode(type, content, line, column);
15615         }
15616
15617         /**
15618          * Checks for a selector that starts with a combinator.
15619          */
15620         function checkSelector2(i) {
15621           if (i >= tokensLength) return 0;
15622
15623           var start = i;
15624           var l = void 0;
15625
15626           if (l = checkCombinator(i)) i += l;else return 0;
15627
15628           while (i < tokensLength) {
15629             var spaceBefore = checkSC(i);
15630             if (l = checkCompoundSelector(i + spaceBefore)) i += spaceBefore + l;else break;
15631
15632             var spaceAfter = checkSC(i);
15633             var comma = checkCombinator(i + spaceAfter);
15634             if (!spaceAfter && !comma) break;
15635             if (comma) {
15636               i += spaceAfter + comma;
15637             }
15638           }
15639
15640           tokens[start].selectorEnd = i;
15641           return i - start;
15642         }
15643
15644         function getSelector2() {
15645           var type = NodeType.SelectorType;
15646           var token = tokens[pos];
15647           var line = token.ln;
15648           var column = token.col;
15649           var selectorEnd = token.selectorEnd;
15650           var content = [getCombinator()];
15651
15652           while (pos < selectorEnd) {
15653             if (checkSC(pos)) content = content.concat(getSC());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkCompoundSelector(pos)) content = content.concat(getCompoundSelector());
15654           }
15655
15656           return newNode(type, content, line, column);
15657         }
15658
15659         function checkCompoundSelector(i) {
15660           var l = void 0;
15661
15662           if (l = checkCompoundSelector1(i)) {
15663             tokens[i].compoundSelectorType = 1;
15664           } else if (l = checkCompoundSelector2(i)) {
15665             tokens[i].compoundSelectorType = 2;
15666           }
15667
15668           return l;
15669         }
15670
15671         function getCompoundSelector() {
15672           var type = tokens[pos].compoundSelectorType;
15673           if (type === 1) return getCompoundSelector1();
15674           if (type === 2) return getCompoundSelector2();
15675         }
15676
15677         /**
15678          * Check for compound selectors that start with either a type selector,
15679          * placeholder or parent selector with extension
15680          * (1) `foo.bar`
15681          * (2) `foo[attr=val]`
15682          * (3) `foo:first-of-type`
15683          * (4) `foo%bar`
15684          * @param {number} i Token's index
15685          * @return {number} Compound selector's length
15686          */
15687         function checkCompoundSelector1(i) {
15688           if (i >= tokensLength) return 0;
15689
15690           var start = i;
15691           var l = void 0;
15692
15693           if (l = checkUniversalSelector(i) || checkTypeSelector(i) || checkPlaceholder(i) || checkParentSelectorWithExtension(i)) i += l;else return 0;
15694
15695           while (i < tokensLength) {
15696             var _l2 = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i) || checkPlaceholder(i) || checkInterpolation(i);
15697
15698             if (_l2) i += _l2;else break;
15699           }
15700
15701           tokens[start].compoundSelectorEnd = i;
15702
15703           return i - start;
15704         }
15705
15706         /**
15707          * @return {Array} An array of nodes that make up the compound selector
15708          */
15709         function getCompoundSelector1() {
15710           var sequence = [];
15711           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
15712
15713           if (checkUniversalSelector(pos)) sequence.push(getUniversalSelector());else if (checkTypeSelector(pos)) sequence.push(getTypeSelector());else if (checkPlaceholder(pos)) sequence.push(getPlaceholder());else if (checkParentSelectorWithExtension(pos)) sequence = sequence.concat(getParentSelectorWithExtension());
15714
15715           while (pos < compoundSelectorEnd) {
15716             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());else if (checkPlaceholder(pos)) sequence.push(getPlaceholder());else if (checkInterpolation(pos)) sequence.push(getInterpolation());else break;
15717           }
15718
15719           return sequence;
15720         }
15721
15722         /**
15723          * Check for all other compound selectors
15724          * (1) `.foo.bar`
15725          * (2) `.foo[attr=val]`
15726          * (3) `.foo:first-of-type`
15727          * (4) `.foo%bar`
15728          * (5) `.foo#{$bar}`
15729          * @param {number} i Token's index
15730          * @return {number} Compound selector's length
15731          */
15732         function checkCompoundSelector2(i) {
15733           if (i >= tokensLength) return 0;
15734
15735           var start = i;
15736
15737           while (i < tokensLength) {
15738             var l = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i) || checkPlaceholder(i) || checkInterpolation(i);
15739
15740             if (l) i += l;else break;
15741           }
15742
15743           tokens[start].compoundSelectorEnd = i;
15744
15745           return i - start;
15746         }
15747
15748         /**
15749          * @return {Array} An array of nodes that make up the compound selector
15750          */
15751         function getCompoundSelector2() {
15752           var sequence = [];
15753           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
15754
15755           while (pos < compoundSelectorEnd) {
15756             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());else if (checkPlaceholder(pos)) sequence.push(getPlaceholder());else if (checkInterpolation(pos)) sequence.push(getInterpolation());else break;
15757           }
15758
15759           return sequence;
15760         }
15761
15762         function checkUniversalSelector(i) {
15763           if (i >= tokensLength) return 0;
15764
15765           var start = i;
15766           var l = void 0;
15767
15768           if (l = checkNamePrefix(i)) i += l;
15769
15770           if (tokens[i].type === TokenType.Asterisk) i++;else return 0;
15771
15772           return i - start;
15773         }
15774
15775         function getUniversalSelector() {
15776           var type = NodeType.UniversalSelectorType;
15777           var token = tokens[pos];
15778           var line = token.ln;
15779           var column = token.col;
15780           var content = [];
15781           var end = void 0;
15782
15783           if (checkNamePrefix(pos)) {
15784             content.push(getNamePrefix());
15785             end = getLastPosition(content, line, column, 1);
15786           }
15787
15788           pos++;
15789
15790           return newNode(type, content, line, column, end);
15791         }
15792
15793         /**
15794          * Check if token is part of a type selector
15795          * @param {number} i Token's index
15796          * @return {number} Type selector's length
15797          */
15798         function checkTypeSelector(i) {
15799           if (i >= tokensLength) return 0;
15800
15801           var start = i;
15802           var l = void 0;
15803
15804           if (l = checkNamePrefix(i)) i += l;
15805
15806           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
15807
15808           return i - start;
15809         }
15810
15811         /**
15812          * Get type selector node
15813          * @return {Node}
15814          */
15815         function getTypeSelector() {
15816           var type = NodeType.TypeSelectorType;
15817           var token = tokens[pos];
15818           var line = token.ln;
15819           var column = token.col;
15820           var content = [];
15821
15822           if (checkNamePrefix(pos)) content.push(getNamePrefix());
15823
15824           content = content.concat(getIdentOrInterpolation());
15825
15826           return newNode(type, content, line, column);
15827         }
15828
15829         function checkAttributeSelector(i) {
15830           var l = void 0;
15831           if (l = checkAttributeSelector1(i)) tokens[i].attributeSelectorType = 1;else if (l = checkAttributeSelector2(i)) tokens[i].attributeSelectorType = 2;
15832
15833           return l;
15834         }
15835
15836         function getAttributeSelector() {
15837           var type = tokens[pos].attributeSelectorType;
15838           if (type === 1) return getAttributeSelector1();else return getAttributeSelector2();
15839         }
15840
15841         /**
15842          * (1) `[panda=nani]`
15843          * (2) `[panda='nani']`
15844          * (3) `[panda='nani' i]`
15845          *
15846          */
15847         function checkAttributeSelector1(i) {
15848           var start = i;
15849
15850           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
15851
15852           var l = void 0;
15853           if (l = checkSC(i)) i += l;
15854
15855           if (l = checkAttributeName(i)) i += l;else return 0;
15856
15857           if (l = checkSC(i)) i += l;
15858
15859           if (l = checkAttributeMatch(i)) i += l;else return 0;
15860
15861           if (l = checkSC(i)) i += l;
15862
15863           if (l = checkAttributeValue(i)) i += l;else return 0;
15864
15865           if (l = checkSC(i)) i += l;
15866
15867           if (l = checkAttributeFlags(i)) {
15868             i += l;
15869             if (l = checkSC(i)) i += l;
15870           }
15871
15872           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
15873
15874           return i - start;
15875         }
15876
15877         function getAttributeSelector1() {
15878           var type = NodeType.AttributeSelectorType;
15879           var token = tokens[pos];
15880           var line = token.ln;
15881           var column = token.col;
15882           var content = [];
15883
15884           // Skip `[`.
15885           pos++;
15886
15887           content = content.concat(getSC(), getAttributeName(), getSC(), getAttributeMatch(), getSC(), getAttributeValue(), getSC());
15888
15889           if (checkAttributeFlags(pos)) {
15890             content.push(getAttributeFlags());
15891             content = content.concat(getSC());
15892           }
15893
15894           // Skip `]`.
15895           pos++;
15896
15897           var end = getLastPosition(content, line, column, 1);
15898           return newNode(type, content, line, column, end);
15899         }
15900
15901         /**
15902          * (1) `[panda]`
15903          */
15904         function checkAttributeSelector2(i) {
15905           var start = i;
15906
15907           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
15908
15909           var l = void 0;
15910           if (l = checkSC(i)) i += l;
15911
15912           if (l = checkAttributeName(i)) i += l;else return 0;
15913
15914           if (l = checkSC(i)) i += l;
15915
15916           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
15917
15918           return i - start;
15919         }
15920
15921         function getAttributeSelector2() {
15922           var type = NodeType.AttributeSelectorType;
15923           var token = tokens[pos];
15924           var line = token.ln;
15925           var column = token.col;
15926           var content = [];
15927
15928           // Skip `[`.
15929           pos++;
15930
15931           content = content.concat(getSC(), getAttributeName(), getSC());
15932
15933           // Skip `]`.
15934           pos++;
15935
15936           var end = getLastPosition(content, line, column, 1);
15937           return newNode(type, content, line, column, end);
15938         }
15939
15940         function checkAttributeName(i) {
15941           var start = i;
15942           var l = void 0;
15943
15944           if (l = checkNamePrefix(i)) i += l;
15945
15946           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
15947
15948           return i - start;
15949         }
15950
15951         function getAttributeName() {
15952           var type = NodeType.AttributeNameType;
15953           var token = tokens[pos];
15954           var line = token.ln;
15955           var column = token.col;
15956           var content = [];
15957
15958           if (checkNamePrefix(pos)) content.push(getNamePrefix());
15959           content = content.concat(getIdentOrInterpolation());
15960
15961           return newNode(type, content, line, column);
15962         }
15963
15964         function checkAttributeMatch(i) {
15965           var l = void 0;
15966           if (l = checkAttributeMatch1(i)) tokens[i].attributeMatchType = 1;else if (l = checkAttributeMatch2(i)) tokens[i].attributeMatchType = 2;
15967
15968           return l;
15969         }
15970
15971         function getAttributeMatch() {
15972           var type = tokens[pos].attributeMatchType;
15973           if (type === 1) return getAttributeMatch1();else return getAttributeMatch2();
15974         }
15975
15976         function checkAttributeMatch1(i) {
15977           var start = i;
15978
15979           var type = tokens[i].type;
15980           if (type === TokenType.Tilde || type === TokenType.VerticalLine || type === TokenType.CircumflexAccent || type === TokenType.DollarSign || type === TokenType.Asterisk) i++;else return 0;
15981
15982           if (tokens[i].type === TokenType.EqualsSign) i++;else return 0;
15983
15984           return i - start;
15985         }
15986
15987         function getAttributeMatch1() {
15988           var type = NodeType.AttributeMatchType;
15989           var token = tokens[pos];
15990           var line = token.ln;
15991           var column = token.col;
15992           var content = tokens[pos].value + tokens[pos + 1].value;
15993           pos += 2;
15994
15995           return newNode(type, content, line, column);
15996         }
15997
15998         function checkAttributeMatch2(i) {
15999           if (tokens[i].type === TokenType.EqualsSign) return 1;else return 0;
16000         }
16001
16002         function getAttributeMatch2() {
16003           var type = NodeType.AttributeMatchType;
16004           var token = tokens[pos];
16005           var line = token.ln;
16006           var column = token.col;
16007           var content = '=';
16008
16009           pos++;
16010           return newNode(type, content, line, column);
16011         }
16012
16013         function checkAttributeValue(i) {
16014           return checkString(i) || checkIdentOrInterpolation(i);
16015         }
16016
16017         function getAttributeValue() {
16018           var type = NodeType.AttributeValueType;
16019           var token = tokens[pos];
16020           var line = token.ln;
16021           var column = token.col;
16022           var content = [];
16023
16024           if (checkString(pos)) content.push(getString());else content = content.concat(getIdentOrInterpolation());
16025
16026           return newNode(type, content, line, column);
16027         }
16028
16029         function checkAttributeFlags(i) {
16030           return checkIdentOrInterpolation(i);
16031         }
16032
16033         function getAttributeFlags() {
16034           var type = NodeType.AttributeFlagsType;
16035           var token = tokens[pos];
16036           var line = token.ln;
16037           var column = token.col;
16038           var content = getIdentOrInterpolation();
16039
16040           return newNode(type, content, line, column);
16041         }
16042
16043         function checkNamePrefix(i) {
16044           if (i >= tokensLength) return 0;
16045
16046           var l = void 0;
16047           if (l = checkNamePrefix1(i)) tokens[i].namePrefixType = 1;else if (l = checkNamePrefix2(i)) tokens[i].namePrefixType = 2;
16048
16049           return l;
16050         }
16051
16052         function getNamePrefix() {
16053           var type = tokens[pos].namePrefixType;
16054           if (type === 1) return getNamePrefix1();else return getNamePrefix2();
16055         }
16056
16057         /**
16058          * (1) `panda|`
16059          * (2) `panda<comment>|`
16060          */
16061         function checkNamePrefix1(i) {
16062           var start = i;
16063           var l = void 0;
16064
16065           if (l = checkNamespacePrefix(i)) i += l;else return 0;
16066
16067           if (l = checkCommentML(i)) i += l;
16068
16069           if (l = checkNamespaceSeparator(i)) i += l;else return 0;
16070
16071           return i - start;
16072         }
16073
16074         function getNamePrefix1() {
16075           var type = NodeType.NamePrefixType;
16076           var token = tokens[pos];
16077           var line = token.ln;
16078           var column = token.col;
16079           var content = [];
16080
16081           content.push(getNamespacePrefix());
16082
16083           if (checkCommentML(pos)) content.push(getCommentML());
16084
16085           content.push(getNamespaceSeparator());
16086
16087           return newNode(type, content, line, column);
16088         }
16089
16090         /**
16091          * (1) `|`
16092          */
16093         function checkNamePrefix2(i) {
16094           return checkNamespaceSeparator(i);
16095         }
16096
16097         function getNamePrefix2() {
16098           var type = NodeType.NamePrefixType;
16099           var token = tokens[pos];
16100           var line = token.ln;
16101           var column = token.col;
16102           var content = [getNamespaceSeparator()];
16103
16104           return newNode(type, content, line, column);
16105         }
16106
16107         /**
16108          * (1) `*`
16109          * (2) `panda`
16110          */
16111         function checkNamespacePrefix(i) {
16112           if (i >= tokensLength) return 0;
16113
16114           var l = void 0;
16115
16116           if (tokens[i].type === TokenType.Asterisk) return 1;else if (l = checkIdentOrInterpolation(i)) return l;else return 0;
16117         }
16118
16119         function getNamespacePrefix() {
16120           var type = NodeType.NamespacePrefixType;
16121           var token = tokens[pos];
16122           var line = token.ln;
16123           var column = token.col;
16124           var content = [];
16125
16126           if (token.type === TokenType.Asterisk) {
16127             var asteriskNode = newNode(NodeType.IdentType, '*', line, column);
16128             content.push(asteriskNode);
16129             pos++;
16130           } else if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());
16131
16132           return newNode(type, content, line, column);
16133         }
16134
16135         /**
16136          * (1) `|`
16137          */
16138         function checkNamespaceSeparator(i) {
16139           if (i >= tokensLength) return 0;
16140
16141           if (tokens[i].type !== TokenType.VerticalLine) return 0;
16142
16143           // Return false if `|=` - [attr|=value]
16144           if (tokens[i + 1] && tokens[i + 1].type === TokenType.EqualsSign) return 0;
16145
16146           return 1;
16147         }
16148
16149         function getNamespaceSeparator() {
16150           var type = NodeType.NamespaceSeparatorType;
16151           var token = tokens[pos];
16152           var line = token.ln;
16153           var column = token.col;
16154           var content = '|';
16155
16156           pos++;
16157           return newNode(type, content, line, column);
16158         }
16159
16160         module.exports = function (_tokens, context) {
16161           tokens = _tokens;
16162           tokensLength = tokens.length;
16163           pos = 0;
16164
16165           return contexts[context]();
16166         };
16167
16168 /***/ }),
16169 /* 24 */
16170 /***/ (function(module, exports, __webpack_require__) {
16171
16172         'use strict';
16173
16174         module.exports = function (css, tabSize) {
16175           var TokenType = __webpack_require__(13);
16176
16177           var tokens = [];
16178           var urlMode = false;
16179           var c = void 0; // Current character
16180           var cn = void 0; // Next character
16181           var pos = 0;
16182           var tn = 0;
16183           var ln = 1;
16184           var col = 1;
16185
16186           var Punctuation = {
16187             ' ': TokenType.Space,
16188             '\n': TokenType.Newline,
16189             '\r': TokenType.Newline,
16190             '\t': TokenType.Tab,
16191             '!': TokenType.ExclamationMark,
16192             '"': TokenType.QuotationMark,
16193             '#': TokenType.NumberSign,
16194             '$': TokenType.DollarSign,
16195             '%': TokenType.PercentSign,
16196             '&': TokenType.Ampersand,
16197             '\'': TokenType.Apostrophe,
16198             '(': TokenType.LeftParenthesis,
16199             ')': TokenType.RightParenthesis,
16200             '*': TokenType.Asterisk,
16201             '+': TokenType.PlusSign,
16202             ',': TokenType.Comma,
16203             '-': TokenType.HyphenMinus,
16204             '.': TokenType.FullStop,
16205             '/': TokenType.Solidus,
16206             ':': TokenType.Colon,
16207             ';': TokenType.Semicolon,
16208             '<': TokenType.LessThanSign,
16209             '=': TokenType.EqualsSign,
16210             '==': TokenType.EqualitySign,
16211             '!=': TokenType.InequalitySign,
16212             '>': TokenType.GreaterThanSign,
16213             '?': TokenType.QuestionMark,
16214             '@': TokenType.CommercialAt,
16215             '[': TokenType.LeftSquareBracket,
16216             ']': TokenType.RightSquareBracket,
16217             '^': TokenType.CircumflexAccent,
16218             '_': TokenType.LowLine,
16219             '{': TokenType.LeftCurlyBracket,
16220             '|': TokenType.VerticalLine,
16221             '}': TokenType.RightCurlyBracket,
16222             '~': TokenType.Tilde,
16223             '`': TokenType.Backtick
16224           };
16225
16226           /**
16227            * Add a token to the token list
16228            * @param {string} type
16229            * @param {string} value
16230            */
16231           function pushToken(type, value, column) {
16232             tokens.push({
16233               tn: tn++,
16234               ln: ln,
16235               col: column,
16236               type: type,
16237               value: value
16238             });
16239           }
16240
16241           /**
16242            * Check if a character is a decimal digit
16243            * @param {string} c Character
16244            * @returns {boolean}
16245            */
16246           function isDecimalDigit(c) {
16247             return '0123456789'.indexOf(c) >= 0;
16248           }
16249
16250           /**
16251            * Parse spaces
16252            * @param {string} css Unparsed part of CSS string
16253            */
16254           function parseSpaces(css) {
16255             var start = pos;
16256
16257             // Read the string until we meet a non-space character:
16258             for (; pos < css.length; pos++) {
16259               if (css.charAt(pos) !== ' ') break;
16260             }
16261
16262             // Add a substring containing only spaces to tokens:
16263             pushToken(TokenType.Space, css.substring(start, pos--), col);
16264             col += pos - start;
16265           }
16266
16267           /**
16268            * Parse a string within quotes
16269            * @param {string} css Unparsed part of CSS string
16270            * @param {string} q Quote (either `'` or `"`)
16271            */
16272           function parseString(css, q) {
16273             var start = pos;
16274
16275             // Read the string until we meet a matching quote:
16276             for (pos++; pos < css.length; pos++) {
16277               // Skip escaped quotes:
16278               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) === q) break;
16279             }
16280
16281             // Add the string (including quotes) to tokens:
16282             var type = q === '"' ? TokenType.StringDQ : TokenType.StringSQ;
16283             pushToken(type, css.substring(start, pos + 1), col);
16284             col += pos - start;
16285           }
16286
16287           /**
16288            * Parse numbers
16289            * @param {string} css Unparsed part of CSS string
16290            */
16291           function parseDecimalNumber(css) {
16292             var start = pos;
16293
16294             // Read the string until we meet a character that's not a digit:
16295             for (; pos < css.length; pos++) {
16296               if (!isDecimalDigit(css.charAt(pos))) break;
16297             }
16298
16299             // Add the number to tokens:
16300             pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col);
16301             col += pos - start;
16302           }
16303
16304           /**
16305            * Parse identifier
16306            * @param {string} css Unparsed part of CSS string
16307            */
16308           function parseIdentifier(css) {
16309             var start = pos;
16310
16311             // Skip all opening slashes:
16312             while (css.charAt(pos) === '/') {
16313               pos++;
16314             } // Read the string until we meet a punctuation mark:
16315             for (; pos < css.length; pos++) {
16316               // Skip all '\':
16317               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) in Punctuation) break;
16318             }
16319
16320             var ident = css.substring(start, pos--);
16321
16322             // Enter url mode if parsed substring is `url`:
16323             if (!urlMode && ident === 'url' && css.charAt(pos + 1) === '(') {
16324               urlMode = true;
16325             }
16326
16327             // Add identifier to tokens:
16328             pushToken(TokenType.Identifier, ident, col);
16329             col += pos - start;
16330           }
16331
16332           /**
16333            * Parse equality sign
16334            */
16335           function parseEquality() {
16336             pushToken(TokenType.EqualitySign, '==', col);
16337             pos++;
16338             col++;
16339           }
16340
16341           /**
16342            * Parse inequality sign
16343            */
16344           function parseInequality() {
16345             pushToken(TokenType.InequalitySign, '!=', col);
16346             pos++;
16347             col++;
16348           }
16349
16350           /**
16351           * Parse a multiline comment
16352           * @param {string} css Unparsed part of CSS string
16353           */
16354           function parseMLComment(css) {
16355             var start = pos;
16356             var col_ = col;
16357
16358             // Get current indent level:
16359             var il = 0;
16360             for (var _pos = pos - 1; _pos > -1; _pos--) {
16361               // TODO: Can be tabs:
16362               if (css.charAt(_pos) === ' ') il++;else break;
16363             }
16364
16365             for (pos += 2; pos < css.length; pos++) {
16366               var ch = css.charAt(pos);
16367               if (ch === '\n') {
16368                 var _pos2 = void 0;
16369                 // Get new line's indent level:
16370                 var _il = 0;
16371                 for (_pos2 = pos + 1; _pos2 < css.length; _pos2++) {
16372                   if (css.charAt(_pos2) === ' ') _il++;else break;
16373                 }
16374
16375                 if (_il > il) {
16376                   col = 0;
16377                   pos += _pos2 - pos;
16378                 } else {
16379                   pos--;
16380                   break;
16381                 }
16382               } else if (ch === '*' && css.charAt(pos + 1) === '/') {
16383                 pos++;
16384                 break;
16385               }
16386             }
16387
16388             // If CRLF is used, we need to adjust pos
16389             if (css.charAt(pos) === '\r') pos--;
16390
16391             // Add full comment (including `/*`) to the list of tokens:
16392             var comment = css.substring(start, pos + 1);
16393             pushToken(TokenType.CommentML, comment, col_);
16394
16395             var newlines = comment.split('\n');
16396             if (newlines.length > 1) {
16397               ln += newlines.length - 1;
16398               col = newlines[newlines.length - 1].length;
16399             } else {
16400               col += pos - start;
16401             }
16402           }
16403
16404           /**
16405           * Parse a single line comment
16406           * @param {string} css Unparsed part of CSS string
16407           */
16408           function parseSLComment(css) {
16409             var start = pos;
16410             var col_ = col;
16411             var _pos;
16412
16413             // Check if comment is the only token on the line, and if so,
16414             // get current indent level:
16415             var il = 0;
16416             var onlyToken = false;
16417             for (_pos = pos - 1; _pos > -1; _pos--) {
16418               // TODO: Can be tabs:
16419               if (css.charAt(_pos) === ' ') il++;else if (css.charAt(_pos) === '\n') {
16420                 onlyToken = true;
16421                 break;
16422               } else break;
16423             }
16424             if (_pos === -1) onlyToken = true;
16425
16426             // Read the string until we meet comment end.
16427             // Since we already know first 2 characters (`//`), start reading
16428             // from `pos + 2`:
16429             if (!onlyToken) {
16430               for (pos += 2; pos < css.length; pos++) {
16431                 if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') {
16432                   break;
16433                 }
16434               }
16435             } else {
16436               for (pos += 2; pos < css.length; pos++) {
16437                 var ch = css.charAt(pos);
16438                 if (ch === '\n') {
16439                   // Get new line's indent level:
16440                   var _il = 0;
16441                   for (_pos = pos + 1; _pos < css.length; _pos++) {
16442                     if (css.charAt(_pos) === ' ') _il++;else break;
16443                   }
16444
16445                   if (_il > il) {
16446                     col = 0;
16447                     pos += _pos - pos;
16448                   } else {
16449                     break;
16450                   }
16451                 }
16452               }
16453             }
16454
16455             // If CRLF is used, we need to adjust pos
16456             if (css.charAt(pos - 1) === '\r') pos--;
16457
16458             // Add comment (including `//` and line break) to the list of tokens:
16459             var comment = css.substring(start, pos--);
16460             pushToken(TokenType.CommentSL, comment, col_);
16461
16462             var newlines = comment.split('\n');
16463             if (newlines.length > 1) {
16464               ln += newlines.length - 1;
16465               col = newlines[newlines.length - 1].length;
16466             } else {
16467               col += pos - start;
16468             }
16469           }
16470
16471           /**
16472            * Convert a CSS string to a list of tokens
16473            * @param {string} css CSS string
16474            * @returns {Array} List of tokens
16475            * @private
16476            */
16477           function getTokens(css) {
16478             // Parse string, character by character:
16479             for (pos = 0; pos < css.length; col++, pos++) {
16480               c = css.charAt(pos);
16481               cn = css.charAt(pos + 1);
16482
16483               // If we meet `/*`, it's a start of a multiline comment.
16484               // Parse following characters as a multiline comment:
16485               if (c === '/' && cn === '*') {
16486                 parseMLComment(css);
16487               }
16488
16489               // If we meet `//` and it is not a part of url:
16490               else if (!urlMode && c === '/' && cn === '/') {
16491                   // If we're currently inside a block, treat `//` as a start
16492                   // of identifier. Else treat `//` as a start of a single-line
16493                   // comment:
16494                   parseSLComment(css);
16495                 }
16496
16497                 // If current character is a double or single quote, it's a start
16498                 // of a string:
16499                 else if (c === '"' || c === "'") {
16500                     parseString(css, c);
16501                   }
16502
16503                   // If current character is a space:
16504                   else if (c === ' ') {
16505                       parseSpaces(css);
16506                     }
16507
16508                     // If current character is `=`, it must be combined with next `=`
16509                     else if (c === '=' && cn === '=') {
16510                         parseEquality(css);
16511                       }
16512
16513                       // If we meet `!=`, this must be inequality
16514                       else if (c === '!' && cn === '=') {
16515                           parseInequality(css);
16516                         }
16517
16518                         // If current character is a punctuation mark:
16519                         else if (c in Punctuation) {
16520                             // Check for CRLF here or just LF
16521                             if (c === '\r' && cn === '\n' || c === '\n') {
16522                               // If \r we know the next character is \n due to statement above
16523                               // so we push a CRLF token type to the token list and importantly
16524                               // skip the next character so as not to double count newlines or
16525                               // columns etc
16526                               if (c === '\r') {
16527                                 pushToken(TokenType.Newline, '\r\n', col);
16528                                 pos++; // If CRLF skip the next character and push crlf token
16529                               } else if (c === '\n') {
16530                                 // If just a LF newline and not part of CRLF newline we can just
16531                                 // push punctuation as usual
16532                                 pushToken(Punctuation[c], c, col);
16533                               }
16534
16535                               ln++; // Go to next line
16536                               col = 0; // Reset the column count
16537                             } else if (c !== '\r' && c !== '\n') {
16538                               // Handle all other punctuation and add to list of tokens
16539                               pushToken(Punctuation[c], c, col);
16540                             } // Go to next line
16541                             if (c === ')') urlMode = false; // Exit url mode
16542                             else if (c === '\t' && tabSize > 1) col += tabSize - 1;
16543                           }
16544
16545                           // If current character is a decimal digit:
16546                           else if (isDecimalDigit(c)) {
16547                               parseDecimalNumber(css);
16548                             }
16549
16550                             // If current character is anything else:
16551                             else {
16552                                 parseIdentifier(css);
16553                               }
16554             }
16555
16556             return tokens;
16557           }
16558
16559           return getTokens(css);
16560         };
16561
16562 /***/ }),
16563 /* 25 */
16564 /***/ (function(module, exports, __webpack_require__) {
16565
16566         'use strict';
16567
16568         exports.__esModule = true;
16569         exports.default = {
16570           mark: __webpack_require__(26),
16571           parse: __webpack_require__(27),
16572           stringify: __webpack_require__(6),
16573           tokenizer: __webpack_require__(28)
16574         };
16575         module.exports = exports['default'];
16576
16577 /***/ }),
16578 /* 26 */
16579 /***/ (function(module, exports, __webpack_require__) {
16580
16581         'use strict';
16582
16583         var TokenType = __webpack_require__(13);
16584
16585         module.exports = function () {
16586           /**
16587           * Mark whitespaces and comments
16588           */
16589           function markSC(tokens) {
16590             var tokensLength = tokens.length;
16591             var ws = -1; // Flag for whitespaces
16592             var sc = -1; // Flag for whitespaces and comments
16593             var t = void 0; // Current token
16594
16595             // For every token in the token list, mark spaces and line breaks
16596             // as spaces (set both `ws` and `sc` flags). Mark multiline comments
16597             // with `sc` flag.
16598             // If there are several spaces or tabs or line breaks or multiline
16599             // comments in a row, group them: take the last one's index number
16600             // and save it to the first token in the group as a reference:
16601             // e.g., `ws_last = 7` for a group of whitespaces or `sc_last = 9`
16602             // for a group of whitespaces and comments.
16603             for (var i = 0; i < tokensLength; i++) {
16604               t = tokens[i];
16605               switch (t.type) {
16606                 case TokenType.Space:
16607                 case TokenType.Tab:
16608                 case TokenType.Newline:
16609                   t.ws = true;
16610                   t.sc = true;
16611
16612                   if (ws === -1) ws = i;
16613                   if (sc === -1) sc = i;
16614
16615                   break;
16616                 case TokenType.CommentML:
16617                 case TokenType.CommentSL:
16618                   if (ws !== -1) {
16619                     tokens[ws].ws_last = i - 1;
16620                     ws = -1;
16621                   }
16622
16623                   t.sc = true;
16624
16625                   break;
16626                 default:
16627                   if (ws !== -1) {
16628                     tokens[ws].ws_last = i - 1;
16629                     ws = -1;
16630                   }
16631
16632                   if (sc !== -1) {
16633                     tokens[sc].sc_last = i - 1;
16634                     sc = -1;
16635                   }
16636               }
16637             }
16638
16639             if (ws !== -1) tokens[ws].ws_last = i - 1;
16640             if (sc !== -1) tokens[sc].sc_last = i - 1;
16641           }
16642
16643           /**
16644           * Pair brackets
16645           */
16646           function markBrackets(tokens) {
16647             var tokensLength = tokens.length;
16648             var ps = []; // Parentheses
16649             var sbs = []; // Square brackets
16650             var cbs = []; // Curly brackets
16651             var t = void 0; // Current token
16652
16653             // For every token in the token list, if we meet an opening (left)
16654             // bracket, push its index number to a corresponding array.
16655             // If we then meet a closing (right) bracket, look at the corresponding
16656             // array. If there are any elements (records about previously met
16657             // left brackets), take a token of the last left bracket (take
16658             // the last index number from the array and find a token with
16659             // this index number) and save right bracket's index as a reference:
16660             for (var i = 0; i < tokensLength; i++) {
16661               t = tokens[i];
16662               switch (t.type) {
16663                 case TokenType.LeftParenthesis:
16664                   ps.push(i);
16665                   break;
16666                 case TokenType.RightParenthesis:
16667                   if (ps.length) {
16668                     t.left = ps.pop();
16669                     tokens[t.left].right = i;
16670                   }
16671                   break;
16672                 case TokenType.LeftSquareBracket:
16673                   sbs.push(i);
16674                   break;
16675                 case TokenType.RightSquareBracket:
16676                   if (sbs.length) {
16677                     t.left = sbs.pop();
16678                     tokens[t.left].right = i;
16679                   }
16680                   break;
16681                 case TokenType.LeftCurlyBracket:
16682                   cbs.push(i);
16683                   break;
16684                 case TokenType.RightCurlyBracket:
16685                   if (cbs.length) {
16686                     t.left = cbs.pop();
16687                     tokens[t.left].right = i;
16688                   }
16689                   break;
16690               }
16691             }
16692           }
16693
16694           return function (tokens) {
16695             markBrackets(tokens);
16696             markSC(tokens);
16697           };
16698         }();
16699
16700 /***/ }),
16701 /* 27 */
16702 /***/ (function(module, exports, __webpack_require__) {
16703
16704         'use strict';
16705
16706         var Node = __webpack_require__(1);
16707         var NodeType = __webpack_require__(15);
16708         var TokenType = __webpack_require__(13);
16709
16710         var tokens = void 0;
16711         var tokensLength = void 0;
16712         var pos = void 0;
16713
16714         var contexts = {
16715           'arguments': function _arguments() {
16716             return checkArguments(pos) && getArguments();
16717           },
16718           'atkeyword': function atkeyword() {
16719             return checkAtkeyword(pos) && getAtkeyword();
16720           },
16721           'atrule': function atrule() {
16722             return checkAtrule(pos) && getAtrule();
16723           },
16724           'attributeSelector': function attributeSelector() {
16725             return checkAttributeSelector(pos) && getAttributeSelector();
16726           },
16727           'block': function block() {
16728             return checkBlock(pos) && getBlock();
16729           },
16730           'brackets': function brackets() {
16731             return checkBrackets(pos) && getBrackets();
16732           },
16733           'class': function _class() {
16734             return checkClass(pos) && getClass();
16735           },
16736           'combinator': function combinator() {
16737             return checkCombinator(pos) && getCombinator();
16738           },
16739           'commentML': function commentML() {
16740             return checkCommentML(pos) && getCommentML();
16741           },
16742           'commentSL': function commentSL() {
16743             return checkCommentSL(pos) && getCommentSL();
16744           },
16745           'condition': function condition() {
16746             return checkCondition(pos) && getCondition();
16747           },
16748           'conditionalStatement': function conditionalStatement() {
16749             return checkConditionalStatement(pos) && getConditionalStatement();
16750           },
16751           'declaration': function declaration() {
16752             return checkDeclaration(pos) && getDeclaration();
16753           },
16754           'declDelim': function declDelim() {
16755             return checkDeclDelim(pos) && getDeclDelim();
16756           },
16757           'default': function _default() {
16758             return checkDefault(pos) && getDefault();
16759           },
16760           'delim': function delim() {
16761             return checkDelim(pos) && getDelim();
16762           },
16763           'dimension': function dimension() {
16764             return checkDimension(pos) && getDimension();
16765           },
16766           'expression': function expression() {
16767             return checkExpression(pos) && getExpression();
16768           },
16769           'extend': function extend() {
16770             return checkExtend(pos) && getExtend();
16771           },
16772           'function': function _function() {
16773             return checkFunction(pos) && getFunction();
16774           },
16775           'global': function global() {
16776             return checkGlobal(pos) && getGlobal();
16777           },
16778           'ident': function ident() {
16779             return checkIdent(pos) && getIdent();
16780           },
16781           'important': function important() {
16782             return checkImportant(pos) && getImportant();
16783           },
16784           'include': function include() {
16785             return checkInclude(pos) && getInclude();
16786           },
16787           'interpolation': function interpolation() {
16788             return checkInterpolation(pos) && getInterpolation();
16789           },
16790           'loop': function loop() {
16791             return checkLoop(pos) && getLoop();
16792           },
16793           'mixin': function mixin() {
16794             return checkMixin(pos) && getMixin();
16795           },
16796           'namespace': function namespace() {
16797             return checkNamespace(pos) && getNamespace();
16798           },
16799           'number': function number() {
16800             return checkNumber(pos) && getNumber();
16801           },
16802           'operator': function operator() {
16803             return checkOperator(pos) && getOperator();
16804           },
16805           'optional': function optional() {
16806             return checkOptional(pos) && getOptional();
16807           },
16808           'parentheses': function parentheses() {
16809             return checkParentheses(pos) && getParentheses();
16810           },
16811           'parentselector': function parentselector() {
16812             return checkParentSelector(pos) && getParentSelector();
16813           },
16814           'percentage': function percentage() {
16815             return checkPercentage(pos) && getPercentage();
16816           },
16817           'placeholder': function placeholder() {
16818             return checkPlaceholder(pos) && getPlaceholder();
16819           },
16820           'progid': function progid() {
16821             return checkProgid(pos) && getProgid();
16822           },
16823           'property': function property() {
16824             return checkProperty(pos) && getProperty();
16825           },
16826           'propertyDelim': function propertyDelim() {
16827             return checkPropertyDelim(pos) && getPropertyDelim();
16828           },
16829           'pseudoc': function pseudoc() {
16830             return checkPseudoc(pos) && getPseudoc();
16831           },
16832           'pseudoe': function pseudoe() {
16833             return checkPseudoe(pos) && getPseudoe();
16834           },
16835           'ruleset': function ruleset() {
16836             return checkRuleset(pos) && getRuleset();
16837           },
16838           's': function s() {
16839             return checkS(pos) && getS();
16840           },
16841           'selector': function selector() {
16842             return checkSelector(pos) && getSelector();
16843           },
16844           'shash': function shash() {
16845             return checkShash(pos) && getShash();
16846           },
16847           'string': function string() {
16848             return checkString(pos) && getString();
16849           },
16850           'stylesheet': function stylesheet() {
16851             return checkStylesheet(pos) && getStylesheet();
16852           },
16853           'typeSelector': function typeSelector() {
16854             return checkTypeSelector(pos) && getTypeSelector();
16855           },
16856           'unary': function unary() {
16857             return checkUnary(pos) && getUnary();
16858           },
16859           'unicodeRange': function unicodeRange() {
16860             return checkUnicodeRange(pos) && getUnicodeRange();
16861           },
16862           'universalSelector': function universalSelector() {
16863             return checkUniversalSelector(pos) && getUniversalSelector();
16864           },
16865           'urange': function urange() {
16866             return checkUrange(pos) && getUrange();
16867           },
16868           'uri': function uri() {
16869             return checkUri(pos) && getUri();
16870           },
16871           'value': function value() {
16872             return checkValue(pos) && getValue();
16873           },
16874           'variable': function variable() {
16875             return checkVariable(pos) && getVariable();
16876           },
16877           'variableslist': function variableslist() {
16878             return checkVariablesList(pos) && getVariablesList();
16879           },
16880           'vhash': function vhash() {
16881             return checkVhash(pos) && getVhash();
16882           }
16883         };
16884
16885         /**
16886          * Stop parsing and display error
16887          * @param {Number=} i Token's index number
16888          */
16889         function throwError(i) {
16890           var ln = tokens[i].ln;
16891
16892           throw { line: ln, syntax: 'scss' };
16893         }
16894
16895         /**
16896          * @param {Number} start
16897          * @param {Number} finish
16898          * @returns {String}
16899          */
16900         function joinValues(start, finish) {
16901           var s = '';
16902
16903           for (var i = start; i < finish + 1; i++) {
16904             s += tokens[i].value;
16905           }
16906
16907           return s;
16908         }
16909
16910         /**
16911          * @param {Number} start
16912          * @param {Number} num
16913          * @returns {String}
16914          */
16915         function joinValues2(start, num) {
16916           if (start + num - 1 >= tokensLength) return;
16917
16918           var s = '';
16919
16920           for (var i = 0; i < num; i++) {
16921             s += tokens[start + i].value;
16922           }
16923
16924           return s;
16925         }
16926
16927         function getLastPosition(content, line, column, colOffset) {
16928           return typeof content === 'string' ? getLastPositionForString(content, line, column, colOffset) : getLastPositionForArray(content, line, column, colOffset);
16929         }
16930
16931         function getLastPositionForString(content, line, column, colOffset) {
16932           var position = [];
16933
16934           if (!content) {
16935             position = [line, column];
16936             if (colOffset) position[1] += colOffset - 1;
16937             return position;
16938           }
16939
16940           var lastLinebreak = content.lastIndexOf('\n');
16941           var endsWithLinebreak = lastLinebreak === content.length - 1;
16942           var splitContent = content.split('\n');
16943           var linebreaksCount = splitContent.length - 1;
16944           var prevLinebreak = linebreaksCount === 0 || linebreaksCount === 1 ? -1 : content.length - splitContent[linebreaksCount - 1].length - 2;
16945
16946           // Line:
16947           var offset = endsWithLinebreak ? linebreaksCount - 1 : linebreaksCount;
16948           position[0] = line + offset;
16949
16950           // Column:
16951           if (endsWithLinebreak) {
16952             offset = prevLinebreak !== -1 ? content.length - prevLinebreak : content.length - 1;
16953           } else {
16954             offset = linebreaksCount !== 0 ? content.length - lastLinebreak - column - 1 : content.length - 1;
16955           }
16956           position[1] = column + offset;
16957
16958           if (!colOffset) return position;
16959
16960           if (endsWithLinebreak) {
16961             position[0]++;
16962             position[1] = colOffset;
16963           } else {
16964             position[1] += colOffset;
16965           }
16966
16967           return position;
16968         }
16969
16970         function getLastPositionForArray(content, line, column, colOffset) {
16971           var position = void 0;
16972
16973           if (content.length === 0) {
16974             position = [line, column];
16975           } else {
16976             var c = content[content.length - 1];
16977             if (c.hasOwnProperty('end')) {
16978               position = [c.end.line, c.end.column];
16979             } else {
16980               position = getLastPosition(c.content, line, column);
16981             }
16982           }
16983
16984           if (!colOffset) return position;
16985
16986           if (tokens[pos - 1] && tokens[pos - 1].type !== 'Newline') {
16987             position[1] += colOffset;
16988           } else {
16989             position[0]++;
16990             position[1] = 1;
16991           }
16992
16993           return position;
16994         }
16995
16996         function newNode(type, content, line, column, end) {
16997           if (!end) end = getLastPosition(content, line, column);
16998           return new Node({
16999             type: type,
17000             content: content,
17001             start: {
17002               line: line,
17003               column: column
17004             },
17005             end: {
17006               line: end[0],
17007               column: end[1]
17008             },
17009             syntax: 'scss'
17010           });
17011         }
17012
17013         /**
17014          * @param {Number} i Token's index number
17015          * @returns {Number}
17016          */
17017         function checkAny(i) {
17018           var l = void 0;
17019
17020           if (l = checkBrackets(i)) tokens[i].any_child = 1;else if (l = checkParentheses(i)) tokens[i].any_child = 2;else if (l = checkString(i)) tokens[i].any_child = 3;else if (l = checkVariablesList(i)) tokens[i].any_child = 4;else if (l = checkVariable(i)) tokens[i].any_child = 5;else if (l = checkPlaceholder(i)) tokens[i].any_child = 6;else if (l = checkPercentage(i)) tokens[i].any_child = 7;else if (l = checkDimension(i)) tokens[i].any_child = 8;else if (l = checkUnicodeRange(i)) tokens[i].any_child = 9;else if (l = checkNumber(i)) tokens[i].any_child = 10;else if (l = checkUri(i)) tokens[i].any_child = 11;else if (l = checkExpression(i)) tokens[i].any_child = 12;else if (l = checkFunctionsList(i)) tokens[i].any_child = 13;else if (l = checkFunction(i)) tokens[i].any_child = 14;else if (l = checkInterpolation(i)) tokens[i].any_child = 15;else if (l = checkIdent(i)) tokens[i].any_child = 16;else if (l = checkClass(i)) tokens[i].any_child = 17;else if (l = checkUnary(i)) tokens[i].any_child = 18;else if (l = checkParentSelector(i)) tokens[i].any_child = 19;else if (l = checkImportant(i)) tokens[i].any_child = 20;else if (l = checkGlobal(i)) tokens[i].any_child = 21;else if (l = checkDefault(i)) tokens[i].any_child = 22;else if (l = checkOptional(i)) tokens[i].any_child = 23;
17021
17022           return l;
17023         }
17024
17025         /**
17026          * @returns {!Node}
17027          */
17028         function getAny() {
17029           var childType = tokens[pos].any_child;
17030
17031           if (childType === 1) return getBrackets();
17032           if (childType === 2) return getParentheses();
17033           if (childType === 3) return getString();
17034           if (childType === 4) return getVariablesList();
17035           if (childType === 5) return getVariable();
17036           if (childType === 6) return getPlaceholder();
17037           if (childType === 7) return getPercentage();
17038           if (childType === 8) return getDimension();
17039           if (childType === 9) return getUnicodeRange();
17040           if (childType === 10) return getNumber();
17041           if (childType === 11) return getUri();
17042           if (childType === 12) return getExpression();
17043           if (childType === 13) return getFunctionsList();
17044           if (childType === 14) return getFunction();
17045           if (childType === 15) return getInterpolation();
17046           if (childType === 16) return getIdent();
17047           if (childType === 17) return getClass();
17048           if (childType === 18) return getUnary();
17049           if (childType === 19) return getParentSelector();
17050           if (childType === 20) return getImportant();
17051           if (childType === 21) return getGlobal();
17052           if (childType === 22) return getDefault();
17053           if (childType === 23) return getOptional();
17054         }
17055
17056         /**
17057          * Check if token is part of mixin's arguments.
17058          * @param {Number} i Token's index number
17059          * @returns {Number} Length of arguments
17060          */
17061         function checkArguments(i) {
17062           var start = i;
17063           var l = void 0;
17064
17065           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
17066
17067           // Skip `(`.
17068           i++;
17069
17070           while (i < tokens[start].right) {
17071             if (l = checkArgument(i)) i += l;else return 0;
17072           }
17073
17074           return tokens[start].right - start + 1;
17075         }
17076
17077         /**
17078          * @returns {Array}
17079          */
17080         function getArguments() {
17081           var type = NodeType.ArgumentsType;
17082           var token = tokens[pos];
17083           var line = token.ln;
17084           var column = token.col;
17085           var content = [];
17086           var body = void 0;
17087
17088           // Skip `(`.
17089           pos++;
17090
17091           while (pos < tokensLength && tokens[pos].type !== TokenType.RightParenthesis) {
17092             if (checkSingleValueDeclaration(pos)) {
17093               content.push(getSingleValueDeclaration());
17094             } else if (checkArgument(pos)) {
17095               body = getArgument();
17096               if (typeof body.content === 'string') content.push(body);else content = content.concat(body);
17097             } else if (checkClass(pos)) content.push(getClass());else throwError(pos);
17098           }
17099
17100           var end = getLastPosition(content, line, column, 1);
17101
17102           // Skip `)`.
17103           pos++;
17104
17105           return newNode(type, content, line, column, end);
17106         }
17107
17108         /**
17109          * Check if token is valid to be part of arguments list
17110          * @param {Number} i Token's index number
17111          * @returns {Number} Length of argument
17112          */
17113         function checkArgument(i) {
17114           var l = void 0;
17115
17116           if (l = checkBrackets(i)) tokens[i].argument_child = 1;else if (l = checkParentheses(i)) tokens[i].argument_child = 2;else if (l = checkSingleValueDeclaration(i)) tokens[i].argument_child = 3;else if (l = checkFunctionsList(i)) tokens[i].argument_child = 4;else if (l = checkFunction(i)) tokens[i].argument_child = 5;else if (l = checkVariablesList(i)) tokens[i].argument_child = 6;else if (l = checkVariable(i)) tokens[i].argument_child = 7;else if (l = checkSC(i)) tokens[i].argument_child = 8;else if (l = checkDelim(i)) tokens[i].argument_child = 9;else if (l = checkDeclDelim(i)) tokens[i].argument_child = 10;else if (l = checkString(i)) tokens[i].argument_child = 11;else if (l = checkPercentage(i)) tokens[i].argument_child = 12;else if (l = checkDimension(i)) tokens[i].argument_child = 13;else if (l = checkNumber(i)) tokens[i].argument_child = 14;else if (l = checkUri(i)) tokens[i].argument_child = 15;else if (l = checkInterpolation(i)) tokens[i].argument_child = 16;else if (l = checkIdent(i)) tokens[i].argument_child = 17;else if (l = checkVhash(i)) tokens[i].argument_child = 18;else if (l = checkCustomProperty(i)) tokens[i].argument_child = 19;else if (l = checkOperator(i)) tokens[i].argument_child = 20;else if (l = checkUnary(i)) tokens[i].argument_child = 21;else if (l = checkParentSelector(i)) tokens[i].argument_child = 22;else if (l = checkImportant(i)) tokens[i].argument_child = 23;else if (l = checkGlobal(i)) tokens[i].argument_child = 24;else if (l = checkDefault(i)) tokens[i].argument_child = 25;else if (l = checkOptional(i)) tokens[i].argument_child = 26;
17117
17118           return l;
17119         }
17120
17121         /**
17122          * @returns {Array} Node that is part of arguments list
17123          */
17124         function getArgument() {
17125           var childType = tokens[pos].argument_child;
17126
17127           if (childType === 1) return getBrackets();
17128           if (childType === 2) return getParentheses();
17129           if (childType === 3) return getSingleValueDeclaration();
17130           if (childType === 4) return getFunctionsList();
17131           if (childType === 5) return getFunction();
17132           if (childType === 6) return getVariablesList();
17133           if (childType === 7) return getVariable();
17134           if (childType === 8) return getSC();
17135           if (childType === 9) return getDelim();
17136           if (childType === 10) return getDeclDelim();
17137           if (childType === 11) return getString();
17138           if (childType === 12) return getPercentage();
17139           if (childType === 13) return getDimension();
17140           if (childType === 14) return getNumber();
17141           if (childType === 15) return getUri();
17142           if (childType === 16) return getInterpolation();
17143           if (childType === 17) return getIdent();
17144           if (childType === 18) return getVhash();
17145           if (childType === 19) return getCustomProperty();
17146           if (childType === 20) return getOperator();
17147           if (childType === 21) return getUnary();
17148           if (childType === 22) return getParentSelector();
17149           if (childType === 23) return getImportant();
17150           if (childType === 24) return getGlobal();
17151           if (childType === 25) return getDefault();
17152           if (childType === 26) return getOptional();
17153         }
17154
17155         /**
17156          * Check if token is part of an @-word (e.g. `@import`, `@include`)
17157          * @param {Number} i Token's index number
17158          * @returns {Number}
17159          */
17160         function checkAtkeyword(i) {
17161           var l = void 0;
17162
17163           // Check that token is `@`:
17164           if (i >= tokensLength || tokens[i++].type !== TokenType.CommercialAt) return 0;
17165
17166           return (l = checkIdentOrInterpolation(i)) ? l + 1 : 0;
17167         }
17168
17169         /**
17170          * Get node with @-word
17171          * @return {Node}
17172          */
17173         function getAtkeyword() {
17174           var type = NodeType.AtkeywordType;
17175           var token = tokens[pos];
17176           var line = token.ln;
17177           var column = token.col;
17178
17179           // Skip `@`.
17180           pos++;
17181
17182           var content = getIdentOrInterpolation();
17183
17184           return newNode(type, content, line, column);
17185         }
17186
17187         /**
17188          * Check if token is a part of an @-rule
17189          * @param {Number} i Token's index number
17190          * @returns {Number} Length of @-rule
17191          */
17192         function checkAtrule(i) {
17193           var l = void 0;
17194
17195           if (i >= tokensLength) return 0;
17196
17197           // If token already has a record of being part of an @-rule,
17198           // return the @-rule's length:
17199           if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l;
17200
17201           // If token is part of an @-rule, save the rule's type to token.
17202           // @keyframes:
17203           if (l = checkKeyframesRule(i)) tokens[i].atrule_type = 4;
17204           // @-rule with ruleset:
17205           else if (l = checkAtruler(i)) tokens[i].atrule_type = 1;
17206             // Block @-rule:
17207             else if (l = checkAtruleb(i)) tokens[i].atrule_type = 2;
17208               // Single-line @-rule:
17209               else if (l = checkAtrules(i)) tokens[i].atrule_type = 3;else return 0;
17210
17211           // If token is part of an @-rule, save the rule's length to token:
17212           tokens[i].atrule_l = l;
17213
17214           return l;
17215         }
17216
17217         /**
17218          * Get node with @-rule
17219          * @returns {Array}
17220          */
17221         function getAtrule() {
17222           var childType = tokens[pos].atrule_type;
17223
17224           if (childType === 1) return getAtruler(); // @-rule with ruleset
17225           if (childType === 2) return getAtruleb(); // Block @-rule
17226           if (childType === 3) return getAtrules(); // Single-line @-rule
17227           if (childType === 4) return getKeyframesRule();
17228         }
17229
17230         /**
17231          * Check if token is part of a block @-rule
17232          * @param {Number} i Token's index number
17233          * @returns {Number} Length of the @-rule
17234          */
17235         function checkAtruleb(i) {
17236           var start = i;
17237           var l = void 0;
17238
17239           if (i >= tokensLength) return 0;
17240
17241           if (l = checkAtkeyword(i)) i += l;else return 0;
17242
17243           if (l = checkTsets(i)) i += l;
17244
17245           if (l = checkBlock(i)) i += l;else return 0;
17246
17247           return i - start;
17248         }
17249
17250         /**
17251          * Get node with a block @-rule
17252          * @returns {Array} `['atruleb', ['atkeyword', x], y, ['block', z]]`
17253          */
17254         function getAtruleb() {
17255           var type = NodeType.AtruleType;
17256           var token = tokens[pos];
17257           var line = token.ln;
17258           var column = token.col;
17259           var content = [].concat(getAtkeyword(), getTsets(), getBlock());
17260
17261           return newNode(type, content, line, column);
17262         }
17263
17264         /**
17265          * Check if token is part of an @-rule with ruleset
17266          * @param {Number} i Token's index number
17267          * @returns {Number} Length of the @-rule
17268          */
17269         function checkAtruler(i) {
17270           var start = i;
17271           var l = void 0;
17272
17273           if (i >= tokensLength) return 0;
17274
17275           if (l = checkAtkeyword(i)) i += l;else return 0;
17276
17277           if (l = checkTsets(i)) i += l;
17278
17279           if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;else return 0;
17280
17281           if (l = checkAtrulers(i)) i += l;
17282
17283           if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;else return 0;
17284
17285           return i - start;
17286         }
17287
17288         /**
17289          * Get node with an @-rule with ruleset
17290          * @returns {Array} ['atruler', ['atkeyword', x], y, z]
17291          */
17292         function getAtruler() {
17293           var type = NodeType.AtruleType;
17294           var token = tokens[pos];
17295           var line = token.ln;
17296           var column = token.col;
17297           var content = [].concat(getAtkeyword(), getTsets(), getAtrulers());
17298
17299           return newNode(type, content, line, column);
17300         }
17301
17302         /**
17303          * @param {Number} i Token's index number
17304          * @returns {Number}
17305          */
17306         function checkAtrulers(i) {
17307           var start = i;
17308           var l = void 0;
17309
17310           if (i >= tokensLength) return 0;
17311
17312           if (l = checkSC(i)) i += l;
17313
17314           while (i < tokensLength) {
17315             if (l = checkSC(i)) tokens[i].atrulers_child = 1;else if (l = checkAtrule(i)) tokens[i].atrulers_child = 2;else if (l = checkRuleset(i)) tokens[i].atrulers_child = 3;else break;
17316             i += l;
17317           }
17318
17319           if (i < tokensLength) tokens[i].atrulers_end = 1;
17320
17321           if (l = checkSC(i)) i += l;
17322
17323           return i - start;
17324         }
17325
17326         /**
17327          * @returns {Array} `['atrulers', x]`
17328          */
17329         function getAtrulers() {
17330           var type = NodeType.BlockType;
17331           var token = tokens[pos];
17332           var line = token.ln;
17333           var column = token.col;
17334           var content = [];
17335
17336           // Skip `{`.
17337           pos++;
17338
17339           content = content.concat(getSC());
17340
17341           while (pos < tokensLength && !tokens[pos].atrulers_end) {
17342             var childType = tokens[pos].atrulers_child;
17343             if (childType === 1) content = content.concat(getSC());else if (childType === 2) content.push(getAtrule());else if (childType === 3) content.push(getRuleset());else break;
17344           }
17345
17346           content = content.concat(getSC());
17347
17348           var end = getLastPosition(content, line, column, 1);
17349
17350           // Skip `}`.
17351           pos++;
17352
17353           return newNode(type, content, line, column, end);
17354         }
17355
17356         /**
17357          * @param {Number} i Token's index number
17358          * @returns {Number}
17359          */
17360         function checkAtrules(i) {
17361           var start = i;
17362           var l = void 0;
17363
17364           if (i >= tokensLength) return 0;
17365
17366           if (l = checkAtkeyword(i)) i += l;else return 0;
17367
17368           if (l = checkTsets(i)) i += l;
17369
17370           return i - start;
17371         }
17372
17373         /**
17374          * @returns {Array} `['atrules', ['atkeyword', x], y]`
17375          */
17376         function getAtrules() {
17377           var type = NodeType.AtruleType;
17378           var token = tokens[pos];
17379           var line = token.ln;
17380           var column = token.col;
17381           var content = [].concat(getAtkeyword(), getTsets());
17382
17383           return newNode(type, content, line, column);
17384         }
17385
17386         /**
17387          * Check if token is part of a block (e.g. `{...}`).
17388          * @param {Number} i Token's index number
17389          * @returns {Number} Length of the block
17390          */
17391         function checkBlock(i) {
17392           return i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket ? tokens[i].right - i + 1 : 0;
17393         }
17394
17395         /**
17396          * Get node with a block
17397          * @returns {Array} `['block', x]`
17398          */
17399         function getBlock() {
17400           var type = NodeType.BlockType;
17401           var token = tokens[pos];
17402           var line = token.ln;
17403           var column = token.col;
17404           var end = tokens[pos].right;
17405           var content = [];
17406
17407           // Skip `{`.
17408           pos++;
17409
17410           while (pos < end) {
17411             if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());else throwError(pos);
17412           }
17413
17414           var end_ = getLastPosition(content, line, column, 1);
17415           pos = end + 1;
17416
17417           return newNode(type, content, line, column, end_);
17418         }
17419
17420         /**
17421          * Check if token is part of a declaration (property-value pair)
17422          * @param {Number} i Token's index number
17423          * @returns {Number} Length of the declaration
17424          */
17425         function checkBlockdecl(i) {
17426           var l = void 0;
17427
17428           if (i >= tokensLength) return 0;
17429
17430           if (l = checkBlockdecl1(i)) tokens[i].bd_type = 1;else if (l = checkBlockdecl2(i)) tokens[i].bd_type = 2;else if (l = checkBlockdecl3(i)) tokens[i].bd_type = 3;else if (l = checkBlockdecl4(i)) tokens[i].bd_type = 4;else return 0;
17431
17432           return l;
17433         }
17434
17435         /**
17436          * @returns {Array}
17437          */
17438         function getBlockdecl() {
17439           var childType = tokens[pos].bd_type;
17440
17441           if (childType === 1) return getBlockdecl1();
17442           if (childType === 2) return getBlockdecl2();
17443           if (childType === 3) return getBlockdecl3();
17444           if (childType === 4) return getBlockdecl4();
17445         }
17446
17447         /**
17448          * @param {Number} i Token's index number
17449          * @returns {Number}
17450          */
17451         function checkBlockdecl1(i) {
17452           var start = i;
17453           var l = void 0;
17454
17455           if (l = checkSC(i)) i += l;
17456
17457           if (l = checkConditionalStatement(i)) tokens[i].bd_kind = 1;else if (l = checkInclude(i)) tokens[i].bd_kind = 2;else if (l = checkExtend(i)) tokens[i].bd_kind = 4;else if (l = checkLoop(i)) tokens[i].bd_kind = 3;else if (l = checkAtrule(i)) tokens[i].bd_kind = 6;else if (l = checkRuleset(i)) tokens[i].bd_kind = 7;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 5;else return 0;
17458
17459           i += l;
17460
17461           if (i < tokensLength && (l = checkDeclDelim(i))) i += l;else return 0;
17462
17463           if (l = checkSC(i)) i += l;
17464
17465           return i - start;
17466         }
17467
17468         /**
17469          * @returns {Array}
17470          */
17471         function getBlockdecl1() {
17472           var sc = getSC();
17473           var content = void 0;
17474
17475           switch (tokens[pos].bd_kind) {
17476             case 1:
17477               content = getConditionalStatement();
17478               break;
17479             case 2:
17480               content = getInclude();
17481               break;
17482             case 3:
17483               content = getLoop();
17484               break;
17485             case 4:
17486               content = getExtend();
17487               break;
17488             case 5:
17489               content = getDeclaration();
17490               break;
17491             case 6:
17492               content = getAtrule();
17493               break;
17494             case 7:
17495               content = getRuleset();
17496               break;
17497           }
17498
17499           return sc.concat(content, getSC(), getDeclDelim(), getSC());
17500         }
17501
17502         /**
17503          * @param {Number} i Token's index number
17504          * @returns {Number}
17505          */
17506         function checkBlockdecl2(i) {
17507           var start = i;
17508           var l = void 0;
17509
17510           if (l = checkSC(i)) i += l;
17511
17512           if (l = checkConditionalStatement(i)) tokens[i].bd_kind = 1;else if (l = checkInclude(i)) tokens[i].bd_kind = 2;else if (l = checkExtend(i)) tokens[i].bd_kind = 4;else if (l = checkMixin(i)) tokens[i].bd_kind = 8;else if (l = checkLoop(i)) tokens[i].bd_kind = 3;else if (l = checkAtrule(i)) tokens[i].bd_kind = 6;else if (l = checkRuleset(i)) tokens[i].bd_kind = 7;else if (l = checkDeclaration(i)) tokens[i].bd_kind = 5;else return 0;
17513
17514           i += l;
17515
17516           if (l = checkSC(i)) i += l;
17517
17518           return i - start;
17519         }
17520
17521         /**
17522          * @returns {Array}
17523          */
17524         function getBlockdecl2() {
17525           var sc = getSC();
17526           var content = void 0;
17527
17528           switch (tokens[pos].bd_kind) {
17529             case 1:
17530               content = getConditionalStatement();
17531               break;
17532             case 2:
17533               content = getInclude();
17534               break;
17535             case 3:
17536               content = getLoop();
17537               break;
17538             case 4:
17539               content = getExtend();
17540               break;
17541             case 5:
17542               content = getDeclaration();
17543               break;
17544             case 6:
17545               content = getAtrule();
17546               break;
17547             case 7:
17548               content = getRuleset();
17549               break;
17550             case 8:
17551               content = getMixin();
17552               break;
17553           }
17554
17555           return sc.concat(content, getSC());
17556         }
17557
17558         /**
17559          * @param {Number} i Token's index number
17560          * @returns {Number}
17561          */
17562         function checkBlockdecl3(i) {
17563           var start = i;
17564           var l = void 0;
17565
17566           if (l = checkSC(i)) i += l;
17567
17568           if (l = checkDeclDelim(i)) i += l;else return 0;
17569
17570           if (l = checkSC(i)) i += l;
17571
17572           return i - start;
17573         }
17574
17575         /**
17576          * @returns {Array} `[s0, ['declDelim'], s1]` where `s0` and `s1` are
17577          *      are optional whitespaces.
17578          */
17579         function getBlockdecl3() {
17580           return [].concat(getSC(), getDeclDelim(), getSC());
17581         }
17582
17583         /**
17584          * @param {Number} i Token's index number
17585          * @returns {Number}
17586          */
17587         function checkBlockdecl4(i) {
17588           return checkSC(i);
17589         }
17590
17591         /**
17592          * @returns {Array}
17593          */
17594         function getBlockdecl4() {
17595           return getSC();
17596         }
17597
17598         /**
17599          * Check if token is part of text inside square brackets, e.g. `[1]`
17600          * @param {Number} i Token's index number
17601          * @returns {Number}
17602          */
17603         function checkBrackets(i) {
17604           if (i >= tokensLength) return 0;
17605
17606           var start = i;
17607
17608           // Skip `[`.
17609           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
17610
17611           if (i < tokens[start].right) {
17612             var l = checkTsets(i);
17613             if (l) i += l;else return 0;
17614           }
17615
17616           // Skip `]`.
17617           i++;
17618
17619           return i - start;
17620         }
17621
17622         /**
17623          * Get node with text inside parentheses or square brackets (e.g. `(1)`)
17624          * @return {Node}
17625          */
17626         function getBrackets() {
17627           var type = NodeType.BracketsType;
17628           var token = tokens[pos];
17629           var line = token.ln;
17630           var column = token.col;
17631           var right = token.right;
17632           var content = [];
17633
17634           // Skip `[`.
17635           pos++;
17636
17637           if (pos < right) {
17638             content = getTsets();
17639           }
17640
17641           var end = getLastPosition(content, line, column, 1);
17642
17643           // Skip `]`.
17644           pos++;
17645
17646           return newNode(type, content, line, column, end);
17647         }
17648
17649         /**
17650          * Check if token is part of a class selector (e.g. `.abc`)
17651          * @param {Number} i Token's index number
17652          * @returns {Number} Length of the class selector
17653          */
17654         function checkClass(i) {
17655           var start = i;
17656           var l = void 0;
17657
17658           if (i >= tokensLength) return 0;
17659
17660           if (tokens[i].class_l) return tokens[i].class_l;
17661
17662           // Skip `.`.
17663           if (tokens[i].type === TokenType.FullStop) i++;else return 0;
17664
17665           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
17666
17667           while (i < tokensLength) {
17668             if (l = checkIdentOrInterpolation(i)) {
17669               tokens[start].class_l = l + 1;
17670               i += l;
17671             } else break;
17672           }
17673
17674           tokens[start].classEnd = i;
17675
17676           return i - start;
17677         }
17678
17679         /**
17680          * Get node with a class selector
17681          * @returns {Array} `['class', ['ident', x]]` where x is a class's
17682          *      identifier (without `.`, e.g. `abc`).
17683          */
17684         function getClass() {
17685           var type = NodeType.ClassType;
17686           var token = tokens[pos];
17687           var line = token.ln;
17688           var column = token.col;
17689           var end = token.classEnd;
17690           var content = [];
17691
17692           // Skip `.`
17693           pos++;
17694
17695           while (pos < end) {
17696             if (checkIdentOrInterpolation(pos)) {
17697               content = content.concat(getIdentOrInterpolation());
17698             } else break;
17699           }
17700
17701           return newNode(type, content, line, column);
17702         }
17703
17704         function checkCombinator(i) {
17705           if (i >= tokensLength) return 0;
17706
17707           var l = void 0;
17708           if (l = checkCombinator1(i)) tokens[i].combinatorType = 1;else if (l = checkCombinator2(i)) tokens[i].combinatorType = 2;else if (l = checkCombinator3(i)) tokens[i].combinatorType = 3;else if (l = checkCombinator4(i)) tokens[i].combinatorType = 4;
17709
17710           return l;
17711         }
17712
17713         function getCombinator() {
17714           var type = tokens[pos].combinatorType;
17715           if (type === 1) return getCombinator1();
17716           if (type === 2) return getCombinator2();
17717           if (type === 3) return getCombinator3();
17718           if (type === 4) return getCombinator4();
17719         }
17720
17721         /**
17722          * (1) `>>>`
17723          *
17724          * @param {Number} i
17725          * @return {Number}
17726          */
17727         function checkCombinator1(i) {
17728           if (i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign && i < tokensLength && tokens[i++].type === TokenType.GreaterThanSign) return 3;
17729
17730           return 0;
17731         }
17732
17733         /**
17734          * @return {Node}
17735          */
17736         function getCombinator1() {
17737           var type = NodeType.CombinatorType;
17738           var token = tokens[pos];
17739           var line = token.ln;
17740           var column = token.col;
17741           var content = '>>>';
17742
17743           // Skip combinator
17744           pos += 3;
17745
17746           return newNode(type, content, line, column);
17747         }
17748
17749         /**
17750          * (1) `||`
17751          * (2) `>>`
17752          *
17753          * @param {Number} i
17754          * @return {Number}
17755          */
17756         function checkCombinator2(i) {
17757           if (i + 1 >= tokensLength) return 0;
17758
17759           if (tokens[i].type === TokenType.VerticalLine && tokens[i + 1].type === TokenType.VerticalLine) return 2;
17760
17761           if (tokens[i].type === TokenType.GreaterThanSign && tokens[i + 1].type === TokenType.GreaterThanSign) return 2;
17762
17763           return 0;
17764         }
17765
17766         /**
17767          * @return {Node}
17768          */
17769         function getCombinator2() {
17770           var type = NodeType.CombinatorType;
17771           var token = tokens[pos];
17772           var line = token.ln;
17773           var column = token.col;
17774           var content = '' + token.value + tokens[pos + 1].value;
17775
17776           // Skip combinator
17777           pos += 2;
17778
17779           return newNode(type, content, line, column);
17780         }
17781
17782         /**
17783          * (1) `>`
17784          * (2) `+`
17785          * (3) `~`
17786          *
17787          * @param {Number} i
17788          * @return {Number}
17789          */
17790         function checkCombinator3(i) {
17791           var type = tokens[i].type;
17792           if (type === TokenType.PlusSign || type === TokenType.GreaterThanSign || type === TokenType.Tilde) return 1;else return 0;
17793         }
17794
17795         /**
17796          * @return {Node}
17797          */
17798         function getCombinator3() {
17799           var type = NodeType.CombinatorType;
17800           var token = tokens[pos];
17801           var line = token.ln;
17802           var column = token.col;
17803           var content = token.value;
17804
17805           // Skip combinator
17806           pos++;
17807
17808           return newNode(type, content, line, column);
17809         }
17810
17811         /**
17812          * (1) `/panda/`
17813          */
17814         function checkCombinator4(i) {
17815           var start = i;
17816
17817           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
17818
17819           var l = void 0;
17820           if (l = checkIdent(i)) i += l;else return 0;
17821
17822           if (tokens[i].type === TokenType.Solidus) i++;else return 0;
17823
17824           return i - start;
17825         }
17826
17827         /**
17828          * @return {Node}
17829          */
17830         function getCombinator4() {
17831           var type = NodeType.CombinatorType;
17832           var token = tokens[pos];
17833           var line = token.ln;
17834           var column = token.col;
17835
17836           // Skip `/`.
17837           pos++;
17838
17839           var ident = getIdent();
17840
17841           // Skip `/`.
17842           pos++;
17843
17844           var content = '/' + ident.content + '/';
17845
17846           return newNode(type, content, line, column);
17847         }
17848
17849         /**
17850          * Check if token is a multiline comment.
17851          * @param {Number} i Token's index number
17852          * @returns {Number} `1` if token is a multiline comment, otherwise `0`
17853          */
17854         function checkCommentML(i) {
17855           return i < tokensLength && tokens[i].type === TokenType.CommentML ? 1 : 0;
17856         }
17857
17858         /**
17859          * Get node with a multiline comment
17860          * @returns {Array} `['commentML', x]` where `x`
17861          *      is the comment's text (without `/*` and `* /`).
17862          */
17863         function getCommentML() {
17864           var type = NodeType.CommentMLType;
17865           var token = tokens[pos];
17866           var line = token.ln;
17867           var column = token.col;
17868           var content = tokens[pos].value.substring(2);
17869           var l = content.length;
17870
17871           if (content.charAt(l - 2) === '*' && content.charAt(l - 1) === '/') content = content.substring(0, l - 2);
17872
17873           var end = getLastPosition(content, line, column, 2);
17874           if (end[0] === line) end[1] += 2;
17875           pos++;
17876
17877           return newNode(type, content, line, column, end);
17878         }
17879
17880         /**
17881          * Check if token is part of a single-line comment.
17882          * @param {Number} i Token's index number
17883          * @returns {Number} `1` if token is a single-line comment, otherwise `0`
17884          */
17885         function checkCommentSL(i) {
17886           return i < tokensLength && tokens[i].type === TokenType.CommentSL ? 1 : 0;
17887         }
17888
17889         /**
17890          * Get node with a single-line comment.
17891          * @returns {Array} `['commentSL', x]` where `x` is comment's message
17892          *      (without `//`)
17893          */
17894         function getCommentSL() {
17895           var type = NodeType.CommentSLType;
17896           var token = tokens[pos];
17897           var line = token.ln;
17898           var column = token.col;
17899           var content = tokens[pos++].value.substring(2);
17900           var end = getLastPosition(content, line, column + 2);
17901
17902           return newNode(type, content, line, column, end);
17903         }
17904
17905         /**
17906          * Check if token is part of a condition
17907          * (e.g. `@if ...`, `@else if ...` or `@else ...`).
17908          * @param {Number} i Token's index number
17909          * @returns {Number} Length of the condition
17910          */
17911         function checkCondition(i) {
17912           var start = i;
17913           var l = void 0;
17914           var _i = void 0;
17915           var s = void 0;
17916
17917           if (i >= tokensLength) return 0;
17918
17919           if (l = checkAtkeyword(i)) i += l;else return 0;
17920
17921           if (['if', 'else'].indexOf(tokens[start + 1].value) < 0) return 0;
17922
17923           while (i < tokensLength) {
17924             if (l = checkBlock(i)) break;
17925
17926             s = checkSC(i);
17927             _i = i + s;
17928
17929             if (l = _checkCondition(_i)) i += l + s;else break;
17930           }
17931
17932           return i - start;
17933         }
17934
17935         function _checkCondition(i) {
17936           return checkVariable(i) || checkNumber(i) || checkInterpolation(i) || checkIdent(i) || checkOperator(i) || checkCombinator(i) || checkString(i);
17937         }
17938
17939         /**
17940          * Get node with a condition.
17941          * @returns {Array} `['condition', x]`
17942          */
17943         function getCondition() {
17944           var type = NodeType.ConditionType;
17945           var token = tokens[pos];
17946           var line = token.ln;
17947           var column = token.col;
17948           var content = [];
17949           var s = void 0;
17950           var _pos = void 0;
17951
17952           content.push(getAtkeyword());
17953
17954           while (pos < tokensLength) {
17955             if (checkBlock(pos)) break;
17956
17957             s = checkSC(pos);
17958             _pos = pos + s;
17959
17960             if (!_checkCondition(_pos)) break;
17961
17962             if (s) content = content.concat(getSC());
17963             content.push(_getCondition());
17964           }
17965
17966           return newNode(type, content, line, column);
17967         }
17968
17969         function _getCondition() {
17970           if (checkVariable(pos)) return getVariable();
17971           if (checkNumber(pos)) return getNumber();
17972           if (checkInterpolation(pos)) return getInterpolation();
17973           if (checkIdent(pos)) return getIdent();
17974           if (checkOperator(pos)) return getOperator();
17975           if (checkCombinator(pos)) return getCombinator();
17976           if (checkString(pos)) return getString();
17977         }
17978
17979         /**
17980          * Check if token is part of a conditional statement
17981          * (e.g. `@if ... {} @else if ... {} @else ... {}`).
17982          * @param {Number} i Token's index number
17983          * @returns {Number} Length of the condition
17984          */
17985         function checkConditionalStatement(i) {
17986           var start = i;
17987           var l = void 0;
17988
17989           if (i >= tokensLength) return 0;
17990
17991           if (l = checkCondition(i)) i += l;else return 0;
17992
17993           if (l = checkSC(i)) i += l;
17994
17995           if (l = checkBlock(i)) i += l;else return 0;
17996
17997           return i - start;
17998         }
17999
18000         /**
18001          * Get node with a condition.
18002          * @returns {Array} `['condition', x]`
18003          */
18004         function getConditionalStatement() {
18005           var type = NodeType.ConditionalStatementType;
18006           var token = tokens[pos];
18007           var line = token.ln;
18008           var column = token.col;
18009           var content = [].concat(getCondition(), getSC(), getBlock());
18010
18011           return newNode(type, content, line, column);
18012         }
18013
18014         /**
18015          * Check if token is part of a declaration (property-value pair)
18016          * @param {Number} i Token's index number
18017          * @returns {Number} Length of the declaration
18018          */
18019         function checkDeclaration(i) {
18020           var start = i;
18021           var l = void 0;
18022
18023           if (i >= tokensLength) return 0;
18024
18025           if (l = checkProperty(i)) i += l;else return 0;
18026
18027           if (l = checkSC(i)) i += l;
18028
18029           if (l = checkPropertyDelim(i)) i++;else return 0;
18030
18031           if (l = checkSC(i)) i += l;
18032
18033           if (l = checkValue(i)) i += l;else return 0;
18034
18035           return i - start;
18036         }
18037
18038         /**
18039          * Get node with a declaration
18040          * @returns {Array} `['declaration', ['property', x], ['propertyDelim'],
18041          *       ['value', y]]`
18042          */
18043         function getDeclaration() {
18044           var type = NodeType.DeclarationType;
18045           var token = tokens[pos];
18046           var line = token.ln;
18047           var column = token.col;
18048           var content = [].concat(getProperty(), getSC(), getPropertyDelim(), getSC(), getValue());
18049
18050           return newNode(type, content, line, column);
18051         }
18052
18053         /**
18054          * @param {number} i Token's index number
18055          * @returns {number} Length of the declaration
18056          */
18057         function checkSingleValueDeclaration(i) {
18058           var start = i;
18059           var l = void 0;
18060
18061           if (i >= tokensLength) return 0;
18062
18063           if (l = checkProperty(i)) i += l;else return 0;
18064
18065           if (l = checkSC(i)) i += l;
18066
18067           if (l = checkPropertyDelim(i)) i++;else return 0;
18068
18069           if (l = checkSC(i)) i += l;
18070
18071           if (l = checkSingleValue(i)) i += l;else return 0;
18072
18073           return i - start;
18074         }
18075
18076         /**
18077          * Get node with a declaration
18078          * @returns {Array} `['declaration', ['property', x], ['propertyDelim'],
18079          *       ['value', y]]`
18080          */
18081         function getSingleValueDeclaration() {
18082           var type = NodeType.DeclarationType;
18083           var token = tokens[pos];
18084           var line = token.ln;
18085           var column = token.col;
18086           var content = [].concat(getProperty(), getSC(), getPropertyDelim(), getSC(), getSingleValue());
18087
18088           return newNode(type, content, line, column);
18089         }
18090
18091         /**
18092          * Check if token is a semicolon
18093          * @param {Number} i Token's index number
18094          * @returns {Number} `1` if token is a semicolon, otherwise `0`
18095          */
18096         function checkDeclDelim(i) {
18097           return i < tokensLength && tokens[i].type === TokenType.Semicolon ? 1 : 0;
18098         }
18099
18100         /**
18101          * Get node with a semicolon
18102          * @returns {Array} `['declDelim']`
18103          */
18104         function getDeclDelim() {
18105           var type = NodeType.DeclDelimType;
18106           var token = tokens[pos];
18107           var line = token.ln;
18108           var column = token.col;
18109           var content = ';';
18110
18111           pos++;
18112
18113           return newNode(type, content, line, column);
18114         }
18115
18116         /**
18117          * Check if token if part of `!default` word.
18118          * @param {Number} i Token's index number
18119          * @returns {Number} Length of the `!default` word
18120          */
18121         function checkDefault(i) {
18122           var start = i;
18123           var l = void 0;
18124
18125           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
18126
18127           if (l = checkSC(i)) i += l;
18128
18129           if (tokens[i].value === 'default') {
18130             tokens[start].defaultEnd = i;
18131             return i - start + 1;
18132           } else {
18133             return 0;
18134           }
18135         }
18136
18137         /**
18138          * Get node with a `!default` word
18139          * @returns {Array} `['default', sc]` where `sc` is optional whitespace
18140          */
18141         function getDefault() {
18142           var type = NodeType.DefaultType;
18143           var token = tokens[pos];
18144           var line = token.ln;
18145           var column = token.col;
18146           var content = joinValues(pos, token.defaultEnd);
18147
18148           pos = token.defaultEnd + 1;
18149
18150           return newNode(type, content, line, column);
18151         }
18152
18153         /**
18154          * Check if token is a comma
18155          * @param {Number} i Token's index number
18156          * @returns {Number} `1` if token is a comma, otherwise `0`
18157          */
18158         function checkDelim(i) {
18159           return i < tokensLength && tokens[i].type === TokenType.Comma ? 1 : 0;
18160         }
18161
18162         /**
18163          * Get node with a comma
18164          * @returns {Array} `['delim']`
18165          */
18166         function getDelim() {
18167           var type = NodeType.DelimType;
18168           var token = tokens[pos];
18169           var line = token.ln;
18170           var column = token.col;
18171           var content = ',';
18172
18173           pos++;
18174
18175           return newNode(type, content, line, column);
18176         }
18177
18178         /**
18179          * Check if token is part of a number with dimension unit (e.g. `10px`)
18180          * @param {Number} i Token's index number
18181          * @return {Number}
18182          */
18183         function checkDimension(i) {
18184           var ln = checkNumber(i);
18185           var li = void 0;
18186
18187           if (i >= tokensLength || !ln || i + ln >= tokensLength) return 0;
18188
18189           return (li = checkUnit(i + ln)) ? ln + li : 0;
18190         }
18191
18192         /**
18193          * Get node of a number with dimension unit
18194          * @return {Node}
18195          */
18196         function getDimension() {
18197           var type = NodeType.DimensionType;
18198           var token = tokens[pos];
18199           var line = token.ln;
18200           var column = token.col;
18201           var content = [getNumber(), getUnit()];
18202
18203           return newNode(type, content, line, column);
18204         }
18205
18206         /**
18207          * @param {Number} i Token's index number
18208          * @returns {Number}
18209          */
18210         function checkExpression(i) {
18211           var start = i;
18212
18213           if (i >= tokensLength || tokens[i++].value !== 'expression' || i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) {
18214             return 0;
18215           }
18216
18217           return tokens[i].right - start + 1;
18218         }
18219
18220         /**
18221          * @returns {Array}
18222          */
18223         function getExpression() {
18224           var type = NodeType.ExpressionType;
18225           var token = tokens[pos];
18226           var line = token.ln;
18227           var column = token.col;
18228
18229           pos++;
18230
18231           var content = joinValues(pos + 1, tokens[pos].right - 1);
18232           var end = getLastPosition(content, line, column, 1);
18233
18234           if (end[0] === line) end[1] += 11;
18235           pos = tokens[pos].right + 1;
18236
18237           return newNode(type, content, line, column, end);
18238         }
18239
18240         function checkExtend(i) {
18241           if (i >= tokensLength) return 0;
18242
18243           var l = void 0;
18244
18245           if (l = checkExtend1(i)) tokens[i].extend_child = 1;else if (l = checkExtend2(i)) tokens[i].extend_child = 2;
18246
18247           return l;
18248         }
18249
18250         function getExtend() {
18251           var childType = tokens[pos].extend_child;
18252
18253           if (childType === 1) return getExtend1();
18254           if (childType === 2) return getExtend2();
18255         }
18256
18257         /**
18258          * Checks if token is part of an extend with `!optional` flag.
18259          * @param {Number} i
18260          */
18261         function checkExtend1(i) {
18262           var start = i;
18263           var l = void 0;
18264
18265           if (i >= tokensLength) return 0;
18266
18267           if (l = checkAtkeyword(i)) i += l;else return 0;
18268
18269           if (tokens[start + 1].value !== 'extend') return 0;
18270
18271           if (l = checkSC(i)) i += l;else return 0;
18272
18273           if (l = checkSelectorsGroup(i)) i += l;else return 0;
18274
18275           if (l = checkSC(i)) i += l;else return 0;
18276
18277           if (l = checkOptional(i)) i += l;else return 0;
18278
18279           return i - start;
18280         }
18281
18282         function getExtend1() {
18283           var type = NodeType.ExtendType;
18284           var token = tokens[pos];
18285           var line = token.ln;
18286           var column = token.col;
18287           var content = [].concat(getAtkeyword(), getSC(), getSelectorsGroup(), getSC(), getOptional());
18288
18289           return newNode(type, content, line, column);
18290         }
18291
18292         /**
18293          * Checks if token is part of an extend without `!optional` flag.
18294          * @param {Number} i
18295          */
18296         function checkExtend2(i) {
18297           var start = i;
18298           var l = void 0;
18299
18300           if (i >= tokensLength) return 0;
18301
18302           if (l = checkAtkeyword(i)) i += l;else return 0;
18303
18304           if (tokens[start + 1].value !== 'extend') return 0;
18305
18306           if (l = checkSC(i)) i += l;else return 0;
18307
18308           if (l = checkSelectorsGroup(i)) i += l;else return 0;
18309
18310           return i - start;
18311         }
18312
18313         function getExtend2() {
18314           var type = NodeType.ExtendType;
18315           var token = tokens[pos];
18316           var line = token.ln;
18317           var column = token.col;
18318           var content = [].concat(getAtkeyword(), getSC(), getSelectorsGroup());
18319
18320           return newNode(type, content, line, column);
18321         }
18322
18323         /**
18324          * @param {Number} i Token's index number
18325          * @returns {Number}
18326          */
18327         function checkFunction(i) {
18328           var start = i;
18329           var l = void 0;
18330
18331           if (i >= tokensLength) return 0;
18332
18333           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
18334
18335           return i < tokensLength && tokens[i].type === TokenType.LeftParenthesis ? tokens[i].right - start + 1 : 0;
18336         }
18337
18338         /**
18339          * @returns {Array}
18340          */
18341         function getFunction() {
18342           var type = NodeType.FunctionType;
18343           var token = tokens[pos];
18344           var line = token.ln;
18345           var column = token.col;
18346           var content = [].concat(getIdentOrInterpolation(), getArguments());
18347
18348           return newNode(type, content, line, column);
18349         }
18350
18351         /**
18352          * Check if token is part of a functions list (e.g. `function(value)...`).
18353          * @param {Number} i Token's index number
18354          * @returns {Number}
18355          */
18356         function checkFunctionsList(i) {
18357           var d = 0; // Number of dots
18358           var l = void 0;
18359
18360           if (i >= tokensLength) return 0;
18361
18362           if (l = checkFunction(i)) i += l;else return 0;
18363
18364           while (i < tokensLength && tokens[i].type === TokenType.FullStop) {
18365             d++;
18366             i++;
18367           }
18368
18369           return d === 3 ? l + d : 0;
18370         }
18371
18372         /**
18373          * Get node with a functions list
18374          * @returns {Array}
18375          */
18376         function getFunctionsList() {
18377           var type = NodeType.FunctionsListType;
18378           var token = tokens[pos];
18379           var line = token.ln;
18380           var column = token.col;
18381           var content = [getFunction()];
18382           var end = getLastPosition(content, line, column, 3);
18383
18384           // Skip `...`.
18385           pos += 3;
18386
18387           return newNode(type, content, line, column, end);
18388         }
18389
18390         /**
18391          * Check if token is part of `!global` word
18392          * @param {Number} i Token's index number
18393          * @returns {Number}
18394          */
18395         function checkGlobal(i) {
18396           var start = i;
18397           var l = void 0;
18398
18399           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
18400
18401           if (l = checkSC(i)) i += l;
18402
18403           if (tokens[i].value === 'global') {
18404             tokens[start].globalEnd = i;
18405             return i - start + 1;
18406           } else {
18407             return 0;
18408           }
18409         }
18410
18411         /**
18412          * Get node with `!global` word
18413          */
18414         function getGlobal() {
18415           var type = NodeType.GlobalType;
18416           var token = tokens[pos];
18417           var line = token.ln;
18418           var column = token.col;
18419           var content = joinValues(pos, token.globalEnd);
18420
18421           pos = token.globalEnd + 1;
18422
18423           return newNode(type, content, line, column);
18424         }
18425
18426         /**
18427          * Check if token is part of an identifier
18428          * @param {Number} i Token's index number
18429          * @returns {Number} Length of the identifier
18430          */
18431         function checkIdent(i) {
18432           var start = i;
18433
18434           if (i >= tokensLength) return 0;
18435
18436           // Check if token is part of a negative number
18437           if (tokens[i].type === TokenType.HyphenMinus && tokens[i + 1].type === TokenType.DecimalNumber) return 0;
18438
18439           if (tokens[i].type === TokenType.HyphenMinus) i++;
18440
18441           if (checkInterpolation(i)) {
18442             tokens[start].ident_last = i - 1;
18443             return i - start;
18444           }
18445
18446           if (tokens[i].type === TokenType.LowLine || tokens[i].type === TokenType.Identifier) i++;else return 0;
18447
18448           for (; i < tokensLength; i++) {
18449             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
18450           }
18451
18452           tokens[start].ident_last = i - 1;
18453
18454           return i - start;
18455         }
18456
18457         /**
18458          * Get node with an identifier
18459          * @returns {Array} `['ident', x]` where `x` is identifier's name
18460          */
18461         function getIdent() {
18462           var type = NodeType.IdentType;
18463           var token = tokens[pos];
18464           var line = token.ln;
18465           var column = token.col;
18466           var content = joinValues(pos, tokens[pos].ident_last);
18467
18468           pos = tokens[pos].ident_last + 1;
18469
18470           return newNode(type, content, line, column);
18471         }
18472
18473         /**
18474          * @param {number} i Token's index number
18475          * @returns {number} Length of the identifier
18476          */
18477         function checkPartialIdent(i) {
18478           var start = i;
18479
18480           if (i >= tokensLength) return 0;
18481
18482           for (; i < tokensLength; i++) {
18483             if (tokens[i].type !== TokenType.HyphenMinus && tokens[i].type !== TokenType.LowLine && tokens[i].type !== TokenType.Identifier && tokens[i].type !== TokenType.DecimalNumber) break;
18484           }
18485
18486           tokens[start].ident_last = i - 1;
18487
18488           return i - start;
18489         }
18490
18491         function checkIdentOrInterpolation(i) {
18492           var start = i;
18493           var l = void 0;
18494           var prevIsInterpolation = false;
18495
18496           while (i < tokensLength) {
18497             if (l = checkInterpolation(i)) {
18498               tokens[i].ii_type = 1;
18499               i += l;
18500               prevIsInterpolation = true;
18501             } else if (l = checkIdent(i)) {
18502               tokens[i].ii_type = 2;
18503               i += l;
18504               prevIsInterpolation = false;
18505             } else if (prevIsInterpolation && (l = checkPartialIdent(i))) {
18506               tokens[i].ii_type = 3;
18507               i += l;
18508               prevIsInterpolation = false;
18509             } else break;
18510           }
18511
18512           return i - start;
18513         }
18514
18515         function getIdentOrInterpolation() {
18516           var content = [];
18517
18518           while (pos < tokensLength) {
18519             var tokenType = tokens[pos].ii_type;
18520
18521             if (tokenType === 1) {
18522               content.push(getInterpolation());
18523             } else if (tokenType === 2 || tokenType === 3) {
18524               content.push(getIdent());
18525             } else break;
18526           }
18527
18528           return content;
18529         }
18530
18531         /**
18532          * Check if token is part of `!important` word
18533          * @param {Number} i Token's index number
18534          * @returns {Number}
18535          */
18536         function checkImportant(i) {
18537           var start = i;
18538           var l = void 0;
18539
18540           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
18541
18542           if (l = checkSC(i)) i += l;
18543
18544           if (tokens[i].value === 'important') {
18545             tokens[start].importantEnd = i;
18546             return i - start + 1;
18547           } else {
18548             return 0;
18549           }
18550         }
18551
18552         /**
18553          * Get node with `!important` word
18554          * @returns {Array} `['important', sc]` where `sc` is optional whitespace
18555          */
18556         function getImportant() {
18557           var type = NodeType.ImportantType;
18558           var token = tokens[pos];
18559           var line = token.ln;
18560           var column = token.col;
18561           var content = joinValues(pos, token.importantEnd);
18562
18563           pos = token.importantEnd + 1;
18564
18565           return newNode(type, content, line, column);
18566         }
18567
18568         /**
18569          * Check if token is part of an included mixin (`@include` or `@extend`
18570          *      directive).
18571          * @param {Number} i Token's index number
18572          * @returns {Number} Length of the included mixin
18573          */
18574         function checkInclude(i) {
18575           var l = void 0;
18576
18577           if (i >= tokensLength) return 0;
18578
18579           if (l = checkInclude1(i)) tokens[i].include_type = 1;else if (l = checkInclude2(i)) tokens[i].include_type = 2;else if (l = checkInclude3(i)) tokens[i].include_type = 3;else if (l = checkInclude4(i)) tokens[i].include_type = 4;else if (l = checkInclude5(i)) tokens[i].include_type = 5;
18580
18581           return l;
18582         }
18583
18584         /**
18585          * Get node with included mixin
18586          * @returns {Array} `['include', x]`
18587          */
18588         function getInclude() {
18589           var type = tokens[pos].include_type;
18590
18591           if (type === 1) return getInclude1();
18592           if (type === 2) return getInclude2();
18593           if (type === 3) return getInclude3();
18594           if (type === 4) return getInclude4();
18595           if (type === 5) return getInclude5();
18596         }
18597
18598         /**
18599          * Get node with included mixin with keyfames selector like
18600          * `@include nani(foo) { 0% {}}`
18601          * @param {Number} i Token's index number
18602          * @returns {Number} Length of the include
18603          */
18604         function checkInclude1(i) {
18605           var start = i;
18606           var l = void 0;
18607
18608           if (l = checkAtkeyword(i)) i += l;else return 0;
18609
18610           if (tokens[start + 1].value !== 'include') return 0;
18611
18612           if (l = checkSC(i)) i += l;else return 0;
18613
18614           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
18615
18616           if (l = checkSC(i)) i += l;
18617
18618           if (l = checkArguments(i)) i += l;else return 0;
18619
18620           if (l = checkSC(i)) i += l;
18621
18622           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
18623
18624           return i - start;
18625         }
18626
18627         /**
18628          * Get node with included mixin with keyfames selector like
18629          * `@include nani(foo) { 0% {}}`
18630          * @returns {Array} `['include', ['atkeyword', x], sc, ['selector', y], sc,
18631          *      ['arguments', z], sc, ['block', q], sc` where `x` is `include` or
18632          *      `extend`, `y` is mixin's identifier (selector), `z` are arguments
18633          *      passed to the mixin, `q` is block passed to the mixin containing a
18634          *      ruleset > selector > keyframesSelector, and `sc` are optional
18635          *      whitespaces
18636          */
18637         function getInclude1() {
18638           var type = NodeType.IncludeType;
18639           var token = tokens[pos];
18640           var line = token.ln;
18641           var column = token.col;
18642           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getArguments(), getSC(), getKeyframesBlocks());
18643
18644           return newNode(type, content, line, column);
18645         }
18646
18647         /**
18648          * Check if token is part of an included mixin like `@include nani(foo) {...}`
18649          * @param {Number} i Token's index number
18650          * @returns {Number} Length of the include
18651          */
18652         function checkInclude2(i) {
18653           var start = i;
18654           var l = void 0;
18655
18656           if (l = checkAtkeyword(i)) i += l;else return 0;
18657
18658           if (tokens[start + 1].value !== 'include') return 0;
18659
18660           if (l = checkSC(i)) i += l;else return 0;
18661
18662           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
18663
18664           if (l = checkSC(i)) i += l;
18665
18666           if (l = checkArguments(i)) i += l;else return 0;
18667
18668           if (l = checkSC(i)) i += l;
18669
18670           if (l = checkBlock(i)) i += l;else return 0;
18671
18672           return i - start;
18673         }
18674
18675         /**
18676          * Get node with included mixin like `@include nani(foo) {...}`
18677          * @returns {Array} `['include', ['atkeyword', x], sc, ['selector', y], sc,
18678          *      ['arguments', z], sc, ['block', q], sc` where `x` is `include` or
18679          *      `extend`, `y` is mixin's identifier (selector), `z` are arguments
18680          *      passed to the mixin, `q` is block passed to the mixin and `sc`
18681          *      are optional whitespaces
18682          */
18683         function getInclude2() {
18684           var type = NodeType.IncludeType;
18685           var token = tokens[pos];
18686           var line = token.ln;
18687           var column = token.col;
18688           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getArguments(), getSC(), getBlock());
18689
18690           return newNode(type, content, line, column);
18691         }
18692
18693         /**
18694          * Check if token is part of an included mixin like `@include nani(foo)`
18695          * @param {Number} i Token's index number
18696          * @returns {Number} Length of the include
18697          */
18698         function checkInclude3(i) {
18699           var start = i;
18700           var l = void 0;
18701
18702           if (l = checkAtkeyword(i)) i += l;else return 0;
18703
18704           if (tokens[start + 1].value !== 'include') return 0;
18705
18706           if (l = checkSC(i)) i += l;else return 0;
18707
18708           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
18709
18710           if (l = checkSC(i)) i += l;
18711
18712           if (l = checkArguments(i)) i += l;else return 0;
18713
18714           return i - start;
18715         }
18716
18717         /**
18718          * Get node with included mixin like `@include nani(foo)`
18719          * @returns {Array} `['include', ['atkeyword', x], sc, ['selector', y], sc,
18720          *      ['arguments', z], sc]` where `x` is `include` or `extend`, `y` is
18721          *      mixin's identifier (selector), `z` are arguments passed to the
18722          *      mixin and `sc` are optional whitespaces
18723          */
18724         function getInclude3() {
18725           var type = NodeType.IncludeType;
18726           var token = tokens[pos];
18727           var line = token.ln;
18728           var column = token.col;
18729           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getArguments());
18730
18731           return newNode(type, content, line, column);
18732         }
18733
18734         /**
18735          * Check if token is part of an included mixin with a content block passed
18736          *      as an argument (e.g. `@include nani {...}`)
18737          * @param {Number} i Token's index number
18738          * @returns {Number} Length of the mixin
18739          */
18740         function checkInclude4(i) {
18741           var start = i;
18742           var l = void 0;
18743
18744           if (l = checkAtkeyword(i)) i += l;else return 0;
18745
18746           if (tokens[start + 1].value !== 'include') return 0;
18747
18748           if (l = checkSC(i)) i += l;else return 0;
18749
18750           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
18751
18752           if (l = checkSC(i)) i += l;
18753
18754           if (l = checkBlock(i)) i += l;else return 0;
18755
18756           return i - start;
18757         }
18758
18759         /**
18760          * Get node with an included mixin with a content block passed
18761          *      as an argument (e.g. `@include nani {...}`)
18762          * @returns {Array} `['include', x]`
18763          */
18764         function getInclude4() {
18765           var type = NodeType.IncludeType;
18766           var token = tokens[pos];
18767           var line = token.ln;
18768           var column = token.col;
18769           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation(), getSC(), getBlock());
18770
18771           return newNode(type, content, line, column);
18772         }
18773
18774         /**
18775          * @param {Number} i Token's index number
18776          * @returns {Number}
18777          */
18778         function checkInclude5(i) {
18779           var start = i;
18780           var l = void 0;
18781
18782           if (l = checkAtkeyword(i)) i += l;else return 0;
18783
18784           if (tokens[start + 1].value !== 'include') return 0;
18785
18786           if (l = checkSC(i)) i += l;else return 0;
18787
18788           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
18789
18790           return i - start;
18791         }
18792
18793         /**
18794          * @returns {Array} `['include', x]`
18795          */
18796         function getInclude5() {
18797           var type = NodeType.IncludeType;
18798           var token = tokens[pos];
18799           var line = token.ln;
18800           var column = token.col;
18801           var content = [].concat(getAtkeyword(), getSC(), getIdentOrInterpolation());
18802
18803           return newNode(type, content, line, column);
18804         }
18805
18806         /**
18807          * Check if token is part of an interpolated variable (e.g. `#{$nani}`).
18808          * @param {Number} i Token's index number
18809          * @returns {Number}
18810          */
18811         function checkInterpolation(i) {
18812           var start = i;
18813           var l = void 0;
18814
18815           if (i >= tokensLength) return 0;
18816
18817           if (tokens[i].type !== TokenType.NumberSign || !tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket) return 0;
18818
18819           i += 2;
18820
18821           while (tokens[i].type !== TokenType.RightCurlyBracket) {
18822             if (l = checkArgument(i)) i += l;else return 0;
18823           }
18824
18825           return tokens[i].type === TokenType.RightCurlyBracket ? i - start + 1 : 0;
18826         }
18827
18828         /**
18829          * Get node with an interpolated variable
18830          * @returns {Array} `['interpolation', x]`
18831          */
18832         function getInterpolation() {
18833           var type = NodeType.InterpolationType;
18834           var token = tokens[pos];
18835           var line = token.ln;
18836           var column = token.col;
18837           var content = [];
18838
18839           // Skip `#{`:
18840           pos += 2;
18841
18842           while (pos < tokensLength && tokens[pos].type !== TokenType.RightCurlyBracket) {
18843             var body = getArgument();
18844             if (typeof body.content === 'string') content.push(body);else content = content.concat(body);
18845           }
18846
18847           var end = getLastPosition(content, line, column, 1);
18848
18849           // Skip `}`:
18850           pos++;
18851
18852           return newNode(type, content, line, column, end);
18853         }
18854
18855         /**
18856          * Check a single keyframe block - `5% {}`
18857          * @param {Number} i
18858          * @returns {Number}
18859          */
18860         function checkKeyframesBlock(i) {
18861           var start = i;
18862           var l = void 0;
18863
18864           if (i >= tokensLength) return 0;
18865
18866           if (l = checkKeyframesSelectorsGroup(i)) i += l;else return 0;
18867
18868           if (l = checkSC(i)) i += l;
18869
18870           if (l = checkBlock(i)) i += l;else return 0;
18871
18872           return i - start;
18873         }
18874
18875         /**
18876          * Get a single keyframe block - `5% {}`
18877          * @returns {Node}
18878          */
18879         function getKeyframesBlock() {
18880           var type = NodeType.RulesetType;
18881           var token = tokens[pos];
18882           var line = token.ln;
18883           var column = token.col;
18884           var content = [].concat(getKeyframesSelectorsGroup(), getSC(), getBlock());
18885
18886           return newNode(type, content, line, column);
18887         }
18888
18889         /**
18890          * Check all keyframe blocks - `5% {} 100% {}`
18891          * @param {Number} i
18892          * @returns {Number}
18893          */
18894         function checkKeyframesBlocks(i) {
18895           var start = i;
18896           var l = void 0;
18897
18898           if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;else return 0;
18899
18900           if (l = checkSC(i)) i += l;
18901
18902           if (l = checkKeyframesBlock(i)) i += l;
18903
18904           while (tokens[i].type !== TokenType.RightCurlyBracket) {
18905             if (l = checkSC(i)) i += l;else if (l = checkKeyframesBlock(i)) i += l;else if (l = checkAtrule(i)) {
18906               i += l;
18907               if (l = checkSC(i)) i += l;
18908               if (l = checkDeclDelim(i)) i += l;
18909             } else break;
18910           }
18911
18912           if (i < tokensLength && tokens[i].type === TokenType.RightCurlyBracket) i++;else return 0;
18913
18914           return i - start;
18915         }
18916
18917         /**
18918          * Get all keyframe blocks - `5% {} 100% {}`
18919          * @returns {Node}
18920          */
18921         function getKeyframesBlocks() {
18922           var type = NodeType.BlockType;
18923           var token = tokens[pos];
18924           var line = token.ln;
18925           var column = token.col;
18926           var keyframesBlocksEnd = token.right;
18927           var content = [];
18928
18929           // Skip `{`.
18930           pos++;
18931
18932           while (pos < keyframesBlocksEnd) {
18933             if (checkSC(pos)) content = content.concat(getSC());else if (checkKeyframesBlock(pos)) content.push(getKeyframesBlock());else if (checkAtrule(pos)) {
18934               content.push(getAtrule()); // @content
18935               if (checkSC(pos)) content = content.concat(getSC());
18936               if (checkDeclDelim(pos)) content.push(getDeclDelim());
18937             } else break;
18938           }
18939
18940           var end = getLastPosition(content, line, column, 1);
18941
18942           // Skip `}`.
18943           pos++;
18944
18945           return newNode(type, content, line, column, end);
18946         }
18947
18948         /**
18949          * Check if token is part of a @keyframes rule.
18950          * @param {Number} i Token's index number
18951          * @return {Number} Length of the @keyframes rule
18952          */
18953         function checkKeyframesRule(i) {
18954           var start = i;
18955           var l = void 0;
18956
18957           if (i >= tokensLength) return 0;
18958
18959           if (l = checkAtkeyword(i)) i += l;else return 0;
18960
18961           var atruleName = joinValues2(i - l, l);
18962           if (atruleName.toLowerCase().indexOf('keyframes') === -1) return 0;
18963
18964           if (l = checkSC(i)) i += l;else return 0;
18965
18966           if (l = checkIdentOrInterpolation(i) || checkPseudoc(i)) i += l;else return 0;
18967
18968           if (l = checkSC(i)) i += l;
18969
18970           if (l = checkKeyframesBlocks(i)) i += l;else return 0;
18971
18972           return i - start;
18973         }
18974
18975         /**
18976          * @return {Node}
18977          */
18978         function getKeyframesRule() {
18979           var type = NodeType.AtruleType;
18980           var token = tokens[pos];
18981           var line = token.ln;
18982           var column = token.col;
18983           var content = [].concat(getAtkeyword(), getSC());
18984
18985           if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());else if (checkPseudoc(pos)) {
18986             content = content.concat(getPseudoc());
18987           }
18988
18989           content = content.concat(getSC(), getKeyframesBlocks());
18990
18991           return newNode(type, content, line, column);
18992         }
18993
18994         /**
18995          * Check a single keyframe selector - `5%`, `from` etc
18996          * @param {Number} i
18997          * @returns {Number}
18998          */
18999         function checkKeyframesSelector(i) {
19000           var start = i;
19001           var l = void 0;
19002
19003           if (i >= tokensLength) return 0;
19004
19005           if (l = checkIdent(i)) {
19006             // Valid selectors are only `from` and `to`.
19007             var selector = joinValues2(i, l);
19008             if (selector !== 'from' && selector !== 'to') return 0;
19009
19010             i += l;
19011             tokens[start].keyframesSelectorType = 1;
19012           } else if (l = checkPercentage(i)) {
19013             i += l;
19014             tokens[start].keyframesSelectorType = 2;
19015           } else if (l = checkInterpolation(i)) {
19016             i += l;
19017             tokens[start].keyframesSelectorType = 3;
19018           } else {
19019             return 0;
19020           }
19021
19022           return i - start;
19023         }
19024
19025         /**
19026          * Get a single keyframe selector
19027          * @returns {Node}
19028          */
19029         function getKeyframesSelector() {
19030           var keyframesSelectorType = NodeType.KeyframesSelectorType;
19031           var selectorType = NodeType.SelectorType;
19032           var token = tokens[pos];
19033           var line = token.ln;
19034           var column = token.col;
19035           var content = [];
19036
19037           if (token.keyframesSelectorType === 1) {
19038             content.push(getIdent());
19039           } else if (token.keyframesSelectorType === 2) {
19040             content.push(getPercentage());
19041           } else if (token.keyframesSelectorType === 3) {
19042             content.push(getInterpolation());
19043           }
19044
19045           var keyframesSelector = newNode(keyframesSelectorType, content, line, column);
19046
19047           return newNode(selectorType, [keyframesSelector], line, column);
19048         }
19049
19050         /**
19051          * Check the keyframe's selector groups
19052          * @param {Number} i
19053          * @returns {Number}
19054          */
19055         function checkKeyframesSelectorsGroup(i) {
19056           var start = i;
19057           var l = void 0;
19058
19059           if (l = checkKeyframesSelector(i)) i += l;else return 0;
19060
19061           while (i < tokensLength) {
19062             var spaceBefore = checkSC(i);
19063             var comma = checkDelim(i + spaceBefore);
19064             if (!comma) break;
19065
19066             var spaceAfter = checkSC(i + spaceBefore + comma);
19067             if (l = checkKeyframesSelector(i + spaceBefore + comma + spaceAfter)) {
19068               i += spaceBefore + comma + spaceAfter + l;
19069             } else break;
19070           }
19071
19072           tokens[start].selectorsGroupEnd = i;
19073
19074           return i - start;
19075         }
19076
19077         /**
19078          * Get the keyframe's selector groups
19079          * @returns {Array} An array of keyframe selectors
19080          */
19081         function getKeyframesSelectorsGroup() {
19082           var selectorsGroup = [];
19083           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
19084
19085           selectorsGroup.push(getKeyframesSelector());
19086
19087           while (pos < selectorsGroupEnd) {
19088             selectorsGroup = selectorsGroup.concat(getSC(), getDelim(), getSC(), getKeyframesSelector());
19089           }
19090
19091           return selectorsGroup;
19092         }
19093
19094         /**
19095          * Check if token is part of a loop.
19096          * @param {Number} i Token's index number
19097          * @returns {Number} Length of the loop
19098          */
19099         function checkLoop(i) {
19100           var start = i;
19101           var l = void 0;
19102
19103           if (i >= tokensLength) return 0;
19104
19105           if (l = checkAtkeyword(i)) i += l;else return 0;
19106
19107           if (['for', 'each', 'while'].indexOf(tokens[start + 1].value) < 0) return 0;
19108
19109           while (i < tokensLength) {
19110             if (l = checkBlock(i)) {
19111               i += l;
19112               break;
19113             } else if (l = checkVariable(i) || checkNumber(i) || checkInterpolation(i) || checkIdent(i) || checkSC(i) || checkOperator(i) || checkCombinator(i) || checkString(i)) i += l;else return 0;
19114           }
19115
19116           return i - start;
19117         }
19118
19119         /**
19120          * Get node with a loop.
19121          * @returns {Array} `['loop', x]`
19122          */
19123         function getLoop() {
19124           var type = NodeType.LoopType;
19125           var token = tokens[pos];
19126           var line = token.ln;
19127           var column = token.col;
19128           var content = [];
19129
19130           content.push(getAtkeyword());
19131
19132           while (pos < tokensLength) {
19133             if (checkBlock(pos)) {
19134               content.push(getBlock());
19135               break;
19136             } else if (checkVariable(pos)) content.push(getVariable());else if (checkNumber(pos)) content.push(getNumber());else if (checkInterpolation(pos)) content.push(getInterpolation());else if (checkIdent(pos)) content.push(getIdent());else if (checkOperator(pos)) content.push(getOperator());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkSC(pos)) content = content.concat(getSC());else if (checkString(pos)) content.push(getString());
19137           }
19138
19139           return newNode(type, content, line, column);
19140         }
19141
19142         /**
19143          * Check if token is part of a mixin
19144          * @param {Number} i Token's index number
19145          * @returns {Number} Length of the mixin
19146          */
19147         function checkMixin(i) {
19148           var start = i;
19149           var l = void 0;
19150
19151           if (i >= tokensLength) return 0;
19152
19153           if ((l = checkAtkeyword(i)) && tokens[i + 1].value === 'mixin') i += l;else return 0;
19154
19155           if (l = checkSC(i)) i += l;
19156
19157           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
19158
19159           if (l = checkSC(i)) i += l;
19160
19161           if (l = checkArguments(i)) i += l;
19162
19163           if (l = checkSC(i)) i += l;
19164
19165           if (l = checkBlock(i)) i += l;else return 0;
19166
19167           return i - start;
19168         }
19169
19170         /**
19171          * Get node with a mixin
19172          * @returns {Array} `['mixin', x]`
19173          */
19174         function getMixin() {
19175           var type = NodeType.MixinType;
19176           var token = tokens[pos];
19177           var line = token.ln;
19178           var column = token.col;
19179           var content = [].concat(getAtkeyword(), getSC());
19180
19181           if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());
19182
19183           content = content.concat(getSC());
19184
19185           if (checkArguments(pos)) content.push(getArguments());
19186
19187           content = content.concat(getSC());
19188
19189           if (checkBlock(pos)) content.push(getBlock());
19190
19191           return newNode(type, content, line, column);
19192         }
19193
19194         /**
19195          * Check if token is a namespace sign (`|`)
19196          * @param {Number} i Token's index number
19197          * @returns {Number} `1` if token is `|`, `0` if not
19198          */
19199         function checkNamespace(i) {
19200           return i < tokensLength && tokens[i].type === TokenType.VerticalLine ? 1 : 0;
19201         }
19202
19203         /**
19204          * Get node with a namespace sign
19205          * @returns {Array} `['namespace']`
19206          */
19207         function getNamespace() {
19208           var type = NodeType.NamespaceType;
19209           var token = tokens[pos];
19210           var line = token.ln;
19211           var column = token.col;
19212           var content = '|';
19213
19214           pos++;
19215
19216           return newNode(type, content, line, column);
19217         }
19218
19219         /**
19220          * @param {Number} i Token's index number
19221          * @returns {Number}
19222          */
19223         function checkNmName2(i) {
19224           if (tokens[i].type === TokenType.Identifier) return 1;else if (tokens[i].type !== TokenType.DecimalNumber) return 0;
19225
19226           i++;
19227
19228           return i < tokensLength && tokens[i].type === TokenType.Identifier ? 2 : 1;
19229         }
19230
19231         /**
19232          * @returns {String}
19233          */
19234         function getNmName2() {
19235           var s = tokens[pos].value;
19236
19237           if (tokens[pos++].type === TokenType.DecimalNumber && pos < tokensLength && tokens[pos].type === TokenType.Identifier) s += tokens[pos++].value;
19238
19239           return s;
19240         }
19241
19242         /**
19243          * Check if token is part of a number
19244          * @param {Number} i Token's index number
19245          * @returns {Number} Length of number
19246          */
19247         function checkNumber(i) {
19248           if (i >= tokensLength) return 0;
19249
19250           if (tokens[i].number_l) return tokens[i].number_l;
19251
19252           // `10`:
19253           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && (!tokens[i + 1] || tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop)) {
19254             tokens[i].number_l = 1;
19255             return 1;
19256           }
19257
19258           // `10.`:
19259           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && (!tokens[i + 2] || tokens[i + 2].type !== TokenType.DecimalNumber)) {
19260             tokens[i].number_l = 2;
19261             return 2;
19262           }
19263
19264           // `.10`:
19265           if (i < tokensLength && tokens[i].type === TokenType.FullStop && tokens[i + 1].type === TokenType.DecimalNumber) {
19266             tokens[i].number_l = 2;
19267             return 2;
19268           }
19269
19270           // `10.10`:
19271           if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber && tokens[i + 1] && tokens[i + 1].type === TokenType.FullStop && tokens[i + 2] && tokens[i + 2].type === TokenType.DecimalNumber) {
19272             tokens[i].number_l = 3;
19273             return 3;
19274           }
19275
19276           return 0;
19277         }
19278
19279         /**
19280          * Get node with number
19281          * @returns {Array} `['number', x]` where `x` is a number converted
19282          *      to string.
19283          */
19284         function getNumber() {
19285           var type = NodeType.NumberType;
19286           var token = tokens[pos];
19287           var line = token.ln;
19288           var column = token.col;
19289           var l = tokens[pos].number_l;
19290           var content = '';
19291
19292           for (var j = 0; j < l; j++) {
19293             content += tokens[pos + j].value;
19294           }
19295
19296           pos += l;
19297
19298           return newNode(type, content, line, column);
19299         }
19300
19301         /**
19302          * Check if token is an operator (`/`, `%`, `,`, `:` or `=`).
19303          * @param {Number} i Token's index number
19304          * @returns {Number} `1` if token is an operator, otherwise `0`
19305          */
19306         function checkOperator(i) {
19307           if (i >= tokensLength) return 0;
19308
19309           switch (tokens[i].type) {
19310             case TokenType.Solidus:
19311             case TokenType.PercentSign:
19312             case TokenType.Comma:
19313             case TokenType.Colon:
19314             case TokenType.EqualsSign:
19315             case TokenType.EqualitySign:
19316             case TokenType.InequalitySign:
19317             case TokenType.LessThanSign:
19318             case TokenType.GreaterThanSign:
19319             case TokenType.Asterisk:
19320               return 1;
19321           }
19322
19323           return 0;
19324         }
19325
19326         /**
19327          * Get node with an operator
19328          * @returns {Array} `['operator', x]` where `x` is an operator converted
19329          *      to string.
19330          */
19331         function getOperator() {
19332           var type = NodeType.OperatorType;
19333           var token = tokens[pos];
19334           var line = token.ln;
19335           var column = token.col;
19336           var content = token.value;
19337
19338           pos++;
19339
19340           return newNode(type, content, line, column);
19341         }
19342
19343         /**
19344          * Check if token is part of `!optional` word
19345          * @param {Number} i Token's index number
19346          * @returns {Number}
19347          */
19348         function checkOptional(i) {
19349           var start = i;
19350           var l = void 0;
19351
19352           if (i >= tokensLength || tokens[i++].type !== TokenType.ExclamationMark) return 0;
19353
19354           if (l = checkSC(i)) i += l;
19355
19356           if (tokens[i].value === 'optional') {
19357             tokens[start].optionalEnd = i;
19358             return i - start + 1;
19359           } else {
19360             return 0;
19361           }
19362         }
19363
19364         /**
19365          * Get node with `!optional` word
19366          */
19367         function getOptional() {
19368           var type = NodeType.OptionalType;
19369           var token = tokens[pos];
19370           var line = token.ln;
19371           var column = token.col;
19372           var content = joinValues(pos, token.optionalEnd);
19373
19374           pos = token.optionalEnd + 1;
19375
19376           return newNode(type, content, line, column);
19377         }
19378
19379         /**
19380          * Check if token is part of text inside parentheses, e.g. `(1)`
19381          * @param {Number} i Token's index number
19382          * @return {Number}
19383          */
19384         function checkParentheses(i) {
19385           if (i >= tokensLength) return 0;
19386
19387           var start = i;
19388           var right = tokens[i].right;
19389           var l = void 0;
19390
19391           // Skip `(`.
19392           if (tokens[i].type === TokenType.LeftParenthesis) i++;else return 0;
19393
19394           if (i < right) {
19395             if (l = checkTsets(i)) i += l;else return 0;
19396           }
19397
19398           // Skip `)`.
19399           i++;
19400
19401           return i - start;
19402         }
19403
19404         /**
19405          * Get node with text inside parentheses, e.g. `(1)`
19406          * @return {Node}
19407          */
19408         function getParentheses() {
19409           var type = NodeType.ParenthesesType;
19410           var token = tokens[pos];
19411           var line = token.ln;
19412           var column = token.col;
19413           var right = token.right;
19414           var content = [];
19415
19416           // Skip `(`.
19417           pos++;
19418
19419           if (pos < right) {
19420             content = getTsets();
19421           }
19422
19423           var end = getLastPosition(content, line, column, 1);
19424
19425           // Skip `)`.
19426           pos++;
19427
19428           return newNode(type, content, line, column, end);
19429         }
19430
19431         /**
19432          * Check if token is a parent selector, e.g. `&`
19433          * @param {number} i Token's index number
19434          * @return {number}
19435          */
19436         function checkParentSelector(i) {
19437           return i < tokensLength && tokens[i].type === TokenType.Ampersand ? 1 : 0;
19438         }
19439
19440         /**
19441          * Get node with a parent selector
19442          * @return {Node}
19443          */
19444         function getParentSelector() {
19445           var type = NodeType.ParentSelectorType;
19446           var token = tokens[pos];
19447           var line = token.ln;
19448           var column = token.col;
19449           var content = '&';
19450
19451           pos++;
19452
19453           return newNode(type, content, line, column);
19454         }
19455
19456         /**
19457          * Check if token is a parent selector extension, e.g. `&--foo-bar`
19458          * @param {number} i Token's index number
19459          * @returns {number} Length of the parent selector extension
19460          */
19461         function checkParentSelectorExtension(i) {
19462           var start = i;
19463           var l = void 0;
19464
19465           if (i >= tokensLength) return 0;
19466
19467           while (i < tokensLength) {
19468             if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;else break;
19469           }
19470
19471           return i - start;
19472         }
19473
19474         /**
19475          * Get parent selector extension node
19476          * @return {Node}
19477          */
19478         function getParentSelectorExtension() {
19479           var type = NodeType.ParentSelectorExtensionType;
19480           var token = tokens[pos];
19481           var line = token.ln;
19482           var column = token.col;
19483           var content = [];
19484
19485           while (pos < tokensLength) {
19486             if (checkIdentOrInterpolation(pos)) {
19487               content = content.concat(getIdentOrInterpolation());
19488             } else if (checkPartialIdent(pos)) {
19489               content.push(getIdent());
19490             } else break;
19491           }
19492
19493           return newNode(type, content, line, column);
19494         }
19495
19496         /**
19497          * Check if token is a parent selector with an extension or not
19498          * @param {number} i Token's index number
19499          * @return {number} Length of the parent selector and extension if applicable
19500          */
19501         function checkParentSelectorWithExtension(i) {
19502           var start = i;
19503           var l = void 0;
19504
19505           if (i >= tokensLength) return 0;
19506
19507           if (l = checkParentSelector(i)) i += l;else return 0;
19508
19509           if (l = checkParentSelectorExtension(i)) i += l;
19510
19511           return i - start;
19512         }
19513
19514         /**
19515          * Get parent selector node and extension node if applicable
19516          * @return {Array}
19517          */
19518         function getParentSelectorWithExtension() {
19519           var content = [getParentSelector()];
19520
19521           if (checkParentSelectorExtension(pos)) content.push(getParentSelectorExtension());
19522
19523           return content;
19524         }
19525
19526         /**
19527          * Check if token is part of a number or an interpolation with a percent sign
19528          * (e.g. `10%`).
19529          * @param {Number} i Token's index number
19530          * @returns {Number}
19531          */
19532         function checkPercentage(i) {
19533           var start = i;
19534           var l = void 0;
19535
19536           if (i >= tokensLength) return 0;
19537
19538           if (l = checkNumberOrInterpolation(i)) i += l;else return 0;
19539
19540           if (i >= tokensLength) return 0;
19541
19542           // Skip `%`.
19543           if (tokens[i].type === TokenType.PercentSign) i++;else return 0;
19544
19545           return i - start;
19546         }
19547
19548         /**
19549          * Get a percentage node that contains either a number or an interpolation
19550          * @returns {Object} The percentage node
19551          */
19552         function getPercentage() {
19553           var type = NodeType.PercentageType;
19554           var token = tokens[pos];
19555           var line = token.ln;
19556           var column = token.col;
19557           var content = getNumberOrInterpolation();
19558           var end = getLastPosition(content, line, column, 1);
19559
19560           // Skip `%`.
19561           pos++;
19562
19563           return newNode(type, content, line, column, end);
19564         }
19565
19566         /**
19567          * Check if token is a number or an interpolation
19568          * @param {Number} i Token's index number
19569          * @returns {Number}
19570          */
19571         function checkNumberOrInterpolation(i) {
19572           var start = i;
19573           var l = void 0;
19574
19575           while (i < tokensLength) {
19576             if (l = checkInterpolation(i) || checkNumber(i)) i += l;else break;
19577           }
19578
19579           return i - start;
19580         }
19581
19582         /**
19583          * Get a number and/or interpolation node
19584          * @returns {Array} An array containing a single or multiple nodes
19585          */
19586         function getNumberOrInterpolation() {
19587           var content = [];
19588
19589           while (pos < tokensLength) {
19590             if (checkInterpolation(pos)) content.push(getInterpolation());else if (checkNumber(pos)) content.push(getNumber());else break;
19591           }
19592
19593           return content;
19594         }
19595
19596         /**
19597          * Check if token is part of a placeholder selector (e.g. `%abc`).
19598          * @param {Number} i Token's index number
19599          * @returns {Number} Length of the selector
19600          */
19601         function checkPlaceholder(i) {
19602           var start = i;
19603           var l = void 0;
19604
19605           if (i >= tokensLength) return 0;
19606
19607           if (tokens[start].placeholder_l) return tokens[start].placeholder_l;
19608
19609           // Skip `%`.
19610           if (tokens[i].type === TokenType.PercentSign) i++;else return 0;
19611
19612           if (l = checkIdentOrInterpolation(i)) {
19613             i += l;
19614             tokens[start].placeholder_l = i - start;
19615           } else return 0;
19616
19617           return i - start;
19618         }
19619
19620         /**
19621          * Get node with a placeholder selector
19622          * @returns {Array} `['placeholder', ['ident', x]]` where x is a placeholder's
19623          *      identifier (without `%`, e.g. `abc`).
19624          */
19625         function getPlaceholder() {
19626           var type = NodeType.PlaceholderType;
19627           var token = tokens[pos];
19628           var line = token.ln;
19629           var column = token.col;
19630           var content = [];
19631
19632           // Skip `%`.
19633           pos++;
19634
19635           content = content.concat(getIdentOrInterpolation());
19636
19637           return newNode(type, content, line, column);
19638         }
19639
19640         /**
19641          * @param {Number} i Token's index number
19642          * @returns {Number}
19643          */
19644         function checkProgid(i) {
19645           var start = i;
19646           var l = void 0;
19647
19648           if (i >= tokensLength) return 0;
19649
19650           if (joinValues2(i, 6) === 'progid:DXImageTransform.Microsoft.') i += 6;else return 0;
19651
19652           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
19653
19654           if (l = checkSC(i)) i += l;
19655
19656           if (tokens[i].type === TokenType.LeftParenthesis) {
19657             tokens[start].progid_end = tokens[i].right;
19658             i = tokens[i].right + 1;
19659           } else return 0;
19660
19661           return i - start;
19662         }
19663
19664         /**
19665          * @returns {Array}
19666          */
19667         function getProgid() {
19668           var type = NodeType.ProgidType;
19669           var token = tokens[pos];
19670           var line = token.ln;
19671           var column = token.col;
19672           var progid_end = token.progid_end;
19673           var content = joinValues(pos, progid_end);
19674
19675           pos = progid_end + 1;
19676
19677           return newNode(type, content, line, column);
19678         }
19679
19680         /**
19681          * Check if token is part of a property
19682          * @param {Number} i Token's index number
19683          * @return {Number} Length of the property
19684          */
19685         function checkProperty(i) {
19686           var start = i;
19687           var l = void 0;
19688
19689           if (l = checkProperty1(i)) tokens[start].propertyType = 1;else if (l = checkProperty2(i)) tokens[start].propertyType = 2;else if (l = checkProperty3(i)) tokens[start].propertyType = 3;
19690
19691           return l;
19692         }
19693
19694         /**
19695          * Get node with a property
19696          * @return {Node}
19697          */
19698         function getProperty() {
19699           var type = tokens[pos].propertyType;
19700
19701           if (type === 1) return getProperty1();
19702           if (type === 2) return getProperty2();
19703           if (type === 3) return getProperty3();
19704         }
19705
19706         /**
19707          * Check if token is part of a property
19708          * (1) `foo`
19709          * (2) `#{$foo}`
19710          * @param {Number} i Token's index number
19711          * @returns {Number} Length of the property
19712          */
19713         function checkProperty1(i) {
19714           var start = i;
19715           var l = void 0;
19716
19717           if (i >= tokensLength) return 0;
19718
19719           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
19720
19721           return i - start;
19722         }
19723
19724         /**
19725          * Get node with a property
19726          * @returns {Array}
19727          */
19728         function getProperty1() {
19729           var type = NodeType.PropertyType;
19730           var token = tokens[pos];
19731           var line = token.ln;
19732           var column = token.col;
19733           var content = getIdentOrInterpolation();
19734
19735           return newNode(type, content, line, column);
19736         }
19737
19738         /**
19739          * Check if token is part of a custom property
19740          * (1) `--foo-bar`
19741          * @param {Number} i Token's index number
19742          * @return {Number} Length of the property
19743          */
19744         function checkProperty2(i) {
19745           return checkCustomProperty(i);
19746         }
19747
19748         /**
19749          * Get node with a custom property
19750          * @return {Node}
19751          */
19752         function getProperty2() {
19753           return getCustomProperty();
19754         }
19755
19756         /**
19757          * Check if token is part of a property
19758          * (1) `$foo`
19759          * @param {Number} i Token's index number
19760          * @returns {Number} Length of the property
19761          */
19762         function checkProperty3(i) {
19763           var start = i;
19764           var l = void 0;
19765
19766           if (i >= tokensLength) return 0;
19767
19768           if (l = checkVariable(i)) i += l;else return 0;
19769
19770           return i - start;
19771         }
19772
19773         /**
19774          * Get node with a property
19775          * @returns {Array} `['property', x]`
19776          */
19777         function getProperty3() {
19778           var type = NodeType.PropertyType;
19779           var token = tokens[pos];
19780           var line = token.ln;
19781           var column = token.col;
19782           var content = [getVariable()];
19783
19784           return newNode(type, content, line, column);
19785         }
19786
19787         /**
19788          * Check if token is part of a custom property
19789          * @param {Number} i Token's index number
19790          * @return {Number} Length of the property
19791          */
19792         function checkCustomProperty(i) {
19793           var start = i;
19794           var l = void 0;
19795
19796           if (i >= tokensLength) return 0;
19797
19798           if (tokens[i].type !== TokenType.HyphenMinus || tokens[i + 1] && tokens[i + 1].type !== TokenType.HyphenMinus) return 0;
19799
19800           // Skip `--`
19801           i += 2;
19802
19803           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
19804
19805           return i - start;
19806         }
19807
19808         /**
19809          * Get node with a custom property
19810          * @return {Node}
19811          */
19812         function getCustomProperty() {
19813           var type = NodeType.CustomPropertyType;
19814           var token = tokens[pos];
19815           var line = token.ln;
19816           var column = token.col;
19817
19818           // Skip `--`
19819           pos += 2;
19820
19821           var content = getIdentOrInterpolation();
19822
19823           return newNode(type, content, line, column);
19824         }
19825
19826         /**
19827          * Check if token is a colon
19828          * @param {Number} i Token's index number
19829          * @returns {Number} `1` if token is a colon, otherwise `0`
19830          */
19831         function checkPropertyDelim(i) {
19832           return i < tokensLength && tokens[i].type === TokenType.Colon ? 1 : 0;
19833         }
19834
19835         /**
19836          * Get node with a colon
19837          * @returns {Array} `['propertyDelim']`
19838          */
19839         function getPropertyDelim() {
19840           var type = NodeType.PropertyDelimType;
19841           var token = tokens[pos];
19842           var line = token.ln;
19843           var column = token.col;
19844           var content = ':';
19845
19846           // Skip `:`.
19847           pos++;
19848
19849           return newNode(type, content, line, column);
19850         }
19851
19852         /**
19853          * @param {Number} i Token's index number
19854          * @returns {Number}
19855          */
19856         function checkPseudo(i) {
19857           return checkPseudoe(i) || checkPseudoc(i);
19858         }
19859
19860         /**
19861          * @returns {Array}
19862          */
19863         function getPseudo() {
19864           if (checkPseudoe(pos)) return getPseudoe();
19865           if (checkPseudoc(pos)) return getPseudoc();
19866         }
19867
19868         /**
19869          * @param {Number} i Token's index number
19870          * @returns {Number}
19871          */
19872         function checkPseudoe(i) {
19873           var l = void 0;
19874
19875           // Check `::`
19876           if (i >= tokensLength || tokens[i].type !== TokenType.Colon || i >= tokensLength || tokens[i + 1].type !== TokenType.Colon) return 0;
19877
19878           if (l = checkPseudoElement1(i)) tokens[i].pseudoElementType = 1;else if (l = checkPseudoElement2(i)) tokens[i].pseudoElementType = 2;else return 0;
19879
19880           return l;
19881         }
19882
19883         /**
19884          * @returns {Node}
19885          */
19886         function getPseudoe() {
19887           var childType = tokens[pos].pseudoElementType;
19888           if (childType === 1) return getPseudoElement1();
19889           if (childType === 2) return getPseudoElement2();
19890         }
19891
19892         /**
19893          * (1) `::slotted(selector)`
19894          * (2) `::slotted(selector, selector)`
19895          */
19896         function checkPseudoElement1(i) {
19897           var start = i;
19898           var l = void 0;
19899
19900           // Skip `::`.
19901           i += 2;
19902
19903           if (i >= tokensLength) return 0;
19904
19905           if (l = checkIdent(i)) i += l;else return 0;
19906
19907           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
19908
19909           var right = tokens[i].right;
19910
19911           // Skip `(`.
19912           i++;
19913
19914           if (l = checkSC(i)) i += l;
19915
19916           if (l = checkSelectorsGroup(i)) i += l;else return 0;
19917
19918           if (l = checkSC(i)) i += l;
19919
19920           if (i !== right) return 0;
19921
19922           // Skip `)`.
19923           i++;
19924
19925           return i - start;
19926         }
19927
19928         /**
19929          * (1) `::slotted(selector)`
19930          * (2) `::slotted(selector, selector)`
19931          */
19932         function getPseudoElement1() {
19933           var type = NodeType.PseudoeType;
19934           var token = tokens[pos];
19935           var line = token.ln;
19936           var column = token.col;
19937           var content = [];
19938
19939           // Skip `::`.
19940           pos += 2;
19941
19942           content.push(getIdent());
19943
19944           {
19945             var _type = NodeType.ArgumentsType;
19946             var _token = tokens[pos];
19947             var _line = _token.ln;
19948             var _column = _token.col;
19949
19950             // Skip `(`.
19951             pos++;
19952
19953             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
19954
19955             var end = getLastPosition(selectorContent, _line, _column, 1);
19956             var args = newNode(_type, selectorContent, _line, _column, end);
19957             content.push(args);
19958
19959             // Skip `)`.
19960             pos++;
19961           }
19962
19963           return newNode(type, content, line, column);
19964         }
19965
19966         function checkPseudoElement2(i) {
19967           var start = i;
19968           var l = void 0;
19969
19970           // Skip `::`.
19971           i += 2;
19972
19973           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
19974
19975           return i - start;
19976         }
19977
19978         /**
19979          * @returns {Node}
19980          */
19981         function getPseudoElement2() {
19982           var type = NodeType.PseudoeType;
19983           var token = tokens[pos];
19984           var line = token.ln;
19985           var column = token.col;
19986
19987           // Skip `::`.
19988           pos += 2;
19989
19990           var content = getIdentOrInterpolation();
19991
19992           return newNode(type, content, line, column);
19993         }
19994
19995         /**
19996          * @param {Number} i Token's index number
19997          * @returns {Number}
19998          */
19999         function checkPseudoc(i) {
20000           var l = void 0;
20001
20002           if (i >= tokensLength || tokens[i].type !== TokenType.Colon) return 0;
20003
20004           if (l = checkPseudoClass3(i)) tokens[i].pseudoClassType = 3;else if (l = checkPseudoClass4(i)) tokens[i].pseudoClassType = 4;else if (l = checkPseudoClass5(i)) tokens[i].pseudoClassType = 5;else if (l = checkPseudoClass1(i)) tokens[i].pseudoClassType = 1;else if (l = checkPseudoClass2(i)) tokens[i].pseudoClassType = 2;else if (l = checkPseudoClass6(i)) tokens[i].pseudoClassType = 6;else return 0;
20005
20006           return l;
20007         }
20008
20009         /**
20010          * @returns {Array}
20011          */
20012         function getPseudoc() {
20013           var childType = tokens[pos].pseudoClassType;
20014           if (childType === 1) return getPseudoClass1();
20015           if (childType === 2) return getPseudoClass2();
20016           if (childType === 3) return getPseudoClass3();
20017           if (childType === 4) return getPseudoClass4();
20018           if (childType === 5) return getPseudoClass5();
20019           if (childType === 6) return getPseudoClass6();
20020         }
20021
20022         /**
20023          * (-) `:not(panda)`
20024          */
20025         function checkPseudoClass1(i) {
20026           var start = i;
20027           var l = void 0;
20028
20029           // Skip `:`.
20030           i++;
20031
20032           if (i >= tokensLength) return 0;
20033
20034           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20035
20036           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
20037
20038           var right = tokens[i].right;
20039
20040           // Skip `(`.
20041           i++;
20042
20043           if (l = checkSC(i)) i += l;
20044
20045           if (l = checkSelectorsGroup(i)) i += l;else return 0;
20046
20047           if (l = checkSC(i)) i += l;
20048
20049           if (i !== right) return 0;
20050
20051           // Skip `)`.
20052           i++;
20053
20054           return i - start;
20055         }
20056
20057         /**
20058          * (-) `:not(panda)`
20059          */
20060         function getPseudoClass1() {
20061           var type = NodeType.PseudocType;
20062           var token = tokens[pos];
20063           var line = token.ln;
20064           var column = token.col;
20065           var content = [];
20066
20067           // Skip `:`.
20068           pos++;
20069
20070           content = content.concat(getIdentOrInterpolation());
20071
20072           {
20073             var _type2 = NodeType.ArgumentsType;
20074             var _token2 = tokens[pos];
20075             var _line2 = _token2.ln;
20076             var _column2 = _token2.col;
20077
20078             // Skip `(`.
20079             pos++;
20080
20081             var selectorContent = [].concat(getSC(), getSelectorsGroup(), getSC());
20082
20083             var end = getLastPosition(selectorContent, _line2, _column2, 1);
20084             var args = newNode(_type2, selectorContent, _line2, _column2, end);
20085             content.push(args);
20086
20087             // Skip `)`.
20088             pos++;
20089           }
20090
20091           return newNode(type, content, line, column);
20092         }
20093
20094         /**
20095          * (1) `:nth-child(odd)`
20096          * (2) `:nth-child(even)`
20097          * (3) `:lang(de-DE)`
20098          */
20099         function checkPseudoClass2(i) {
20100           var start = i;
20101           var l = void 0;
20102
20103           // Skip `:`.
20104           i++;
20105
20106           if (i >= tokensLength) return 0;
20107
20108           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20109
20110           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
20111
20112           var right = tokens[i].right;
20113
20114           // Skip `(`.
20115           i++;
20116
20117           if (l = checkSC(i)) i += l;
20118
20119           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20120
20121           if (l = checkSC(i)) i += l;
20122
20123           if (i !== right) return 0;
20124
20125           // Skip `)`.
20126           i++;
20127
20128           return i - start;
20129         }
20130
20131         function getPseudoClass2() {
20132           var type = NodeType.PseudocType;
20133           var token = tokens[pos];
20134           var line = token.ln;
20135           var column = token.col;
20136           var content = [];
20137
20138           // Skip `:`.
20139           pos++;
20140
20141           content = content.concat(getIdentOrInterpolation());
20142
20143           var l = tokens[pos].ln;
20144           var c = tokens[pos].col;
20145
20146           // Skip `(`.
20147           pos++;
20148
20149           var value = [].concat(getSC(), getIdentOrInterpolation(), getSC());
20150
20151           var end = getLastPosition(value, l, c, 1);
20152           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
20153           content.push(args);
20154
20155           // Skip `)`.
20156           pos++;
20157
20158           return newNode(type, content, line, column);
20159         }
20160
20161         /**
20162          * (-) `:nth-child(-3n + 2)`
20163          */
20164         function checkPseudoClass3(i) {
20165           var start = i;
20166           var l = void 0;
20167
20168           // Skip `:`.
20169           i++;
20170
20171           if (i >= tokensLength) return 0;
20172
20173           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20174
20175           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
20176
20177           var right = tokens[i].right;
20178
20179           // Skip `(`.
20180           i++;
20181
20182           if (l = checkSC(i)) i += l;
20183
20184           if (l = checkUnary(i)) i += l;
20185
20186           if (l = checkNumberOrInterpolation(i)) i += l;
20187
20188           if (i >= tokensLength) return 0;
20189
20190           if (tokens[i].value === 'n') i++;
20191
20192           if (l = checkSC(i)) i += l;
20193
20194           if (i >= tokensLength) return 0;
20195
20196           if (tokens[i].type === TokenType.PlusSign || tokens[i].type === TokenType.HyphenMinus) i++;else return 0;
20197
20198           if (l = checkSC(i)) i += l;
20199
20200           if (l = checkNumberOrInterpolation(i)) i += l;else return 0;
20201
20202           if (l = checkSC(i)) i += l;
20203
20204           if (i !== right) return 0;
20205
20206           // Skip `)`.
20207           i++;
20208
20209           return i - start;
20210         }
20211
20212         function getPseudoClass3() {
20213           var type = NodeType.PseudocType;
20214           var token = tokens[pos];
20215           var line = token.ln;
20216           var column = token.col;
20217           var content = [];
20218
20219           // Skip `:`.
20220           pos++;
20221
20222           content = content.concat(getIdentOrInterpolation());
20223
20224           var l = tokens[pos].ln;
20225           var c = tokens[pos].col;
20226           var value = [];
20227
20228           // Skip `(`.
20229           pos++;
20230
20231           value = value.concat(getSC());
20232
20233           if (checkUnary(pos)) value.push(getUnary());
20234           if (checkNumberOrInterpolation(pos)) value = value.concat(getNumberOrInterpolation());
20235
20236           {
20237             var _token3 = tokens[pos];
20238
20239             if (_token3.value === 'n') {
20240               var _l = _token3.ln;
20241               var _c = _token3.col;
20242               var _content = _token3.value;
20243               var ident = newNode(NodeType.IdentType, _content, _l, _c);
20244               value.push(ident);
20245               pos++;
20246             }
20247           }
20248
20249           value = value.concat(getSC());
20250
20251           if (checkUnary(pos)) value.push(getUnary());
20252
20253           value = value.concat(getSC());
20254
20255           if (checkNumberOrInterpolation(pos)) value = value.concat(getNumberOrInterpolation());
20256
20257           value = value.concat(getSC());
20258
20259           var end = getLastPosition(value, l, c, 1);
20260           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
20261           content.push(args);
20262
20263           // Skip `)`.
20264           pos++;
20265
20266           return newNode(type, content, line, column);
20267         }
20268
20269         /**
20270          * (-) `:nth-child(-3n)`
20271          */
20272         function checkPseudoClass4(i) {
20273           var start = i;
20274           var l = void 0;
20275
20276           // Skip `:`.
20277           i++;
20278
20279           if (i >= tokensLength) return 0;
20280
20281           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20282
20283           if (i >= tokensLength) return 0;
20284           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
20285
20286           var right = tokens[i].right;
20287
20288           // Skip `(`.
20289           i++;
20290
20291           if (l = checkSC(i)) i += l;
20292
20293           if (l = checkUnary(i)) i += l;
20294
20295           if (l = checkInterpolation(i)) i += l;
20296
20297           if (tokens[i].type === TokenType.DecimalNumber) i++;
20298
20299           if (tokens[i].value === 'n') i++;else return 0;
20300
20301           if (l = checkSC(i)) i += l;
20302
20303           if (i !== right) return 0;
20304
20305           // Skip `)`.
20306           i++;
20307
20308           return i - start;
20309         }
20310
20311         function getPseudoClass4() {
20312           var type = NodeType.PseudocType;
20313           var token = tokens[pos];
20314           var line = token.ln;
20315           var column = token.col;
20316           var content = [];
20317
20318           // Skip `:`.
20319           pos++;
20320
20321           content = content.concat(getIdentOrInterpolation());
20322
20323           var l = tokens[pos].ln;
20324           var c = tokens[pos].col;
20325           var value = [];
20326
20327           // Skip `(`.
20328           pos++;
20329
20330           value = value.concat(getSC());
20331
20332           if (checkUnary(pos)) value.push(getUnary());
20333           if (checkInterpolation(pos)) value.push(getInterpolation());
20334           if (checkNumber(pos)) value.push(getNumber());
20335           if (checkIdent(pos)) value.push(getIdent());
20336
20337           value = value.concat(getSC());
20338
20339           var end = getLastPosition(value, l, c, 1);
20340           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
20341           content.push(args);
20342
20343           // Skip `)`.
20344           pos++;
20345
20346           return newNode(type, content, line, column);
20347         }
20348
20349         /**
20350          * (-) `:nth-child(+8)`
20351          */
20352         function checkPseudoClass5(i) {
20353           var start = i;
20354           var l = void 0;
20355
20356           // Skip `:`.
20357           i++;
20358
20359           if (i >= tokensLength) return 0;
20360
20361           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20362
20363           if (i >= tokensLength) return 0;
20364           if (tokens[i].type !== TokenType.LeftParenthesis) return 0;
20365
20366           var right = tokens[i].right;
20367
20368           // Skip `(`.
20369           i++;
20370
20371           if (l = checkSC(i)) i += l;
20372
20373           if (l = checkUnary(i)) i += l;
20374           if (tokens[i].type === TokenType.DecimalNumber) i++;else return 0;
20375
20376           if (l = checkSC(i)) i += l;
20377
20378           if (i !== right) return 0;
20379
20380           // Skip `)`.
20381           i++;
20382
20383           return i - start;
20384         }
20385
20386         function getPseudoClass5() {
20387           var type = NodeType.PseudocType;
20388           var token = tokens[pos];
20389           var line = token.ln;
20390           var column = token.col;
20391           var content = [];
20392
20393           // Skip `:`.
20394           pos++;
20395
20396           content = content.concat(getIdentOrInterpolation());
20397
20398           var l = tokens[pos].ln;
20399           var c = tokens[pos].col;
20400           var value = [];
20401
20402           // Skip `(`.
20403           pos++;
20404
20405           value = value.concat(getSC());
20406
20407           if (checkUnary(pos)) value.push(getUnary());
20408           if (checkNumber(pos)) value.push(getNumber());
20409
20410           value = value.concat(getSC());
20411
20412           var end = getLastPosition(value, l, c, 1);
20413           var args = newNode(NodeType.ArgumentsType, value, l, c, end);
20414           content.push(args);
20415
20416           // Skip `)`.
20417           pos++;
20418
20419           return newNode(type, content, line, column);
20420         }
20421
20422         /**
20423          * (-) `:checked`
20424          */
20425         function checkPseudoClass6(i) {
20426           var start = i;
20427           var l = void 0;
20428
20429           // Skip `:`.
20430           i++;
20431
20432           if (i >= tokensLength) return 0;
20433
20434           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
20435
20436           return i - start;
20437         }
20438
20439         function getPseudoClass6() {
20440           var type = NodeType.PseudocType;
20441           var token = tokens[pos];
20442           var line = token.ln;
20443           var column = token.col;
20444
20445           // Skip `:`.
20446           pos++;
20447
20448           var content = getIdentOrInterpolation();
20449
20450           return newNode(type, content, line, column);
20451         }
20452
20453         /**
20454          * @param {Number} i Token's index number
20455          * @returns {Number}
20456          */
20457         function checkRuleset(i) {
20458           var start = i;
20459           var l = void 0;
20460
20461           if (i >= tokensLength) return 0;
20462
20463           if (l = checkSelectorsGroup(i)) i += l;else return 0;
20464
20465           if (l = checkSC(i)) i += l;
20466
20467           if (l = checkBlock(i)) i += l;else return 0;
20468
20469           return i - start;
20470         }
20471
20472         function getRuleset() {
20473           var type = NodeType.RulesetType;
20474           var token = tokens[pos];
20475           var line = token.ln;
20476           var column = token.col;
20477           var content = [].concat(getSelectorsGroup(), getSC(), getBlock());
20478
20479           return newNode(type, content, line, column);
20480         }
20481
20482         /**
20483          * Check if token is marked as a space (if it's a space or a tab
20484          *      or a line break).
20485          * @param {Number} i
20486          * @returns {Number} Number of spaces in a row starting with the given token.
20487          */
20488         function checkS(i) {
20489           return i < tokensLength && tokens[i].ws ? tokens[i].ws_last - i + 1 : 0;
20490         }
20491
20492         /**
20493          * Get node with spaces
20494          * @returns {Array} `['s', x]` where `x` is a string containing spaces
20495          */
20496         function getS() {
20497           var type = NodeType.SType;
20498           var token = tokens[pos];
20499           var line = token.ln;
20500           var column = token.col;
20501           var content = joinValues(pos, tokens[pos].ws_last);
20502
20503           pos = tokens[pos].ws_last + 1;
20504
20505           return newNode(type, content, line, column);
20506         }
20507
20508         /**
20509          * Check if token is a space or a comment.
20510          * @param {Number} i Token's index number
20511          * @returns {Number} Number of similar (space or comment) tokens
20512          *      in a row starting with the given token.
20513          */
20514         function checkSC(i) {
20515           if (i >= tokensLength) return 0;
20516
20517           var l = void 0;
20518           var lsc = 0;
20519
20520           while (i < tokensLength) {
20521             if (l = checkS(i)) tokens[i].sc_child = 1;else if (l = checkCommentML(i)) tokens[i].sc_child = 2;else if (l = checkCommentSL(i)) tokens[i].sc_child = 3;else break;
20522
20523             i += l;
20524             lsc += l;
20525           }
20526
20527           return lsc || 0;
20528         }
20529
20530         /**
20531          * Get node with spaces and comments
20532          * @returns {Array} Array containing nodes with spaces (if there are any)
20533          *      and nodes with comments (if there are any):
20534          *      `[['s', x]*, ['comment', y]*]` where `x` is a string of spaces
20535          *      and `y` is a comment's text (without `/*` and `* /`).
20536          */
20537         function getSC() {
20538           var sc = [];
20539
20540           if (pos >= tokensLength) return sc;
20541
20542           while (pos < tokensLength) {
20543             var childType = tokens[pos].sc_child;
20544
20545             if (childType === 1) sc.push(getS());else if (childType === 2) sc.push(getCommentML());else if (childType === 3) sc.push(getCommentSL());else break;
20546           }
20547
20548           return sc;
20549         }
20550
20551         /**
20552          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside a simple
20553          * selector
20554          * @param {number} i Token's index number
20555          * @return {number}
20556          */
20557         function checkShash(i) {
20558           var start = i;
20559           var l = void 0;
20560
20561           if (i >= tokensLength) return 0;
20562
20563           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
20564
20565           if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;else return 0;
20566
20567           while (i < tokensLength) {
20568             if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;else break;
20569           }
20570
20571           tokens[start].shashEnd = i;
20572
20573           return i - start;
20574         }
20575
20576         /**
20577          * Get node with a hexadecimal number (e.g. `#fff`) inside a simple selector
20578          * @returns {Node}
20579          */
20580         function getShash() {
20581           var type = NodeType.ShashType;
20582           var token = tokens[pos];
20583           var line = token.ln;
20584           var column = token.col;
20585           var end = token.shashEnd;
20586           var content = [];
20587
20588           // Skip `#`.
20589           pos++;
20590
20591           while (pos < end) {
20592             if (checkIdentOrInterpolation(pos)) {
20593               content = content.concat(getIdentOrInterpolation());
20594             } else if (checkPartialIdent(pos)) {
20595               content.push(getIdent());
20596             } else break;
20597           }
20598
20599           return newNode(type, content, line, column);
20600         }
20601
20602         /**
20603          * Check if token is part of a string (text wrapped in quotes)
20604          * @param {Number} i Token's index number
20605          * @returns {Number} `1` if token is part of a string, `0` if not
20606          */
20607         function checkString(i) {
20608           if (i >= tokensLength) return 0;
20609
20610           if (tokens[i].type === TokenType.StringSQ || tokens[i].type === TokenType.StringDQ) {
20611             return 1;
20612           }
20613
20614           return 0;
20615         }
20616
20617         /**
20618          * Get string's node
20619          * @returns {Array} `['string', x]` where `x` is a string (including
20620          *      quotes).
20621          */
20622         function getString() {
20623           var type = NodeType.StringType;
20624           var token = tokens[pos];
20625           var line = token.ln;
20626           var column = token.col;
20627           var content = token.value;
20628
20629           pos++;
20630
20631           return newNode(type, content, line, column);
20632         }
20633
20634         /**
20635          * Validate stylesheet: it should consist of any number (0 or more) of
20636          * rulesets (sets of rules with selectors), @-rules, whitespaces or
20637          * comments.
20638          * @param {Number} i Token's index number
20639          * @returns {Number}
20640          */
20641         function checkStylesheet(i) {
20642           var start = i;
20643           var l = void 0;
20644
20645           while (i < tokensLength) {
20646             if (l = checkSC(i)) tokens[i].stylesheet_child = 1;else if (l = checkRuleset(i)) tokens[i].stylesheet_child = 2;else if (l = checkInclude(i)) tokens[i].stylesheet_child = 3;else if (l = checkExtend(i)) tokens[i].stylesheet_child = 4;else if (l = checkMixin(i)) tokens[i].stylesheet_child = 5;else if (l = checkLoop(i)) tokens[i].stylesheet_child = 6;else if (l = checkConditionalStatement(i)) tokens[i].stylesheet_child = 7;else if (l = checkAtrule(i)) tokens[i].stylesheet_child = 8;else if (l = checkDeclaration(i)) tokens[i].stylesheet_child = 9;else if (l = checkDeclDelim(i)) tokens[i].stylesheet_child = 10;else throwError(i);
20647
20648             i += l;
20649           }
20650
20651           return i - start;
20652         }
20653
20654         /**
20655          * @returns {Array} `['stylesheet', x]` where `x` is all stylesheet's
20656          *      nodes.
20657          */
20658         function getStylesheet() {
20659           var type = NodeType.StylesheetType;
20660           var token = tokens[pos];
20661           var line = token.ln;
20662           var column = token.col;
20663           var content = [];
20664
20665           while (pos < tokensLength) {
20666             var childType = tokens[pos].stylesheet_child;
20667
20668             if (childType === 1) content = content.concat(getSC());
20669             if (childType === 2) content.push(getRuleset());
20670             if (childType === 3) content.push(getInclude());
20671             if (childType === 4) content.push(getExtend());
20672             if (childType === 5) content.push(getMixin());
20673             if (childType === 6) content.push(getLoop());
20674             if (childType === 7) content.push(getConditionalStatement());
20675             if (childType === 8) content.push(getAtrule());
20676             if (childType === 9) content.push(getDeclaration());
20677             if (childType === 10) content.push(getDeclDelim());
20678           }
20679
20680           return newNode(type, content, line, column);
20681         }
20682
20683         /**
20684          * @param {Number} i Token's index number
20685          * @returns {Number}
20686          */
20687         function checkTset(i) {
20688           var l = void 0;
20689
20690           if (l = checkVhash(i)) tokens[i].tset_child = 1;else if (l = checkOperator(i)) tokens[i].tset_child = 2;else if (l = checkAny(i)) tokens[i].tset_child = 3;else if (l = checkSC(i)) tokens[i].tset_child = 4;
20691
20692           return l;
20693         }
20694
20695         /**
20696          * @returns {Array}
20697          */
20698         function getTset() {
20699           var childType = tokens[pos].tset_child;
20700
20701           if (childType === 1) return getVhash();
20702           if (childType === 2) return getOperator();
20703           if (childType === 3) return getAny();
20704           if (childType === 4) return getSC();
20705         }
20706
20707         /**
20708          * @param {Number} i Token's index number
20709          * @returns {Number}
20710          */
20711         function checkTsets(i) {
20712           var start = i;
20713           var l = void 0;
20714
20715           if (i >= tokensLength) return 0;
20716
20717           while (l = checkTset(i)) {
20718             i += l;
20719           }
20720
20721           tokens[start].tsets_end = i;
20722           return i - start;
20723         }
20724
20725         /**
20726          * @returns {Array}
20727          */
20728         function getTsets() {
20729           var content = [];
20730           var t = void 0;
20731
20732           if (pos >= tokensLength) return content;
20733
20734           var end = tokens[pos].tsets_end;
20735           while (pos < end) {
20736             t = getTset();
20737             if (typeof t.content === 'string') content.push(t);else content = content.concat(t);
20738           }
20739
20740           return content;
20741         }
20742
20743         /**
20744          * Check if token is an unary (arithmetical) sign (`+` or `-`)
20745          * @param {Number} i Token's index number
20746          * @returns {Number} `1` if token is an unary sign, `0` if not
20747          */
20748         function checkUnary(i) {
20749           if (i >= tokensLength) return 0;
20750
20751           if (tokens[i].type === TokenType.HyphenMinus || tokens[i].type === TokenType.PlusSign) {
20752             return 1;
20753           }
20754
20755           return 0;
20756         }
20757
20758         /**
20759          * Get node with an unary (arithmetical) sign (`+` or `-`)
20760          * @returns {Array} `['unary', x]` where `x` is an unary sign
20761          *      converted to string.
20762          */
20763         function getUnary() {
20764           var type = NodeType.OperatorType;
20765           var token = tokens[pos];
20766           var line = token.ln;
20767           var column = token.col;
20768           var content = token.value;
20769
20770           pos++;
20771
20772           return newNode(type, content, line, column);
20773         }
20774
20775         /**
20776          * Check if token is a unicode range (single or multiple <urange> nodes)
20777          * @param {number} i Token's index
20778          * @return {number} Unicode range node's length
20779          */
20780         function checkUnicodeRange(i) {
20781           var start = i;
20782           var l = void 0;
20783
20784           if (i >= tokensLength) return 0;
20785
20786           if (l = checkUrange(i)) i += l;else return 0;
20787
20788           while (i < tokensLength) {
20789             var spaceBefore = checkSC(i);
20790             var comma = checkDelim(i + spaceBefore);
20791             if (!comma) break;
20792
20793             var spaceAfter = checkSC(i + spaceBefore + comma);
20794             if (l = checkUrange(i + spaceBefore + comma + spaceAfter)) {
20795               i += spaceBefore + comma + spaceAfter + l;
20796             } else break;
20797           }
20798
20799           return i - start;
20800         }
20801
20802         /**
20803          * Get a unicode range node
20804          * @return {Node}
20805          */
20806         function getUnicodeRange() {
20807           var type = NodeType.UnicodeRangeType;
20808           var token = tokens[pos];
20809           var line = token.ln;
20810           var column = token.col;
20811           var content = [];
20812
20813           while (pos < tokensLength) {
20814             if (checkSC(pos)) content = content.concat(getSC());else if (checkDelim(pos)) content.push(getDelim());else if (checkUrange(pos)) content.push(getUrange());else break;
20815           }
20816
20817           return newNode(type, content, line, column);
20818         }
20819
20820         /**
20821          * Check if token is unit
20822          * @param {Number} i Token's index number
20823          * @return {Number}
20824          */
20825         function checkUnit(i) {
20826           var units = ['em', 'ex', 'ch', 'rem', 'vh', 'vw', 'vmin', 'vmax', 'px', 'mm', 'q', 'cm', 'in', 'pt', 'pc', 'deg', 'grad', 'rad', 'turn', 's', 'ms', 'Hz', 'kHz', 'dpi', 'dpcm', 'dppx'];
20827
20828           return units.indexOf(tokens[i].value) !== -1 ? 1 : 0;
20829         }
20830
20831         /**
20832          * Get unit node of type ident
20833          * @return {Node} An ident node containing the unit value
20834          */
20835         function getUnit() {
20836           var type = NodeType.IdentType;
20837           var token = tokens[pos];
20838           var line = token.ln;
20839           var column = token.col;
20840           var content = token.value;
20841
20842           pos++;
20843
20844           return newNode(type, content, line, column);
20845         }
20846
20847         /**
20848          * Check if token is a u-range (part of a unicode-range)
20849          * (1) `U+416`
20850          * (2) `U+400-4ff`
20851          * (3) `U+4??`
20852          * @param {number} i Token's index
20853          * @return {number} Urange node's length
20854          */
20855         function checkUrange(i) {
20856           var start = i;
20857           var l = void 0;
20858
20859           if (i >= tokensLength) return 0;
20860
20861           // Check for unicode prefix (u+ or U+)
20862           if (tokens[i].value === 'U' || tokens[i].value === 'u') i += 1;else return 0;
20863
20864           if (i >= tokensLength) return 0;
20865
20866           if (tokens[i].value === '+') i += 1;else return 0;
20867
20868           while (i < tokensLength) {
20869             if (l = checkIdent(i)) i += l;else if (l = checkNumber(i)) i += l;else if (l = checkUnary(i)) i += l;else if (l = _checkUnicodeWildcard(i)) i += l;else break;
20870           }
20871
20872           tokens[start].urangeEnd = i - 1;
20873
20874           return i - start;
20875         }
20876
20877         /**
20878          * Get a u-range node (part of a unicode-range)
20879          * @return {Node}
20880          */
20881         function getUrange() {
20882           var startPos = pos;
20883           var type = NodeType.UrangeType;
20884           var token = tokens[pos];
20885           var line = token.ln;
20886           var column = token.col;
20887           var content = [];
20888
20889           content = joinValues(startPos, tokens[startPos].urangeEnd);
20890           pos = tokens[startPos].urangeEnd + 1;
20891
20892           return newNode(type, content, line, column);
20893         }
20894
20895         /**
20896          * Check for unicode wildcard characters `?`
20897          * @param {number} i Token's index
20898          * @return {number} Wildcard length
20899          */
20900         function _checkUnicodeWildcard(i) {
20901           var start = i;
20902
20903           if (i >= tokensLength) return 0;
20904
20905           while (i < tokensLength) {
20906             if (tokens[i].type === TokenType.QuestionMark) i += 1;else break;
20907           }
20908
20909           return i - start;
20910         }
20911
20912         /**
20913          * Check if token is part of URI, e.g. `url('/css/styles.css')`
20914          * @param {number} i Token's index number
20915          * @returns {number} Length of URI
20916          */
20917         function checkUri(i) {
20918           var start = i;
20919           var l = void 0;
20920
20921           if (i >= tokensLength || tokens[i].value !== 'url') return 0;
20922
20923           // Skip `url`.
20924           i++;
20925
20926           if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis) return 0;
20927
20928           // Store the opening parenthesis token as we will reference it's `right`
20929           // property to determine when the parentheses close
20930           var leftParenthesis = tokens[i];
20931
20932           // Skip `(`.
20933           i++;
20934
20935           // Determine the type of URI
20936           while (i < leftParenthesis.right) {
20937             if (l = checkUri1(i)) {
20938               i += l;
20939               tokens[start].uriType = 1; // Raw based URI (without quotes)
20940             } else if (l = checkUri2(i)) {
20941               i += l;
20942               tokens[start].uriType = 2; // Non-raw based URI (with quotes)
20943             } else return 0;
20944           }
20945
20946           // Skip `)`.
20947           i++;
20948
20949           return i - start;
20950         }
20951
20952         /**
20953          * Get specific type of URI node
20954          * @return {Node} Specific type of URI node
20955          */
20956         function getUri() {
20957           var startPos = pos;
20958           var type = NodeType.UriType;
20959           var token = tokens[startPos];
20960           var line = token.ln;
20961           var column = token.col;
20962           var content = [];
20963           var end = void 0;
20964
20965           var uriType = tokens[startPos].uriType;
20966
20967           // Skip `url` and `(`.
20968           pos += 2;
20969
20970           if (uriType === 1) content = content.concat(getUri1());else if (uriType === 2) content = content.concat(getUri2());else end = getLastPosition(content, line, column, 4);
20971
20972           if (!end) end = getLastPosition(content, line, column, 1);
20973
20974           // Skip `)`.
20975           pos++;
20976
20977           return newNode(type, content, line, column, end);
20978         }
20979
20980         /**
20981          * Check if token type is valid URI character
20982          * @param {number} i Token's index number
20983          * @return {number} Length of raw node
20984          */
20985         function checkUriRawCharacters(i) {
20986           var start = i;
20987           var l = void 0;
20988
20989           if (l = checkIdent(i)) i += l;else if (l = checkNumber(i)) i += l;else {
20990             switch (tokens[i].type) {
20991               case TokenType.ExclamationMark:
20992               case TokenType.NumberSign:
20993               case TokenType.DollarSign:
20994               case TokenType.PercentSign:
20995               case TokenType.Ampersand:
20996               case TokenType.Asterisk:
20997               case TokenType.PlusSign:
20998               case TokenType.Comma:
20999               case TokenType.HyphenMinus:
21000               case TokenType.FullStop:
21001               case TokenType.Solidus:
21002               case TokenType.Colon:
21003               case TokenType.Semicolon:
21004               case TokenType.LessThanSign:
21005               case TokenType.EqualsSign:
21006               case TokenType.GreaterThanSign:
21007               case TokenType.QuotationMark:
21008               case TokenType.CommercialAt:
21009               case TokenType.LeftSquareBracket:
21010               case TokenType.RightSquareBracket:
21011               case TokenType.CircumflexAccent:
21012               case TokenType.LowLine:
21013               case TokenType.LeftCurlyBracket:
21014               case TokenType.VerticalLine:
21015               case TokenType.RightCurlyBracket:
21016               case TokenType.Tilde:
21017                 i += 1;
21018                 break;
21019
21020               default:
21021                 return 0;
21022             }
21023           }
21024
21025           return i - start;
21026         }
21027
21028         /**
21029          * Check if content of URI can be contained within a raw node
21030          * @param {number} i Token's index number
21031          * @return {number} Length of raw node
21032          */
21033         function checkUriRaw(i) {
21034           var start = i;
21035           var l = void 0;
21036
21037           while (i < tokensLength) {
21038             if (checkInterpolation(i) || checkVariable(i)) break;else if (l = checkUriRawCharacters(i)) i += l;else break;
21039           }
21040
21041           tokens[start].uri_raw_end = i;
21042
21043           return i - start;
21044         }
21045
21046         /**
21047          * Get a raw node
21048          * @return {Node}
21049          */
21050         function getUriRaw() {
21051           var startPos = pos;
21052           var type = NodeType.RawType;
21053           var token = tokens[startPos];
21054           var line = token.ln;
21055           var column = token.col;
21056           var content = [];
21057           var l = void 0;
21058
21059           while (pos < tokens[startPos].uri_raw_end) {
21060             if (checkInterpolation(pos) || checkVariable(pos)) break;else if (l = checkUriRawCharacters(pos)) pos += l;else break;
21061           }
21062
21063           content = joinValues(startPos, pos - 1);
21064
21065           return newNode(type, content, line, column);
21066         }
21067
21068         /**
21069          * Check for a raw (without quotes) URI
21070          * (1) http://foo.com/bar.png
21071          * (2) http://foo.com/#{$bar}.png
21072          * (3) #{$foo}/bar.png
21073          * (4) #{$foo}
21074          * @param {number} i Token's index number
21075          * @return {number} Length of URI node
21076          */
21077         function checkUri1(i) {
21078           var start = i;
21079           var l = void 0;
21080
21081           if (l = checkSC(i)) i += l;
21082
21083           while (i < tokensLength) {
21084             if (l = checkInterpolation(i) || checkUriRaw(i)) i += l;else break;
21085           }
21086
21087           if (l = checkSC(i)) i += l;
21088
21089           // Check that we are at the end of the uri
21090           if (i < tokens[start - 1].right) return 0;
21091
21092           tokens[start].uri_end = i;
21093
21094           return i - start;
21095         }
21096
21097         /**
21098          * Get a raw (without quotes) URI
21099           node
21100          * @return {Array}
21101          */
21102         function getUri1() {
21103           var startPos = pos;
21104           var content = [];
21105
21106           if (checkSC(pos)) content = content.concat(getSC());
21107
21108           while (pos < tokens[startPos].uri_end) {
21109             if (checkInterpolation(pos)) content.push(getInterpolation());else if (checkUriRaw(pos)) content.push(getUriRaw());else break;
21110           }
21111
21112           if (checkSC(pos)) content = content.concat(getSC());
21113
21114           return content;
21115         }
21116
21117         /**
21118          * Check for a non-raw (with quotes) URI
21119          * (1) 'http://foo.com/bar.png'
21120          * (2) 'http://foo.com/'#{$bar}.png
21121          * (3) #{$foo}'/bar.png'
21122          * @param {number} i Token's index number
21123          * @return {number} Length of URI node
21124          */
21125         function checkUri2(i) {
21126           var start = i;
21127           var l = void 0;
21128
21129           while (i < tokensLength) {
21130             if (l = checkSC(i)) i += l;else if (l = checkString(i)) i += l;else if (l = checkFunction(i)) i += l;else if (l = checkUnary(i)) i += l;else if (l = checkIdentOrInterpolation(i)) i += l;else if (l = checkVariable(i)) i += l;else break;
21131           }
21132
21133           // Check that we are at the end of the uri
21134           if (i < tokens[start - 1].right) return 0;
21135
21136           tokens[start].uri_end = i;
21137
21138           return i - start;
21139         }
21140
21141         /**
21142          * Get a non-raw (with quotes) URI node
21143          * @return {Array}
21144          */
21145         function getUri2() {
21146           var startPos = pos;
21147           var content = [];
21148
21149           while (pos < tokens[startPos].uri_end) {
21150             if (checkSC(pos)) content = content.concat(getSC());else if (checkUnary(pos)) content.push(getUnary());else if (_checkValue(pos)) content.push(_getValue());else break;
21151           }
21152
21153           return content;
21154         }
21155
21156         /**
21157          * Check if token is part of a value
21158          * @param {Number} i Token's index number
21159          * @returns {Number} Length of the value
21160          */
21161         function checkValue(i) {
21162           var start = i;
21163           var l = void 0;
21164           var s = void 0;
21165           var _i = void 0;
21166
21167           while (i < tokensLength) {
21168             if (checkDeclDelim(i)) break;
21169
21170             s = checkSC(i);
21171             _i = i + s;
21172
21173             if (l = _checkValue(_i)) i += l + s;
21174             if (!l || checkBlock(i - l)) break;
21175           }
21176
21177           tokens[start].value_end = i;
21178
21179           return i - start;
21180         }
21181
21182         /**
21183          * @returns {Array}
21184          */
21185         function getValue() {
21186           var type = NodeType.ValueType;
21187           var token = tokens[pos];
21188           var line = token.ln;
21189           var column = token.col;
21190           var end = tokens[pos].value_end;
21191           var content = [];
21192           var _pos = void 0;
21193           var s = void 0;
21194
21195           while (pos < end) {
21196             s = checkSC(pos);
21197             _pos = pos + s;
21198
21199             if (checkDeclDelim(_pos)) break;
21200
21201             if (!_checkValue(_pos)) break;
21202
21203             if (s) content = content.concat(getSC());
21204             content.push(_getValue());
21205
21206             if (checkBlock(_pos)) break;
21207           }
21208
21209           return newNode(type, content, line, column);
21210         }
21211
21212         /**
21213          * @param {Number} i Token's index number
21214          * @returns {Number}
21215          */
21216         function _checkValue(i) {
21217           var l = void 0;
21218
21219           if (l = checkInterpolation(i)) tokens[i].value_child = 1;else if (l = checkVariable(i)) tokens[i].value_child = 2;else if (l = checkVhash(i)) tokens[i].value_child = 3;else if (l = checkBlock(i)) tokens[i].value_child = 4;else if (l = checkAtkeyword(i)) tokens[i].value_child = 5;else if (l = checkOperator(i)) tokens[i].value_child = 6;else if (l = checkImportant(i)) tokens[i].value_child = 7;else if (l = checkGlobal(i)) tokens[i].value_child = 8;else if (l = checkDefault(i)) tokens[i].value_child = 9;else if (l = checkProgid(i)) tokens[i].value_child = 10;else if (l = checkAny(i)) tokens[i].value_child = 11;else if (l = checkParentSelector(i)) tokens[i].value_child = 12;
21220
21221           return l;
21222         }
21223
21224         /**
21225          * @returns {Array}
21226          */
21227         function _getValue() {
21228           var childType = tokens[pos].value_child;
21229           if (childType === 1) return getInterpolation();
21230           if (childType === 2) return getVariable();
21231           if (childType === 3) return getVhash();
21232           if (childType === 4) return getBlock();
21233           if (childType === 5) return getAtkeyword();
21234           if (childType === 6) return getOperator();
21235           if (childType === 7) return getImportant();
21236           if (childType === 8) return getGlobal();
21237           if (childType === 9) return getDefault();
21238           if (childType === 10) return getProgid();
21239           if (childType === 11) return getAny();
21240           if (childType === 12) return getParentSelector();
21241         }
21242
21243         /**
21244          * @param {number} i Token's index number
21245          * @returns {number} Length of the value
21246          */
21247         function checkSingleValue(i) {
21248           var start = i;
21249           var l = void 0;
21250           var s = void 0;
21251           var _i = void 0;
21252
21253           while (i < tokensLength) {
21254             if (checkDeclDelim(i) || checkDelim(i)) break;
21255
21256             s = checkSC(i);
21257             _i = i + s;
21258
21259             if (l = _checkValue(_i)) i += l + s;
21260             if (!l || checkBlock(i - l)) break;
21261           }
21262
21263           return i - start;
21264         }
21265
21266         /**
21267          * @returns {Array}
21268          */
21269         function getSingleValue() {
21270           var type = NodeType.ValueType;
21271           var token = tokens[pos];
21272           var line = token.ln;
21273           var column = token.col;
21274           var content = [];
21275           var _pos = void 0;
21276           var s = void 0;
21277
21278           while (pos < tokensLength) {
21279             s = checkSC(pos);
21280             _pos = pos + s;
21281
21282             if (checkDeclDelim(_pos) || checkDelim(_pos)) break;
21283
21284             if (!_checkValue(_pos)) break;
21285
21286             if (s) content = content.concat(getSC());
21287             content.push(_getValue());
21288
21289             if (checkBlock(_pos)) break;
21290           }
21291
21292           return newNode(type, content, line, column);
21293         }
21294
21295         /**
21296          * Check if token is part of a variable
21297          * @param {Number} i Token's index number
21298          * @returns {Number} Length of the variable
21299          */
21300         function checkVariable(i) {
21301           var start = i;
21302           var l = void 0;
21303
21304           if (i >= tokensLength) return 0;
21305
21306           // Skip `$`.
21307           if (tokens[i].type === TokenType.DollarSign) i++;else return 0;
21308
21309           if (l = checkIdent(i)) i += l;else return 0;
21310
21311           return i - start;
21312         }
21313
21314         /**
21315          * Get node with a variable
21316          * @returns {Array} `['variable', ['ident', x]]` where `x` is
21317          *      a variable name.
21318          */
21319         function getVariable() {
21320           var type = NodeType.VariableType;
21321           var token = tokens[pos];
21322           var line = token.ln;
21323           var column = token.col;
21324
21325           // Skip `$`.
21326           pos++;
21327
21328           var content = [getIdent()];
21329
21330           return newNode(type, content, line, column);
21331         }
21332
21333         /**
21334          * Check if token is part of a variables list (e.g. `$values...`).
21335          * @param {Number} i Token's index number
21336          * @returns {Number}
21337          */
21338         function checkVariablesList(i) {
21339           var d = 0; // Number of dots
21340           var l = void 0;
21341
21342           if (i >= tokensLength) return 0;
21343
21344           if (l = checkVariable(i)) i += l;else return 0;
21345
21346           while (i < tokensLength && tokens[i].type === TokenType.FullStop) {
21347             d++;
21348             i++;
21349           }
21350
21351           return d === 3 ? l + d : 0;
21352         }
21353
21354         /**
21355          * Get node with a variables list
21356          * @returns {Array} `['variableslist', ['variable', ['ident', x]]]` where
21357          *      `x` is a variable name.
21358          */
21359         function getVariablesList() {
21360           var type = NodeType.VariablesListType;
21361           var token = tokens[pos];
21362           var line = token.ln;
21363           var column = token.col;
21364           var content = [getVariable()];
21365           var end = getLastPosition(content, line, column, 3);
21366
21367           // Skip `...`.
21368           pos += 3;
21369
21370           return newNode(type, content, line, column, end);
21371         }
21372
21373         /**
21374          * Check if token is part of a hexadecimal number (e.g. `#fff`) inside
21375          *      some value
21376          * @param {Number} i Token's index number
21377          * @returns {Number}
21378          */
21379         function checkVhash(i) {
21380           var start = i;
21381           var l = void 0;
21382
21383           if (i >= tokensLength) return 0;
21384
21385           // Skip `#`.
21386           if (tokens[i].type === TokenType.NumberSign) i++;else return 0;
21387
21388           if (l = checkNmName2(i)) i += l;else return 0;
21389
21390           return i - start;
21391         }
21392
21393         /**
21394          * Get node with a hexadecimal number (e.g. `#fff`) inside some value
21395          * @returns {Array} `['vhash', x]` where `x` is a hexadecimal number
21396          *      converted to string (without `#`, e.g. `'fff'`).
21397          */
21398         function getVhash() {
21399           var type = NodeType.VhashType;
21400           var token = tokens[pos];
21401           var line = token.ln;
21402           var column = token.col;
21403
21404           // Skip `#`.
21405           pos++;
21406
21407           var content = getNmName2();
21408           var end = getLastPosition(content, line, column + 1);
21409           return newNode(type, content, line, column, end);
21410         }
21411
21412         function checkSelectorsGroup(i) {
21413           if (i >= tokensLength) return 0;
21414
21415           var start = i;
21416           var l = void 0;
21417           var selectorCounter = 0;
21418           var delimCounter = 0;
21419
21420           if (l = checkSelector(i)) {
21421             i += l;
21422             selectorCounter++;
21423           } else return 0;
21424
21425           while (i < tokensLength) {
21426             var tempStart = i;
21427             var tempIndex = i;
21428             var tempLength = void 0;
21429
21430             var spaceBefore = checkSC(tempIndex);
21431
21432             if (tempLength = checkDelim(tempIndex + spaceBefore)) {
21433               tempIndex += spaceBefore + tempLength;
21434               delimCounter++;
21435
21436               if (tempLength = checkSC(tempIndex)) tempIndex += tempLength;
21437               if (tempLength = checkSelector(tempIndex)) {
21438                 tempIndex += tempLength;
21439                 selectorCounter++;
21440               }
21441             } else break;
21442
21443             i += tempIndex - tempStart;
21444           }
21445
21446           tokens[start].selectorsGroupEnd = i;
21447           tokens[start].selectorsGroupSelectorCount = selectorCounter;
21448           tokens[start].selectorsGroupDelimCount = delimCounter;
21449
21450           return i - start;
21451         }
21452
21453         function getSelectorsGroup() {
21454           var selectorsGroup = [];
21455           var selectorCounter = 0;
21456           var delimCounter = 0;
21457
21458           var selectorsGroupEnd = tokens[pos].selectorsGroupEnd;
21459           var selectorCount = tokens[pos].selectorsGroupSelectorCount;
21460           var delimCount = tokens[pos].selectorsGroupDelimCount;
21461
21462           selectorsGroup.push(getSelector());
21463           selectorCounter++;
21464
21465           while (pos < selectorsGroupEnd) {
21466             if (delimCounter < delimCount) {
21467               selectorsGroup = selectorsGroup.concat(getSC());
21468               selectorsGroup = selectorsGroup.concat(getDelim());
21469               delimCounter++;
21470
21471               selectorsGroup = selectorsGroup.concat(getSC());
21472
21473               if (selectorCounter < selectorCount) {
21474                 selectorsGroup = selectorsGroup.concat(getSelector());
21475                 selectorCounter++;
21476               }
21477             }
21478           }
21479
21480           return selectorsGroup;
21481         }
21482
21483         function checkSelector(i) {
21484           var l = void 0;
21485
21486           if (l = checkSelector1(i)) tokens[i].selectorType = 1;else if (l = checkSelector2(i)) tokens[i].selectorType = 2;
21487
21488           return l;
21489         }
21490
21491         function getSelector() {
21492           var selectorType = tokens[pos].selectorType;
21493           if (selectorType === 1) return getSelector1();else return getSelector2();
21494         }
21495
21496         /**
21497          * Checks for selector which starts with a compound selector.
21498          */
21499         function checkSelector1(i) {
21500           if (i >= tokensLength) return 0;
21501
21502           var start = i;
21503           var l = void 0;
21504
21505           if (l = checkCompoundSelector(i)) i += l;else return 0;
21506
21507           while (i < tokensLength) {
21508             var space = checkSC(i);
21509             var comma = checkCombinator(i + space);
21510             if (!space && !comma) break;
21511
21512             if (comma) {
21513               i += space + comma;
21514               space = checkSC(i);
21515             }
21516
21517             if (l = checkCompoundSelector(i + space)) i += space + l;else break;
21518           }
21519
21520           tokens[start].selectorEnd = i;
21521           return i - start;
21522         }
21523
21524         function getSelector1() {
21525           var type = NodeType.SelectorType;
21526           var token = tokens[pos];
21527           var line = token.ln;
21528           var column = token.col;
21529           var selectorEnd = token.selectorEnd;
21530           var content = getCompoundSelector();
21531
21532           while (pos < selectorEnd) {
21533             if (checkSC(pos)) content = content.concat(getSC());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkCompoundSelector(pos)) content = content.concat(getCompoundSelector());
21534           }
21535
21536           return newNode(type, content, line, column);
21537         }
21538
21539         /**
21540          * Checks for a selector that starts with a combinator.
21541          */
21542         function checkSelector2(i) {
21543           if (i >= tokensLength) return 0;
21544
21545           var start = i;
21546           var l = void 0;
21547
21548           if (l = checkCombinator(i)) i += l;else return 0;
21549
21550           while (i < tokensLength) {
21551             var spaceBefore = checkSC(i);
21552             if (l = checkCompoundSelector(i + spaceBefore)) i += spaceBefore + l;else break;
21553
21554             var spaceAfter = checkSC(i);
21555             var comma = checkCombinator(i + spaceAfter);
21556             if (!spaceAfter && !comma) break;
21557             if (comma) {
21558               i += spaceAfter + comma;
21559             }
21560           }
21561
21562           tokens[start].selectorEnd = i;
21563           return i - start;
21564         }
21565
21566         function getSelector2() {
21567           var type = NodeType.SelectorType;
21568           var token = tokens[pos];
21569           var line = token.ln;
21570           var column = token.col;
21571           var selectorEnd = token.selectorEnd;
21572           var content = [getCombinator()];
21573
21574           while (pos < selectorEnd) {
21575             if (checkSC(pos)) content = content.concat(getSC());else if (checkCombinator(pos)) content.push(getCombinator());else if (checkCompoundSelector(pos)) content = content.concat(getCompoundSelector());
21576           }
21577
21578           return newNode(type, content, line, column);
21579         }
21580
21581         function checkCompoundSelector(i) {
21582           var l = void 0;
21583
21584           if (l = checkCompoundSelector1(i)) {
21585             tokens[i].compoundSelectorType = 1;
21586           } else if (l = checkCompoundSelector2(i)) {
21587             tokens[i].compoundSelectorType = 2;
21588           }
21589
21590           return l;
21591         }
21592
21593         function getCompoundSelector() {
21594           var type = tokens[pos].compoundSelectorType;
21595           if (type === 1) return getCompoundSelector1();
21596           if (type === 2) return getCompoundSelector2();
21597         }
21598
21599         /**
21600          * Check for compound selectors that start with either a type selector,
21601          * placeholder or parent selector with extension
21602          * (1) `foo.bar`
21603          * (2) `foo[attr=val]`
21604          * (3) `foo:first-of-type`
21605          * (4) `foo%bar`
21606          * @param {number} i Token's index
21607          * @return {number} Compound selector's length
21608          */
21609         function checkCompoundSelector1(i) {
21610           if (i >= tokensLength) return 0;
21611
21612           var start = i;
21613           var l = void 0;
21614
21615           if (l = checkUniversalSelector(i) || checkTypeSelector(i) || checkPlaceholder(i) || checkParentSelectorWithExtension(i)) i += l;else return 0;
21616
21617           while (i < tokensLength) {
21618             var _l2 = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i) || checkPlaceholder(i) || checkInterpolation(i);
21619
21620             if (_l2) i += _l2;else break;
21621           }
21622
21623           tokens[start].compoundSelectorEnd = i;
21624
21625           return i - start;
21626         }
21627
21628         /**
21629          * @return {Array} An array of nodes that make up the compound selector
21630          */
21631         function getCompoundSelector1() {
21632           var sequence = [];
21633           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
21634
21635           if (checkUniversalSelector(pos)) sequence.push(getUniversalSelector());else if (checkTypeSelector(pos)) sequence.push(getTypeSelector());else if (checkPlaceholder(pos)) sequence.push(getPlaceholder());else if (checkParentSelectorWithExtension(pos)) sequence = sequence.concat(getParentSelectorWithExtension());
21636
21637           while (pos < compoundSelectorEnd) {
21638             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());else if (checkPlaceholder(pos)) sequence.push(getPlaceholder());else if (checkInterpolation(pos)) sequence.push(getInterpolation());else break;
21639           }
21640
21641           return sequence;
21642         }
21643
21644         /**
21645          * Check for all other compound selectors
21646          * (1) `.foo.bar`
21647          * (2) `.foo[attr=val]`
21648          * (3) `.foo:first-of-type`
21649          * (4) `.foo%bar`
21650          * (5) `.foo#{$bar}`
21651          * @param {number} i Token's index
21652          * @return {number} Compound selector's length
21653          */
21654         function checkCompoundSelector2(i) {
21655           if (i >= tokensLength) return 0;
21656
21657           var start = i;
21658
21659           while (i < tokensLength) {
21660             var l = checkShash(i) || checkClass(i) || checkAttributeSelector(i) || checkPseudo(i) || checkPlaceholder(i) || checkInterpolation(i);
21661
21662             if (l) i += l;else break;
21663           }
21664
21665           tokens[start].compoundSelectorEnd = i;
21666
21667           return i - start;
21668         }
21669
21670         /**
21671          * @return {Array} An array of nodes that make up the compound selector
21672          */
21673         function getCompoundSelector2() {
21674           var sequence = [];
21675           var compoundSelectorEnd = tokens[pos].compoundSelectorEnd;
21676
21677           while (pos < compoundSelectorEnd) {
21678             if (checkShash(pos)) sequence.push(getShash());else if (checkClass(pos)) sequence.push(getClass());else if (checkAttributeSelector(pos)) sequence.push(getAttributeSelector());else if (checkPseudo(pos)) sequence.push(getPseudo());else if (checkPlaceholder(pos)) sequence.push(getPlaceholder());else if (checkInterpolation(pos)) sequence.push(getInterpolation());else break;
21679           }
21680
21681           return sequence;
21682         }
21683
21684         function checkUniversalSelector(i) {
21685           if (i >= tokensLength) return 0;
21686
21687           var start = i;
21688           var l = void 0;
21689
21690           if (l = checkNamePrefix(i)) i += l;
21691
21692           if (tokens[i].type === TokenType.Asterisk) i++;else return 0;
21693
21694           return i - start;
21695         }
21696
21697         function getUniversalSelector() {
21698           var type = NodeType.UniversalSelectorType;
21699           var token = tokens[pos];
21700           var line = token.ln;
21701           var column = token.col;
21702           var content = [];
21703           var end = void 0;
21704
21705           if (checkNamePrefix(pos)) {
21706             content.push(getNamePrefix());
21707             end = getLastPosition(content, line, column, 1);
21708           }
21709
21710           pos++;
21711
21712           return newNode(type, content, line, column, end);
21713         }
21714
21715         /**
21716          * Check if token is part of a type selector
21717          * @param {number} i Token's index
21718          * @return {number} Type selector's length
21719          */
21720         function checkTypeSelector(i) {
21721           if (i >= tokensLength) return 0;
21722
21723           var start = i;
21724           var l = void 0;
21725
21726           if (l = checkNamePrefix(i)) i += l;
21727
21728           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
21729
21730           return i - start;
21731         }
21732
21733         /**
21734          * Get type selector node
21735          * @return {Node}
21736          */
21737         function getTypeSelector() {
21738           var type = NodeType.TypeSelectorType;
21739           var token = tokens[pos];
21740           var line = token.ln;
21741           var column = token.col;
21742           var content = [];
21743
21744           if (checkNamePrefix(pos)) content.push(getNamePrefix());
21745
21746           content = content.concat(getIdentOrInterpolation());
21747
21748           return newNode(type, content, line, column);
21749         }
21750
21751         function checkAttributeSelector(i) {
21752           var l = void 0;
21753           if (l = checkAttributeSelector1(i)) tokens[i].attributeSelectorType = 1;else if (l = checkAttributeSelector2(i)) tokens[i].attributeSelectorType = 2;
21754
21755           return l;
21756         }
21757
21758         function getAttributeSelector() {
21759           var type = tokens[pos].attributeSelectorType;
21760           if (type === 1) return getAttributeSelector1();else return getAttributeSelector2();
21761         }
21762
21763         /**
21764          * (1) `[panda=nani]`
21765          * (2) `[panda='nani']`
21766          * (3) `[panda='nani' i]`
21767          *
21768          */
21769         function checkAttributeSelector1(i) {
21770           var start = i;
21771
21772           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
21773
21774           var l = void 0;
21775           if (l = checkSC(i)) i += l;
21776
21777           if (l = checkAttributeName(i)) i += l;else return 0;
21778
21779           if (l = checkSC(i)) i += l;
21780
21781           if (l = checkAttributeMatch(i)) i += l;else return 0;
21782
21783           if (l = checkSC(i)) i += l;
21784
21785           if (l = checkAttributeValue(i)) i += l;else return 0;
21786
21787           if (l = checkSC(i)) i += l;
21788
21789           if (l = checkAttributeFlags(i)) {
21790             i += l;
21791             if (l = checkSC(i)) i += l;
21792           }
21793
21794           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
21795
21796           return i - start;
21797         }
21798
21799         function getAttributeSelector1() {
21800           var type = NodeType.AttributeSelectorType;
21801           var token = tokens[pos];
21802           var line = token.ln;
21803           var column = token.col;
21804           var content = [];
21805
21806           // Skip `[`.
21807           pos++;
21808
21809           content = content.concat(getSC(), getAttributeName(), getSC(), getAttributeMatch(), getSC(), getAttributeValue(), getSC());
21810
21811           if (checkAttributeFlags(pos)) {
21812             content.push(getAttributeFlags());
21813             content = content.concat(getSC());
21814           }
21815
21816           // Skip `]`.
21817           pos++;
21818
21819           var end = getLastPosition(content, line, column, 1);
21820           return newNode(type, content, line, column, end);
21821         }
21822
21823         /**
21824          * (1) `[panda]`
21825          */
21826         function checkAttributeSelector2(i) {
21827           var start = i;
21828
21829           if (tokens[i].type === TokenType.LeftSquareBracket) i++;else return 0;
21830
21831           var l = void 0;
21832           if (l = checkSC(i)) i += l;
21833
21834           if (l = checkAttributeName(i)) i += l;else return 0;
21835
21836           if (l = checkSC(i)) i += l;
21837
21838           if (tokens[i].type === TokenType.RightSquareBracket) i++;else return 0;
21839
21840           return i - start;
21841         }
21842
21843         function getAttributeSelector2() {
21844           var type = NodeType.AttributeSelectorType;
21845           var token = tokens[pos];
21846           var line = token.ln;
21847           var column = token.col;
21848           var content = [];
21849
21850           // Skip `[`.
21851           pos++;
21852
21853           content = content.concat(getSC(), getAttributeName(), getSC());
21854
21855           // Skip `]`.
21856           pos++;
21857
21858           var end = getLastPosition(content, line, column, 1);
21859           return newNode(type, content, line, column, end);
21860         }
21861
21862         function checkAttributeName(i) {
21863           var start = i;
21864           var l = void 0;
21865
21866           if (l = checkNamePrefix(i)) i += l;
21867
21868           if (l = checkIdentOrInterpolation(i)) i += l;else return 0;
21869
21870           return i - start;
21871         }
21872
21873         function getAttributeName() {
21874           var type = NodeType.AttributeNameType;
21875           var token = tokens[pos];
21876           var line = token.ln;
21877           var column = token.col;
21878           var content = [];
21879
21880           if (checkNamePrefix(pos)) content.push(getNamePrefix());
21881           content = content.concat(getIdentOrInterpolation());
21882
21883           return newNode(type, content, line, column);
21884         }
21885
21886         function checkAttributeMatch(i) {
21887           var l = void 0;
21888           if (l = checkAttributeMatch1(i)) tokens[i].attributeMatchType = 1;else if (l = checkAttributeMatch2(i)) tokens[i].attributeMatchType = 2;
21889
21890           return l;
21891         }
21892
21893         function getAttributeMatch() {
21894           var type = tokens[pos].attributeMatchType;
21895           if (type === 1) return getAttributeMatch1();else return getAttributeMatch2();
21896         }
21897
21898         function checkAttributeMatch1(i) {
21899           var start = i;
21900
21901           var type = tokens[i].type;
21902           if (type === TokenType.Tilde || type === TokenType.VerticalLine || type === TokenType.CircumflexAccent || type === TokenType.DollarSign || type === TokenType.Asterisk) i++;else return 0;
21903
21904           if (tokens[i].type === TokenType.EqualsSign) i++;else return 0;
21905
21906           return i - start;
21907         }
21908
21909         function getAttributeMatch1() {
21910           var type = NodeType.AttributeMatchType;
21911           var token = tokens[pos];
21912           var line = token.ln;
21913           var column = token.col;
21914           var content = tokens[pos].value + tokens[pos + 1].value;
21915           pos += 2;
21916
21917           return newNode(type, content, line, column);
21918         }
21919
21920         function checkAttributeMatch2(i) {
21921           if (tokens[i].type === TokenType.EqualsSign) return 1;else return 0;
21922         }
21923
21924         function getAttributeMatch2() {
21925           var type = NodeType.AttributeMatchType;
21926           var token = tokens[pos];
21927           var line = token.ln;
21928           var column = token.col;
21929           var content = '=';
21930
21931           pos++;
21932           return newNode(type, content, line, column);
21933         }
21934
21935         function checkAttributeValue(i) {
21936           return checkString(i) || checkIdentOrInterpolation(i);
21937         }
21938
21939         function getAttributeValue() {
21940           var type = NodeType.AttributeValueType;
21941           var token = tokens[pos];
21942           var line = token.ln;
21943           var column = token.col;
21944           var content = [];
21945
21946           if (checkString(pos)) content.push(getString());else content = content.concat(getIdentOrInterpolation());
21947
21948           return newNode(type, content, line, column);
21949         }
21950
21951         function checkAttributeFlags(i) {
21952           return checkIdentOrInterpolation(i);
21953         }
21954
21955         function getAttributeFlags() {
21956           var type = NodeType.AttributeFlagsType;
21957           var token = tokens[pos];
21958           var line = token.ln;
21959           var column = token.col;
21960           var content = getIdentOrInterpolation();
21961
21962           return newNode(type, content, line, column);
21963         }
21964
21965         function checkNamePrefix(i) {
21966           if (i >= tokensLength) return 0;
21967
21968           var l = void 0;
21969           if (l = checkNamePrefix1(i)) tokens[i].namePrefixType = 1;else if (l = checkNamePrefix2(i)) tokens[i].namePrefixType = 2;
21970
21971           return l;
21972         }
21973
21974         function getNamePrefix() {
21975           var type = tokens[pos].namePrefixType;
21976           if (type === 1) return getNamePrefix1();else return getNamePrefix2();
21977         }
21978
21979         /**
21980          * (1) `panda|`
21981          * (2) `panda<comment>|`
21982          */
21983         function checkNamePrefix1(i) {
21984           var start = i;
21985           var l = void 0;
21986
21987           if (l = checkNamespacePrefix(i)) i += l;else return 0;
21988
21989           if (l = checkCommentML(i)) i += l;
21990
21991           if (l = checkNamespaceSeparator(i)) i += l;else return 0;
21992
21993           return i - start;
21994         }
21995
21996         function getNamePrefix1() {
21997           var type = NodeType.NamePrefixType;
21998           var token = tokens[pos];
21999           var line = token.ln;
22000           var column = token.col;
22001           var content = [];
22002
22003           content.push(getNamespacePrefix());
22004
22005           if (checkCommentML(pos)) content.push(getCommentML());
22006
22007           content.push(getNamespaceSeparator());
22008
22009           return newNode(type, content, line, column);
22010         }
22011
22012         /**
22013          * (1) `|`
22014          */
22015         function checkNamePrefix2(i) {
22016           return checkNamespaceSeparator(i);
22017         }
22018
22019         function getNamePrefix2() {
22020           var type = NodeType.NamePrefixType;
22021           var token = tokens[pos];
22022           var line = token.ln;
22023           var column = token.col;
22024           var content = [getNamespaceSeparator()];
22025
22026           return newNode(type, content, line, column);
22027         }
22028
22029         /**
22030          * (1) `*`
22031          * (2) `panda`
22032          */
22033         function checkNamespacePrefix(i) {
22034           if (i >= tokensLength) return 0;
22035
22036           var l = void 0;
22037
22038           if (tokens[i].type === TokenType.Asterisk) return 1;else if (l = checkIdentOrInterpolation(i)) return l;else return 0;
22039         }
22040
22041         function getNamespacePrefix() {
22042           var type = NodeType.NamespacePrefixType;
22043           var token = tokens[pos];
22044           var line = token.ln;
22045           var column = token.col;
22046           var content = [];
22047
22048           if (token.type === TokenType.Asterisk) {
22049             var asteriskNode = newNode(NodeType.IdentType, '*', line, column);
22050             content.push(asteriskNode);
22051             pos++;
22052           } else if (checkIdentOrInterpolation(pos)) content = content.concat(getIdentOrInterpolation());
22053
22054           return newNode(type, content, line, column);
22055         }
22056
22057         /**
22058          * (1) `|`
22059          */
22060         function checkNamespaceSeparator(i) {
22061           if (i >= tokensLength) return 0;
22062
22063           if (tokens[i].type !== TokenType.VerticalLine) return 0;
22064
22065           // Return false if `|=` - [attr|=value]
22066           if (tokens[i + 1] && tokens[i + 1].type === TokenType.EqualsSign) return 0;
22067
22068           return 1;
22069         }
22070
22071         function getNamespaceSeparator() {
22072           var type = NodeType.NamespaceSeparatorType;
22073           var token = tokens[pos];
22074           var line = token.ln;
22075           var column = token.col;
22076           var content = '|';
22077
22078           pos++;
22079           return newNode(type, content, line, column);
22080         }
22081
22082         module.exports = function (_tokens, context) {
22083           tokens = _tokens;
22084           tokensLength = tokens.length;
22085           pos = 0;
22086
22087           return contexts[context]();
22088         };
22089
22090 /***/ }),
22091 /* 28 */
22092 /***/ (function(module, exports, __webpack_require__) {
22093
22094         'use strict';
22095
22096         module.exports = function (css, tabSize) {
22097           var TokenType = __webpack_require__(13);
22098
22099           var tokens = [];
22100           var urlMode = false;
22101           var c = void 0; // Current character
22102           var cn = void 0; // Next character
22103           var pos = 0;
22104           var tn = 0;
22105           var ln = 1;
22106           var col = 1;
22107
22108           var Punctuation = {
22109             ' ': TokenType.Space,
22110             '\n': TokenType.Newline,
22111             '\r': TokenType.Newline,
22112             '\t': TokenType.Tab,
22113             '!': TokenType.ExclamationMark,
22114             '"': TokenType.QuotationMark,
22115             '#': TokenType.NumberSign,
22116             '$': TokenType.DollarSign,
22117             '%': TokenType.PercentSign,
22118             '&': TokenType.Ampersand,
22119             '\'': TokenType.Apostrophe,
22120             '(': TokenType.LeftParenthesis,
22121             ')': TokenType.RightParenthesis,
22122             '*': TokenType.Asterisk,
22123             '+': TokenType.PlusSign,
22124             ',': TokenType.Comma,
22125             '-': TokenType.HyphenMinus,
22126             '.': TokenType.FullStop,
22127             '/': TokenType.Solidus,
22128             ':': TokenType.Colon,
22129             ';': TokenType.Semicolon,
22130             '<': TokenType.LessThanSign,
22131             '=': TokenType.EqualsSign,
22132             '==': TokenType.EqualitySign,
22133             '!=': TokenType.InequalitySign,
22134             '>': TokenType.GreaterThanSign,
22135             '?': TokenType.QuestionMark,
22136             '@': TokenType.CommercialAt,
22137             '[': TokenType.LeftSquareBracket,
22138             ']': TokenType.RightSquareBracket,
22139             '^': TokenType.CircumflexAccent,
22140             '_': TokenType.LowLine,
22141             '{': TokenType.LeftCurlyBracket,
22142             '|': TokenType.VerticalLine,
22143             '}': TokenType.RightCurlyBracket,
22144             '~': TokenType.Tilde,
22145             '`': TokenType.Backtick
22146           };
22147
22148           /**
22149            * Add a token to the token list
22150            * @param {string} type
22151            * @param {string} value
22152            */
22153           function pushToken(type, value, column) {
22154             tokens.push({
22155               tn: tn++,
22156               ln: ln,
22157               col: column,
22158               type: type,
22159               value: value
22160             });
22161           }
22162
22163           /**
22164            * Check if a character is a decimal digit
22165            * @param {string} c Character
22166            * @returns {boolean}
22167            */
22168           function isDecimalDigit(c) {
22169             return '0123456789'.indexOf(c) >= 0;
22170           }
22171
22172           /**
22173            * Parse spaces
22174            * @param {string} css Unparsed part of CSS string
22175            */
22176           function parseSpaces(css) {
22177             var start = pos;
22178
22179             // Read the string until we meet a non-space character:
22180             for (; pos < css.length; pos++) {
22181               if (css.charAt(pos) !== ' ') break;
22182             }
22183
22184             // Add a substring containing only spaces to tokens:
22185             pushToken(TokenType.Space, css.substring(start, pos--), col);
22186             col += pos - start;
22187           }
22188
22189           /**
22190            * Parse a string within quotes
22191            * @param {string} css Unparsed part of CSS string
22192            * @param {string} q Quote (either `'` or `"`)
22193            */
22194           function parseString(css, q) {
22195             var start = pos;
22196
22197             // Read the string until we meet a matching quote:
22198             for (pos++; pos < css.length; pos++) {
22199               // Skip escaped quotes:
22200               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) === q) break;
22201             }
22202
22203             // Add the string (including quotes) to tokens:
22204             var type = q === '"' ? TokenType.StringDQ : TokenType.StringSQ;
22205             pushToken(type, css.substring(start, pos + 1), col);
22206             col += pos - start;
22207           }
22208
22209           /**
22210            * Parse numbers
22211            * @param {string} css Unparsed part of CSS string
22212            */
22213           function parseDecimalNumber(css) {
22214             var start = pos;
22215
22216             // Read the string until we meet a character that's not a digit:
22217             for (; pos < css.length; pos++) {
22218               if (!isDecimalDigit(css.charAt(pos))) break;
22219             }
22220
22221             // Add the number to tokens:
22222             pushToken(TokenType.DecimalNumber, css.substring(start, pos--), col);
22223             col += pos - start;
22224           }
22225
22226           /**
22227            * Parse identifier
22228            * @param {string} css Unparsed part of CSS string
22229            */
22230           function parseIdentifier(css) {
22231             var start = pos;
22232
22233             // Skip all opening slashes:
22234             while (css.charAt(pos) === '/') {
22235               pos++;
22236             } // Read the string until we meet a punctuation mark:
22237             for (; pos < css.length; pos++) {
22238               // Skip all '\':
22239               if (css.charAt(pos) === '\\') pos++;else if (css.charAt(pos) in Punctuation) break;
22240             }
22241
22242             var ident = css.substring(start, pos--);
22243
22244             // Enter url mode if parsed substring is `url`:
22245             if (!urlMode && ident === 'url' && css.charAt(pos + 1) === '(') {
22246               urlMode = true;
22247             }
22248
22249             // Add identifier to tokens:
22250             pushToken(TokenType.Identifier, ident, col);
22251             col += pos - start;
22252           }
22253
22254           /**
22255            * Parse equality sign
22256            */
22257           function parseEquality() {
22258             pushToken(TokenType.EqualitySign, '==', col);
22259             pos++;
22260             col++;
22261           }
22262
22263           /**
22264            * Parse inequality sign
22265            */
22266           function parseInequality() {
22267             pushToken(TokenType.InequalitySign, '!=', col);
22268             pos++;
22269             col++;
22270           }
22271
22272           /**
22273           * Parse a multiline comment
22274           * @param {string} css Unparsed part of CSS string
22275           */
22276           function parseMLComment(css) {
22277             var start = pos;
22278
22279             // Read the string until we meet `*/`.
22280             // Since we already know first 2 characters (`/*`), start reading
22281             // from `pos + 2`:
22282             for (pos += 2; pos < css.length; pos++) {
22283               if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') {
22284                 pos++;
22285                 break;
22286               }
22287             }
22288
22289             // Add full comment (including `/*` and `*/`) to the list of tokens:
22290             var comment = css.substring(start, pos + 1);
22291             pushToken(TokenType.CommentML, comment, col);
22292
22293             var newlines = comment.split('\n');
22294             if (newlines.length > 1) {
22295               ln += newlines.length - 1;
22296               col = newlines[newlines.length - 1].length;
22297             } else {
22298               col += pos - start;
22299             }
22300           }
22301
22302           /**
22303           * Parse a single line comment
22304           * @param {string} css Unparsed part of CSS string
22305           */
22306           function parseSLComment(css) {
22307             var start = pos;
22308
22309             // Read the string until we meet line break.
22310             // Since we already know first 2 characters (`//`), start reading
22311             // from `pos + 2`:
22312             for (pos += 2; pos < css.length; pos++) {
22313               if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') {
22314                 break;
22315               }
22316             }
22317
22318             // Add comment (including `//` and line break) to the list of tokens:
22319             pushToken(TokenType.CommentSL, css.substring(start, pos--), col);
22320             col += pos - start;
22321           }
22322
22323           /**
22324            * Convert a CSS string to a list of tokens
22325            * @param {string} css CSS string
22326            * @returns {Array} List of tokens
22327            * @private
22328            */
22329           function getTokens(css) {
22330             // Parse string, character by character:
22331             for (pos = 0; pos < css.length; col++, pos++) {
22332               c = css.charAt(pos);
22333               cn = css.charAt(pos + 1);
22334
22335               // If we meet `/*`, it's a start of a multiline comment.
22336               // Parse following characters as a multiline comment:
22337               if (c === '/' && cn === '*') {
22338                 parseMLComment(css);
22339               }
22340
22341               // If we meet `//` and it is not a part of url:
22342               else if (!urlMode && c === '/' && cn === '/') {
22343                   // If we're currently inside a block, treat `//` as a start
22344                   // of identifier. Else treat `//` as a start of a single-line
22345                   // comment:
22346                   parseSLComment(css);
22347                 }
22348
22349                 // If current character is a double or single quote, it's a start
22350                 // of a string:
22351                 else if (c === '"' || c === "'") {
22352                     parseString(css, c);
22353                   }
22354
22355                   // If current character is a space:
22356                   else if (c === ' ') {
22357                       parseSpaces(css);
22358                     }
22359
22360                     // If current character is `=`, it must be combined with next `=`
22361                     else if (c === '=' && cn === '=') {
22362                         parseEquality(css);
22363                       }
22364
22365                       // If we meet `!=`, this must be inequality
22366                       else if (c === '!' && cn === '=') {
22367                           parseInequality(css);
22368                         }
22369
22370                         // If current character is a punctuation mark:
22371                         else if (c in Punctuation) {
22372                             // Check for CRLF here or just LF
22373                             if (c === '\r' && cn === '\n' || c === '\n') {
22374                               // If \r we know the next character is \n due to statement above
22375                               // so we push a CRLF token type to the token list and importantly
22376                               // skip the next character so as not to double count newlines or
22377                               // columns etc
22378                               if (c === '\r') {
22379                                 pushToken(TokenType.Newline, '\r\n', col);
22380                                 pos++; // If CRLF skip the next character and push crlf token
22381                               } else if (c === '\n') {
22382                                 // If just a LF newline and not part of CRLF newline we can just
22383                                 // push punctuation as usual
22384                                 pushToken(Punctuation[c], c, col);
22385                               }
22386
22387                               ln++; // Go to next line
22388                               col = 0; // Reset the column count
22389                             } else if (c !== '\r' && c !== '\n') {
22390                               // Handle all other punctuation and add to list of tokens
22391                               pushToken(Punctuation[c], c, col);
22392                             } // Go to next line
22393                             if (c === ')') urlMode = false; // Exit url mode
22394                             else if (c === '\t' && tabSize > 1) col += tabSize - 1;
22395                           }
22396
22397                           // If current character is a decimal digit:
22398                           else if (isDecimalDigit(c)) {
22399                               parseDecimalNumber(css);
22400                             }
22401
22402                             // If current character is anything else:
22403                             else {
22404                                 parseIdentifier(css);
22405                               }
22406             }
22407
22408             return tokens;
22409           }
22410
22411           return getTokens(css);
22412         };
22413
22414 /***/ }),
22415 /* 29 */
22416 /***/ (function(module, exports, __webpack_require__) {
22417
22418         'use strict';
22419
22420         var Node = __webpack_require__(1);
22421         var NodeTypes = __webpack_require__(15);
22422
22423         module.exports = function () {
22424           return new Node({
22425             type: NodeTypes.StylesheetType,
22426             content: [],
22427             start: [0, 0],
22428             end: [0, 0]
22429           });
22430         };
22431
22432 /***/ })
22433 /******/ ])
22434 });
22435 ;