display_expr dumps out an expression without any comma operators.
It just shows a subscript off "list" with one "index," obj["name3"].attr["b"].
It's the behavior I would expect if the operands of the commas were not
protoized expressions, but they _should_ be protoized.
The funny thing is, if I write a small testcase just isolating the terminals,
members, etc. needed to construct the expression, it works as expected.
But in the context of the (much) larger language, it fails. However, the
grammar specification shouldn't have any bearing on what display_expr
dumps out.
I have the following toy program :
#include <iostream>
#include
using namespace std;
namespace proto=boost::proto;
struct list_ {};
struct attr_ {};
struct obj_ {};
template<class E> struct obj_expr;
struct obj_domain
: proto::domain >
{};
template <class E>
struct obj_expr {
BOOST_PROTO_BASIC_EXTENDS(E, obj_expr<E>, obj_domain);
BOOST_PROTO_EXTENDS_SUBSCRIPT();
BOOST_PROTO_EXTENDS_MEMBERS(
((attr_, attr))
)
};
proto::terminal::type list;
obj_expr::type> obj;
int main()
{
proto::display_expr(
list[obj["name1"].attr["a"],
obj["name2"].attr["a"],
obj["name3"].attr["b"]]
);
return 0;
}
and I do see the expression getting printed out correctly as follows.
Do you see something different?
subscript(
terminal(5list_)
, comma(
comma(
subscript(
member(
subscript(
terminal(4obj_)
, terminal(name1)
)
, terminal(5attr_)
)
, terminal(a)
)
, subscript(
member(
subscript(
terminal(4obj_)
, terminal(name2)
)
, terminal(5attr_)
)
, terminal(a)
)
)
, subscript(
member(
subscript(
terminal(4obj_)
, terminal(name3)
)
, terminal(5attr_)
)
, terminal(b)
)
)
)
Manjunath