From 4f0e32b69b5c1566d7835238b858b8282b6f7ad1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 25 Jul 2015 00:34:18 -0400 Subject: [PATCH] Lexer: Improved ::decomposePattern to extract raw string --- src/Lexer.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 90a439186..5bea2b8a3 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -1395,18 +1395,16 @@ bool Lexer::decomposePattern ( std::string& pattern, std::string& flags) { - std::string parsed_pattern; + std::string ignored; std::string::size_type cursor = 0; - if (readWord (text, "/", cursor, parsed_pattern) && - parsed_pattern.length ()) + if (readWord (text, "/", cursor, ignored) && + ignored.length ()) { - std::string parsed_flags = text.substr (cursor); + auto parsed_flags = text.substr (cursor); if (parsed_flags.find ("/") == std::string::npos) { - dequote (parsed_pattern, "/"); - - pattern = parsed_pattern; flags = parsed_flags; + pattern = text.substr (1, cursor - 2 - flags.length ()); return true; } }