Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63086 - trunk/boost/spirit/home/qi/action
From: hartmut.kaiser_at_[hidden]
Date: 2010-06-18 17:49:54


Author: hkaiser
Date: 2010-06-18 17:49:51 EDT (Fri, 18 Jun 2010)
New Revision: 63086
URL: http://svn.boost.org/trac/boost/changeset/63086

Log:
Spirit: fixed backtracking problem if semantic action makes parse fail retrospectively
Text files modified:
   trunk/boost/spirit/home/qi/action/action.hpp | 8 +++++++-
   1 files changed, 7 insertions(+), 1 deletions(-)

Modified: trunk/boost/spirit/home/qi/action/action.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/action/action.hpp (original)
+++ trunk/boost/spirit/home/qi/action/action.hpp 2010-06-18 17:49:51 EDT (Fri, 18 Jun 2010)
@@ -59,11 +59,17 @@
             typename make_attribute::type made_attr = make_attribute::call(attr_);
             typename transform::type attr = transform::pre(made_attr);
 
+ Iterator save = first;
             if (subject.parse(first, last, context, skipper, attr))
             {
                 // call the function, passing the attribute, the context.
                 // The client can return false to fail parsing.
- return traits::action_dispatch<Subject>()(f, attr, context);
+ if (traits::action_dispatch<Subject>()(f, attr, context))
+ return true;
+
+ // reset iterators if semantic action failed the match
+ // retrospectively
+ first = save;
             }
             return false;
         }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk