Re: SpiritX3 two strings with attr last

Dainis Polis <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 2016.07.05. 01:55, Joel de Guzman wrote:
> Hmmm, that's not right. Minimal cpp test file please?
>
> Regards,

Yes, in attached main.cpp std out is exactly "string2" (git status  on 
spirit libs - origin/develop ).

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general
main.cpp (text/x-c++src, 569 B)
#include <boost/spirit/home/x3.hpp>
#include <string>
#include <iostream>



int main()
{
 namespace x3 = boost::spirit::x3;
  using x3::space;
   using x3::attr;
   using x3::string;
   std::string str("string1");
   std::string::const_iterator iter = str.begin();
   std::string::const_iterator end = str.end();
   std::string result;
 bool   r = x3::phrase_parse(iter, end, string("string1") >> attr(std::string("string2")), space,result);
    if(r && iter == end)
       std::cout << result << "\n";
    else
      std::cout <<  "parse failed \n";
    return 0;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.