Boost logo

Boost Users :

Subject: [Boost-users] [proto] Comma Strangeness
From: David Greene (greened_at_[hidden])
Date: 2010-03-26 03:11:09


Well, my little lambda-like experimental language is getting rather large.
I'm really having fun with it and am close to actually doing something
almost useful with it. :)

Unfortunately I've run into a problem I can't seem to isolate to a small
testcase.

I'm doing something like this:

proto::display_expr(
  list [
    obj["name1"].attr["a"],
    obj["name2"].attr["a"],
    obj["name3"].attr["b"]
  ]
);

Presume I have all of the terminals, members, etc. declared/defined
correctly (at least "correctly" as I understand it).

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.

So any ideas as to why commas might be gobbled up prematurely?

                                      -Dave


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