{

    name                               = "new"

    sub_name                           = "SUBTITLE"

    values                      = { 1, 2, 3; }

    input_values                = { 1, 2, 3; 

5, 5, 6

10, 12, 3}

    type                         = input 

intval                       = 100

}


Can some one help me to write the parser for the above format?
I am trying something like below and this doesn’t seem to work for me.

template <typename Iterator>

struct keys_and_values

    : qi::grammar<Iterator, mapDef()>

{

    keys_and_values()

        : keys_and_values::base_type(query)

    {

        using namespace qi;

        query =  '{'  >> *lit(' ') >> pair >> *(lit(' ') >> *lit(' ') >> pair) >> *lit(' ') >> '}';

        pair  =  key >> -(*lit(' ') >> "=" >> *lit(' ') >> value);

        key   =  +char_("a-zA-Z0-9_") ;

        value = +char_("a-zA-Z0-9")  |  lexeme[('{' >> +char_("\"@+*.( , ) $ a-zA-Z0-9_ -") >> '}')] | lexeme[('"' >> +char_("\"@+*.( , ) $ a-zA-Z0-9_ -") >> '"')];

    }

    qi::rule<Iterator, mapDef()> query;

    qi::rule<Iterator, std::pair<std::string, std::string>()> pair;

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

};



Any help would be highly appriciated.

Regards,

UJ