|
Boost Users : |
Subject: Re: [Boost-users] [proto] concise error messages
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-01-23 00:35:32
On 1/23/2010 12:45 PM, Eric Niebler wrote:
> template<typename Expr>
> void check_grammar(const Expr&e)
> {
> BOOST_MPL_ASSERT_MSG((proto::matches<Expr, napl_grammar>::value),
> SYNTAX_NOT_CORRECT,
> (void));
> // Dispatch to the correct impl depending on whether we have
> // a valid expression or not.
> check_grammar_impl(e, proto::matches<Expr, napl_grammar>());
> }
>
> That should reduce the noise gcc emits when your users create invalid
> expressions.
Yep. This is essentially what Spirit does. It's not perfect, but
it works.
Regards,
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon
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