dist/index.js
/**
 * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
 * position, until a match is found.
 *
 * @private
 * @param {String} pattern Original pattern from which an XRegExp object is being built.
 * @param {String} flags Flags being used to construct the regex.
 * @param {Number} pos Position to search for tokens within `pattern`.
 * @param {Number} scope Regex scope to apply: 'default' or 'class'.
 * @param {Object} context Context object to use for token handler functions.
 * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`.
 */
Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
position, until a match is found.

@private
@param {String} pattern Original pattern from which an XRegExp object is being built.
@param {String} flags Flags being used to construct the regex.
@param {Number} pos Position to search for tokens within `pattern`.
@param {Number} scope Regex scope to apply: 'default' or 'class'.
@param {Object} context Context object to use for token handler functions.
Runs built - in and custom regex syntax tokens in reverse insertion order at the specified position until a match is found . @private @param { String } pattern Original pattern from which an XRegExp object is being built . @param { String } flags Flags being used to construct the regex . @param { Number } pos Position to search for tokens within ` pattern ` . @param { Number } scope Regex scope to apply : ' default ' or ' class ' . @param { Object } context Context object to use for token handler functions .
function runTokens(pattern, flags, pos, scope, context) {
  var i = tokens.length;
  var leadChar = pattern[pos];
  var result = null;
  var match;
  var t; 
  while (i--) {
    t = tokens[i];
    if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && !(0, _includes["default"])(flags).call(flags, t.flag)) {
      continue;
    }
    match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
    if (match) {
      result = {
        matchLength: match[0].length,
        output: t.handler.call(context, match, scope, flags),
        reparse: t.reparse
      }; 
      break;
    }
  }
  return result;
}
function runTokens ( pattern , flags , pos , scope , context ) { var i = tokens . length ; var leadChar = pattern [ pos ] ; var result = null ; var match ; var t ; while ( i -- ) { t = tokens [ i ] ; if ( t . leadChar && t . leadChar !== leadChar || t . scope !== scope && t . scope !== 'all' || t . flag && ! ( 0 , _includes [ "default" ] ) ( flags ) . call ( flags , t . flag ) ) { continue ; } match = XRegExp . exec ( pattern , t . regex , pos , 'sticky' ) ; if ( match ) { result = { matchLength : match [ 0 ] . length , output : t . handler . call ( context , match , scope , flags ) , reparse : t . reparse } ; break ; } } return result ; }
Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
 position, until a match is found.
Runs built - in and custom regex syntax tokens in reverse insertion order at the specified position until a match is found .
// Run in reverse insertion order // Finished with token tests