Sha256: b4968ba4223ee854205f90e555892fafbb825df60461a81cad48be37175e969b

Contents?: true

Size: 1.22 KB

Versions: 19

Compression:

Stored size: 1.22 KB

Contents

var TYPE = require('../../tokenizer').TYPE;

var IDENTIFIER = TYPE.Identifier;
var ASTERISK = TYPE.Asterisk;
var VERTICALLINE = TYPE.VerticalLine;

function eatIdentifierOrAsterisk() {
    if (this.scanner.tokenType !== IDENTIFIER &&
        this.scanner.tokenType !== ASTERISK) {
        this.scanner.error('Identifier or asterisk is expected');
    }

    this.scanner.next();
}

// ident
// ident|ident
// ident|*
// *
// *|ident
// *|*
// |ident
// |*
module.exports = {
    name: 'TypeSelector',
    structure: {
        name: String
    },
    parse: function() {
        var start = this.scanner.tokenStart;

        if (this.scanner.tokenType === VERTICALLINE) {
            this.scanner.next();
            eatIdentifierOrAsterisk.call(this);
        } else {
            eatIdentifierOrAsterisk.call(this);

            if (this.scanner.tokenType === VERTICALLINE) {
                this.scanner.next();
                eatIdentifierOrAsterisk.call(this);
            }
        }

        return {
            type: 'TypeSelector',
            loc: this.getLocation(start, this.scanner.tokenStart),
            name: this.scanner.substrToCursor(start)
        };
    },
    generate: function(node) {
        this.chunk(node.name);
    }
};

Version data entries

19 entries across 18 versions & 4 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.18.2 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.16.1 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.15.2 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.18.4 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.18.1 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.14.0 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
jester-data-8.0.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
ezii-os-5.2.1 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
ezii-os-2.0.1 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
ezii-os-1.1.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
ezii-os-1.0.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
ezii-os-0.0.0.1.0 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
ezii-os-0.0.0.0.1 node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/css-tree/lib/syntax/node/TypeSelector.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js
locomotivecms-3.4.0 app/javascript/node_modules/csso/node_modules/css-tree/lib/syntax/node/TypeSelector.js