On 9/24/2010 11:15 AM, Roland Bock wrote:
On 09/24/2010 04:52 PM, Thomas Heller wrote:
you can compute that type information directly in your proto transform:
struct sorted_argument_function: proto::and_ < proto::function
, proto::if_ < grammar_less< proto::_value(proto::_child0(proto::_child1)) , proto::_value(proto::_child0(proto::_child2))>() > > {}; OK, admittedly, that looks a lot nicer, but in case I call something like
fun(b(0), 42));
the error messages are just horrible in both solutions...
The proto::and_ has two branches: proto::function and proto::if_.
The proto::if_ is assuming:
1. That there are at least three child nodes
2. That child1 and child2 themselves have a child
3. That the child nodes of child1 and child2 are terminals
The proto::function has only verified the first of these assumptions.
You need to change it to validate the other two as well:
struct function_argument
: proto::function