File indexing completed on 2025-01-18 09:53:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #if !defined(BOOST_CPP_DEFINED_GRAMMAR_HPP_F48287B2_DC67_40A8_B4A1_800EFBD67869_INCLUDED)
0012 #define BOOST_CPP_DEFINED_GRAMMAR_HPP_F48287B2_DC67_40A8_B4A1_800EFBD67869_INCLUDED
0013
0014 #include <boost/wave/wave_config.hpp>
0015
0016 #include <boost/assert.hpp>
0017 #include <boost/spirit/include/classic_core.hpp>
0018 #include <boost/spirit/include/classic_closure.hpp>
0019 #include <boost/spirit/include/classic_assign_actor.hpp>
0020 #include <boost/spirit/include/classic_push_back_actor.hpp>
0021
0022 #include <boost/wave/token_ids.hpp>
0023 #include <boost/wave/util/pattern_parser.hpp>
0024 #include <boost/wave/grammars/cpp_defined_grammar_gen.hpp>
0025
0026 #if !defined(spirit_append_actor)
0027 #define spirit_append_actor(actor) boost::spirit::classic::push_back_a(actor)
0028 #define spirit_assign_actor(actor) boost::spirit::classic::assign_a(actor)
0029 #endif
0030
0031
0032 #ifdef BOOST_HAS_ABI_HEADERS
0033 #include BOOST_ABI_PREFIX
0034 #endif
0035
0036
0037 namespace boost {
0038 namespace wave {
0039 namespace grammars {
0040
0041
0042
0043 #define TRACE_CPP_DEFINED_GRAMMAR \
0044 bool(BOOST_SPIRIT_DEBUG_FLAGS_CPP & BOOST_SPIRIT_DEBUG_FLAGS_DEFINED_GRAMMAR) \
0045
0046
0047 template <typename ContainerT>
0048 struct defined_grammar :
0049 public boost::spirit::classic::grammar<defined_grammar<ContainerT> >
0050 {
0051 defined_grammar(ContainerT &result_seq_)
0052 : result_seq(result_seq_)
0053 {
0054 BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(*this, "defined_grammar",
0055 TRACE_CPP_DEFINED_GRAMMAR);
0056 }
0057
0058 template <typename ScannerT>
0059 struct definition
0060 {
0061 typedef boost::spirit::classic::rule<ScannerT> rule_t;
0062
0063 rule_t defined_op;
0064 rule_t identifier;
0065
0066 definition(defined_grammar const &self)
0067 {
0068 using namespace boost::spirit::classic;
0069 using namespace boost::wave;
0070 using namespace boost::wave::util;
0071
0072 defined_op
0073 = ch_p(T_IDENTIFIER)
0074 >> (
0075 ( ch_p(T_LEFTPAREN)
0076 >> identifier
0077 >> ch_p(T_RIGHTPAREN)
0078 )
0079 | identifier
0080 )
0081 ;
0082
0083 identifier
0084 = ch_p(T_IDENTIFIER)
0085 [
0086 spirit_append_actor(self.result_seq)
0087 ]
0088 | pattern_p(KeywordTokenType, TokenTypeMask|PPTokenFlag)
0089 [
0090 spirit_append_actor(self.result_seq)
0091 ]
0092 | pattern_p(OperatorTokenType|AltExtTokenType,
0093 ExtTokenTypeMask|PPTokenFlag)
0094 [
0095 spirit_append_actor(self.result_seq)
0096 ]
0097 | pattern_p(BoolLiteralTokenType, TokenTypeMask|PPTokenFlag)
0098 [
0099 spirit_append_actor(self.result_seq)
0100 ]
0101 ;
0102
0103 BOOST_SPIRIT_DEBUG_TRACE_RULE(defined_op, TRACE_CPP_DEFINED_GRAMMAR);
0104 BOOST_SPIRIT_DEBUG_TRACE_RULE(identifier, TRACE_CPP_DEFINED_GRAMMAR);
0105 }
0106
0107
0108 rule_t const& start() const
0109 { return defined_op; }
0110 };
0111
0112 ContainerT &result_seq;
0113 };
0114
0115
0116 #undef TRACE_CPP_DEFINED_GRAMMAR
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126 #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
0127 #define BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
0128 #else
0129 #define BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE inline
0130 #endif
0131
0132
0133
0134
0135
0136
0137
0138
0139 template <typename LexIteratorT>
0140 BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
0141 boost::spirit::classic::parse_info<
0142 typename defined_grammar_gen<LexIteratorT>::iterator1_type
0143 >
0144 defined_grammar_gen<LexIteratorT>::parse_operator_defined (
0145 iterator1_type const &first, iterator1_type const &last,
0146 token_sequence_type &found_qualified_name)
0147 {
0148 using namespace boost::spirit::classic;
0149 using namespace boost::wave;
0150
0151 defined_grammar<token_sequence_type> g(found_qualified_name);
0152 return boost::spirit::classic::parse (
0153 first, last, g, ch_p(T_SPACE) | ch_p(T_CCOMMENT));
0154 }
0155
0156 template <typename LexIteratorT>
0157 BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
0158 boost::spirit::classic::parse_info<
0159 typename defined_grammar_gen<LexIteratorT>::iterator2_type
0160 >
0161 defined_grammar_gen<LexIteratorT>::parse_operator_defined (
0162 iterator2_type const &first, iterator2_type const &last,
0163 token_sequence_type &found_qualified_name)
0164 {
0165 using namespace boost::spirit::classic;
0166 using namespace boost::wave;
0167
0168 defined_grammar<token_sequence_type> g(found_qualified_name);
0169 return boost::spirit::classic::parse (
0170 first, last, g, ch_p(T_SPACE) | ch_p(T_CCOMMENT));
0171 }
0172
0173 #undef BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
0174
0175
0176 }
0177 }
0178 }
0179
0180
0181 #ifdef BOOST_HAS_ABI_HEADERS
0182 #include BOOST_ABI_SUFFIX
0183 #endif
0184
0185 #endif