x3 bug? It cannot synthesize attribute of type boost::iterator_range in a sequence parser

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

x3 bug? It cannot synthesize attribute of type boost::iterator_range in a sequence parser

wanghan02
In a simple parser test http://coliru.stacked-crooked.com/a/5b3bde9736c9fc43

    std::string str("x123x");
    boost::iterator_range<boost::range_iterator<decltype(str)>::type> attr;
    if( x3::parse( boost::begin(str), boost::end(str), x3::lit('x') >> x3::raw[+x3::digit] >> x3::lit('x'), attr ) ) {
        std::cout<<"Match! attr = "<<attr<<std::endl;
    } else {
        std::cout<<"Not match!"<<std::endl;
    }

The highlighted code is supposed to synthesize an attribute of type boost::iterator_range<Iterator>. But it cannot compile. If we remove either of the two x3::lit('x'), it compiles.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: x3 bug? It cannot synthesize attribute of type boost::iterator_range in a sequence parser

sehe
For info, this is a cross post from this Stackoverflow question, which
doesn't have the formatting issues:

http://stackoverflow.com/q/42955312/85371

On 23-03-17 09:50, wanghan02 wrote:

> In a simple parser test  http://coliru.stacked-crooked.com/a/5b3bde9736c9fc43
> <http://coliru.stacked-crooked.com/a/5b3bde9736c9fc43>  
>
>     std::string str("x123x");
>     boost::iterator_range<boost::range_iterator&lt;decltype(str)>::type>
> attr;
>     if( x3::parse( boost::begin(str), boost::end(str), *x3::lit('x') >>
> x3::raw[+x3::digit] >> x3::lit('x')*, attr ) ) {
>         std::cout<<"Match! attr = "<<attr&lt;&lt;std::endl;
>     } else {
>         std::cout&lt;&lt;&quot;Not match!&quot;&lt;&lt;std::endl;
>     }
>
> The highlighted code is supposed to synthesize an attribute of type
> boost::iterator_range&lt;Iterator>. But it cannot compile. If we remove
> either of the two x3::lit('x'), it compiles.
>
>
>
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/x3-bug-It-cannot-synthesize-attribute-of-type-boost-iterator-range-in-a-sequence-parser-tp4692826.html
> Sent from the spirit-general mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Spirit-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/spirit-general



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Loading...