Sha256: a68e7a409157f5a83e9b86ad8b3dd11a0a7ead106bd4484a03025c15936f4687

Contents?: true

Size: 959 Bytes

Versions: 16

Compression:

Stored size: 959 Bytes

Contents

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

var ASTERISK = CHARCODE.Asterisk;
var SOLIDUS = CHARCODE.Solidus;
var COMMENT = TYPE.Comment;

// '/*' .* '*/'
module.exports = {
    name: 'Comment',
    structure: {
        value: String
    },
    parse: function() {
        var start = this.scanner.tokenStart;
        var end = this.scanner.tokenEnd;

        this.eat(COMMENT);

        if ((end - start + 2) >= 2 &&
            this.scanner.source.charCodeAt(end - 2) === ASTERISK &&
            this.scanner.source.charCodeAt(end - 1) === SOLIDUS) {
            end -= 2;
        }

        return {
            type: 'Comment',
            loc: this.getLocation(start, this.scanner.tokenStart),
            value: this.scanner.source.substring(start + 2, end)
        };
    },
    generate: function(node) {
        this.chunk('/*');
        this.chunk(node.value);
        this.chunk('*/');
    }
};

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/Comment.js
disco_app-0.18.2 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.16.1 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.15.2 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.18.4 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.18.1 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.14.0 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/css-tree/lib/syntax/node/Comment.js
jester-data-8.0.0 node_modules/css-tree/lib/syntax/node/Comment.js
ezii-os-5.2.1 node_modules/css-tree/lib/syntax/node/Comment.js
ezii-os-2.0.1 node_modules/css-tree/lib/syntax/node/Comment.js
ezii-os-1.1.0 node_modules/css-tree/lib/syntax/node/Comment.js
ezii-os-1.0.0 node_modules/css-tree/lib/syntax/node/Comment.js
ezii-os-0.0.0.1.0 node_modules/css-tree/lib/syntax/node/Comment.js
ezii-os-0.0.0.0.1 node_modules/css-tree/lib/syntax/node/Comment.js