Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66167 - trunk/boost/spirit/home/qi/directive
From: hartmut.kaiser_at_[hidden]
Date: 2010-10-24 18:25:38


Author: hkaiser
Date: 2010-10-24 18:25:37 EDT (Sun, 24 Oct 2010)
New Revision: 66167
URL: http://svn.boost.org/trac/boost/changeset/66167

Log:
Spirit: fixing a problem in repeat, which caused the iterator not to be reset on certain parsing failures
Text files modified:
   trunk/boost/spirit/home/qi/directive/repeat.hpp | 24 ++++++++++++++----------
   1 files changed, 14 insertions(+), 10 deletions(-)

Modified: trunk/boost/spirit/home/qi/directive/repeat.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/repeat.hpp (original)
+++ trunk/boost/spirit/home/qi/directive/repeat.hpp 2010-10-24 18:25:37 EDT (Sun, 24 Oct 2010)
@@ -217,23 +217,27 @@
             typename LoopIter::type i = iter.start();
 
             // parse the minimum required
+ Iterator save = first;
             if (!iter.got_min(i) &&
- !parse_minimal(first, last, context, skipper, attr, val, i))
+ !parse_minimal(save, last, context, skipper, attr, val, i))
             {
                 return false;
             }
 
             // parse some more up to the maximum specified
- Iterator save = first;
- for (; !iter.got_max(i); ++i)
- {
- if (!subject.parse(save, last, context, skipper, val) ||
- !traits::push_back(attr, val))
- {
- break;
- }
+ if (!iter.got_max(i)) {
+ do {
+ if (!subject.parse(save, last, context, skipper, val) ||
+ !traits::push_back(attr, val))
+ {
+ break;
+ }
+ first = save;
+ traits::clear(val);
+ } while (!iter.got_max(++i));
+ }
+ else {
                 first = save;
- traits::clear(val);
             }
             return true;
         }


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