V2 llvfs merge
This commit is contained in:
@@ -128,6 +128,14 @@ bool LLDirIterator::Impl::next(std::string &fname)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts the incoming glob into a regex. This involves
|
||||||
|
converting incoming glob expressions to regex equivilents and
|
||||||
|
at the same time, escaping any regex meaningful characters which
|
||||||
|
do not have glob meaning, i.e.
|
||||||
|
.()+|^$
|
||||||
|
in the input.
|
||||||
|
*/
|
||||||
std::string glob_to_regex(const std::string& glob)
|
std::string glob_to_regex(const std::string& glob)
|
||||||
{
|
{
|
||||||
std::string regex;
|
std::string regex;
|
||||||
@@ -142,9 +150,6 @@ std::string glob_to_regex(const std::string& glob)
|
|||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '.':
|
|
||||||
regex+="\\.";
|
|
||||||
break;
|
|
||||||
case '*':
|
case '*':
|
||||||
if (glob.begin() == i)
|
if (glob.begin() == i)
|
||||||
{
|
{
|
||||||
@@ -177,8 +182,16 @@ std::string glob_to_regex(const std::string& glob)
|
|||||||
case '!':
|
case '!':
|
||||||
regex+= square_brace_open ? '^' : c;
|
regex+= square_brace_open ? '^' : c;
|
||||||
break;
|
break;
|
||||||
|
case '.': // This collection have different regex meaning
|
||||||
|
case '^': // and so need escaping.
|
||||||
|
case '(':
|
||||||
|
case ')':
|
||||||
|
case '+':
|
||||||
|
case '|':
|
||||||
|
case '$':
|
||||||
|
regex += '\\';
|
||||||
default:
|
default:
|
||||||
regex+=c;
|
regex += c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user