Skip to content

Commit

Permalink
ffffffff
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlt committed Mar 14, 2024
1 parent 71d41ad commit 8221ce1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/EthDependencies.cmake
Expand Up @@ -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.
Expand Down
14 changes: 8 additions & 6 deletions libyul/AsmParser.cpp
Expand Up @@ -36,6 +36,7 @@

#include <algorithm>
#include <regex>
#include <boost/regex.hpp>

using namespace solidity;
using namespace solidity::util;
Expand Down Expand Up @@ -276,13 +277,14 @@ std::optional<std::pair<std::string_view, SourceLocation>> 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<std::string_view::const_iterator> match;
if (!regex_search(_arguments.cbegin(), _arguments.cend(), match, argsRegex))
std::string argumentsString = std::string(_arguments);
boost::match_results<std::string::const_iterator> match;
if (!boost::regex_search(argumentsString.cbegin(), argumentsString.cend(), match, argsRegex))
{
m_errorReporter.syntaxError(
8387_error,
Expand Down
2 changes: 1 addition & 1 deletion libyul/CMakeLists.txt
Expand Up @@ -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)

0 comments on commit 8221ce1

Please sign in to comment.