Sha256: 65ec71586f2f7fa4632a9806248d368910fb08280322d1f7ecf2d75bc344abcc

Contents?: true

Size: 1.48 KB

Versions: 16

Compression:

Stored size: 1.48 KB

Contents

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

var IDENT = TYPE.Ident;
var PLUSSIGN = CHARCODE.PlusSign;
var SOLIDUS = CHARCODE.Solidus;
var GREATERTHANSIGN = CHARCODE.GreaterThanSign;
var TILDE = CHARCODE.Tilde;

// + | > | ~ | /deep/
module.exports = {
    name: 'Combinator',
    structure: {
        name: String
    },
    parse: function() {
        var start = this.scanner.tokenStart;
        var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);

        switch (code) {
            case GREATERTHANSIGN:
            case PLUSSIGN:
            case TILDE:
                this.scanner.next();
                break;

            case SOLIDUS:
                this.scanner.next();

                if (this.scanner.tokenType !== IDENT || this.scanner.lookupValue(0, 'deep') === false) {
                    this.error('Identifier `deep` is expected');
                }

                this.scanner.next();

                if (!this.scanner.isDelim(SOLIDUS)) {
                    this.error('Solidus is expected');
                }

                this.scanner.next();
                break;

            default:
                this.error('Combinator is expected');
        }

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

Version data entries

16 entries across 16 versions & 3 rubygems

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