Sha256: 9aa619a5e4dc29ea0301568c9fd3bac5fd141ed343b24032f660ab2b0451e703

Contents?: true

Size: 1.93 KB

Versions: 41

Compression:

Stored size: 1.93 KB

Contents

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

var WHITESPACE = TYPE.WhiteSpace;
var COMMENT = TYPE.Comment;
var IDENT = TYPE.Ident;
var FUNCTION = TYPE.Function;
var COLON = TYPE.Colon;
var LEFTPARENTHESIS = TYPE.LeftParenthesis;

function consumeRaw() {
    return this.createSingleNodeList(
        this.Raw(this.scanner.tokenIndex, null, false)
    );
}

function parentheses() {
    this.scanner.skipSC();

    if (this.scanner.tokenType === IDENT &&
        this.lookupNonWSType(1) === COLON) {
        return this.createSingleNodeList(
            this.Declaration()
        );
    }

    return readSequence.call(this);
}

function readSequence() {
    var children = this.createList();
    var space = null;
    var child;

    this.scanner.skipSC();

    scan:
    while (!this.scanner.eof) {
        switch (this.scanner.tokenType) {
            case WHITESPACE:
                space = this.WhiteSpace();
                continue;

            case COMMENT:
                this.scanner.next();
                continue;

            case FUNCTION:
                child = this.Function(consumeRaw, this.scope.AtrulePrelude);
                break;

            case IDENT:
                child = this.Identifier();
                break;

            case LEFTPARENTHESIS:
                child = this.Parentheses(parentheses, this.scope.AtrulePrelude);
                break;

            default:
                break scan;
        }

        if (space !== null) {
            children.push(space);
            space = null;
        }

        children.push(child);
    }

    return children;
}

module.exports = {
    parse: {
        prelude: function() {
            var children = readSequence.call(this);

            if (this.getFirstListNode(children) === null) {
                this.error('Condition is expected');
            }

            return children;
        },
        block: function() {
            return this.Block(false);
        }
    }
};

Version data entries

41 entries across 31 versions & 9 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
optimacms-0.1.61 spec/dummy/node_modules/csso/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.18.0 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.18.2 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.16.1 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.15.2 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.18.4 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.18.1 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.14.0 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/atrule/supports.js
isomorfeus-preact-10.5.7 node_modules/css-tree/lib/syntax/atrule/supports.js
isomorfeus-preact-10.5.6 node_modules/css-tree/lib/syntax/atrule/supports.js
isomorfeus-preact-10.5.5 node_modules/css-tree/lib/syntax/atrule/supports.js
isomorfeus-preact-10.5.4 node_modules/css-tree/lib/syntax/atrule/supports.js
isomorfeus-preact-10.5.3 node_modules/css-tree/lib/syntax/atrule/supports.js
isomorfeus-preact-10.5.2 node_modules/css-tree/lib/syntax/atrule/supports.js
tang-0.2.1 spec/tang_app/node_modules/csso/node_modules/css-tree/lib/syntax/atrule/supports.js
tang-0.2.1 spec/tang_app/node_modules/css-tree/lib/syntax/atrule/supports.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/csso/node_modules/css-tree/lib/syntax/atrule/supports.js