Make this simple and modern:
if (typeof module === "object" && typeof module.exports === "object") module.exports = NAME_1;

NAME_1.defunct = function (chr) {
    throw new Error("Unexpected character at index " + (this.index - 1) + ": " + chr);
};
try {
    NAME_1.engineHasStickySupport = typeof /(?:)/.sticky == 'boolean';
} catch (ignored) {
    NAME_1.engineHasStickySupport = false;
}
try {
    NAME_1.engineHasUnicodeSupport = typeof /(?:)/.unicode == 'boolean';
} catch (ignored) {
    NAME_1.engineHasUnicodeSupport = false;
}

function NAME_1(defunct) {
    if (typeof defunct !== "function") defunct = NAME_1.defunct;

    var tokens = [];
    var rules = [];
    var remove = 0;
    this.state = 0;
    this.index = 0;
    this.input = "";

    this.addRule = function (pattern, action, start) {
        var global = pattern.global;

        if (!global || NAME_1.engineHasStickySupport && !pattern.sticky) {
            var flags = NAME_1.engineHasStickySupport ? "gy" : "g";
            if (pattern.multiline) flags += "m";
            if (pattern.ignoreCase) flags += "i";
            if (NAME_1.engineHasUnicodeSupport && pattern.unicode) flags += "u";
            pattern = new RegExp(pattern.source, flags);
        }

        if (Object.prototype.toString.call(start) !== "[object Array]") start = [0];

        rules.push({
            pattern: pattern,
            global: global,
            action: action,
            start: start
        });

        return this;
    };

    this.setInput = function (input) {
        rem