Re: Parsing of a mapping between keys and values by X3 programming interface

SF Markus Elfring via Spirit-general <[email protected]> Fri, 28 Sep 2018 09:15:50 +0200
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
> You have a parser for 'structures::settings',

This detail seems to be clear.


> but you don't have one for 'structures::map_type', your current target attribute.

I wonder why this could be here according to your interpretation
of my source code example.


> I'm guessing what you  really want is to use 'structures::settings' as your attribute.

I would prefer to get the shown class member “mapping” (which was passed to
the macro “BOOST_FUSION_ADAPT_STRUCT”) as an attribute for this parsing approach.


> In 'struct extractor', line 38, change your attribute type to 'structures::settings'
> and fix the printing stuff in main and it will work.

These source code places are working as expected.


> "no matching function for call to 'move_to'" means no parser to attribute match has been found.

Thanks for such an explanation.


> If you do want to parse into 'map_type', you could:
…
>             auto pair = bsx::lexeme[(+bsa::alnum)] >> '=' >> bsx::lexeme[(+bsa::alnum)];
>             bool r(bsx::phrase_parse(first, last, +pair, bsa::space, table));

Why should I introduce such a variable when the example “RExpressions - Recursive ASTs!”
can work already without it?
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

Do I eventually need a temporary workaround?

Regards,
Markus


_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general