From: Roman N. <neu...@si...> - 2010-01-07 23:45:17
|
Hello, I've got a simple Qi grammar that's been all auto-rules until now. Current code is: optionline %= optname >> omit[*blank] >> '=' >> omit[*blank] >> optval ; optname %= bareword; optval %= (qstring | bareword) % +blank >> eol; bareword %= lexeme[+(alnum | char_("-.,_$"))]; qstring %= lexeme['"' > *~char_('"') > '"']; qi::rule<I, std::string()> optname; qi::rule<I, std::vector<std::string>()> optval; qi::rule<I, std::string()> qstring; qi::rule<I, std::string()> bareword; I want to extend the grammar to support continuation lines in optval, where a continuation line is a physical line (outside qstring) with leading whitespace. Tentative code: optval %= ovline >> *(omit[+blank] >> ovline) ; ovline %= ((qstring | bareword) % +blank) >> eol ; qi::rule<I, std::vector<std::string>()> ovline; of course fails to compile, though I'm perplexed by the error: .../boost_1_41_0/boost/spirit/home/support/attributes.hpp:409: error: No match for 'vector<string>::vector(string &)' Is there a way to keep the grammar both simple (as in language) and free of semantic actions? If not, what's the most concise way to flatten the ovlines' vector<string>s into a single vector<string> in optval? -- Roman Neuhauser |