[Boost-bugs] [Boost C++ Libraries] #13313: Problem when mixing repeat with epsilon parser

Subject: [Boost-bugs] [Boost C++ Libraries] #13313: Problem when mixing repeat with epsilon parser
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-11-28 02:46:24


#13313: Problem when mixing repeat with epsilon parser
------------------------------+----------------------------
 Reporter: Sebastien Matte | Owner: Joel de Guzman
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost 1.65.0 | Severity: Problem
 Keywords: repeat eps |
------------------------------+----------------------------
 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);
     }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13313>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-11-28 02:52:27 UTC