Ticket #11824: patch.diff

File patch.diff, 23.6 KB (added by Daniel Starke <daniel.f.starke@…>, 7 years ago)

possible patch for qi (boost 1.59) - untested

  • spirit/home/qi/auxiliary/eoi.hpp

    diff -uart boost-orig/spirit/home/qi/auxiliary/eoi.hpp boost/spirit/home/qi/auxiliary/eoi.hpp
    old new  
    5050          , Context& /*context*/, Skipper const& skipper
    5151          , Attribute& /*attr*/) const
    5252        {
    53             qi::skip_over(first, last, skipper);
    54             return first == last;
     53            Iterator it = first;
     54            qi::skip_over(it, last, skipper);
     55            if (it == last)
     56            {
     57                first = it;
     58                return true;
     59            }
     60            return false;
    5561        }
    5662
    5763        template <typename Context>
  • spirit/home/qi/auxiliary/eol.hpp

    diff -uart boost-orig/spirit/home/qi/auxiliary/eol.hpp boost/spirit/home/qi/auxiliary/eol.hpp
    old new  
    5050          , Context& /*context*/, Skipper const& skipper
    5151          , Attribute& /*attr*/) const
    5252        {
    53             qi::skip_over(first, last, skipper);
    54 
    5553            Iterator it = first;
     54           
     55            qi::skip_over(it, last, skipper);
     56
    5657            bool matched = false;
    5758            if (it != last && *it == '\r')  // CR
    5859            {
  • spirit/home/qi/auxiliary/eps.hpp

    diff -uart boost-orig/spirit/home/qi/auxiliary/eps.hpp boost/spirit/home/qi/auxiliary/eps.hpp
    old new  
    8989          , Context& /*context*/, Skipper const& skipper
    9090          , Attribute& /*attr*/) const
    9191        {
    92             qi::skip_over(first, last, skipper);
     92            if (predicate)
     93                qi::skip_over(first, last, skipper);
    9394            return predicate;
    9495        }
    9596
  • spirit/home/qi/binary/binary.hpp

    diff -uart boost-orig/spirit/home/qi/binary/binary.hpp boost/spirit/home/qi/binary/binary.hpp
    old new  
    243243          , Context& /*context*/, Skipper const& skipper
    244244          , Attribute& attr_param) const
    245245        {
    246             qi::skip_over(first, last, skipper);
     246            Iterator it = first;
     247           
     248            qi::skip_over(it, last, skipper);
    247249
    248250            typename attribute<Context, Iterator>::type attr_;
    249251            unsigned char* bytes = reinterpret_cast<unsigned char*>(&attr_);
    250252
    251             Iterator it = first;
    252253            for (unsigned int i = 0; i < sizeof(attr_); ++i)
    253254            {
    254255                if (it == last)
     
    289290          , Context& /*context*/, Skipper const& skipper
    290291          , Attribute& attr_param) const
    291292        {
    292             qi::skip_over(first, last, skipper);
     293            Iterator it = first;
     294           
     295            qi::skip_over(it, last, skipper);
    293296
    294297            // Even if the endian types are not pod's (at least not in the
    295298            // definition of C++03) it seems to be safe to assume they are
     
    309312
    310313            unsigned char* bytes = reinterpret_cast<unsigned char*>(&attr_);
    311314
    312             Iterator it = first;
    313315            for (unsigned int i = 0; i < sizeof(attr_); ++i)
    314316            {
    315317                if (it == last || *bytes++ != static_cast<unsigned char>(*it++))
  • spirit/home/qi/char/char_parser.hpp

    diff -uart boost-orig/spirit/home/qi/char/char_parser.hpp boost/spirit/home/qi/char/char_parser.hpp
    old new  
    6363        bool parse(Iterator& first, Iterator const& last
    6464          , Context& context, Skipper const& skipper, Attribute& attr_) const
    6565        {
    66             qi::skip_over(first, last, skipper);
     66            Iterator it = first;
     67           
     68            qi::skip_over(it, last, skipper);
    6769
    68             if (first != last && this->derived().test(*first, context))
     70            if (it != last && this->derived().test(*it, context))
    6971            {
    70                 spirit::traits::assign_to(*first, attr_);
    71                 ++first;
     72                spirit::traits::assign_to(*it, attr_);
     73                ++it;
     74                first = it;
    7275                return true;
    7376            }
    7477            return false;
  • spirit/home/qi/directive/lexeme.hpp

    diff -uart boost-orig/spirit/home/qi/directive/lexeme.hpp boost/spirit/home/qi/directive/lexeme.hpp
    old new  
    6161          , Context& context, Skipper const& skipper
    6262          , Attribute& attr_) const
    6363        {
    64             qi::skip_over(first, last, skipper);
    65             return subject.parse(first, last, context
    66               , detail::unused_skipper<Skipper>(skipper), attr_);
     64            Iterator it = first;
     65            qi::skip_over(it, last, skipper);
     66            if (subject.parse(it, last, context
     67              , detail::unused_skipper<Skipper>(skipper), attr_))
     68            {
     69                first = it;
     70                return true;
     71            }
     72            return false;
    6773        }
    6874        template <typename Iterator, typename Context
    6975          , typename Skipper, typename Attribute>
  • spirit/home/qi/directive/raw.hpp

    diff -uart boost-orig/spirit/home/qi/directive/raw.hpp boost/spirit/home/qi/directive/raw.hpp
    old new  
    5858        bool parse(Iterator& first, Iterator const& last
    5959          , Context& context, Skipper const& skipper, Attribute& attr_) const
    6060        {
    61             qi::skip_over(first, last, skipper);
    62             Iterator i = first;
    63             if (subject.parse(i, last, context, skipper, unused))
     61            Iterator it = first;
     62            qi::skip_over(it, last, skipper);
     63            Iterator start = it;
     64            if (subject.parse(it, last, context, skipper, unused))
    6465            {
    65                 spirit::traits::assign_to(first, i, attr_);
    66                 first = i;
     66                spirit::traits::assign_to(start, it, attr_);
     67                first = it;
    6768                return true;
    6869            }
    6970            return false;
  • spirit/home/qi/nonterminal/rule.hpp

    diff -uart boost-orig/spirit/home/qi/nonterminal/rule.hpp boost/spirit/home/qi/nonterminal/rule.hpp
    old new  
    277277        {
    278278            if (f)
    279279            {
     280                Iterator it = first;
    280281                // do a preskip if this is an implied lexeme
    281282                if (is_same<skipper_type, unused_type>::value)
    282                     qi::skip_over(first, last, skipper);
     283                    qi::skip_over(it, last, skipper);
    283284
    284285                typedef traits::make_attribute<attr_type, Attribute> make_attribute;
    285286
     
    301302                // fourth parameter can't be converted to a required target type
    302303                // then you are probably trying to use a rule or a grammar with
    303304                // an incompatible skipper type.
    304                 if (f(first, last, context, skipper))
     305                if (f(it, last, context, skipper))
    305306                {
    306307                    // do up-stream transformation, this integrates the results
    307308                    // back into the original attribute value, if appropriate
    308309                    traits::post_transform(attr_param, attr_);
     310                    first = it;
    309311                    return true;
    310312                }
    311313
     
    323325        {
    324326            if (f)
    325327            {
     328                Iterator it = first;
    326329                // do a preskip if this is an implied lexeme
    327330                if (is_same<skipper_type, unused_type>::value)
    328                     qi::skip_over(first, last, skipper);
     331                    qi::skip_over(it, last, skipper);
    329332
    330333                typedef traits::make_attribute<attr_type, Attribute> make_attribute;
    331334
     
    347350                // fourth parameter can't be converted to a required target type
    348351                // then you are probably trying to use a rule or a grammar with
    349352                // an incompatible skipper type.
    350                 if (f(first, last, context, skipper))
     353                if (f(it, last, context, skipper))
    351354                {
    352355                    // do up-stream transformation, this integrates the results
    353356                    // back into the original attribute value, if appropriate
    354357                    traits::post_transform(attr_param, attr_);
     358                    first = it;
    355359                    return true;
    356360                }
    357361
  • spirit/home/qi/numeric/bool.hpp

    diff -uart boost-orig/spirit/home/qi/numeric/bool.hpp boost/spirit/home/qi/numeric/bool.hpp
    old new  
    156156          , Attribute& attr_) const
    157157        {
    158158            typedef detail::bool_impl<T, BoolPolicies> extract;
    159             qi::skip_over(first, last, skipper);
    160             return extract::parse(first, last, attr_, BoolPolicies());
     159            Iterator it = first;
     160            qi::skip_over(it, last, skipper);
     161            if (extract::parse(it, last, attr_, BoolPolicies()))
     162            {
     163                first = it;
     164                return true;
     165            }
     166            return false;
    161167        }
    162168
    163169        template <typename Context>
     
    187193          , Attribute& attr_) const
    188194        {
    189195            typedef detail::bool_impl<T, BoolPolicies> extract;
    190             qi::skip_over(first, last, skipper);
    191             return extract::parse(first, last, attr_, BoolPolicies(), n_, n_);
     196            Iterator it = first;
     197            qi::skip_over(it, last, skipper);
     198            if (extract::parse(if, last, attr_, BoolPolicies(), n_, n_))
     199            {
     200                first = it;
     201                return true;
     202            }
     203            return false;
    192204        }
    193205
    194206        template <typename Context>
  • spirit/home/qi/numeric/int.hpp

    diff -uart boost-orig/spirit/home/qi/numeric/int.hpp boost/spirit/home/qi/numeric/int.hpp
    old new  
    205205          , Attribute& attr_) const
    206206        {
    207207            typedef extract_int<T, Radix, MinDigits, MaxDigits> extract;
    208             qi::skip_over(first, last, skipper);
    209             return extract::call(first, last, attr_);
     208            Iterator it = first;
     209            qi::skip_over(it, last, skipper);
     210            if (extract::call(it, last, attr_))
     211            {
     212                first = it;
     213                return true;
     214            }
     215            return false;
    210216        }
    211217
    212218        template <typename Context>
     
    243249          , Attribute& attr_param) const
    244250        {
    245251            typedef extract_int<T, Radix, MinDigits, MaxDigits> extract;
    246             qi::skip_over(first, last, skipper);
     252            Iterator it = first;
     253            qi::skip_over(it, last, skipper);
    247254
    248             Iterator save = first;
    249255            T attr_;
    250256
    251             if (extract::call(first, last, attr_) && (attr_ == n_))
     257            if (extract::call(it, last, attr_) && (attr_ == n_))
    252258            {
    253259                traits::assign_to(attr_, attr_param);
     260                first = it;
    254261                return true;
    255262            }
    256263
    257             first = save;
    258264            return false;
    259265        }
    260266
  • spirit/home/qi/numeric/real.hpp

    diff -uart boost-orig/spirit/home/qi/numeric/real.hpp boost/spirit/home/qi/numeric/real.hpp
    old new  
    164164          , T& attr_) const
    165165        {
    166166            typedef detail::real_impl<T, RealPolicies> extract;
    167             qi::skip_over(first, last, skipper);
    168             return extract::parse(first, last, attr_, RealPolicies());
     167            Iterator it = first;
     168            qi::skip_over(it, last, skipper);
     169            if (extract::parse(it, last, attr_, RealPolicies()))
     170            {
     171                first = it;
     172                return true;
     173            }
     174            return false;
    169175        }
    170176
    171177        template <typename Iterator, typename Context
     
    211217          , Attribute& attr_param) const
    212218        {
    213219            typedef detail::real_impl<T, RealPolicies> extract;
    214             qi::skip_over(first, last, skipper);
     220            Iterator it = first;
     221            qi::skip_over(it, last, skipper);
    215222
    216             Iterator save = first;
    217223            T attr_;
    218224
    219             if (extract::parse(first, last, attr_, RealPolicies()) &&
     225            if (extract::parse(it, last, attr_, RealPolicies()) &&
    220226                (attr_ == n_))
    221227            {
    222228                traits::assign_to(attr_, attr_param);
     229                first = it;
    223230                return true;
    224231            }
    225232
    226             first = save;
    227233            return false;
    228234        }
    229235
  • spirit/home/qi/numeric/uint.hpp

    diff -uart boost-orig/spirit/home/qi/numeric/uint.hpp boost/spirit/home/qi/numeric/uint.hpp
    old new  
    238238          , Attribute& attr_) const
    239239        {
    240240            typedef extract_uint<T, Radix, MinDigits, MaxDigits> extract;
    241             qi::skip_over(first, last, skipper);
    242             return extract::call(first, last, attr_);
     241            Iterator it = first;
     242            qi::skip_over(it, last, skipper);
     243            if (extract::call(it, last, attr_))
     244            {
     245                first = it;
     246                return true;
     247            }
     248            return false;
    243249        }
    244250
    245251        template <typename Context>
     
    276282          , Attribute& attr_param) const
    277283        {
    278284            typedef extract_uint<T, Radix, MinDigits, MaxDigits> extract;
    279             qi::skip_over(first, last, skipper);
     285            Iterator it = first;
     286            qi::skip_over(it, last, skipper);
    280287
    281             Iterator save = first;
    282288            T attr_;
    283289
    284             if (extract::call(first, last, attr_) && (attr_ == n_))
     290            if (extract::call(it, last, attr_) && (attr_ == n_))
    285291            {
    286292                traits::assign_to(attr_, attr_param);
     293                first = it;
    287294                return true;
    288295            }
    289296
    290             first = save;
    291297            return false;
    292298        }
    293299
  • spirit/home/qi/stream/stream.hpp

    diff -uart boost-orig/spirit/home/qi/stream/stream.hpp boost/spirit/home/qi/stream/stream.hpp
    old new  
    6262        {
    6363            typedef qi::detail::iterator_source<Iterator> source_device;
    6464            typedef boost::iostreams::stream<source_device> instream;
     65           
     66            Iterator it = first;
    6567
    66             qi::skip_over(first, last, skipper);
     68            qi::skip_over(it, last, skipper);
    6769
    68             instream in(first, last);           // copies 'first'
    69             in >> attr_;                        // use existing operator>>()
     70            instream in(it, last);           // copies 'first'
     71            in >> attr_;                     // use existing operator>>()
    7072
    7173            // advance the iterator if everything is ok
    7274            if (in) {
    7375                if (!in.eof()) {
    7476                    std::streamsize pos = in.tellg();
    75                     std::advance(first, pos);
     77                    std::advance(it, pos);
    7678                } else {
    77                     first = last;
     79                    it = last;
    7880                }
     81                first = it;
    7982                return true;
    8083            }
    8184
  • spirit/home/qi/string/lit.hpp

    diff -uart boost-orig/spirit/home/qi/string/lit.hpp boost/spirit/home/qi/string/lit.hpp
    old new  
    106106        bool parse(Iterator& first, Iterator const& last
    107107          , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const
    108108        {
    109             qi::skip_over(first, last, skipper);
    110             return detail::string_parse(str, first, last, attr_);
     109            Iterator it = first;
     110            qi::skip_over(it, last, skipper);
     111            if (detail::string_parse(str, first, last, attr_))
     112            {
     113                first = it;
     114                return true;
     115            }
     116            return false;
    111117        }
    112118
    113119        template <typename Context>
     
    165171        bool parse(Iterator& first, Iterator const& last
    166172          , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const
    167173        {
    168             qi::skip_over(first, last, skipper);
    169             return detail::string_parse(str_lo, str_hi, first, last, attr_);
     174            Iterator it = first;
     175            qi::skip_over(it, last, skipper);
     176            if (detail::string_parse(str_lo, str_hi, first, last, attr_))
     177            {
     178                first = it;
     179                return true;
     180            }
     181            return false;
    170182        }
    171183
    172184        template <typename Context>
  • spirit/home/qi/string/symbols.hpp

    diff -uart boost-orig/spirit/home/qi/string/symbols.hpp boost/spirit/home/qi/string/symbols.hpp
    old new  
    259259        bool parse(Iterator& first, Iterator const& last
    260260          , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const
    261261        {
    262             qi::skip_over(first, last, skipper);
     262            Iterator it = first;
     263           
     264            qi::skip_over(it, last, skipper);
    263265
    264266            if (value_type* val_ptr
    265                 = lookup->find(first, last, Filter()))
     267                = lookup->find(it, last, Filter()))
    266268            {
    267269                spirit::traits::assign_to(*val_ptr, attr_);
     270                first = it;
    268271                return true;
    269272            }
    270273            return false;
  • spirit/repository/home/qi/directive/distinct.hpp

    diff -uart boost-orig/spirit/repository/home/qi/directive/distinct.hpp boost/spirit/repository/home/qi/directive/distinct.hpp
    old new  
    7676        bool parse(Iterator& first, Iterator const& last
    7777          , Context& context, Skipper const& skipper, Attribute& attr) const
    7878        {
    79             Iterator iter = first;
     79            Iterator it = first;
    8080
    81             spirit::qi::skip_over(iter, last, skipper);
    82             if (!subject.parse(iter, last, context
     81            spirit::qi::skip_over(it, last, skipper);
     82            if (!subject.parse(it, last, context
    8383              , spirit::qi::detail::unused_skipper<Skipper>(skipper), attr))
    8484                return false;
    8585
    86             Iterator i = iter;
     86            Iterator i = it;
    8787            if (tail.parse(i, last, context, unused, unused))
    8888                return false;
    8989
    90             first = iter;
     90            first = it;
    9191            return true;
    9292        }
    9393
  • spirit/repository/home/qi/operator/detail/keywords.hpp

    diff -uart boost-orig/spirit/repository/home/qi/operator/detail/keywords.hpp boost/spirit/repository/home/qi/operator/detail/keywords.hpp
    old new  
    9898                       (!is_distinct<ElementType>::value)
    9999                    || skipper.parse(first,last,unused,unused,unused)
    100100                  ){
    101                       spirit::qi::skip_over(first, last, skipper);
    102                       return call_subject_unused(fusion::at_c<T::value>(elements), first, last, context, skipper, idx );
     101                      Iterator it = first;
     102                      spirit::qi::skip_over(it, last, skipper);
     103                      if (call_subject_unused(fusion::at_c<T::value>(elements), it, last, context, skipper, idx ))
     104                      {
     105                          first = it;
     106                          return true;
     107                      }
     108                      return false;
    103109                    }
    104110                return false;
    105111            }
  • spirit/repository/home/qi/operator/keywords.hpp

    diff -uart boost-orig/spirit/repository/home/qi/operator/keywords.hpp boost/spirit/repository/home/qi/operator/keywords.hpp
    old new  
    254254
    255255            // We have a bool array 'flags' with one flag for each parser as well as a 'counter'
    256256            // array.
    257             // The kwd directive sets and increments the counter when a successeful parse occurred
     257            // The kwd directive sets and increments the counter when a successful parse occurred
    258258            // as well as the slot of the corresponding parser to true in the flags array as soon
    259259            // the minimum repetition requirement is met and keeps that value to true as long as
    260260            // the maximum repetition requirement is met.
     
    264264
    265265            while(true)
    266266            {
    267 
    268                 spirit::qi::skip_over(first, last, skipper);
    269267                Iterator save = first;
     268                spirit::qi::skip_over(first, last, skipper);
    270269                if (string_keywords_inst.parse(first, last,parse_visitor,skipper))
    271270                {
    272271                    save = first;
     
    277276                  if(!complex_keywords_inst.parse(complex_function))
    278277                  {
    279278                    first = save;
    280                     // Check that we are leaving the keywords parser in a successfull state
     279                    // Check that we are leaving the keywords parser in a successful state
    281280                    BOOST_FOREACH(bool &valid,flags)
    282281                    {
    283282                      if(!valid)
     
    335334
    336335            // We have a bool array 'flags' with one flag for each parser as well as a 'counter'
    337336            // array.
    338             // The kwd directive sets and increments the counter when a successeful parse occurred
     337            // The kwd directive sets and increments the counter when a successful parse occurred
    339338            // as well as the slot of the corresponding parser to true in the flags array as soon
    340339            // the minimum repetition requirement is met and keeps that value to true as long as
    341340            // the maximum repetition requirement is met.
     
    345344
    346345            while(true)
    347346            {
    348                 spirit::qi::skip_over(first, last, skipper);
    349347                Iterator save = first;
     348                spirit::qi::skip_over(first, last, skipper);
    350349                // String keywords pass
    351350                if (string_keywords_inst.parse(first,last,parse_visitor,no_case_parse_visitor,skipper))
    352351                {
     
    358357                  if(!complex_keywords_inst.parse(complex_function))
    359358                  {
    360359                    first = save;
    361                     // Check that we are leaving the keywords parser in a successfull state
     360                    // Check that we are leaving the keywords parser in a successful state
    362361                    BOOST_FOREACH(bool &valid,flags)
    363362                    {
    364363                      if(!valid)