function runTokens(pattern, pos, scope, context) {
        var i = tokens.length,
            result = null,
            match,
            t;
        // Protect against constructing XRegExps within token handler and trigger functions
        isInsideConstructor = true;
        // Must reset `isInsideConstructor`, even if a `trigger` or `handler` throws
        try {
            while (i--) { // Run in reverse order
                t = tokens[i];
                if ((t.scope === "all" || t.scope === scope) && (!t.trigger || t.trigger.call(context))) {
                    t.pattern.lastIndex = pos;
                    match = fixed.exec.call(t.pattern, pattern); // Fixed `exec` here allows use of named backreferences, etc.
                    if (match && match.index === pos) {
                        result = {
                            output: t.handler.call(context, match, scope),
                            match: match
                        };
                        break;
                    }
                }
            }
        } catch (err) {
            throw err;
        } finally {
            isInsideConstructor = false;
        }
        return result;
    }
Runs built-in/custom tokens in reverse insertion order, until a match is found.
@private
@param {String} pattern Original pattern from which an XRegExp object is being built.
@param {Number} pos Position to search for tokens within `pattern`.
@param {Number} scope Current regex scope.
@param {Object} context Context object assigned to token handler functions.
@returns {Object} Object with properties `output` (the substitution string returned by the
  successful token handler) and `match` (the token's match array), or null.