On 7/11/2018 15:08, Michael Powell wrote:
When it matches
id >> *(char_('.') >> id)
this has an attribute of vector>> or something similar.
Where are you getting that from? It makes no sense whatsoever given
the struct full_it_t { std::string val; }, which is similarly mapped,
and ruled, etc.
This might be wrong, but it's how I read the docs:
The output of parsing is a Fusion sequence of the attributes that were
parsed.
So the output of
id >> *(char_('.') >> id)
is something like (but not exactly)
tuple<string>
tuple
tuple
etc
string because that's the output attribute declared for id.
char because you've used char_ instead of using '.' by itself (otherwise
it would just disappear).
And the latter two can be repeated zero or more times because you've used *.
When you assign this to a rule with %=, it tries to best-fit this
against the rule's declared output attribute.
full_id_t contains a single string field, so the Fusion adaptation makes
it equivalent to tuple<string>, and apparently this results in any
additional values being discarded, not in concatenating as you expect.
You can probably use an explicit semantic action to build a single
string instead of using %=.
Or you can make full_id_t contain vector<string> as rmawatson and I
previously suggested, which should give you all the values.
Another possibility, which I can't test because coliru appears to be
grumpy at present, is to try using:
full_id %= as_string[lexeme[id >> *(char_('.') >> id)]];