Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
minimatch.js1006 linesDownload Raw Back to minimatch
1module.exports = minimatch2minimatch.Minimatch = Minimatch3 4var path = (function () { try { return require('path') } catch (e) {}}()) || {5  sep: '/'6}7minimatch.sep = path.sep8 9var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}10var expand = require('brace-expansion')11 12var plTypes = {13  '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},14  '?': { open: '(?:', close: ')?' },15  '+': { open: '(?:', close: ')+' },16  '*': { open: '(?:', close: ')*' },17  '@': { open: '(?:', close: ')' }18}19 20// any single thing other than /21// don't need to escape / when using new RegExp()22var qmark = '[^/]'23 24// * => any number of characters25var star = qmark + '*?'26 27// ** when dots are allowed.  Anything goes, except .. and .28// not (^ or / followed by one or two dots followed by $ or /),29// followed by anything, any number of times.30var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'31 32// not a ^ or / followed by a dot,33// followed by anything, any number of times.34var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'35 36// characters that need to be escaped in RegExp.37var reSpecials = charSet('().*{}+?[]^$\\!')38 39// "abc" -> { a:true, b:true, c:true }40function charSet (s) {41  return s.split('').reduce(function (set, c) {42    set[c] = true43    return set44  }, {})45}46 47// normalizes slashes.48var slashSplit = /\/+/49 50minimatch.filter = filter51function filter (pattern, options) {52  options = options || {}53  return function (p, i, list) {54    return minimatch(p, pattern, options)55  }56}57 58function ext (a, b) {59  b = b || {}60  var t = {}61  Object.keys(a).forEach(function (k) {62    t[k] = a[k]63  })64  Object.keys(b).forEach(function (k) {65    t[k] = b[k]66  })67  return t68}69 70minimatch.defaults = function (def) {71  if (!def || typeof def !== 'object' || !Object.keys(def).length) {72    return minimatch73  }74 75  var orig = minimatch76 77  var m = function minimatch (p, pattern, options) {78    return orig(p, pattern, ext(def, options))79  }80 81  m.Minimatch = function Minimatch (pattern, options) {82    return new orig.Minimatch(pattern, ext(def, options))83  }84  m.Minimatch.defaults = function defaults (options) {85    return orig.defaults(ext(def, options)).Minimatch86  }87 88  m.filter = function filter (pattern, options) {89    return orig.filter(pattern, ext(def, options))90  }91 92  m.defaults = function defaults (options) {93    return orig.defaults(ext(def, options))94  }95 96  m.makeRe = function makeRe (pattern, options) {97    return orig.makeRe(pattern, ext(def, options))98  }99 100  m.braceExpand = function braceExpand (pattern, options) {101    return orig.braceExpand(pattern, ext(def, options))102  }103 104  m.match = function (list, pattern, options) {105    return orig.match(list, pattern, ext(def, options))106  }107 108  return m109}110 111Minimatch.defaults = function (def) {112  return minimatch.defaults(def).Minimatch113}114 115function minimatch (p, pattern, options) {116  assertValidPattern(pattern)117 118  if (!options) options = {}119 120  // shortcut: comments match nothing.121  if (!options.nocomment && pattern.charAt(0) === '#') {122    return false123  }124 125  return new Minimatch(pattern, options).match(p)126}127 128function Minimatch (pattern, options) {129  if (!(this instanceof Minimatch)) {130    return new Minimatch(pattern, options)131  }132 133  assertValidPattern(pattern)134 135  if (!options) options = {}136 137  pattern = pattern.trim()138 139  // windows support: need to use /, not \140  if (!options.allowWindowsEscape && path.sep !== '/') {141    pattern = pattern.split(path.sep).join('/')142  }143 144  this.options = options145  this.maxGlobstarRecursion = options.maxGlobstarRecursion !== undefined146    ? options.maxGlobstarRecursion : 200147  this.set = []148  this.pattern = pattern149  this.regexp = null150  this.negate = false151  this.comment = false152  this.empty = false153  this.partial = !!options.partial154 155  // make the set of regexps etc.156  this.make()157}158 159Minimatch.prototype.debug = function () {}160 161Minimatch.prototype.make = make162function make () {163  var pattern = this.pattern164  var options = this.options165 166  // empty patterns and comments match nothing.167  if (!options.nocomment && pattern.charAt(0) === '#') {168    this.comment = true169    return170  }171  if (!pattern) {172    this.empty = true173    return174  }175 176  // step 1: figure out negation, etc.177  this.parseNegate()178 179  // step 2: expand braces180  var set = this.globSet = this.braceExpand()181 182  if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }183 184  this.debug(this.pattern, set)185 186  // step 3: now we have a set, so turn each one into a series of path-portion187  // matching patterns.188  // These will be regexps, except in the case of "**", which is189  // set to the GLOBSTAR object for globstar behavior,190  // and will not contain any / characters191  set = this.globParts = set.map(function (s) {192    return s.split(slashSplit)193  })194 195  this.debug(this.pattern, set)196 197  // glob --> regexps198  set = set.map(function (s, si, set) {199    return s.map(this.parse, this)200  }, this)201 202  this.debug(this.pattern, set)203 204  // filter out everything that didn't compile properly.205  set = set.filter(function (s) {206    return s.indexOf(false) === -1207  })208 209  this.debug(this.pattern, set)210 211  this.set = set212}213 214Minimatch.prototype.parseNegate = parseNegate215function parseNegate () {216  var pattern = this.pattern217  var negate = false218  var options = this.options219  var negateOffset = 0220 221  if (options.nonegate) return222 223  for (var i = 0, l = pattern.length224    ; i < l && pattern.charAt(i) === '!'225    ; i++) {226    negate = !negate227    negateOffset++228  }229 230  if (negateOffset) this.pattern = pattern.substr(negateOffset)231  this.negate = negate232}233 234// Brace expansion:235// a{b,c}d -> abd acd236// a{b,}c -> abc ac237// a{0..3}d -> a0d a1d a2d a3d238// a{b,c{d,e}f}g -> abg acdfg acefg239// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg240//241// Invalid sets are not expanded.242// a{2..}b -> a{2..}b243// a{b}c -> a{b}c244minimatch.braceExpand = function (pattern, options) {245  return braceExpand(pattern, options)246}247 248Minimatch.prototype.braceExpand = braceExpand249 250function braceExpand (pattern, options) {251  if (!options) {252    if (this instanceof Minimatch) {253      options = this.options254    } else {255      options = {}256    }257  }258 259  pattern = typeof pattern === 'undefined'260    ? this.pattern : pattern261 262  assertValidPattern(pattern)263 264  // Thanks to Yeting Li <https://github.com/yetingli> for265  // improving this regexp to avoid a ReDOS vulnerability.266  if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {267    // shortcut. no need to expand.268    return [pattern]269  }270 271  return expand(pattern)272}273 274var MAX_PATTERN_LENGTH = 1024 * 64275var assertValidPattern = function (pattern) {276  if (typeof pattern !== 'string') {277    throw new TypeError('invalid pattern')278  }279 280  if (pattern.length > MAX_PATTERN_LENGTH) {281    throw new TypeError('pattern is too long')282  }283}284 285// parse a component of the expanded set.286// At this point, no pattern may contain "/" in it287// so we're going to return a 2d array, where each entry is the full288// pattern, split on '/', and then turned into a regular expression.289// A regexp is made at the end which joins each array with an290// escaped /, and another full one which joins each regexp with |.291//292// Following the lead of Bash 4.1, note that "**" only has special meaning293// when it is the *only* thing in a path portion.  Otherwise, any series294// of * is equivalent to a single *.  Globstar behavior is enabled by295// default, and can be disabled by setting options.noglobstar.296Minimatch.prototype.parse = parse297var SUBPARSE = {}298function parse (pattern, isSub) {299  assertValidPattern(pattern)300 301  var options = this.options302 303  // shortcuts304  if (pattern === '**') {305    if (!options.noglobstar)306      return GLOBSTAR307    else308      pattern = '*'309  }310  if (pattern === '') return ''311 312  var re = ''313  var hasMagic = !!options.nocase314  var escaping = false315  // ? => one single character316  var patternListStack = []317  var negativeLists = []318  var stateChar319  var inClass = false320  var reClassStart = -1321  var classStart = -1322  // . and .. never match anything that doesn't start with .,323  // even when options.dot is set.324  var patternStart = pattern.charAt(0) === '.' ? '' // anything325  // not (start or / followed by . or .. followed by / or end)326  : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'327  : '(?!\\.)'328  var self = this329 330  function clearStateChar () {331    if (stateChar) {332      // we had some state-tracking character333      // that wasn't consumed by this pass.334      switch (stateChar) {335        case '*':336          re += star337          hasMagic = true338        break339        case '?':340          re += qmark341          hasMagic = true342        break343        default:344          re += '\\' + stateChar345        break346      }347      self.debug('clearStateChar %j %j', stateChar, re)348      stateChar = false349    }350  }351 352  for (var i = 0, len = pattern.length, c353    ; (i < len) && (c = pattern.charAt(i))354    ; i++) {355    this.debug('%s\t%s %s %j', pattern, i, re, c)356 357    // skip over any that are escaped.358    if (escaping && reSpecials[c]) {359      re += '\\' + c360      escaping = false361      continue362    }363 364    switch (c) {365      /* istanbul ignore next */366      case '/': {367        // completely not allowed, even escaped.368        // Should already be path-split by now.369        return false370      }371 372      case '\\':373        clearStateChar()374        escaping = true375      continue376 377      // the various stateChar values378      // for the "extglob" stuff.379      case '?':380      case '*':381      case '+':382      case '@':383      case '!':384        this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)385 386        // all of those are literals inside a class, except that387        // the glob [!a] means [^a] in regexp388        if (inClass) {389          this.debug('  in class')390          if (c === '!' && i === classStart + 1) c = '^'391          re += c392          continue393        }394 395        // coalesce consecutive non-globstar * characters396        if (c === '*' && stateChar === '*') continue397 398        // if we already have a stateChar, then it means399        // that there was something like ** or +? in there.400        // Handle the stateChar, then proceed with this one.401        self.debug('call clearStateChar %j', stateChar)402        clearStateChar()403        stateChar = c404        // if extglob is disabled, then +(asdf|foo) isn't a thing.405        // just clear the statechar *now*, rather than even diving into406        // the patternList stuff.407        if (options.noext) clearStateChar()408      continue409 410      case '(':411        if (inClass) {412          re += '('413          continue414        }415 416        if (!stateChar) {417          re += '\\('418          continue419        }420 421        patternListStack.push({422          type: stateChar,423          start: i - 1,424          reStart: re.length,425          open: plTypes[stateChar].open,426          close: plTypes[stateChar].close427        })428        // negation is (?:(?!js)[^/]*)429        re += stateChar === '!' ? '(?:(?!(?:' : '(?:'430        this.debug('plType %j %j', stateChar, re)431        stateChar = false432      continue433 434      case ')':435        if (inClass || !patternListStack.length) {436          re += '\\)'437          continue438        }439 440        clearStateChar()441        hasMagic = true442        var pl = patternListStack.pop()443        // negation is (?:(?!js)[^/]*)444        // The others are (?:<pattern>)<type>445        re += pl.close446        if (pl.type === '!') {447          negativeLists.push(pl)448        }449        pl.reEnd = re.length450      continue451 452      case '|':453        if (inClass || !patternListStack.length || escaping) {454          re += '\\|'455          escaping = false456          continue457        }458 459        clearStateChar()460        re += '|'461      continue462 463      // these are mostly the same in regexp and glob464      case '[':465        // swallow any state-tracking char before the [466        clearStateChar()467 468        if (inClass) {469          re += '\\' + c470          continue471        }472 473        inClass = true474        classStart = i475        reClassStart = re.length476        re += c477      continue478 479      case ']':480        //  a right bracket shall lose its special481        //  meaning and represent itself in482        //  a bracket expression if it occurs483        //  first in the list.  -- POSIX.2 2.8.3.2484        if (i === classStart + 1 || !inClass) {485          re += '\\' + c486          escaping = false487          continue488        }489 490        // handle the case where we left a class open.491        // "[z-a]" is valid, equivalent to "\[z-a\]"492        // split where the last [ was, make sure we don't have493        // an invalid re. if so, re-walk the contents of the494        // would-be class to re-translate any characters that495        // were passed through as-is496        // TODO: It would probably be faster to determine this497        // without a try/catch and a new RegExp, but it's tricky498        // to do safely.  For now, this is safe and works.499        var cs = pattern.substring(classStart + 1, i)500        try {501          RegExp('[' + cs + ']')502        } catch (er) {503          // not a valid class!504          var sp = this.parse(cs, SUBPARSE)505          re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'506          hasMagic = hasMagic || sp[1]507          inClass = false508          continue509        }510 511        // finish up the class.512        hasMagic = true513        inClass = false514        re += c515      continue516 517      default:518        // swallow any state char that wasn't consumed519        clearStateChar()520 521        if (escaping) {522          // no need523          escaping = false524        } else if (reSpecials[c]525          && !(c === '^' && inClass)) {526          re += '\\'527        }528 529        re += c530 531    } // switch532  } // for533 534  // handle the case where we left a class open.535  // "[abc" is valid, equivalent to "\[abc"536  if (inClass) {537    // split where the last [ was, and escape it538    // this is a huge pita.  We now have to re-walk539    // the contents of the would-be class to re-translate540    // any characters that were passed through as-is541    cs = pattern.substr(classStart + 1)542    sp = this.parse(cs, SUBPARSE)543    re = re.substr(0, reClassStart) + '\\[' + sp[0]544    hasMagic = hasMagic || sp[1]545  }546 547  // handle the case where we had a +( thing at the *end*548  // of the pattern.549  // each pattern list stack adds 3 chars, and we need to go through550  // and escape any | chars that were passed through as-is for the regexp.551  // Go through and escape them, taking care not to double-escape any552  // | chars that were already escaped.553  for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {554    var tail = re.slice(pl.reStart + pl.open.length)555    this.debug('setting tail', re, pl)556    // maybe some even number of \, then maybe 1 \, followed by a |557    tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {558      if (!$2) {559        // the | isn't already escaped, so escape it.560        $2 = '\\'561      }562 563      // need to escape all those slashes *again*, without escaping the564      // one that we need for escaping the | character.  As it works out,565      // escaping an even number of slashes can be done by simply repeating566      // it exactly after itself.  That's why this trick works.567      //568      // I am sorry that you have to see this.569      return $1 + $1 + $2 + '|'570    })571 572    this.debug('tail=%j\n   %s', tail, tail, pl, re)573    var t = pl.type === '*' ? star574      : pl.type === '?' ? qmark575      : '\\' + pl.type576 577    hasMagic = true578    re = re.slice(0, pl.reStart) + t + '\\(' + tail579  }580 581  // handle trailing things that only matter at the very end.582  clearStateChar()583  if (escaping) {584    // trailing \\585    re += '\\\\'586  }587 588  // only need to apply the nodot start if the re starts with589  // something that could conceivably capture a dot590  var addPatternStart = false591  switch (re.charAt(0)) {592    case '[': case '.': case '(': addPatternStart = true593  }594 595  // Hack to work around lack of negative lookbehind in JS596  // A pattern like: *.!(x).!(y|z) needs to ensure that a name597  // like 'a.xyz.yz' doesn't match.  So, the first negative598  // lookahead, has to look ALL the way ahead, to the end of599  // the pattern.600  for (var n = negativeLists.length - 1; n > -1; n--) {601    var nl = negativeLists[n]602 603    var nlBefore = re.slice(0, nl.reStart)604    var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)605    var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)606    var nlAfter = re.slice(nl.reEnd)607 608    nlLast += nlAfter609 610    // Handle nested stuff like *(*.js|!(*.json)), where open parens611    // mean that we should *not* include the ) in the bit that is considered612    // "after" the negated section.613    var openParensBefore = nlBefore.split('(').length - 1614    var cleanAfter = nlAfter615    for (i = 0; i < openParensBefore; i++) {616      cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')617    }618    nlAfter = cleanAfter619 620    var dollar = ''621    if (nlAfter === '' && isSub !== SUBPARSE) {622      dollar = '$'623    }624    var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast625    re = newRe626  }627 628  // if the re is not "" at this point, then we need to make sure629  // it doesn't match against an empty path part.630  // Otherwise a/* will match a/, which it should not.631  if (re !== '' && hasMagic) {632    re = '(?=.)' + re633  }634 635  if (addPatternStart) {636    re = patternStart + re637  }638 639  // parsing just a piece of a larger pattern.640  if (isSub === SUBPARSE) {641    return [re, hasMagic]642  }643 644  // skip the regexp for non-magical patterns645  // unescape anything in it, though, so that it'll be646  // an exact match against a file etc.647  if (!hasMagic) {648    return globUnescape(pattern)649  }650 651  var flags = options.nocase ? 'i' : ''652  try {653    var regExp = new RegExp('^' + re + '$', flags)654  } catch (er) /* istanbul ignore next - should be impossible */ {655    // If it was an invalid regular expression, then it can't match656    // anything.  This trick looks for a character after the end of657    // the string, which is of course impossible, except in multi-line658    // mode, but it's not a /m regex.659    return new RegExp('$.')660  }661 662  regExp._glob = pattern663  regExp._src = re664 665  return regExp666}667 668minimatch.makeRe = function (pattern, options) {669  return new Minimatch(pattern, options || {}).makeRe()670}671 672Minimatch.prototype.makeRe = makeRe673function makeRe () {674  if (this.regexp || this.regexp === false) return this.regexp675 676  // at this point, this.set is a 2d array of partial677  // pattern strings, or "**".678  //679  // It's better to use .match().  This function shouldn't680  // be used, really, but it's pretty convenient sometimes,681  // when you just want to work with a regex.682  var set = this.set683 684  if (!set.length) {685    this.regexp = false686    return this.regexp687  }688  var options = this.options689 690  var twoStar = options.noglobstar ? star691    : options.dot ? twoStarDot692    : twoStarNoDot693  var flags = options.nocase ? 'i' : ''694 695  var re = set.map(function (pattern) {696    return pattern.map(function (p) {697      return (p === GLOBSTAR) ? twoStar698      : (typeof p === 'string') ? regExpEscape(p)699      : p._src700    }).join('\\\/')701  }).join('|')702 703  // must match entire pattern704  // ending in a * or ** will make it less strict.705  re = '^(?:' + re + ')$'706 707  // can match anything, as long as it's not this.708  if (this.negate) re = '^(?!' + re + ').*$'709 710  try {711    this.regexp = new RegExp(re, flags)712  } catch (ex) /* istanbul ignore next - should be impossible */ {713    this.regexp = false714  }715  return this.regexp716}717 718minimatch.match = function (list, pattern, options) {719  options = options || {}720  var mm = new Minimatch(pattern, options)721  list = list.filter(function (f) {722    return mm.match(f)723  })724  if (mm.options.nonull && !list.length) {725    list.push(pattern)726  }727  return list728}729 730Minimatch.prototype.match = function match (f, partial) {731  if (typeof partial === 'undefined') partial = this.partial732  this.debug('match', f, this.pattern)733  // short-circuit in the case of busted things.734  // comments, etc.735  if (this.comment) return false736  if (this.empty) return f === ''737 738  if (f === '/' && partial) return true739 740  var options = this.options741 742  // windows: need to use /, not \743  if (path.sep !== '/') {744    f = f.split(path.sep).join('/')745  }746 747  // treat the test path as a set of pathparts.748  f = f.split(slashSplit)749  this.debug(this.pattern, 'split', f)750 751  // just ONE of the pattern sets in this.set needs to match752  // in order for it to be valid.  If negating, then just one753  // match means that we have failed.754  // Either way, return on the first hit.755 756  var set = this.set757  this.debug(this.pattern, 'set', set)758 759  // Find the basename of the path by looking for the last non-empty segment760  var filename761  var i762  for (i = f.length - 1; i >= 0; i--) {763    filename = f[i]764    if (filename) break765  }766 767  for (i = 0; i < set.length; i++) {768    var pattern = set[i]769    var file = f770    if (options.matchBase && pattern.length === 1) {771      file = [filename]772    }773    var hit = this.matchOne(file, pattern, partial)774    if (hit) {775      if (options.flipNegate) return true776      return !this.negate777    }778  }779 780  // didn't get any hits.  this is success if it's a negative781  // pattern, failure otherwise.782  if (options.flipNegate) return false783  return this.negate784}785 786// set partial to true to test if, for example,787// "/a/b" matches the start of "/*/b/*/d"788// Partial means, if you run out of file before you run789// out of pattern, then that's fine, as long as all790// the parts match.791Minimatch.prototype.matchOne = function (file, pattern, partial) {792  if (pattern.indexOf(GLOBSTAR) !== -1) {793    return this._matchGlobstar(file, pattern, partial, 0, 0)794  }795  return this._matchOne(file, pattern, partial, 0, 0)796}797 798Minimatch.prototype._matchGlobstar = function (file, pattern, partial, fileIndex, patternIndex) {799  var i800 801  // find first globstar from patternIndex802  var firstgs = -1803  for (i = patternIndex; i < pattern.length; i++) {804    if (pattern[i] === GLOBSTAR) { firstgs = i; break }805  }806 807  // find last globstar808  var lastgs = -1809  for (i = pattern.length - 1; i >= 0; i--) {810    if (pattern[i] === GLOBSTAR) { lastgs = i; break }811  }812 813  var head = pattern.slice(patternIndex, firstgs)814  var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs)815  var tail = partial ? [] : pattern.slice(lastgs + 1)816 817  // check the head818  if (head.length) {819    var fileHead = file.slice(fileIndex, fileIndex + head.length)820    if (!this._matchOne(fileHead, head, partial, 0, 0)) {821      return false822    }823    fileIndex += head.length824  }825 826  // check the tail827  var fileTailMatch = 0828  if (tail.length) {829    if (tail.length + fileIndex > file.length) return false830 831    var tailStart = file.length - tail.length832    if (this._matchOne(file, tail, partial, tailStart, 0)) {833      fileTailMatch = tail.length834    } else {835      // affordance for stuff like a/**/* matching a/b/836      if (file[file.length - 1] !== '' ||837          fileIndex + tail.length === file.length) {838        return false839      }840      tailStart--841      if (!this._matchOne(file, tail, partial, tailStart, 0)) {842        return false843      }844      fileTailMatch = tail.length + 1845    }846  }847 848  // if body is empty (single ** between head and tail)849  if (!body.length) {850    var sawSome = !!fileTailMatch851    for (i = fileIndex; i < file.length - fileTailMatch; i++) {852      var f = String(file[i])853      sawSome = true854      if (f === '.' || f === '..' ||855          (!this.options.dot && f.charAt(0) === '.')) {856        return false857      }858    }859    return partial || sawSome860  }861 862  // split body into segments at each GLOBSTAR863  var bodySegments = [[[], 0]]864  var currentBody = bodySegments[0]865  var nonGsParts = 0866  var nonGsPartsSums = [0]867  for (var bi = 0; bi < body.length; bi++) {868    var b = body[bi]869    if (b === GLOBSTAR) {870      nonGsPartsSums.push(nonGsParts)871      currentBody = [[], 0]872      bodySegments.push(currentBody)873    } else {874      currentBody[0].push(b)875      nonGsParts++876    }877  }878 879  var idx = bodySegments.length - 1880  var fileLength = file.length - fileTailMatch881  for (var si = 0; si < bodySegments.length; si++) {882    bodySegments[si][1] = fileLength -883      (nonGsPartsSums[idx--] + bodySegments[si][0].length)884  }885 886  return !!this._matchGlobStarBodySections(887    file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch888  )889}890 891// return false for "nope, not matching"892// return null for "not matching, cannot keep trying"893Minimatch.prototype._matchGlobStarBodySections = function (894  file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail895) {896  var bs = bodySegments[bodyIndex]897  if (!bs) {898    // just make sure there are no bad dots899    for (var i = fileIndex; i < file.length; i++) {900      sawTail = true901      var f = file[i]902      if (f === '.' || f === '..' ||903          (!this.options.dot && f.charAt(0) === '.')) {904        return false905      }906    }907    return sawTail908  }909 910  var body = bs[0]911  var after = bs[1]912  while (fileIndex <= after) {913    var m = this._matchOne(914      file.slice(0, fileIndex + body.length),915      body,916      partial,917      fileIndex,918      0919    )920    // if limit exceeded, no match. intentional false negative,921    // acceptable break in correctness for security.922    if (m && globStarDepth < this.maxGlobstarRecursion) {923      var sub = this._matchGlobStarBodySections(924        file, bodySegments,925        fileIndex + body.length, bodyIndex + 1,926        partial, globStarDepth + 1, sawTail927      )928      if (sub !== false) {929        return sub930      }931    }932    var f = file[fileIndex]933    if (f === '.' || f === '..' ||934        (!this.options.dot && f.charAt(0) === '.')) {935      return false936    }937    fileIndex++938  }939  return partial || null940}941 942Minimatch.prototype._matchOne = function (file, pattern, partial, fileIndex, patternIndex) {943  var fi, pi, fl, pl944  for (945    fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length946    ; (fi < fl) && (pi < pl)947    ; fi++, pi++948  ) {949    this.debug('matchOne loop')950    var p = pattern[pi]951    var f = file[fi]952 953    this.debug(pattern, p, f)954 955    // should be impossible.956    // some invalid regexp stuff in the set.957    /* istanbul ignore if */958    if (p === false || p === GLOBSTAR) return false959 960    // something other than **961    // non-magic patterns just have to match exactly962    // patterns with magic have been turned into regexps.963    var hit964    if (typeof p === 'string') {965      hit = f === p966      this.debug('string match', p, f, hit)967    } else {968      hit = f.match(p)969      this.debug('pattern match', p, f, hit)970    }971 972    if (!hit) return false973  }974 975  // now either we fell off the end of the pattern, or we're done.976  if (fi === fl && pi === pl) {977    // ran out of pattern and filename at the same time.978    // an exact hit!979    return true980  } else if (fi === fl) {981    // ran out of file, but still had pattern left.982    // this is ok if we're doing the match as part of983    // a glob fs traversal.984    return partial985  } else /* istanbul ignore else */ if (pi === pl) {986    // ran out of pattern, still have file left.987    // this is only acceptable if we're on the very last988    // empty segment of a file with a trailing slash.989    // a/* should match a/b/990    return (fi === fl - 1) && (file[fi] === '')991  }992 993  // should be unreachable.994  /* istanbul ignore next */995  throw new Error('wtf?')996}997 998// replace stuff like \* with *999function globUnescape (s) {1000  return s.replace(/\\(.)/g, '$1')1001}1002 1003function regExpEscape (s) {1004  return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')1005}1006 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai