1 /*============================================================================= 2 Boost.Wave: A Standard compliant C++ preprocessor library 3 4 http://www.boost.org/ 5 6 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 7 Software License, Version 1.0. (See accompanying file 8 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 =============================================================================*/ 10 11 #if !defined(CPP_GRAMMAR_GEN_HPP_80CB8A59_5411_4E45_B406_62531A12FB99_INCLUDED) 12 #define CPP_GRAMMAR_GEN_HPP_80CB8A59_5411_4E45_B406_62531A12FB99_INCLUDED 13 14 #include <boost/wave/wave_config.hpp> 15 #include <boost/wave/language_support.hpp> 16 17 #include <boost/spirit/include/classic_nil.hpp> 18 #include <boost/spirit/include/classic_parse_tree.hpp> 19 20 #include <boost/pool/pool_alloc.hpp> 21 22 // this must occur after all of the includes and before any code appears 23 #ifdef BOOST_HAS_ABI_HEADERS 24 #include BOOST_ABI_PREFIX 25 #endif 26 27 // suppress warnings about dependent classes not being exported from the dll 28 #ifdef BOOST_MSVC 29 #pragma warning(push) 30 #pragma warning(disable : 4251 4231 4660) 31 #endif 32 33 /////////////////////////////////////////////////////////////////////////////// 34 namespace boost { 35 namespace wave { 36 namespace grammars { 37 38 /////////////////////////////////////////////////////////////////////////////// 39 // 40 // Here are the node id's of the different node of the cpp_grammar 41 // 42 /////////////////////////////////////////////////////////////////////////////// 43 #define BOOST_WAVE_PP_STATEMENT_ID 1 44 #define BOOST_WAVE_INCLUDE_FILE_ID 2 45 #define BOOST_WAVE_SYSINCLUDE_FILE_ID 3 46 #define BOOST_WAVE_MACROINCLUDE_FILE_ID 4 47 #define BOOST_WAVE_PLAIN_DEFINE_ID 5 48 #define BOOST_WAVE_MACRO_PARAMETERS_ID 6 49 #define BOOST_WAVE_MACRO_DEFINITION_ID 7 50 #define BOOST_WAVE_UNDEFINE_ID 8 51 #define BOOST_WAVE_IFDEF_ID 9 52 #define BOOST_WAVE_IFNDEF_ID 10 53 #define BOOST_WAVE_IF_ID 11 54 #define BOOST_WAVE_ELIF_ID 12 55 #define BOOST_WAVE_ELSE_ID 13 56 #define BOOST_WAVE_ENDIF_ID 14 57 #define BOOST_WAVE_LINE_ID 15 58 #define BOOST_WAVE_ERROR_ID 16 59 #define BOOST_WAVE_WARNING_ID 17 60 #define BOOST_WAVE_PRAGMA_ID 18 61 #define BOOST_WAVE_ILLFORMED_ID 19 62 #define BOOST_WAVE_PPSPACE_ID 20 63 #define BOOST_WAVE_PPQUALIFIEDNAME_ID 21 64 #define BOOST_WAVE_REGION_ID 22 65 #define BOOST_WAVE_ENDREGION_ID 23 66 67 /////////////////////////////////////////////////////////////////////////////// 68 // 69 // cpp_grammar_gen template class 70 // 71 // This template helps separating the compilation of the cpp_grammar 72 // class from the compilation of the main pp_iterator. This is done to 73 // safe compilation time. 74 // 75 /////////////////////////////////////////////////////////////////////////////// 76 77 template <typename LexIteratorT, typename TokenContainerT> 78 struct BOOST_WAVE_DECL cpp_grammar_gen 79 { 80 typedef LexIteratorT iterator_type; 81 typedef typename LexIteratorT::token_type token_type; 82 typedef TokenContainerT token_container_type; 83 typedef typename token_type::position_type position_type; 84 typedef boost::spirit::classic::node_val_data_factory< 85 // boost::spirit::nil_t, 86 // boost::pool_allocator<boost::spirit::nil_t> 87 > node_factory_type; 88 89 // parse the cpp_grammar and return the resulting parse tree 90 static boost::spirit::classic::tree_parse_info<iterator_type, node_factory_type> 91 parse_cpp_grammar (iterator_type const &first, iterator_type const &last, 92 position_type const &act_pos, bool &found_eof, 93 token_type &found_directive, token_container_type &found_eoltokens); 94 }; 95 96 /////////////////////////////////////////////////////////////////////////////// 97 } // namespace grammars 98 } // namespace wave 99 } // namespace boost 100 101 #ifdef BOOST_MSVC 102 #pragma warning(pop) 103 #endif 104 105 // the suffix header occurs after all of the code 106 #ifdef BOOST_HAS_ABI_HEADERS 107 #include BOOST_ABI_SUFFIX 108 #endif 109 110 #endif // !defined(CPP_GRAMMAR_GEN_HPP_80CB8A59_5411_4E45_B406_62531A12FB99_INCLUDED) 111