From 8221ce1b76c6d86926948570e66c9e063a62fb89 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Thu, 14 Mar 2024 14:19:59 +0100 Subject: [PATCH] ffffffff --- cmake/EthDependencies.cmake | 2 +- libyul/AsmParser.cpp | 14 ++++++++------ libyul/CMakeLists.txt | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 7a84a01d9868..2de021065818 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -29,7 +29,7 @@ if (WIN32) option(Boost_USE_STATIC_RUNTIME "Link Boost against static C++ runtime libraries" ON) endif() -set(BOOST_COMPONENTS "filesystem;unit_test_framework;program_options;system") +set(BOOST_COMPONENTS "filesystem;unit_test_framework;program_options;system;regex") if (WIN32) # Boost 1.77 fixes a bug that causes crashes on Windows for some relative paths in --allow-paths. diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index ed98de349c08..94e1c031648f 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -36,6 +36,7 @@ #include #include +#include using namespace solidity; using namespace solidity::util; @@ -276,13 +277,14 @@ std::optional> Parser::parseSrcComme langutil::SourceLocation const& _commentLocation ) { - static std::regex const argsRegex = std::regex( - R"~~(^(-1|\d+):(-1|\d+):(-1|\d+)(?:\s+|$))~~" // index and location, e.g.: 1:234:-1 - R"~~(("(?:[^"\\]|\\.)*"?)?)~~", // optional code snippet, e.g.: "string memory s = \"abc\";..." - std::regex_constants::ECMAScript | std::regex_constants::optimize + static boost::regex const argsRegex( + R"~~(^(-1|\d+):(-1|\d+):(-1|\d+)(?:\s+|$))~~" + R"~~(("(?:[^"\\]|\\.)*"?)?)~~", + boost::regex_constants::ECMAScript | boost::regex_constants::optimize ); - std::match_results match; - if (!regex_search(_arguments.cbegin(), _arguments.cend(), match, argsRegex)) + std::string argumentsString = std::string(_arguments); + boost::match_results match; + if (!boost::regex_search(argumentsString.cbegin(), argumentsString.cend(), match, argsRegex)) { m_errorReporter.syntaxError( 8387_error, diff --git a/libyul/CMakeLists.txt b/libyul/CMakeLists.txt index 811a6239b7f0..716795c7002f 100644 --- a/libyul/CMakeLists.txt +++ b/libyul/CMakeLists.txt @@ -187,4 +187,4 @@ add_library(yul optimiser/VarNameCleaner.h ) -target_link_libraries(yul PUBLIC evmasm solutil langutil smtutil fmt::fmt-header-only) +target_link_libraries(yul PUBLIC Boost::regex evmasm solutil langutil smtutil fmt::fmt-header-only)