Subject: [Boost-bugs] [Boost C++ Libraries] #11824: [spirit][qi] skip_flag::dont_postskip not working as expected
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-11-28 08:56:53
#11824: [spirit][qi] skip_flag::dont_postskip not working as expected
-----------------------------------------------+-------------------------
Reporter: Daniel Starke <daniel.f.starke@â¦> | Owner: djowel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
Version: Boost 1.59.0 | Severity: Showstopper
Keywords: qi skip post-skip |
-----------------------------------------------+-------------------------
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.
Example:
{{{
string input("a b");
string::const_iterator first(input.begin()), last(input.end());
phrase_parse(first, last, ((+char_("a", "z")) > no_skip[&blank]) >> char_,
blank, dont_postskip);
}}}
This will fail to match in the current implementation even though it looks
perfectly fine.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11824> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC