Boost C++ Libraries: Ticket #11824: [spirit][qi] skip_flag::dont_postskip not working as expected https://svn.boost.org/trac10/ticket/11824 <p> Assuming we want to create a primitive which checks if the skip parser is called at least once before the next terminal we need to disable post-skipping for this purpose. However, disabling post-skipping alone will not work if the previous parser failed on a input because all terminals do not revert to the position before the skip parser but just after it. A workaround could be add an and-prediction in front of each terminal but this makes the code unreadable. Attached is a possible patch for spirit qi which changes all terminals to revert to the position before the skip parser in case of a mismatch. Note: This might introduce some performance regression. </p> <p> Example: </p> <pre class="wiki">string input("a b"); string::const_iterator first(input.begin()), last(input.end()); phrase_parse(first, last, ((+char_("a", "z")) &gt; no_skip[&amp;blank]) &gt;&gt; char_, blank, dont_postskip); </pre><p> This will fail to match in the current implementation even though it looks perfectly fine. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11824 Trac 1.4.3 Daniel Starke <daniel.f.starke@…> Sat, 28 Nov 2015 08:57:39 GMT attachment set https://svn.boost.org/trac10/ticket/11824 https://svn.boost.org/trac10/ticket/11824 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patch.diff</span> </li> </ul> <p> possible patch for qi (boost 1.59) - untested </p> Ticket