Boost logo

Proto :

Subject: Re: [proto] grammars, domains and subdomains
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2010-12-07 14:43:31


Eric Niebler wrote:

> On 12/7/2010 2:37 PM, Thomas Heller wrote:
>> Hi,
>>
>> I have been trying to extend a domain by "subdomaining" it. The sole
>> purpose of this subdomain was to allow another type of terminal
>> expression.
>>
>> Please see the attached code, which is a very simplified version of what
>> I was trying to do.
> <snip>
>
>> So, How to handle that correctly?
>
> Yup, that's a problem. I don't have an answer for you at the moment,
> sorry.

This is a real bummer ... I need it for the phoenix local variables :(
I might be able to work something out ... The idea is the following:

        template <typename Expr>
        struct grammar_of
        {
            typedef typename proto::domain_of<Expr>::type domain_type;
            typedef typename domain_type::proto_grammar type;
        };

        struct grammar
            : proto::or_<
                  proto::plus<
                       grammar_of<_child_c<0> >()
                     , grammar_of<_child_c<1> >()
>
>
        {};

This looks just insane though ... But looks like what I want ... need to
test this properly ...


Proto list run by eric at boostpro.com