forked from lix-project/lix-website
116 lines
10 KiB
JavaScript
116 lines
10 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
||
|
|
||
|
var tokenizer = require('postcss/lib/tokenize');
|
||
|
|
||
|
var Comment = require('postcss/lib/comment');
|
||
|
|
||
|
var Parser = require('postcss/lib/parser');
|
||
|
|
||
|
var SafeParser =
|
||
|
/*#__PURE__*/
|
||
|
function (_Parser) {
|
||
|
_inheritsLoose(SafeParser, _Parser);
|
||
|
|
||
|
function SafeParser() {
|
||
|
return _Parser.apply(this, arguments) || this;
|
||
|
}
|
||
|
|
||
|
var _proto = SafeParser.prototype;
|
||
|
|
||
|
_proto.createTokenizer = function createTokenizer() {
|
||
|
this.tokenizer = tokenizer(this.input, {
|
||
|
ignoreErrors: true
|
||
|
});
|
||
|
};
|
||
|
|
||
|
_proto.comment = function comment(token) {
|
||
|
var node = new Comment();
|
||
|
this.init(node, token[2], token[3]);
|
||
|
node.source.end = {
|
||
|
line: token[4],
|
||
|
column: token[5]
|
||
|
};
|
||
|
var text = token[1].slice(2);
|
||
|
if (text.slice(-2) === '*/') text = text.slice(0, -2);
|
||
|
|
||
|
if (/^\s*$/.test(text)) {
|
||
|
node.text = '';
|
||
|
node.raws.left = text;
|
||
|
node.raws.right = '';
|
||
|
} else {
|
||
|
var match = text.match(/^(\s*)([^]*\S)(\s*)$/);
|
||
|
node.text = match[2];
|
||
|
node.raws.left = match[1];
|
||
|
node.raws.right = match[3];
|
||
|
}
|
||
|
};
|
||
|
|
||
|
_proto.decl = function decl(tokens) {
|
||
|
if (tokens.length > 1 && tokens.some(function (i) {
|
||
|
return i[0] === 'word';
|
||
|
})) {
|
||
|
_Parser.prototype.decl.call(this, tokens);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
_proto.unclosedBracket = function unclosedBracket() {};
|
||
|
|
||
|
_proto.unknownWord = function unknownWord(tokens) {
|
||
|
this.spaces += tokens.map(function (i) {
|
||
|
return i[1];
|
||
|
}).join('');
|
||
|
};
|
||
|
|
||
|
_proto.unexpectedClose = function unexpectedClose() {
|
||
|
this.current.raws.after += '}';
|
||
|
};
|
||
|
|
||
|
_proto.doubleColon = function doubleColon() {};
|
||
|
|
||
|
_proto.unnamedAtrule = function unnamedAtrule(node) {
|
||
|
node.name = '';
|
||
|
};
|
||
|
|
||
|
_proto.precheckMissedSemicolon = function precheckMissedSemicolon(tokens) {
|
||
|
var colon = this.colon(tokens);
|
||
|
if (colon === false) return;
|
||
|
var split;
|
||
|
|
||
|
for (split = colon - 1; split >= 0; split--) {
|
||
|
if (tokens[split][0] === 'word') break;
|
||
|
}
|
||
|
|
||
|
for (split -= 1; split >= 0; split--) {
|
||
|
if (tokens[split][0] !== 'space') {
|
||
|
split += 1;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var other = tokens.splice(split, tokens.length - split);
|
||
|
this.decl(other);
|
||
|
};
|
||
|
|
||
|
_proto.checkMissedSemicolon = function checkMissedSemicolon() {};
|
||
|
|
||
|
_proto.endFile = function endFile() {
|
||
|
if (this.current.nodes && this.current.nodes.length) {
|
||
|
this.current.raws.semicolon = this.semicolon;
|
||
|
}
|
||
|
|
||
|
this.current.raws.after = (this.current.raws.after || '') + this.spaces;
|
||
|
|
||
|
while (this.current.parent) {
|
||
|
this.current = this.current.parent;
|
||
|
this.current.raws.after = '';
|
||
|
}
|
||
|
};
|
||
|
|
||
|
return SafeParser;
|
||
|
}(Parser);
|
||
|
|
||
|
module.exports = SafeParser;
|
||
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNhZmUtcGFyc2VyLmVzNiJdLCJuYW1lcyI6WyJ0b2tlbml6ZXIiLCJyZXF1aXJlIiwiQ29tbWVudCIsIlBhcnNlciIsIlNhZmVQYXJzZXIiLCJjcmVhdGVUb2tlbml6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