diff -uart boost-orig/spirit/home/qi/auxiliary/eoi.hpp boost/spirit/home/qi/auxiliary/eoi.hpp
old
|
new
|
|
50 | 50 | , Context& /*context*/, Skipper const& skipper |
51 | 51 | , Attribute& /*attr*/) const |
52 | 52 | { |
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; |
55 | 61 | } |
56 | 62 | |
57 | 63 | template <typename Context> |
diff -uart boost-orig/spirit/home/qi/auxiliary/eol.hpp boost/spirit/home/qi/auxiliary/eol.hpp
old
|
new
|
|
50 | 50 | , Context& /*context*/, Skipper const& skipper |
51 | 51 | , Attribute& /*attr*/) const |
52 | 52 | { |
53 | | qi::skip_over(first, last, skipper); |
54 | | |
55 | 53 | Iterator it = first; |
| 54 | |
| 55 | qi::skip_over(it, last, skipper); |
| 56 | |
56 | 57 | bool matched = false; |
57 | 58 | if (it != last && *it == '\r') // CR |
58 | 59 | { |
diff -uart boost-orig/spirit/home/qi/auxiliary/eps.hpp boost/spirit/home/qi/auxiliary/eps.hpp
old
|
new
|
|
89 | 89 | , Context& /*context*/, Skipper const& skipper |
90 | 90 | , Attribute& /*attr*/) const |
91 | 91 | { |
92 | | qi::skip_over(first, last, skipper); |
| 92 | if (predicate) |
| 93 | qi::skip_over(first, last, skipper); |
93 | 94 | return predicate; |
94 | 95 | } |
95 | 96 | |
diff -uart boost-orig/spirit/home/qi/binary/binary.hpp boost/spirit/home/qi/binary/binary.hpp
old
|
new
|
|
243 | 243 | , Context& /*context*/, Skipper const& skipper |
244 | 244 | , Attribute& attr_param) const |
245 | 245 | { |
246 | | qi::skip_over(first, last, skipper); |
| 246 | Iterator it = first; |
| 247 | |
| 248 | qi::skip_over(it, last, skipper); |
247 | 249 | |
248 | 250 | typename attribute<Context, Iterator>::type attr_; |
249 | 251 | unsigned char* bytes = reinterpret_cast<unsigned char*>(&attr_); |
250 | 252 | |
251 | | Iterator it = first; |
252 | 253 | for (unsigned int i = 0; i < sizeof(attr_); ++i) |
253 | 254 | { |
254 | 255 | if (it == last) |
… |
… |
|
289 | 290 | , Context& /*context*/, Skipper const& skipper |
290 | 291 | , Attribute& attr_param) const |
291 | 292 | { |
292 | | qi::skip_over(first, last, skipper); |
| 293 | Iterator it = first; |
| 294 | |
| 295 | qi::skip_over(it, last, skipper); |
293 | 296 | |
294 | 297 | // Even if the endian types are not pod's (at least not in the |
295 | 298 | // definition of C++03) it seems to be safe to assume they are |
… |
… |
|
309 | 312 | |
310 | 313 | unsigned char* bytes = reinterpret_cast<unsigned char*>(&attr_); |
311 | 314 | |
312 | | Iterator it = first; |
313 | 315 | for (unsigned int i = 0; i < sizeof(attr_); ++i) |
314 | 316 | { |
315 | 317 | if (it == last || *bytes++ != static_cast<unsigned char>(*it++)) |
diff -uart boost-orig/spirit/home/qi/char/char_parser.hpp boost/spirit/home/qi/char/char_parser.hpp
old
|
new
|
|
63 | 63 | bool parse(Iterator& first, Iterator const& last |
64 | 64 | , Context& context, Skipper const& skipper, Attribute& attr_) const |
65 | 65 | { |
66 | | qi::skip_over(first, last, skipper); |
| 66 | Iterator it = first; |
| 67 | |
| 68 | qi::skip_over(it, last, skipper); |
67 | 69 | |
68 | | if (first != last && this->derived().test(*first, context)) |
| 70 | if (it != last && this->derived().test(*it, context)) |
69 | 71 | { |
70 | | spirit::traits::assign_to(*first, attr_); |
71 | | ++first; |
| 72 | spirit::traits::assign_to(*it, attr_); |
| 73 | ++it; |
| 74 | first = it; |
72 | 75 | return true; |
73 | 76 | } |
74 | 77 | return false; |
diff -uart boost-orig/spirit/home/qi/directive/lexeme.hpp boost/spirit/home/qi/directive/lexeme.hpp
old
|
new
|
|
61 | 61 | , Context& context, Skipper const& skipper |
62 | 62 | , Attribute& attr_) const |
63 | 63 | { |
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; |
67 | 73 | } |
68 | 74 | template <typename Iterator, typename Context |
69 | 75 | , typename Skipper, typename Attribute> |
diff -uart boost-orig/spirit/home/qi/directive/raw.hpp boost/spirit/home/qi/directive/raw.hpp
old
|
new
|
|
58 | 58 | bool parse(Iterator& first, Iterator const& last |
59 | 59 | , Context& context, Skipper const& skipper, Attribute& attr_) const |
60 | 60 | { |
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)) |
64 | 65 | { |
65 | | spirit::traits::assign_to(first, i, attr_); |
66 | | first = i; |
| 66 | spirit::traits::assign_to(start, it, attr_); |
| 67 | first = it; |
67 | 68 | return true; |
68 | 69 | } |
69 | 70 | return false; |
diff -uart boost-orig/spirit/home/qi/nonterminal/rule.hpp boost/spirit/home/qi/nonterminal/rule.hpp
old
|
new
|
|
277 | 277 | { |
278 | 278 | if (f) |
279 | 279 | { |
| 280 | Iterator it = first; |
280 | 281 | // do a preskip if this is an implied lexeme |
281 | 282 | if (is_same<skipper_type, unused_type>::value) |
282 | | qi::skip_over(first, last, skipper); |
| 283 | qi::skip_over(it, last, skipper); |
283 | 284 | |
284 | 285 | typedef traits::make_attribute<attr_type, Attribute> make_attribute; |
285 | 286 | |
… |
… |
|
301 | 302 | // fourth parameter can't be converted to a required target type |
302 | 303 | // then you are probably trying to use a rule or a grammar with |
303 | 304 | // an incompatible skipper type. |
304 | | if (f(first, last, context, skipper)) |
| 305 | if (f(it, last, context, skipper)) |
305 | 306 | { |
306 | 307 | // do up-stream transformation, this integrates the results |
307 | 308 | // back into the original attribute value, if appropriate |
308 | 309 | traits::post_transform(attr_param, attr_); |
| 310 | first = it; |
309 | 311 | return true; |
310 | 312 | } |
311 | 313 | |
… |
… |
|
323 | 325 | { |
324 | 326 | if (f) |
325 | 327 | { |
| 328 | Iterator it = first; |
326 | 329 | // do a preskip if this is an implied lexeme |
327 | 330 | if (is_same<skipper_type, unused_type>::value) |
328 | | qi::skip_over(first, last, skipper); |
| 331 | qi::skip_over(it, last, skipper); |
329 | 332 | |
330 | 333 | typedef traits::make_attribute<attr_type, Attribute> make_attribute; |
331 | 334 | |
… |
… |
|
347 | 350 | // fourth parameter can't be converted to a required target type |
348 | 351 | // then you are probably trying to use a rule or a grammar with |
349 | 352 | // an incompatible skipper type. |
350 | | if (f(first, last, context, skipper)) |
| 353 | if (f(it, last, context, skipper)) |
351 | 354 | { |
352 | 355 | // do up-stream transformation, this integrates the results |
353 | 356 | // back into the original attribute value, if appropriate |
354 | 357 | traits::post_transform(attr_param, attr_); |
| 358 | first = it; |
355 | 359 | return true; |
356 | 360 | } |
357 | 361 | |
diff -uart boost-orig/spirit/home/qi/numeric/bool.hpp boost/spirit/home/qi/numeric/bool.hpp
old
|
new
|
|
156 | 156 | , Attribute& attr_) const |
157 | 157 | { |
158 | 158 | 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; |
161 | 167 | } |
162 | 168 | |
163 | 169 | template <typename Context> |
… |
… |
|
187 | 193 | , Attribute& attr_) const |
188 | 194 | { |
189 | 195 | 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; |
192 | 204 | } |
193 | 205 | |
194 | 206 | template <typename Context> |
diff -uart boost-orig/spirit/home/qi/numeric/int.hpp boost/spirit/home/qi/numeric/int.hpp
old
|
new
|
|
205 | 205 | , Attribute& attr_) const |
206 | 206 | { |
207 | 207 | 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; |
210 | 216 | } |
211 | 217 | |
212 | 218 | template <typename Context> |
… |
… |
|
243 | 249 | , Attribute& attr_param) const |
244 | 250 | { |
245 | 251 | 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); |
247 | 254 | |
248 | | Iterator save = first; |
249 | 255 | T attr_; |
250 | 256 | |
251 | | if (extract::call(first, last, attr_) && (attr_ == n_)) |
| 257 | if (extract::call(it, last, attr_) && (attr_ == n_)) |
252 | 258 | { |
253 | 259 | traits::assign_to(attr_, attr_param); |
| 260 | first = it; |
254 | 261 | return true; |
255 | 262 | } |
256 | 263 | |
257 | | first = save; |
258 | 264 | return false; |
259 | 265 | } |
260 | 266 | |
diff -uart boost-orig/spirit/home/qi/numeric/real.hpp boost/spirit/home/qi/numeric/real.hpp
old
|
new
|
|
164 | 164 | , T& attr_) const |
165 | 165 | { |
166 | 166 | 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; |
169 | 175 | } |
170 | 176 | |
171 | 177 | template <typename Iterator, typename Context |
… |
… |
|
211 | 217 | , Attribute& attr_param) const |
212 | 218 | { |
213 | 219 | 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); |
215 | 222 | |
216 | | Iterator save = first; |
217 | 223 | T attr_; |
218 | 224 | |
219 | | if (extract::parse(first, last, attr_, RealPolicies()) && |
| 225 | if (extract::parse(it, last, attr_, RealPolicies()) && |
220 | 226 | (attr_ == n_)) |
221 | 227 | { |
222 | 228 | traits::assign_to(attr_, attr_param); |
| 229 | first = it; |
223 | 230 | return true; |
224 | 231 | } |
225 | 232 | |
226 | | first = save; |
227 | 233 | return false; |
228 | 234 | } |
229 | 235 | |
diff -uart boost-orig/spirit/home/qi/numeric/uint.hpp boost/spirit/home/qi/numeric/uint.hpp
old
|
new
|
|
238 | 238 | , Attribute& attr_) const |
239 | 239 | { |
240 | 240 | 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; |
243 | 249 | } |
244 | 250 | |
245 | 251 | template <typename Context> |
… |
… |
|
276 | 282 | , Attribute& attr_param) const |
277 | 283 | { |
278 | 284 | 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); |
280 | 287 | |
281 | | Iterator save = first; |
282 | 288 | T attr_; |
283 | 289 | |
284 | | if (extract::call(first, last, attr_) && (attr_ == n_)) |
| 290 | if (extract::call(it, last, attr_) && (attr_ == n_)) |
285 | 291 | { |
286 | 292 | traits::assign_to(attr_, attr_param); |
| 293 | first = it; |
287 | 294 | return true; |
288 | 295 | } |
289 | 296 | |
290 | | first = save; |
291 | 297 | return false; |
292 | 298 | } |
293 | 299 | |
diff -uart boost-orig/spirit/home/qi/stream/stream.hpp boost/spirit/home/qi/stream/stream.hpp
old
|
new
|
|
62 | 62 | { |
63 | 63 | typedef qi::detail::iterator_source<Iterator> source_device; |
64 | 64 | typedef boost::iostreams::stream<source_device> instream; |
| 65 | |
| 66 | Iterator it = first; |
65 | 67 | |
66 | | qi::skip_over(first, last, skipper); |
| 68 | qi::skip_over(it, last, skipper); |
67 | 69 | |
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>>() |
70 | 72 | |
71 | 73 | // advance the iterator if everything is ok |
72 | 74 | if (in) { |
73 | 75 | if (!in.eof()) { |
74 | 76 | std::streamsize pos = in.tellg(); |
75 | | std::advance(first, pos); |
| 77 | std::advance(it, pos); |
76 | 78 | } else { |
77 | | first = last; |
| 79 | it = last; |
78 | 80 | } |
| 81 | first = it; |
79 | 82 | return true; |
80 | 83 | } |
81 | 84 | |
diff -uart boost-orig/spirit/home/qi/string/lit.hpp boost/spirit/home/qi/string/lit.hpp
old
|
new
|
|
106 | 106 | bool parse(Iterator& first, Iterator const& last |
107 | 107 | , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const |
108 | 108 | { |
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; |
111 | 117 | } |
112 | 118 | |
113 | 119 | template <typename Context> |
… |
… |
|
165 | 171 | bool parse(Iterator& first, Iterator const& last |
166 | 172 | , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const |
167 | 173 | { |
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; |
170 | 182 | } |
171 | 183 | |
172 | 184 | template <typename Context> |
diff -uart boost-orig/spirit/home/qi/string/symbols.hpp boost/spirit/home/qi/string/symbols.hpp
old
|
new
|
|
259 | 259 | bool parse(Iterator& first, Iterator const& last |
260 | 260 | , Context& /*context*/, Skipper const& skipper, Attribute& attr_) const |
261 | 261 | { |
262 | | qi::skip_over(first, last, skipper); |
| 262 | Iterator it = first; |
| 263 | |
| 264 | qi::skip_over(it, last, skipper); |
263 | 265 | |
264 | 266 | if (value_type* val_ptr |
265 | | = lookup->find(first, last, Filter())) |
| 267 | = lookup->find(it, last, Filter())) |
266 | 268 | { |
267 | 269 | spirit::traits::assign_to(*val_ptr, attr_); |
| 270 | first = it; |
268 | 271 | return true; |
269 | 272 | } |
270 | 273 | return false; |
diff -uart boost-orig/spirit/repository/home/qi/directive/distinct.hpp boost/spirit/repository/home/qi/directive/distinct.hpp
old
|
new
|
|
76 | 76 | bool parse(Iterator& first, Iterator const& last |
77 | 77 | , Context& context, Skipper const& skipper, Attribute& attr) const |
78 | 78 | { |
79 | | Iterator iter = first; |
| 79 | Iterator it = first; |
80 | 80 | |
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 |
83 | 83 | , spirit::qi::detail::unused_skipper<Skipper>(skipper), attr)) |
84 | 84 | return false; |
85 | 85 | |
86 | | Iterator i = iter; |
| 86 | Iterator i = it; |
87 | 87 | if (tail.parse(i, last, context, unused, unused)) |
88 | 88 | return false; |
89 | 89 | |
90 | | first = iter; |
| 90 | first = it; |
91 | 91 | return true; |
92 | 92 | } |
93 | 93 | |
diff -uart boost-orig/spirit/repository/home/qi/operator/detail/keywords.hpp boost/spirit/repository/home/qi/operator/detail/keywords.hpp
old
|
new
|
|
98 | 98 | (!is_distinct<ElementType>::value) |
99 | 99 | || skipper.parse(first,last,unused,unused,unused) |
100 | 100 | ){ |
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; |
103 | 109 | } |
104 | 110 | return false; |
105 | 111 | } |
diff -uart boost-orig/spirit/repository/home/qi/operator/keywords.hpp boost/spirit/repository/home/qi/operator/keywords.hpp
old
|
new
|
|
254 | 254 | |
255 | 255 | // We have a bool array 'flags' with one flag for each parser as well as a 'counter' |
256 | 256 | // 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 |
258 | 258 | // as well as the slot of the corresponding parser to true in the flags array as soon |
259 | 259 | // the minimum repetition requirement is met and keeps that value to true as long as |
260 | 260 | // the maximum repetition requirement is met. |
… |
… |
|
264 | 264 | |
265 | 265 | while(true) |
266 | 266 | { |
267 | | |
268 | | spirit::qi::skip_over(first, last, skipper); |
269 | 267 | Iterator save = first; |
| 268 | spirit::qi::skip_over(first, last, skipper); |
270 | 269 | if (string_keywords_inst.parse(first, last,parse_visitor,skipper)) |
271 | 270 | { |
272 | 271 | save = first; |
… |
… |
|
277 | 276 | if(!complex_keywords_inst.parse(complex_function)) |
278 | 277 | { |
279 | 278 | 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 |
281 | 280 | BOOST_FOREACH(bool &valid,flags) |
282 | 281 | { |
283 | 282 | if(!valid) |
… |
… |
|
335 | 334 | |
336 | 335 | // We have a bool array 'flags' with one flag for each parser as well as a 'counter' |
337 | 336 | // 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 |
339 | 338 | // as well as the slot of the corresponding parser to true in the flags array as soon |
340 | 339 | // the minimum repetition requirement is met and keeps that value to true as long as |
341 | 340 | // the maximum repetition requirement is met. |
… |
… |
|
345 | 344 | |
346 | 345 | while(true) |
347 | 346 | { |
348 | | spirit::qi::skip_over(first, last, skipper); |
349 | 347 | Iterator save = first; |
| 348 | spirit::qi::skip_over(first, last, skipper); |
350 | 349 | // String keywords pass |
351 | 350 | if (string_keywords_inst.parse(first,last,parse_visitor,no_case_parse_visitor,skipper)) |
352 | 351 | { |
… |
… |
|
358 | 357 | if(!complex_keywords_inst.parse(complex_function)) |
359 | 358 | { |
360 | 359 | 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 |
362 | 361 | BOOST_FOREACH(bool &valid,flags) |
363 | 362 | { |
364 | 363 | if(!valid) |