what.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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_WHAT_APRIL_21_2007_0732AM)
  7. #define BOOST_SPIRIT_WHAT_APRIL_21_2007_0732AM
  8. #if defined(_MSC_VER)
  9. #pragma once
  10. #endif
  11. #include <boost/mpl/assert.hpp>
  12. #include <boost/spirit/home/support/info.hpp>
  13. #include <boost/spirit/home/qi/meta_compiler.hpp>
  14. namespace boost { namespace spirit { namespace qi
  15. {
  16. template <typename Expr>
  17. inline info what(Expr const& expr)
  18. {
  19. // Report invalid expression error as early as possible.
  20. // If you got an error_expr_is_not_convertible_to_a_parser
  21. // error message here, then the expression (expr) is not a
  22. // valid spirit qi expression.
  23. BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
  24. return compile<qi::domain>(expr).what(unused);
  25. }
  26. }}}
  27. #endif