V2 llvfs merge
This commit is contained in:
@@ -128,6 +128,14 @@ bool LLDirIterator::Impl::next(std::string &fname)
|
||||
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 regex;
|
||||
@@ -142,9 +150,6 @@ std::string glob_to_regex(const std::string& glob)
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '.':
|
||||
regex+="\\.";
|
||||
break;
|
||||
case '*':
|
||||
if (glob.begin() == i)
|
||||
{
|
||||
@@ -177,8 +182,16 @@ std::string glob_to_regex(const std::string& glob)
|
||||
case '!':
|
||||
regex+= square_brace_open ? '^' : c;
|
||||
break;
|
||||
case '.': // This collection have different regex meaning
|
||||
case '^': // and so need escaping.
|
||||
case '(':
|
||||
case ')':
|
||||
case '+':
|
||||
case '|':
|
||||
case '$':
|
||||
regex += '\\';
|
||||
default:
|
||||
regex+=c;
|
||||
regex += c;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user