Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit] Qi lexeme only taking the first word
From: Larry Evans (cppljevans_at_[hidden])
Date: 2018-11-07 07:41:24


On 11/6/18 7:12 PM, rmawatson rmawatson via Boost-users wrote:
> It's been a long while since I've used spirit::qi. But What it looks like is happeneing in your setup is something liek this,
>
> When you have:
>
> qi::rule<It, AST::full_id_t()> full_id;
>
> the attribute is vector<string>
>
> When it matches
>
> id >> *(char_('.') >> id)
>
> this has an attribute of vector<string,vector<tuple<char,std::string>>> or something similar.
[snip]

> One thing you can do is use qi::as<std::string>()[ id >> *(char_('.') >> id) ] to force conversion of synthesised attribute to a string to happen
> before it is assigned to your attribute.
[snip]

rmawatson's as<std::string> suggestion works:

https://coliru.stacked-crooked.com/a/a2c9435ee9e88bad

Yeah rmawatson!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net