Boost C++ Libraries: Ticket #6050: Make spirit::transform_attribute::post return bool instead of void https://svn.boost.org/trac10/ticket/6050 <p> Currently, when doing attribute transformations, spirit::qi assumes that if "Transformed" attribute parsing succeedes, then assignment to "Exposed" attribute value will inevitably succeed as well, hence transform_attribute::post return value is not provided nor checked for. </p> <p> However, there are many classes of problems (especially those involving restricted numeric types, such as ranges and strongly typed enums) which can benefit from recoverable parser failures during attribute transformation, if post() was allowed to signal a failure. </p> <p> The proposed patch to spirit::qi is attached. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6050 Trac 1.4.3 oakad@… Mon, 24 Oct 2011 11:09:35 GMT attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spirit-transform-attribute-post-bool.diff</span> </li> </ul> <p> Patch to make attribute_transform::post return bool </p> Ticket oakad@… Tue, 25 Oct 2011 16:19:48 GMT attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spirit-transform-attribute-post-bool-v2.diff</span> </li> </ul> <p> Patch to allow transform_attribute::post to fail the parser; compared to previous version this will set back the input iterator if conversion fails. </p> Ticket oakad@… Tue, 25 Oct 2011 16:20:46 GMT attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_attr.cpp</span> </li> </ul> <p> A short example demonstrating a basic use case for the propoesed change. </p> Ticket oakad@… Tue, 25 Oct 2011 16:24:55 GMT <link>https://svn.boost.org/trac10/ticket/6050#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6050#comment:1</guid> <description> <p> Compared to my initial submission, -v2 version of the patch will hold a copy of the input iterator and won't advance it until it can be sure that attribute conversion succeeded. This is analogous to what as&lt;&gt; directive does. Without this minor quirk the facility is not that useful. :-) </p> <p> I also attached a smallish example which demonstrates the expected functionality. </p> </description> <category>Ticket</category> </item> <item> <author>oakad@…</author> <pubDate>Thu, 27 Oct 2011 16:39:39 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spirit-transform-attribute-post-bool-v3.patch</span> </li> </ul> <p> Added test cases, example and updated documentation </p> Ticket oakad@… Sat, 29 Oct 2011 11:04:46 GMT attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spirit-transform-attribute-post-bool-v4.patch</span> </li> </ul> <p> Backtracking in qi::rule now saves the position before the skipper; support for qi::action new attribute transformation behaviour. </p> Ticket Joel de Guzman Sat, 09 Mar 2013 04:38:21 GMT <link>https://svn.boost.org/trac10/ticket/6050#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6050#comment:2</guid> <description> <p> I tried to apply this patch but there are some parts being rejected. Could you please update the patch? Thanks! </p> </description> <category>Ticket</category> </item> <item> <author>oakad@…</author> <pubDate>Mon, 11 Mar 2013 07:08:19 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spirit-transform-attribute-post-bool-v5.patch</span> </li> </ul> <p> Updated v4 patch to account for some cosmetic differences in the recent qi version + added some examples missing from the v4 patch. </p> Ticket oakad@… Mon, 11 Mar 2013 07:12:25 GMT <link>https://svn.boost.org/trac10/ticket/6050#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6050#comment:3</guid> <description> <p> The only problem I encountered with my patch was slightly shifted line numbers due to some header changes. </p> <p> Unfortunately, I could not retest it as I'm currently traveling abroad. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 16 Mar 2013 06:43:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6050#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6050#comment:4</guid> <description> <p> I get lots of errors running the tests </p> </description> <category>Ticket</category> </item> <item> <author>oakad@…</author> <pubDate>Sun, 17 Mar 2013 14:32:24 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/6050 https://svn.boost.org/trac10/ticket/6050 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">spirit-transform-attribute-post-bool-v6.patch</span> </li> </ul> <p> Fix an unfortunately missed "bit rot" in v5 arising from changed function attribute names. </p> Ticket oakad@… Sun, 17 Mar 2013 15:00:55 GMT <link>https://svn.boost.org/trac10/ticket/6050#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6050#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/6050#comment:4" title="Comment 4">djowel</a>: </p> <blockquote class="citation"> <p> I get lots of errors running the tests </p> </blockquote> <p> Sorry for that. I should have not acted hastily when fixing this patch up. All tests seem to pass just fine with the update, apart from match_manip1.cpp (some problem on my side, may be - it fails with bad_alloc) and regression_stream_eof.cpp (seem to be broken as it is). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sun, 14 Mar 2021 19:48:45 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6050#comment:6 https://svn.boost.org/trac10/ticket/6050#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> breaking change, examples are inconclusive for a feature request as the same can be done with exceptions, semantic actions or custom parsers. </p> Ticket