/////////////////////////////////////////////////////////////////////////// / / [ ]
| 1461 | //////////////////////////////////////////////////////////////////////////////// |
| 1462 | // / <pattern> / [<flags>] |
| 1463 | bool Lexer::decomposePattern(const std::string& text, std::string& pattern, std::string& flags) { |
| 1464 | std::string ignored; |
| 1465 | std::string::size_type cursor = 0; |
| 1466 | if (readWord(text, "/", cursor, ignored) && ignored.length()) { |
| 1467 | auto parsed_flags = text.substr(cursor); |
| 1468 | if (parsed_flags.find('/') == std::string::npos) { |
| 1469 | flags = parsed_flags; |
| 1470 | pattern = text.substr(1, cursor - 2 - flags.length()); |
| 1471 | return true; |
| 1472 | } |
| 1473 | } |
| 1474 | |
| 1475 | return false; |
| 1476 | } |
| 1477 | |
| 1478 | //////////////////////////////////////////////////////////////////////////////// |