Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto]: How to use complex grammars in a domain/extension
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2010-09-21 05:02:17


Mathieu - wrote:

> It bugged me for a while too ... the only fix I can come with is the
> same as yours joel :
>
> struct equation:
> proto::or_
> <
> addition
> ,proto::equal_to<addition, addition>
> > {};
>
> But it's wrong, as in the grammar is right w/o it ... So I figured out
> it's a "bug" in proto?
> Or I'm missing the obvious too...

other "fix" (workaround):

struct equation:
    proto::or_
    <
        proto::terminal<proto::_>,
        proto::equal_to<addition, addition>
>
{};

I think the problem is, that proto's operator enable/disable facilities only
"saw" the equal_to operator, but obviously no terminal type for it's right
and left hand side.
It looks to me as a bug in proto as well. because with my "fix" something
like this:

i == i + i

didn't work anymore.
So, it looks like proto's enable facilities do not look "deep enough" in the
grammar. that is, it somehow misses the template arguments to equal_to.


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