cpp_defined_grammar_gen.hpp 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*=============================================================================
  2. Boost.Wave: A Standard compliant C++ preprocessor library
  3. http://www.boost.org/
  4. Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
  5. Software License, Version 1.0. (See accompanying file
  6. LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. =============================================================================*/
  8. #if !defined(CPP_DEFINED_GRAMMAR_GEN_HPP_825BE9F5_98A3_400D_A97C_AD76B3B08632_INCLUDED)
  9. #define CPP_DEFINED_GRAMMAR_GEN_HPP_825BE9F5_98A3_400D_A97C_AD76B3B08632_INCLUDED
  10. #include <boost/wave/wave_config.hpp>
  11. #include <list>
  12. #include <boost/spirit/include/classic_parser.hpp>
  13. #include <boost/pool/pool_alloc.hpp>
  14. #include <boost/wave/util/unput_queue_iterator.hpp>
  15. // this must occur after all of the includes and before any code appears
  16. #ifdef BOOST_HAS_ABI_HEADERS
  17. #include BOOST_ABI_PREFIX
  18. #endif
  19. // suppress warnings about dependent classes not being exported from the dll
  20. #ifdef BOOST_MSVC
  21. #pragma warning(push)
  22. #pragma warning(disable : 4251 4231 4660)
  23. #endif
  24. ///////////////////////////////////////////////////////////////////////////////
  25. namespace boost {
  26. namespace wave {
  27. namespace grammars {
  28. template <typename LexIteratorT>
  29. struct BOOST_WAVE_DECL defined_grammar_gen
  30. {
  31. typedef typename LexIteratorT::token_type token_type;
  32. typedef std::list<token_type, boost::fast_pool_allocator<token_type> >
  33. token_sequence_type;
  34. // The parse_operator_defined function is instantiated manually twice to
  35. // simplify the explicit specialization of this template. This way the user
  36. // has only to specify one template parameter (the lexer iterator type) to
  37. // correctly formulate the required explicit specialization.
  38. // This results in no code overhead, because otherwise the function would be
  39. // generated by the compiler twice anyway.
  40. typedef boost::wave::util::unput_queue_iterator<
  41. typename token_sequence_type::iterator, token_type, token_sequence_type>
  42. iterator1_type;
  43. typedef boost::wave::util::unput_queue_iterator<
  44. LexIteratorT, token_type, token_sequence_type>
  45. iterator2_type;
  46. // parse the operator defined and return the found qualified name
  47. static boost::spirit::classic::parse_info<iterator1_type>
  48. parse_operator_defined (iterator1_type const &first,
  49. iterator1_type const &last, token_sequence_type &found_qualified_name);
  50. static boost::spirit::classic::parse_info<iterator2_type>
  51. parse_operator_defined (iterator2_type const &first,
  52. iterator2_type const &last, token_sequence_type &found_qualified_name);
  53. };
  54. ///////////////////////////////////////////////////////////////////////////////
  55. } // namespace grammars
  56. } // namespace wave
  57. } // namespace boost
  58. #ifdef BOOST_MSVC
  59. #pragma warning(pop)
  60. #endif
  61. // the suffix header occurs after all of the code
  62. #ifdef BOOST_HAS_ABI_HEADERS
  63. #include BOOST_ABI_SUFFIX
  64. #endif
  65. #endif // !defined(CPP_DEFINED_GRAMMAR_GEN_HPP_825BE9F5_98A3_400D_A97C_AD76B3B08632_INCLUDED)