minimatch
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -12,2 +12,10 @@ module.exports = minimatch | ||
var plTypes = { | ||
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, | ||
'?': { open: '(?:', close: ')?' }, | ||
'+': { open: '(?:', close: ')+' }, | ||
'*': { open: '(?:', close: ')*' }, | ||
'@': { open: '(?:', close: ')' } | ||
} | ||
// any single thing other than / | ||
@@ -281,3 +289,2 @@ // don't need to escape / when using new RegExp() | ||
var negativeLists = [] | ||
var plType | ||
var stateChar | ||
@@ -381,7 +388,8 @@ var inClass = false | ||
plType = stateChar | ||
patternListStack.push({ | ||
type: plType, | ||
type: stateChar, | ||
start: i - 1, | ||
reStart: re.length | ||
reStart: re.length, | ||
open: plTypes[stateChar].open, | ||
close: plTypes[stateChar].close | ||
}) | ||
@@ -402,20 +410,10 @@ // negation is (?:(?!js)[^/]*) | ||
hasMagic = true | ||
re += ')' | ||
var pl = patternListStack.pop() | ||
plType = pl.type | ||
// negation is (?:(?!js)[^/]*) | ||
// The others are (?:<pattern>)<type> | ||
switch (plType) { | ||
case '!': | ||
negativeLists.push(pl) | ||
re += ')[^/]*?)' | ||
pl.reEnd = re.length | ||
break | ||
case '?': | ||
case '+': | ||
case '*': | ||
re += plType | ||
break | ||
case '@': break // the default anyway | ||
re += pl.close | ||
if (pl.type === '!') { | ||
negativeLists.push(pl) | ||
} | ||
pl.reEnd = re.length | ||
continue | ||
@@ -527,3 +525,4 @@ | ||
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { | ||
var tail = re.slice(pl.reStart + 3) | ||
var tail = re.slice(pl.reStart + pl.open.length) | ||
this.debug('setting tail', re, pl) | ||
// maybe some even number of \, then maybe 1 \, followed by a | | ||
@@ -545,3 +544,3 @@ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { | ||
this.debug('tail=%j\n %s', tail, tail) | ||
this.debug('tail=%j\n %s', tail, tail, pl, re) | ||
var t = pl.type === '*' ? star | ||
@@ -548,0 +547,0 @@ : pl.type === '?' ? qmark |
@@ -5,3 +5,3 @@ { | ||
"description": "a glob matcher in javascript", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
33053
780