
Hello,

Playing with spirit-2 (boost 1.36 release) I got the following code to ASSERT when compiled on Visual Studio 2008/SP1.

Any ideas what's wrong?

----------------------------------------------------------

#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/fusion/include/adapt_struct.hpp>

#include <iostream>
#include <string>

using namespace boost::spirit;
using namespace boost::spirit::qi;
using namespace boost::spirit::ascii;
using namespace boost::spirit::arg_names;

namespace phoenix = boost::phoenix;

using phoenix::at_c;

struct key_val
{
    std::string key;
    std::string value; 
};

BOOST_FUSION_ADAPT_STRUCT(
    key_val,
    (std::string, key)
    (std::string, value)
)


template <typename Iterator>
struct my_grammar : grammar<Iterator, key_val(), space_type>
{
    my_grammar() : my_grammar::base_type(start)
    {
        quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
        key %= quoted_string;
        value %= quoted_string;

        start =
                key           [at_c<0>(_val) = _1]
             >> ':'
             >> value         [at_c<1>(_val) = _1]
             ;
    }

    rule<Iterator, std::string(), space_type> key;
    rule<Iterator, std::string(), space_type> quoted_string;
    rule<Iterator, std::string(), space_type> value;

    rule<Iterator, key_val(), space_type> start;

};

int main()
{
    typedef std::string::const_iterator citerator;
    std::string str = "\"x\": \"25\" ";

    citerator iter = str.begin();
    citerator end = str.end();

    my_grammar<citerator> my_parser;
    key_val kv;
    phrase_parse(iter, end, my_parser, kv, space); // ASSERTs

    return 0;
}
--------------------------------------------------------------------------

thanks
<br><hr align="left" width="300">
View this message in context: <a href="http://www.nabble.com/-spirit2--Trivial-parser-crashes-tp19624910p19624910.html">[spirit2] Trivial parser crashes</a><br>
Sent from the <a href="http://www.nabble.com/Boost---Users-f14206.html">Boost - Users mailing list archive</a> at Nabble.com.<br>

