25 assert(!Pattern.empty());
26 assert(!FilePath.empty());
30 if (
const auto C = Pattern.back(); !strchr(
"?*]",
C) &&
C != FilePath.back())
33 constexpr auto Separator =
'/';
34 const auto EOP = Pattern.size();
35 const auto End = FilePath.size();
38 for (
unsigned J = 0; J < End; ++J) {
42 switch (
const auto F = FilePath[J]; Pattern[I]) {
44 if (++I == EOP || F != Pattern[I])
52 while (++I < EOP && Pattern[I] ==
'*') {
54 const auto K = FilePath.find(Separator, J);
55 const bool NoMoreSeparatorsInFilePath = K == StringRef::npos;
57 return NoMoreSeparatorsInFilePath;
59 if (Pattern[I] ==
'\\' && ++I == EOP)
62 if (Pattern[I] == Separator) {
63 if (NoMoreSeparatorsInFilePath)
69 for (
auto Pat = Pattern.substr(I); J < End && FilePath[J] != Separator;
78 if (I + 3 < EOP || (I + 3 == EOP && Pattern[I + 1] !=
'!')) {
80 if (
const auto K = Pattern.find_first_of(
"]/", I + 1);
81 K != StringRef::npos && Pattern[K] ==
']' && K > I + 1) {
86 if (Pattern[I] ==
'!') {
92 if (I + 2 < K && Pattern[I + 1] ==
'-') {
93 Match = Pattern[I] <= F && F <= Pattern[I + 2];
96 Match = F == Pattern[I++];
98 }
while (!Match && I < K);
99 if (Negated ? Match : !Match)
115 while (I < EOP && Pattern[I] ==
'*')
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.