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). |
| 95 | if (compile<qi::domain>(subject). |
96 | 96 | parse(first, last, context, skipper, attr_)) |
97 | 97 | { |
98 | | transform::fail(attr); |
99 | | return false; |
| 98 | // do up-stream transformation, this mainly integrates the results |
| 99 | // back into the original attribute value, if appropriate |
| 100 | if (traits::post_transform(attr, attr_)) |
| 101 | return true; |
100 | 102 | } |
101 | 103 | |
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; |
| 104 | transform::fail(attr); |
| 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | 108 | 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
|
|
293 | 293 | { |
294 | 294 | // do up-stream transformation, this integrates the results |
295 | 295 | // back into the original attribute value, if appropriate |
296 | | traits::post_transform(attr, attr_); |
297 | | return true; |
| 296 | if (traits::post_transform(attr, attr_)) |
| 297 | return true; |
298 | 298 | } |
299 | 299 | |
300 | 300 | // inform attribute transformation of failed rhs |
… |
… |
|
339 | 339 | { |
340 | 340 | // do up-stream transformation, this integrates the results |
341 | 341 | // back into the original attribute value, if appropriate |
342 | | traits::post_transform(attr, attr_); |
343 | | return true; |
| 342 | if (traits::post_transform(attr, attr_)) |
| 343 | return true; |
344 | 344 | } |
345 | 345 | |
346 | 346 | // 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
|
|
217 | 217 | { |
218 | 218 | // do up-stream transformation, this integrates the results |
219 | 219 | // back into the original attribute value, if appropriate |
220 | | traits::post_transform(attr, attr_); |
221 | | return true; |
| 220 | if (traits::post_transform(attr, attr_)) |
| 221 | return true; |
222 | 222 | } |
223 | 223 | |
224 | 224 | // inform attribute transformation of failed rhs |
… |
… |
|
271 | 271 | { |
272 | 272 | // do up-stream transformation, this integrates the results |
273 | 273 | // back into the original attribute value, if appropriate |
274 | | traits::post_transform(attr, attr_); |
275 | | return true; |
| 274 | if (traits::post_transform(attr, attr_)) |
| 275 | return true; |
276 | 276 | } |
277 | 277 | |
278 | 278 | // inform attribute transformation of failed rhs |