Subject: [proto] Externalizing grammar pattern matching
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2010-11-23 10:19:48
Here is some classical pattern matching using proto::or_
This is pretty canonical I guess (unless my proto-fu is rusting).
As stated in the comments, my main concern is that adding new
pattern->value rules need to edit or_<>. Also classical.
For a long time it didn't bothered me until I needed to ship some code
doing this AND wanting to be extended by random contributors to add new
I brainstormed and conjured something like:
(hold your horses on the crappiness of my MPL, it's a quick'n'dirty demo
code trying to get around the fact that mpl::pair, for whatever silly
reason, IS NOT a MPL RandomAccessSequence :| )
So it's slightly better. Now I dont have to touch the or_<>, just the
mpl::vector. Close but no cigare.
After some other hours, I found a way to make a MPL map look-a-like
where the insertion is external:
Alas, i can't find a way to put a decent mpl::iterator over this so both
puzzles pieces fits.
So, question is: is there a way to have an extensible list of
when<pattern,rule> that can be extended "from the outside", something
like a proto::switch_ but with patterns instead of tag ?
My daydream being something akin to :
So, now, I'll be grateful if you can answer this by some "you moron, use
Proto list run by eric at boostpro.com