eoi.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*=============================================================================
  2. Copyright (c) 2001-2014 Joel de Guzman
  3. Copyright (c) 2001-2011 Hartmut Kaiser
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(BOOST_SPIRIT_X3_EOI_MARCH_23_2007_0454PM)
  8. #define BOOST_SPIRIT_X3_EOI_MARCH_23_2007_0454PM
  9. #include <boost/spirit/home/x3/core/skip_over.hpp>
  10. #include <boost/spirit/home/x3/core/parser.hpp>
  11. #include <boost/spirit/home/x3/support/unused.hpp>
  12. namespace boost { namespace spirit { namespace x3
  13. {
  14. struct eoi_parser : parser<eoi_parser>
  15. {
  16. typedef unused_type attribute_type;
  17. static bool const has_attribute = false;
  18. template <typename Iterator, typename Context, typename Attribute>
  19. bool parse(Iterator& first, Iterator const& last
  20. , Context const& context, unused_type, Attribute&) const
  21. {
  22. x3::skip_over(first, last, context);
  23. return first == last;
  24. }
  25. };
  26. template<>
  27. struct get_info<eoi_parser>
  28. {
  29. typedef std::string result_type;
  30. result_type operator()(eoi_parser const &) const { return "eoi"; }
  31. };
  32. auto const eoi = eoi_parser{};
  33. }}}
  34. #endif