Aktueller Stand
This commit is contained in:
2
backend/node_modules/zeptomatch/dist/parse/grammar.d.ts
generated
vendored
Normal file
2
backend/node_modules/zeptomatch/dist/parse/grammar.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const Grammar: import("grammex").ExplicitRule<import("../types.js").Node>;
|
||||
export default Grammar;
|
||||
55
backend/node_modules/zeptomatch/dist/parse/grammar.js
generated
vendored
Normal file
55
backend/node_modules/zeptomatch/dist/parse/grammar.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/* IMPORT */
|
||||
import { match, and, lazy, optional, plus, or, star } from 'grammex';
|
||||
import { makeRangeAlpha, makeRangePaddedInt } from '../range.js';
|
||||
import { identity } from '../utils.js';
|
||||
import zeptomatch from '../index.js';
|
||||
import { regex, alternation, sequence, slash } from './utils.js';
|
||||
/* MAIN */
|
||||
const Escaped = match(/\\./, regex);
|
||||
const Escape = match(/[$.*+?^(){}[\]\|]/, char => regex(`\\${char}`));
|
||||
const Slash = match(/[\\\/]/, slash);
|
||||
const Passthrough = match(/[^$.*+?^(){}[\]\|\\\/]+/, regex);
|
||||
const NegationOdd = match(/^(?:!!)*!(.*)$/, (_, glob) => regex(`(?!^${zeptomatch.compile(glob).source}$).*?`));
|
||||
const NegationEven = match(/^(!!)+/);
|
||||
const Negation = or([NegationOdd, NegationEven]);
|
||||
const StarStarBetween = match(/\/(\*\*\/)+/, () => alternation([sequence([slash(), regex('.+?'), slash()]), slash()]));
|
||||
const StarStarStart = match(/^(\*\*\/)+/, () => alternation([regex('^'), sequence([regex('.*?'), slash()])]));
|
||||
const StarStarEnd = match(/\/(\*\*)$/, () => alternation([sequence([slash(), regex('.*?')]), regex('$')]));
|
||||
const StarStarNone = match(/\*\*/, () => regex('.*?'));
|
||||
const StarStar = or([StarStarBetween, StarStarStart, StarStarEnd, StarStarNone]);
|
||||
const StarDouble = match(/\*\/(?!\*\*\/|\*$)/, () => sequence([regex('[^\\\\/]*?'), slash()]));
|
||||
const StarSingle = match(/\*/, () => regex('[^\\\\/]*'));
|
||||
const Star = or([StarDouble, StarSingle]);
|
||||
const Question = match('?', () => regex('[^\\\\/]'));
|
||||
const ClassOpen = match('[', identity);
|
||||
const ClassClose = match(']', identity);
|
||||
const ClassNegation = match(/[!^]/, '^\\\\/');
|
||||
const ClassRange = match(/[a-z]-[a-z]|[0-9]-[0-9]/i, identity);
|
||||
const ClassEscaped = match(/\\./, identity);
|
||||
const ClassEscape = match(/[$.*+?^(){}[\|]/, char => `\\${char}`);
|
||||
const ClassSlash = match(/[\\\/]/, '\\\\/');
|
||||
const ClassPassthrough = match(/[^$.*+?^(){}[\]\|\\\/]+/, identity);
|
||||
const ClassValue = or([ClassEscaped, ClassEscape, ClassSlash, ClassRange, ClassPassthrough]);
|
||||
const Class = and([ClassOpen, optional(ClassNegation), star(ClassValue), ClassClose], _ => regex(_.join('')));
|
||||
const RangeOpen = match('{', '(?:');
|
||||
const RangeClose = match('}', ')');
|
||||
const RangeNumeric = match(/(\d+)\.\.(\d+)/, (_, $1, $2) => makeRangePaddedInt(+$1, +$2, Math.min($1.length, $2.length)).join('|'));
|
||||
const RangeAlphaLower = match(/([a-z]+)\.\.([a-z]+)/, (_, $1, $2) => makeRangeAlpha($1, $2).join('|'));
|
||||
const RangeAlphaUpper = match(/([A-Z]+)\.\.([A-Z]+)/, (_, $1, $2) => makeRangeAlpha($1.toLowerCase(), $2.toLowerCase()).join('|').toUpperCase());
|
||||
const RangeValue = or([RangeNumeric, RangeAlphaLower, RangeAlphaUpper]);
|
||||
const Range = and([RangeOpen, RangeValue, RangeClose], _ => regex(_.join('')));
|
||||
const BracesOpen = match('{');
|
||||
const BracesClose = match('}');
|
||||
const BracesComma = match(',');
|
||||
const BracesEscaped = match(/\\./, regex);
|
||||
const BracesEscape = match(/[$.*+?^(){[\]\|]/, char => regex(`\\${char}`));
|
||||
const BracesSlash = match(/[\\\/]/, slash);
|
||||
const BracesPassthrough = match(/[^$.*+?^(){}[\]\|\\\/,]+/, regex);
|
||||
const BracesNested = lazy(() => Braces);
|
||||
const BracesEmptyValue = match('', () => regex('(?:)'));
|
||||
const BracesFullValue = plus(or([StarStar, Star, Question, Class, Range, BracesNested, BracesEscaped, BracesEscape, BracesSlash, BracesPassthrough]), sequence);
|
||||
const BracesValue = or([BracesFullValue, BracesEmptyValue]);
|
||||
const Braces = and([BracesOpen, optional(and([BracesValue, star(and([BracesComma, BracesValue]))])), BracesClose], alternation);
|
||||
const Grammar = star(or([Negation, StarStar, Star, Question, Class, Range, Braces, Escaped, Escape, Slash, Passthrough]), sequence);
|
||||
/* EXPORT */
|
||||
export default Grammar;
|
||||
3
backend/node_modules/zeptomatch/dist/parse/index.d.ts
generated
vendored
Normal file
3
backend/node_modules/zeptomatch/dist/parse/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Node } from '../types.js';
|
||||
declare const _parse: (glob: string) => Node;
|
||||
export default _parse;
|
||||
9
backend/node_modules/zeptomatch/dist/parse/index.js
generated
vendored
Normal file
9
backend/node_modules/zeptomatch/dist/parse/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/* IMPORT */
|
||||
import { parse } from 'grammex';
|
||||
import Grammar from './grammar.js';
|
||||
/* MAIN */
|
||||
const _parse = (glob) => {
|
||||
return parse(glob, Grammar, { memoization: false })[0];
|
||||
};
|
||||
/* EXPORT */
|
||||
export default _parse;
|
||||
6
backend/node_modules/zeptomatch/dist/parse/utils.d.ts
generated
vendored
Normal file
6
backend/node_modules/zeptomatch/dist/parse/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Node } from '../types.js';
|
||||
declare const regex: (source: string) => Node;
|
||||
declare const alternation: (children: Node[]) => Node;
|
||||
declare const sequence: (nodes: Node[]) => Node;
|
||||
declare const slash: () => Node;
|
||||
export { regex, alternation, sequence, slash };
|
||||
43
backend/node_modules/zeptomatch/dist/parse/utils.js
generated
vendored
Normal file
43
backend/node_modules/zeptomatch/dist/parse/utils.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/* IMPORT */
|
||||
/* MAIN */
|
||||
const regex = (source) => {
|
||||
const regex = new RegExp(source, 's');
|
||||
return { partial: false, regex, children: [] };
|
||||
};
|
||||
const alternation = (children) => {
|
||||
return { children };
|
||||
};
|
||||
const sequence = (() => {
|
||||
const pushToLeaves = (parent, child, handled) => {
|
||||
if (handled.has(parent))
|
||||
return;
|
||||
handled.add(parent);
|
||||
const { children } = parent;
|
||||
if (!children.length) { // Leaf node
|
||||
children.push(child);
|
||||
}
|
||||
else { // Internal node
|
||||
for (let i = 0, l = children.length; i < l; i++) {
|
||||
pushToLeaves(children[i], child, handled);
|
||||
}
|
||||
}
|
||||
};
|
||||
return (nodes) => {
|
||||
if (!nodes.length) { // no-op
|
||||
return alternation([]);
|
||||
}
|
||||
for (let i = nodes.length - 1; i >= 1; i--) {
|
||||
const handled = new Set();
|
||||
const parent = nodes[i - 1];
|
||||
const child = nodes[i];
|
||||
pushToLeaves(parent, child, handled);
|
||||
}
|
||||
return nodes[0];
|
||||
};
|
||||
})();
|
||||
const slash = () => {
|
||||
const regex = new RegExp('[\\\\/]', 's');
|
||||
return { regex, children: [] };
|
||||
};
|
||||
/* EXPORT */
|
||||
export { regex, alternation, sequence, slash };
|
||||
Reference in New Issue
Block a user