123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- "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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNhZmUtcGFyc2VyLmVzNiJdLCJuYW1lcyI6WyJ0b2tlbml6ZXIiLCJyZXF1aXJlIiwiQ29tbWVudCIsIlBhcnNlciIsIlNhZmVQYXJzZXIiLCJjcmVhdGVUb2tlbml6ZXIiLCJpbnB1dCIsImlnbm9yZUVycm9ycyIsImNvbW1lbnQiLCJ0b2tlbiIsIm5vZGUiLCJpbml0Iiwic291cmNlIiwiZW5kIiwibGluZSIsImNvbHVtbiIsInRleHQiLCJzbGljZSIsInRlc3QiLCJyYXdzIiwibGVmdCIsInJpZ2h0IiwibWF0Y2giLCJkZWNsIiwidG9rZW5zIiwibGVuZ3RoIiwic29tZSIsImkiLCJ1bmNsb3NlZEJyYWNrZXQiLCJ1bmtub3duV29yZCIsInNwYWNlcyIsIm1hcCIsImpvaW4iLCJ1bmV4cGVjdGVkQ2xvc2UiLCJjdXJyZW50IiwiYWZ0ZXIiLCJkb3VibGVDb2xvbiIsInVubmFtZWRBdHJ1bGUiLCJuYW1lIiwicHJlY2hlY2tNaXNzZWRTZW1pY29sb24iLCJjb2xvbiIsInNwbGl0Iiwib3RoZXIiLCJzcGxpY2UiLCJjaGVja01pc3NlZFNlbWljb2xvbiIsImVuZEZpbGUiLCJub2RlcyI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