Subject: [proto] grammars, domains and subdomains
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2010-12-07 14:37:54
I have been trying to extend a domain by "subdomaining" it. The sole purpose
of this subdomain was to allow another type of terminal expression.
Please see the attached code, which is a very simplified version of what I
was trying to do.
Ok, so let me try to explain what happens with a small table showing what
works, and what not (fixed size font helps here).
expression | compiles? | matches grammar1? | matches grammar2?|
1. t1 | yes | yes | no |
2. t1 + t1 | yes | yes | no |
3. t2 | yes | no | yes |
4. t2 + t2 | no | no | no |
5. t1 + t2 | no | no | no |
So, 1.-3. are working as expected. 4. and 5. obviously doesn't work
(operator+ gets SFINAE'd out because of these rules:
So far so good ... Or not.
Let me remind you that I want to get 4. and 5. compiled, matching grammar2,
but not grammar1.
One attempt would be to change grammar1 to:
Which enables the operator+ for 4. however, the expressio 4. starts to match
both grammars. Not really what I.
Expression 5. still fails, and i could not get it to work.
So, How to handle that correctly?
Let me remind you, that adding double_terminal to grammar1 not an option.
Proto list run by eric at boostpro.com