Re: X3: Using dynamic Repetition Parser Directives
Seth <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 31-01-16 13:24, Mike Gresens wrote:
> I tried the provided solution:
>
> auto r = rule<struct _r, std::string > {}
> %= with<_n>(std::ref(n))
> [ omit[uint_[number] ] >> *(eps [more] >> char_) >>
> eps [done] ];
>
> But the string remains empty.
> And I remember something like: If you use semantic actions then you have to
> do it everywhere.
>
> auto r = rule<struct _r, std::string > {}
> %= with<_n>(std::ref(n))
> [ omit[uint_[number] ] >> *(eps [more] >> char_
> [push] ) >> eps [done] ];
>
> So using an explicit push action does fill the string for me.
Is there a question?
You don't show the relevant code.
Why do you write `eps[done]`?
Lastly, the idiomatic way in X3 is to use the rule template argument:
rule<struct _r, std::string, true>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140