diff -ur spirit.orig/home/qi/auxiliary/attr_cast.hpp spirit/home/qi/auxiliary/attr_cast.hpp
old
|
new
|
|
92 | 92 | |
93 | 93 | typename transform::type attr_ = transform::pre(attr); |
94 | 94 | |
95 | | if (!compile<qi::domain>(subject). |
96 | | parse(first, last, context, skipper, attr_)) |
| 95 | Iterator i = first; |
| 96 | |
| 97 | if (compile<qi::domain>(subject). |
| 98 | parse(i, last, context, skipper, attr_)) |
97 | 99 | { |
98 | | transform::fail(attr); |
99 | | return false; |
| 100 | // do up-stream transformation, this mainly integrates the results |
| 101 | // back into the original attribute value, if appropriate |
| 102 | if (traits::post_transform(attr, attr_)) { |
| 103 | first = i; |
| 104 | return true; |
| 105 | } |
100 | 106 | } |
101 | 107 | |
102 | | // do up-stream transformation, this mainly integrates the results |
103 | | // back into the original attribute value, if appropriate |
104 | | traits::post_transform(attr, attr_); |
105 | | return true; |
| 108 | transform::fail(attr); |
| 109 | return false; |
106 | 110 | } |
107 | 111 | |
108 | 112 | template <typename Context> |
diff -ur spirit.orig/home/qi/detail/attributes.hpp spirit/home/qi/detail/attributes.hpp
old
|
new
|
|
22 | 22 | |
23 | 23 | static Transformed pre(Exposed&) { return Transformed(); } |
24 | 24 | |
25 | | static void post(Exposed& val, Transformed const& attr) |
| 25 | static bool post(Exposed& val, Transformed const& attr) |
26 | 26 | { |
27 | 27 | traits::assign_to(attr, val); |
| 28 | return true; |
28 | 29 | } |
29 | 30 | |
30 | 31 | // fail() will be called by Qi rule's if the rhs failed parsing |
… |
… |
|
37 | 38 | { |
38 | 39 | typedef Attribute& type; |
39 | 40 | static Attribute& pre(Attribute& val) { return val; } |
40 | | static void post(Attribute&, Attribute const&) {} |
| 41 | static bool post(Attribute&, Attribute const&) { return true; } |
41 | 42 | static void fail(Attribute&) {} |
42 | 43 | }; |
43 | 44 | |
… |
… |
|
47 | 48 | typedef Transformed type; |
48 | 49 | |
49 | 50 | static Transformed pre(Exposed& val) { return Transformed(val); } |
50 | | static void post(Exposed&, Transformed const&) { /* no-op */ } |
| 51 | static bool post(Exposed&, Transformed const&) { return true; } |
51 | 52 | |
52 | 53 | // fail() will be called by Qi rule's if the rhs failed parsing |
53 | 54 | static void fail(Exposed&) {} |
… |
… |
|
59 | 60 | { |
60 | 61 | typedef Attribute& type; |
61 | 62 | static Attribute& pre(Attribute& val) { return val; } |
62 | | static void post(Attribute&, Attribute const&) {} |
| 63 | static bool post(Attribute&, Attribute const&) { return true; } |
63 | 64 | static void fail(Attribute&) {} |
64 | 65 | }; |
65 | 66 | |
… |
… |
|
87 | 88 | val = Transformed(); |
88 | 89 | return boost::get<Transformed>(val); |
89 | 90 | } |
90 | | static void post(boost::optional<Exposed>&, Transformed const&) {} |
| 91 | static bool post(boost::optional<Exposed>&, Transformed const&) { return true; } |
91 | 92 | static void fail(boost::optional<Exposed>& val) |
92 | 93 | { |
93 | 94 | val = none_t(); // leave optional uninitialized if rhs failed |
… |
… |
|
100 | 101 | { |
101 | 102 | typedef Attribute& type; |
102 | 103 | static Attribute& pre(Attribute& val) { return val; } |
103 | | static void post(Attribute&, Attribute const&) {} |
| 104 | static bool post(Attribute&, Attribute const&) { return true; } |
104 | 105 | static void fail(Attribute&) {} |
105 | 106 | }; |
106 | 107 | |
… |
… |
|
110 | 111 | { |
111 | 112 | typedef unused_type type; |
112 | 113 | static unused_type pre(unused_type) { return unused; } |
113 | | static void post(unused_type, unused_type) {} |
| 114 | static bool post(unused_type, unused_type) { return true; } |
114 | 115 | static void fail(unused_type) {} |
115 | 116 | }; |
116 | 117 | |
… |
… |
|
160 | 161 | |
161 | 162 | /////////////////////////////////////////////////////////////////////////// |
162 | 163 | template <typename Exposed, typename Transformed> |
163 | | void post_transform(Exposed& dest, Transformed const& attr) |
| 164 | bool post_transform(Exposed& dest, Transformed const& attr) |
164 | 165 | { |
165 | 166 | return transform_attribute<Exposed, Transformed, qi::domain>::post(dest, attr); |
166 | 167 | } |
diff -ur spirit.orig/home/qi/nonterminal/rule.hpp spirit/home/qi/nonterminal/rule.hpp
old
|
new
|
|
285 | 285 | // attributes, without passing values for them. |
286 | 286 | context_type context(attr_); |
287 | 287 | |
| 288 | Iterator i = first; |
| 289 | |
288 | 290 | // If you are seeing a compilation error here stating that the |
289 | 291 | // fourth parameter can't be converted to a required target type |
290 | 292 | // then you are probably trying to use a rule or a grammar with |
291 | 293 | // an incompatible skipper type. |
292 | | if (f(first, last, context, skipper)) |
| 294 | if (f(i, last, context, skipper)) |
293 | 295 | { |
294 | 296 | // do up-stream transformation, this integrates the results |
295 | 297 | // back into the original attribute value, if appropriate |
296 | | traits::post_transform(attr, attr_); |
297 | | return true; |
| 298 | if (traits::post_transform(attr, attr_)) { |
| 299 | first = i; |
| 300 | return true; |
| 301 | } |
298 | 302 | } |
299 | 303 | |
300 | 304 | // inform attribute transformation of failed rhs |
… |
… |
|
331 | 335 | // attributes, passing values of incompatible types for them. |
332 | 336 | context_type context(attr_, params, caller_context); |
333 | 337 | |
| 338 | Iterator i = first; |
| 339 | |
334 | 340 | // If you are seeing a compilation error here stating that the |
335 | 341 | // fourth parameter can't be converted to a required target type |
336 | 342 | // then you are probably trying to use a rule or a grammar with |
337 | 343 | // an incompatible skipper type. |
338 | | if (f(first, last, context, skipper)) |
| 344 | if (f(i, last, context, skipper)) |
339 | 345 | { |
340 | 346 | // do up-stream transformation, this integrates the results |
341 | 347 | // back into the original attribute value, if appropriate |
342 | | traits::post_transform(attr, attr_); |
343 | | return true; |
| 348 | if (traits::post_transform(attr, attr_)) { |
| 349 | first = i; |
| 350 | return true; |
| 351 | } |
344 | 352 | } |
345 | 353 | |
346 | 354 | // inform attribute transformation of failed rhs |
diff -ur spirit.orig/home/support/adapt_adt_attributes.hpp spirit/home/support/adapt_adt_attributes.hpp
old
|
new
|
|
257 | 257 | { |
258 | 258 | return val; |
259 | 259 | } |
260 | | static void |
| 260 | static bool |
261 | 261 | post( |
262 | 262 | fusion::extension::adt_attribute_proxy<T, N, false>& val |
263 | 263 | , Attribute const& attr) |
264 | 264 | { |
265 | 265 | val = attr; |
| 266 | return true; |
266 | 267 | } |
267 | 268 | static void |
268 | 269 | fail(fusion::extension::adt_attribute_proxy<T, N, false>&) |
… |
… |
|
289 | 290 | { |
290 | 291 | return val; |
291 | 292 | } |
292 | | static void |
| 293 | static bool |
293 | 294 | post( |
294 | 295 | fusion::extension::adt_attribute_proxy<T, N, Const>& |
295 | 296 | , Attribute const&) |
296 | 297 | { |
| 298 | return true; |
297 | 299 | } |
298 | 300 | static void |
299 | 301 | fail(fusion::extension::adt_attribute_proxy<T, N, Const>&) |
diff -ur spirit.orig/repository/home/qi/nonterminal/subrule.hpp spirit/repository/home/qi/nonterminal/subrule.hpp
old
|
new
|
|
213 | 213 | // without passing values for them. |
214 | 214 | context_type context(*this, attr_); |
215 | 215 | |
216 | | if (def.binder(first, last, context, skipper)) |
| 216 | Iterator i = first; |
| 217 | |
| 218 | if (def.binder(i, last, context, skipper)) |
217 | 219 | { |
218 | 220 | // do up-stream transformation, this integrates the results |
219 | 221 | // back into the original attribute value, if appropriate |
220 | | traits::post_transform(attr, attr_); |
221 | | return true; |
| 222 | if (traits::post_transform(attr, attr_)) { |
| 223 | first = i; |
| 224 | return true; |
| 225 | } |
222 | 226 | } |
223 | 227 | |
224 | 228 | // inform attribute transformation of failed rhs |
… |
… |
|
267 | 271 | // passing values of incompatible types for them. |
268 | 272 | context_type context(*this, attr_, params, caller_context); |
269 | 273 | |
270 | | if (def.binder(first, last, context, skipper)) |
| 274 | Iterator i = first; |
| 275 | |
| 276 | if (def.binder(i, last, context, skipper)) |
271 | 277 | { |
272 | 278 | // do up-stream transformation, this integrates the results |
273 | 279 | // back into the original attribute value, if appropriate |
274 | | traits::post_transform(attr, attr_); |
275 | | return true; |
| 280 | if (traits::post_transform(attr, attr_)) { |
| 281 | first = i; |
| 282 | return true; |
| 283 | } |
276 | 284 | } |
277 | 285 | |
278 | 286 | // inform attribute transformation of failed rhs |