AsmParser: Require whitespace before tags in location comments

This commit is contained in:
Kamil Śliwak 2021-09-09 18:27:29 +02:00
parent 14396c207c
commit fbdfc6bb7a
2 changed files with 2 additions and 2 deletions

View File

@ -131,7 +131,7 @@ void Parser::fetchSourceLocationFromComment()
return;
static regex const tagRegex = regex(
R"~~(\s*(@[a-zA-Z0-9\-_]+)(?:\s+|$))~~", // tag, e.g: @src
R"~~((?:^|\s+)(@[a-zA-Z0-9\-_]+)(?:\s+|$))~~", // tag, e.g: @src
regex_constants::ECMAScript | regex_constants::optimize
);
static regex const srcTagArgsRegex = regex(

View File

@ -534,7 +534,7 @@ BOOST_AUTO_TEST_CASE(customSourceLocations_invalid_prefix)
EVMDialectTyped const& dialect = EVMDialectTyped::instance(EVMVersion{});
shared_ptr<Block> result = parse(sourceText, dialect, reporter);
BOOST_REQUIRE(!!result && errorList.size() == 0);
CHECK_LOCATION(result->debugData->location, "source0", 111, 222);
CHECK_LOCATION(result->debugData->location, "", -1, -1);
}
BOOST_AUTO_TEST_CASE(customSourceLocations_unspecified)