cpp_grammar_gen.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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(BOOST_CPP_GRAMMAR_GEN_HPP_80CB8A59_5411_4E45_B406_62531A12FB99_INCLUDED)
  9. #define BOOST_CPP_GRAMMAR_GEN_HPP_80CB8A59_5411_4E45_B406_62531A12FB99_INCLUDED
  10. #include <boost/wave/wave_config.hpp>
  11. #include <boost/wave/language_support.hpp>
  12. #include <boost/spirit/include/classic_nil.hpp>
  13. #include <boost/spirit/include/classic_parse_tree.hpp>
  14. #include <boost/pool/pool_alloc.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. ///////////////////////////////////////////////////////////////////////////////
  29. //
  30. // Here are the node id's of the different node of the cpp_grammar
  31. //
  32. ///////////////////////////////////////////////////////////////////////////////
  33. #define BOOST_WAVE_PP_STATEMENT_ID 1
  34. #define BOOST_WAVE_INCLUDE_FILE_ID 2
  35. #define BOOST_WAVE_SYSINCLUDE_FILE_ID 3
  36. #define BOOST_WAVE_MACROINCLUDE_FILE_ID 4
  37. #define BOOST_WAVE_PLAIN_DEFINE_ID 5
  38. #define BOOST_WAVE_MACRO_PARAMETERS_ID 6
  39. #define BOOST_WAVE_MACRO_DEFINITION_ID 7
  40. #define BOOST_WAVE_UNDEFINE_ID 8
  41. #define BOOST_WAVE_IFDEF_ID 9
  42. #define BOOST_WAVE_IFNDEF_ID 10
  43. #define BOOST_WAVE_IF_ID 11
  44. #define BOOST_WAVE_ELIF_ID 12
  45. #define BOOST_WAVE_ELSE_ID 13
  46. #define BOOST_WAVE_ENDIF_ID 14
  47. #define BOOST_WAVE_LINE_ID 15
  48. #define BOOST_WAVE_ERROR_ID 16
  49. #define BOOST_WAVE_WARNING_ID 17
  50. #define BOOST_WAVE_PRAGMA_ID 18
  51. #define BOOST_WAVE_ILLFORMED_ID 19
  52. #define BOOST_WAVE_PPSPACE_ID 20
  53. #define BOOST_WAVE_PPQUALIFIEDNAME_ID 21
  54. #define BOOST_WAVE_REGION_ID 22
  55. #define BOOST_WAVE_ENDREGION_ID 23
  56. ///////////////////////////////////////////////////////////////////////////////
  57. //
  58. // cpp_grammar_gen template class
  59. //
  60. // This template helps separating the compilation of the cpp_grammar
  61. // class from the compilation of the main pp_iterator. This is done to
  62. // safe compilation time.
  63. //
  64. ///////////////////////////////////////////////////////////////////////////////
  65. template <typename LexIteratorT, typename TokenContainerT>
  66. struct BOOST_WAVE_DECL cpp_grammar_gen
  67. {
  68. typedef LexIteratorT iterator_type;
  69. typedef typename LexIteratorT::token_type token_type;
  70. typedef TokenContainerT token_container_type;
  71. typedef typename token_type::position_type position_type;
  72. typedef boost::spirit::classic::node_val_data_factory<
  73. // boost::spirit::nil_t,
  74. // boost::pool_allocator<boost::spirit::nil_t>
  75. > node_factory_type;
  76. // parse the cpp_grammar and return the resulting parse tree
  77. static boost::spirit::classic::tree_parse_info<iterator_type, node_factory_type>
  78. parse_cpp_grammar (iterator_type const &first, iterator_type const &last,
  79. position_type const &act_pos, bool &found_eof,
  80. token_type &found_directive, token_container_type &found_eoltokens);
  81. };
  82. ///////////////////////////////////////////////////////////////////////////////
  83. } // namespace grammars
  84. } // namespace wave
  85. } // namespace boost
  86. #ifdef BOOST_MSVC
  87. #pragma warning(pop)
  88. #endif
  89. // the suffix header occurs after all of the code
  90. #ifdef BOOST_HAS_ABI_HEADERS
  91. #include BOOST_ABI_SUFFIX
  92. #endif
  93. #endif // !defined(BOOST_CPP_GRAMMAR_GEN_HPP_80CB8A59_5411_4E45_B406_62531A12FB99_INCLUDED)