(glob, hasMagic, noEmpty = false)
| 987 | }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|"); |
| 988 | } |
| 989 | static #parseGlob(glob, hasMagic, noEmpty = false) { |
| 990 | let escaping = false; |
| 991 | let re = ""; |
| 992 | let uflag = false; |
| 993 | let inStar = false; |
| 994 | for (let i = 0; i < glob.length; i++) { |
| 995 | const c = glob.charAt(i); |
| 996 | if (escaping) { |
| 997 | escaping = false; |
| 998 | re += (reSpecials.has(c) ? "\\" : "") + c; |
| 999 | continue; |
| 1000 | } |
| 1001 | if (c === "*") { |
| 1002 | if (inStar) |
| 1003 | continue; |
| 1004 | inStar = true; |
| 1005 | re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star2; |
| 1006 | hasMagic = true; |
| 1007 | continue; |
| 1008 | } else { |
| 1009 | inStar = false; |
| 1010 | } |
| 1011 | if (c === "\\") { |
| 1012 | if (i === glob.length - 1) { |
| 1013 | re += "\\\\"; |
| 1014 | } else { |
| 1015 | escaping = true; |
| 1016 | } |
| 1017 | continue; |
| 1018 | } |
| 1019 | if (c === "[") { |
| 1020 | const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob, i); |
| 1021 | if (consumed) { |
| 1022 | re += src; |
| 1023 | uflag = uflag || needUflag; |
| 1024 | i += consumed - 1; |
| 1025 | hasMagic = hasMagic || magic; |
| 1026 | continue; |
| 1027 | } |
| 1028 | } |
| 1029 | if (c === "?") { |
| 1030 | re += qmark2; |
| 1031 | hasMagic = true; |
| 1032 | continue; |
| 1033 | } |
| 1034 | re += regExpEscape2(c); |
| 1035 | } |
| 1036 | return [re, (0, unescape_js_12.unescape)(glob), !!hasMagic, uflag]; |
| 1037 | } |
| 1038 | }; |
| 1039 | exports2.AST = AST; |
| 1040 | _a = AST; |
no test coverage detected