skipper.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. =============================================================================*/
  6. #if !defined(BOOST_SPIRIT_MINIC_SKIPPER_HPP)
  7. #define BOOST_SPIRIT_MINIC_SKIPPER_HPP
  8. #include <boost/spirit/include/qi.hpp>
  9. namespace client { namespace parser
  10. {
  11. namespace qi = boost::spirit::qi;
  12. namespace ascii = boost::spirit::ascii;
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // The skipper grammar
  15. ///////////////////////////////////////////////////////////////////////////////
  16. template <typename Iterator>
  17. struct skipper : qi::grammar<Iterator>
  18. {
  19. skipper() : skipper::base_type(start)
  20. {
  21. qi::char_type char_;
  22. ascii::space_type space;
  23. start =
  24. space // tab/space/cr/lf
  25. | "/*" >> *(char_ - "*/") >> "*/" // C-style comments
  26. ;
  27. }
  28. qi::rule<Iterator> start;
  29. };
  30. }}
  31. #endif