source: NonGTP/Boost/boost/wave/grammars/cpp_predef_macros_gen.hpp @ 857

Revision 857, 2.8 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*=============================================================================
2    A Standard compliant C++ preprocessor
3
4    http://www.boost.org/
5
6    Copyright (c) 2001-2005 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_PREDEF_MACROS_GEN_HPP_CADB6D2C_76A4_4988_83E1_EFFC6902B9A2_INCLUDED)
12#define CPP_PREDEF_MACROS_GEN_HPP_CADB6D2C_76A4_4988_83E1_EFFC6902B9A2_INCLUDED
13
14#include <boost/spirit/tree/parse_tree.hpp>
15
16#include <boost/wave/wave_config.hpp>
17
18///////////////////////////////////////////////////////////////////////////////
19namespace boost {
20namespace wave {
21namespace grammars {
22
23///////////////////////////////////////////////////////////////////////////////
24// 
25//  store parser_id's of all rules of the predefined_macros_grammar here
26//  for later access
27//
28///////////////////////////////////////////////////////////////////////////////
29struct predefined_macros_grammar_rule_ids {
30    std::size_t plain_define_id;       // #define
31    std::size_t macro_parameters_id;
32    std::size_t macro_definition_id;
33};
34
35///////////////////////////////////////////////////////////////////////////////
36// 
37//  predefined_macros_grammar_gen template class
38//
39//      This template helps separating the compilation of the
40//      predefined_macros_grammar class from the compilation of the
41//      main pp_iterator. This is done to safe compilation time.
42//
43//      This class helps parsing command line given macro definitions in a
44//      similar way, as macros are parsed by the cpp_grammar class.
45//
46///////////////////////////////////////////////////////////////////////////////
47
48template <typename LexIteratorT>
49struct predefined_macros_grammar_gen
50{
51    typedef LexIteratorT iterator_type;
52
53//  the parser_id's of all rules of the cpp_grammar are stored here
54//  note: these are valid only after the first call to parse_cpp_grammar
55    static predefined_macros_grammar_rule_ids rule_ids;
56
57//  parse the cpp_grammar and return the resulting parse tree   
58    static boost::spirit::tree_parse_info<iterator_type>
59    parse_predefined_macro (iterator_type const &first, iterator_type const &last);
60};
61
62///////////////////////////////////////////////////////////////////////////////
63//  definitions of the static members
64template <typename LexIteratorT>
65predefined_macros_grammar_rule_ids
66    predefined_macros_grammar_gen<LexIteratorT>::rule_ids;
67
68///////////////////////////////////////////////////////////////////////////////
69}   // namespace grammars
70}   // namespace wave
71}   // namespace boost
72
73#endif // !defined(CPP_PREDEF_MACROS_GEN_HPP_CADB6D2C_76A4_4988_83E1_EFFC6902B9A2_INCLUDED)
Note: See TracBrowser for help on using the repository browser.