'use strict';

Object.defineProperty(exports, '__esModule', {
    value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var _tokenize = require('./tokenize');

var _tokenize2 = _interopRequireDefault(_tokenize);

var _selectorsRoot = require('./selectors/root');

var _selectorsRoot2 = _interopRequireDefault(_selectorsRoot);

var _parser = require('./parser');

var _parser2 = _interopRequireDefault(_parser);

var Processor = (function () {
    function Processor(func) {
        _classCallCheck(this, Processor);

        this.func = func || function noop() {};
        return this;
    }

    _createClass(Processor, [{
        key: 'process',
        value: function process(selectors) {
            var input = new _parser2['default']({
                css: selectors,
                error: function error(e) {
                    throw new Error(e);
                }
            });
            this.res = input;
            this.func.call(this, input);
            return this;
        }
    }, {
        key: 'result',
        get: function get() {
            return String(this.res);
        }
    }]);

    return Processor;
})();

exports['default'] = Processor;
module.exports = exports['default'];