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