File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
cucumber_cpp/library/cucumber_expression Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 99#include < cstdint>
1010#include < cstdlib>
1111#include < format>
12+ #include < iostream>
1213#include < map>
1314#include < optional>
1415#include < regex>
@@ -37,14 +38,24 @@ namespace cucumber_cpp::library::cucumber_expression
3738 {
3839 return { .toStrings = [](const MatchRange& matches) -> cucumber::messages::group
3940 {
40- std::string str = matches[1 ].matched ? matches[1 ].str () : matches[3 ].str ();
41- str = std::regex_replace (str, std::regex (R"__( \\")__" ), " \" " );
42- str = std::regex_replace (str, std::regex (R"__( \\')__" ), " '" );
43- return { .value = str };
41+ return {
42+ .children = {
43+ matches[1 ].matched ? cucumber::messages::group{ .value = matches[1 ].str () } : cucumber::messages::group{},
44+ matches[3 ].matched ? cucumber::messages::group{ .value = matches[3 ].str () } : cucumber::messages::group{},
45+ },
46+ .value = matches[0 ].str (),
47+ };
4448 },
4549 .toAny = [](const cucumber::messages::group& matches) -> std::any
4650 {
47- return matches.value .value ();
51+ std::string str = matches.children .front ().value .has_value ()
52+ ? matches.children .front ().value .value ()
53+ : matches.children .back ().value .value ();
54+
55+ str = std::regex_replace (str, std::regex (R"__( \\")__" ), " \" " );
56+ str = std::regex_replace (str, std::regex (R"__( \\')__" ), " '" );
57+
58+ return str;
4859 } };
4960 }
5061 }
You can’t perform that action at this time.
0 commit comments