
On Sat, Jul 4, 2009 at 1:57 PM, Eric Niebler<eric@boostpro.com> wrote:
Felipe Magno de Almeida wrote:
[snip]
Is this possible?
Not directly. You will have to allow "create << table" in your grammar (possibly by not specifying any grammar when defining your domain, or else by specifying a loose one), and then define a /separate/ grammar that validates fully formed expressions for correctness.
Yes, I found that out. I'm planning in creating a full_grammar, which would only match a full expression. This can be passed as a compile-time assert to the expression evaluation. And I want to create the looser grammar, composed of all sub-expressions inside the full grammar somehow. Is there a way to do this in proto, or should I start creating it with mpl? Is there a way to iterate a grammar?
Presumably somewhere in your code there is a place where these expressions get evaluated. That's the place to ensure that "create << table" is always followed by a string literal. For that, you would use BOOST_MPL_ASSERT and proto::matches.
HTH,
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Thanks, -- Felipe Magno de Almeida