Lexer: Improved ::decomposePattern to extract raw string
This commit is contained in:
@@ -1395,18 +1395,16 @@ bool Lexer::decomposePattern (
|
|||||||
std::string& pattern,
|
std::string& pattern,
|
||||||
std::string& flags)
|
std::string& flags)
|
||||||
{
|
{
|
||||||
std::string parsed_pattern;
|
std::string ignored;
|
||||||
std::string::size_type cursor = 0;
|
std::string::size_type cursor = 0;
|
||||||
if (readWord (text, "/", cursor, parsed_pattern) &&
|
if (readWord (text, "/", cursor, ignored) &&
|
||||||
parsed_pattern.length ())
|
ignored.length ())
|
||||||
{
|
{
|
||||||
std::string parsed_flags = text.substr (cursor);
|
auto parsed_flags = text.substr (cursor);
|
||||||
if (parsed_flags.find ("/") == std::string::npos)
|
if (parsed_flags.find ("/") == std::string::npos)
|
||||||
{
|
{
|
||||||
dequote (parsed_pattern, "/");
|
|
||||||
|
|
||||||
pattern = parsed_pattern;
|
|
||||||
flags = parsed_flags;
|
flags = parsed_flags;
|
||||||
|
pattern = text.substr (1, cursor - 2 - flags.length ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user