Code coverage report for lib/parser/scssScanner.js

# all files / lib/parser/ scssScanner.js

90.48% Statements 76/84
75.93% Branches 41/54
83.33% Functions 10/12
93.75% Lines 75/80

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    1271×
    1×

    1×
    1×
    1×
    1×

    1×
    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    66×

    1×

    4290×
    4290×

    4290×

    4290×
    367×
    367×
    360×

    7×

    3930×
    46×

    3884×
    15×

    3869×
    2×

    3867×
    6×
    2×

    4×

    3861×
    8×
    3×

    5×

    3853×
    3×

    3850×

    1×
    8177×
    34×

    8143×
    3×
    63×

    3×

    60×

    3×

    8140×

    1×

    1×

     var __extends = (this && this.__extends) || (function () {
        var extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    (function (factory) {
        Eif (typeof module === "object" && typeof module.exports === "object") {
            var v = factory(require, exports);
            Iif (v !== undefined) module.exports = v;
        }
        else if (typeof define === "function" && define.amd) {
            define(["require", "exports", "./cssScanner"], factory);
        }
    })(function (require, exports) {
        /*---------------------------------------------------------------------------------------------
         *  Copyright (c) Microsoft Corporation. All rights reserved.
         *  Licensed under the MIT License. See License.txt in the project root for license information.
         *--------------------------------------------------------------------------------------------*/
        'use strict';
        Object.defineProperty(exports, "__esModule", { value: true });
        var cssScanner_1 = require("./cssScanner");
        var _FSL = '/'.charCodeAt(0);
        var _NWL = '\n'.charCodeAt(0);
        var _CAR = '\r'.charCodeAt(0);
        var _LFD = '\f'.charCodeAt(0);
        var _DLR = '$'.charCodeAt(0);
        var _HSH = '#'.charCodeAt(0);
        var _CUL = '{'.charCodeAt(0);
        var _EQS = '='.charCodeAt(0);
        var _BNG = '!'.charCodeAt(0);
        var _LAN = '<'.charCodeAt(0);
        var _RAN = '>'.charCodeAt(0);
        var _DOT = '.'.charCodeAt(0);
        var customTokenValue = cssScanner_1.TokenType.CustomToken;
        exports.VariableName = customTokenValue++;
        exports.InterpolationFunction = customTokenValue++;
        exports.Default = customTokenValue++;
        exports.EqualsOperator = customTokenValue++;
        exports.NotEqualsOperator = customTokenValue++;
        exports.GreaterEqualsOperator = customTokenValue++;
        exports.SmallerEqualsOperator = customTokenValue++;
        exports.Ellipsis = customTokenValue++;
        var SCSSScanner = (function (_super) {
            __extends(SCSSScanner, _super);
            function SCSSScanner() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            SCSSScanner.prototype.scan = function () {
                // processes all whitespaces and comments
                var triviaToken = this.trivia();
                Iif (triviaToken !== null) {
                    return triviaToken;
                }
                var offset = this.stream.pos();
                // scss variable
                if (this.stream.advanceIfChar(_DLR)) {
                    var content = ['$'];
                    if (this.ident(content)) {
                        return this.finishToken(offset, exports.VariableName, content.join(''));
                    }
                    else {
                        this.stream.goBackTo(offset);
                    }
                }
                // scss: interpolation function #{..})
                if (this.stream.advanceIfChars([_HSH, _CUL])) {
                    return this.finishToken(offset, exports.InterpolationFunction);
                }
                // operator ==
                if (this.stream.advanceIfChars([_EQS, _EQS])) {
                    return this.finishToken(offset, exports.EqualsOperator);
                }
                // operator !=
                if (this.stream.advanceIfChars([_BNG, _EQS])) {
                    return this.finishToken(offset, exports.NotEqualsOperator);
                }
                // operators <, <=
                if (this.stream.advanceIfChar(_LAN)) {
                    if (this.stream.advanceIfChar(_EQS)) {
                        return this.finishToken(offset, exports.SmallerEqualsOperator);
                    }
                    return this.finishToken(offset, cssScanner_1.TokenType.Delim);
                }
                // ooperators >, >=
                if (this.stream.advanceIfChar(_RAN)) {
                    if (this.stream.advanceIfChar(_EQS)) {
                        return this.finishToken(offset, exports.GreaterEqualsOperator);
                    }
                    return this.finishToken(offset, cssScanner_1.TokenType.Delim);
                }
                // ellipis
                if (this.stream.advanceIfChars([_DOT, _DOT, _DOT])) {
                    return this.finishToken(offset, exports.Ellipsis);
                }
                return _super.prototype.scan.call(this);
            };
            SCSSScanner.prototype.comment = function () {
                if (_super.prototype.comment.call(this)) {
                    return true;
                }
                if (this.stream.advanceIfChars([_FSL, _FSL])) {
                    this.stream.advanceWhileChar(function (ch) {
                        switch (ch) {
                            case _NWL:
                            case _CAR:
                            case _LFD:
                                return false;
                            default:
                                return true;
                        }
                    });
                    return true;
                }
                else {
                    return false;
                }
            };
            return SCSSScanner;
        }(cssScanner_1.Scanner));
        exports.SCSSScanner = SCSSScanner;
    });
    //# sourceMappingURL=scssScanner.js.map