Index: boost/spirit/home/qi/detail/unused_skipper.hpp =================================================================== --- boost/spirit/home/qi/detail/unused_skipper.hpp (revision 84102) +++ boost/spirit/home/qi/detail/unused_skipper.hpp (working copy) @@ -11,6 +11,7 @@ #endif #include +#include namespace boost { namespace spirit { namespace qi { namespace detail { @@ -25,7 +26,19 @@ // silence MSVC warning C4512: assignment operator could not be generated unused_skipper& operator= (unused_skipper const&); }; + + template + struct is_unused_skipper + : mpl::false_ {}; + template + struct is_unused_skipper> + : mpl::true_ {}; + + template <> + struct is_unused_skipper + : mpl::true_ {}; + // If a surrounding lexeme[] directive was specified, the current // skipper is of the type unused_skipper. In this case we // re-activate the skipper which was active before the skip[] Index: boost/spirit/home/qi/directive/lexeme.hpp =================================================================== --- boost/spirit/home/qi/directive/lexeme.hpp (revision 84102) +++ boost/spirit/home/qi/directive/lexeme.hpp (working copy) @@ -20,6 +20,7 @@ #include #include #include +#include namespace boost { namespace spirit { @@ -55,7 +56,8 @@ template - bool parse(Iterator& first, Iterator const& last + typename disable_if, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper , Attribute& attr_) const { @@ -63,6 +65,18 @@ return subject.parse(first, last, context , detail::unused_skipper(skipper), attr_); } + template + typename enable_if, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + // no need to pre-skip if skipper is unused + //- qi::skip_over(first, last, skipper); + return subject.parse(first, last, context + , skipper, attr_); + } template info what(Context& context) const Index: boost/spirit/home/qi/directive/no_skip.hpp =================================================================== --- boost/spirit/home/qi/directive/no_skip.hpp (revision 84102) +++ boost/spirit/home/qi/directive/no_skip.hpp (working copy) @@ -22,6 +22,7 @@ #include #include #include +#include namespace boost { namespace spirit { @@ -58,13 +59,24 @@ template - bool parse(Iterator& first, Iterator const& last + typename disable_if, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper , Attribute& attr_) const { return subject.parse(first, last, context , detail::unused_skipper(skipper), attr_); } + template + typename enable_if, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + return subject.parse(first, last, context + , skipper, attr_); + } template info what(Context& context) const Index: boost/spirit/home/qi/directive/skip.hpp =================================================================== --- boost/spirit/home/qi/directive/skip.hpp (revision 84102) +++ boost/spirit/home/qi/directive/skip.hpp (working copy) @@ -26,6 +26,7 @@ #include #include #include +#include namespace boost { namespace spirit { @@ -75,13 +76,24 @@ template - bool parse(Iterator& first, Iterator const& last + typename enable_if, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& u // --> The skipper is reintroduced , Attribute& attr_) const { return subject.parse(first, last, context , detail::get_skipper(u), attr_); } + template + typename disable_if, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + return subject.parse(first, last, context + , skipper, attr_); + } template info what(Context& context) const Index: libs/spirit/test/qi/skip.cpp =================================================================== --- libs/spirit/test/qi/skip.cpp (revision 84102) +++ libs/spirit/test/qi/skip.cpp (working copy) @@ -39,6 +39,10 @@ BOOST_TEST((test("ab c d", lexeme[lit('a') >> 'b' >> skip[lit('c') >> 'd']], space))); BOOST_TEST((test("abcd", lexeme[lit('a') >> 'b' >> skip[lit('c') >> 'd']], space))); BOOST_TEST(!(test("a bcd", lexeme[lit('a') >> 'b' >> skip[lit('c') >> 'd']], space))); + + BOOST_TEST((test("ab c d", lexeme[lexeme[lit('a') >> 'b' >> skip[lit('c') >> 'd']]], space))); + BOOST_TEST((test("abcd", lexeme[lexeme[lit('a') >> 'b' >> skip[lit('c') >> 'd']]], space))); + BOOST_TEST(!(test("a bcd", lexeme[lexeme[lit('a') >> 'b' >> skip[lit('c') >> 'd']]], space))); } { // lazy skip