Skip to content

Commit

Permalink
ensure globstar is added to state
Browse files Browse the repository at this point in the history
This might need more review in the future.
  • Loading branch information
jonschlinkert committed Jan 4, 2020
1 parent 2f30902 commit d6828aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const parse = (input, options) => {
braces: 0,
parens: 0,
quotes: 0,
globstar: false,
tokens
};

Expand Down Expand Up @@ -763,6 +764,7 @@ const parse = (input, options) => {
prev.value += value;
prev.output = star;
state.backtrack = true;
state.globstar = true;
consume(value);
continue;
}
Expand Down Expand Up @@ -811,6 +813,7 @@ const parse = (input, options) => {
prev.value += value;
prev.output = globstar(opts);
state.output = prev.output;
state.globstar = true;
consume(value);
continue;
}
Expand All @@ -822,7 +825,7 @@ const parse = (input, options) => {
prev.type = 'globstar';
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
prev.value += value;

state.globstar = true;
state.output += prior.output + prev.output;
consume(value);
continue;
Expand All @@ -839,6 +842,8 @@ const parse = (input, options) => {
prev.value += value;

state.output += prior.output + prev.output;
state.globstar = true;

consume(value + advance());

push({ type: 'slash', value: '/', output: '' });
Expand All @@ -850,6 +855,7 @@ const parse = (input, options) => {
prev.value += value;
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
state.output = prev.output;
state.globstar = true;
consume(value + advance());
push({ type: 'slash', value: '/', output: '' });
continue;
Expand All @@ -865,6 +871,7 @@ const parse = (input, options) => {

// reset output with globstar
state.output += prev.output;
state.globstar = true;
consume(value);
continue;
}
Expand Down

0 comments on commit d6828aa

Please sign in to comment.