Opened 5 years ago
Last modified 5 years ago
#13313 new Bugs
Problem when mixing repeat with epsilon parser
Reported by: | Sebastien Matte | Owned by: | Joel de Guzman |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.65.0 | Severity: | Problem |
Keywords: | repeat eps | Cc: |
Description
Mixing lazy repeats with epsilon parser (with action) is not working as expected. The attributes are not synthesized as expected. The following example fails:
std::string s; size_t c = 0; BOOST_TEST(test_attr("aaaaaaaa", repeat(val(8))[char_ >> eps[ref(c)++]], s) && s == "aaaaaaaa" && c == 8);
It failed because s is empty (which I don't think it should)
I have made some variation of the same operations (no actions, no lazy operations) and they all works except for this particular case.
See the complete example that I have made from the repeat.cpp test (only the last test fails):
{ using boost::spirit::qi::eps; using boost::phoenix::val; using boost::phoenix::ref; std::string s; size_t c = 0; s.clear(); BOOST_TEST(test_attr("aaaaaaaa", repeat[char_ >> eps], s) && s == "aaaaaaaa"); s.clear(); BOOST_TEST(test_attr("aaaaaaaa", repeat(8)[char_ >> eps], s) && s == "aaaaaaaa"); s.clear(); BOOST_TEST(test_attr("aaaaaaaa", repeat(val(8))[char_ >> eps], s) && s == "aaaaaaaa"); s.clear(); c = 0; BOOST_TEST(test_attr("aaaaaaaa", repeat[char_ >> eps[ref(c)++]], s) && s == "aaaaaaaa" && c == 8); s.clear(); c = 0; BOOST_TEST(test_attr("aaaaaaaa", repeat(8)[char_ >> eps[ref(c)++]], s) && s == "aaaaaaaa" && c == 8); s.clear(); c = 0; BOOST_TEST(test_attr("aaaaaaaa", repeat(val(8))[char_ >> eps[ref(c)++]], s) && s == "aaaaaaaa" && c == 8); }
Attachments (1)
Change History (2)
by , 5 years ago
Attachment: | repeat.cpp added |
---|
comment:1 by , 5 years ago
It looks like http://boost.2283326.n4.nabble.com/Auto-attributes-propagation-in-directives-with-lazy-arguments-td4672231.html problem. Do you agree?
Modified repeat.cpp test with the included problem