X3: How to provide a rule name

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

X3: How to provide a rule name

Mike Gresens
Hi,

the rule:

const auto list_rule = [](const auto& rule)
{
        return x3::lit('V') >> *(rule - x3::lit('z')) >> x3::lit('z');
};

How to provide a rule name for the list_rule?
Needed for expectation failures.

Thanks,
Mike...
Reply | Threaded
Open this post in threaded view
|

Re: X3: How to provide a rule name

sehe
On 30-01-16 13:39, Mike Gresens wrote:
How to provide a rule name for the list_rule?
Needed for expectation failures.
    template<typename Attr = std::string>
    const auto list_rule = [](auto name, const auto& rule)
    {
        return x3::rule<struct _, Attr> {name} = x3::lit('V') >> *(rule - x3::lit('z')) >> x3::lit('z');
    };

This complicates a bit if you wanted to transparently detect `Attr`

------------------------------------------------------------------------------
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
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general