Re: Parsing of a mapping between keys and values by X3 programming interface
Dan Bloomquist <[email protected]> Sun, 23 Sep 2018 11:01:30 -0700
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
SF Markus Elfring via Spirit-general wrote:
> Hello,
>
> I would like to improve my software development experiences also for the class
> library “Boost.Spirit” once more based on the topic “Parsing a list of key-value
> pairs using Spirit.Qi”.
> https://boost-spirit.com/home/articles/qi-example/parsing-a-list-of-key-value-pairs-using-spirit-qi/
>
> I got into the mood to try something out again with the software version “X3”
> which I can use from “Boost 1.68”.
> I have adjusted one of my previous development attempts based on the example
> “RExpressions - Recursive ASTs!”.
> https://drop.ciere.com/xr-tutorial/boost/libs/spirit/doc/x3/html/spirit_x3/tutorials/rexpr.html
> https://github.com/boostorg/spirit/blob/6846946823ec8822050bc8396b9100cb63c21cf1/example/x3/rexpr/rexpr_min/rexpr.cpp#L9
>
> Unfortunately, I have got understanding difficulties here.
> Now I stumble on the following error message.
>
> /usr/include/boost/spirit/home/x3/support/traits/move_to.hpp:195:9: error: no matching function for call to 'move_to'
> detail::move_to(std::move(src), dest
> ^~~~~~~~~~~~~~~
>
Hi Markus,
It is close. You have a parser for 'structures::settings', but you
don't have one for 'structures::map_type', your current target
attribute. I'm guessing what you really want is to use
'structures::settings' as your attribute. In 'struct extractor', line
38, change your attribute type to 'structures::settings' and fix the
printing stuff in main and it will work.
"no matching function for call to 'move_to'" means no parser to
attribute match has been found.
If you do want to parse into 'map_type', you could:
structures::map_type table;
...
auto pair = bsx::lexeme[(+bsa::alnum)] >> '=' >>
bsx::lexeme[(+bsa::alnum)];
bool r(bsx::phrase_parse(first, last, +pair, bsa::space,
table));
Best, Dan.
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general