Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] [ was Re: [spirit2] Trivial parser crashes ]
From: Eric Niebler (eric_at_[hidden])
Date: 2008-11-18 12:05:18


Joel de Guzman wrote:
> I'm not sure how to deal with this. Do you have a hint?
> I place the original test code here. Tracing the code, the
> first %= works as expected while the second and third becomes
> no-ops calling proto operator %=.

I checked and you just need to define an operator%= that takes a
non-const RHS. Patch attached. Karma might need a similar patch.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Index: rule.hpp
===================================================================
--- rule.hpp (revision 49819)
+++ rule.hpp (working copy)
@@ -90,6 +90,23 @@
         }
 
         template <typename Expr>
+ friend rule& operator%=(rule& r, Expr& xpr)
+ {
+ typedef spirit::traits::is_component<qi::domain, Expr> is_component;
+
+ // report invalid expression error as early as possible
+ //~ BOOST_MPL_ASSERT_MSG(
+ //~ is_component::value,
+ //~ xpr_is_not_convertible_to_a_parser, ());
+
+ // temp workaround for mpl problem
+ BOOST_STATIC_ASSERT(is_component::value);
+
+ r.define(xpr, mpl::true_());
+ return r;
+ }
+
+ template <typename Expr>
         friend rule& operator%=(rule& r, Expr const& xpr)
         {
             typedef spirit::traits::is_component<qi::domain, Expr> is_component;


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