25 assert(!Pattern.empty());
26 assert(!FilePath.empty());
28 const auto FilePathBack = FilePath.back();
32 if (
const auto C = Pattern.back(); !strchr(
"?*]",
C) &&
C != FilePathBack)
35 constexpr auto Separator =
'/';
36 const auto EOP = Pattern.size();
37 const auto End = FilePath.size();
40 for (
unsigned J = 0; J < End; ++J) {
44 switch (
const auto F = FilePath[J]; Pattern[I]) {
46 if (++I == EOP || F != Pattern[I])
54 bool Globstar = I == 0 || Pattern[I - 1] == Separator;
56 for (; ++I < EOP && Pattern[I] ==
'*'; ++StarCount) {
61 const auto K = FilePath.find(Separator, J);
62 const bool NoMoreSeparatorsInFilePath = K == StringRef::npos;
64 return Globstar || NoMoreSeparatorsInFilePath;
65 if (Pattern[I] != Separator) {
67 if (Pattern[I] ==
'\\' && ++I == EOP)
72 if (Pattern[I] == Separator) {
74 if (NoMoreSeparatorsInFilePath)
80 return FilePathBack == Separator;
83 for (
auto Pat = Pattern.substr(I);
84 J < End && (Globstar || FilePath[J] != Separator); ++J) {
92 if (I + 3 < EOP || (I + 3 == EOP && Pattern[I + 1] !=
'!')) {
94 if (
const auto K = Pattern.find_first_of(
"]/", I + 1);
95 K != StringRef::npos && Pattern[K] ==
']' && K > I + 1) {
100 if (Pattern[I] ==
'!') {
106 if (I + 2 < K && Pattern[I + 1] ==
'-') {
107 Match = Pattern[I] <= F && F <= Pattern[I + 2];
110 Match = F == Pattern[I++];
112 }
while (!Match && I < K);
113 if (Negated ? Match : !Match)
129 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.