Boost-Graph

 view release on metacpan or  search on metacpan

include/boost/wave/grammars/cpp_defined_grammar.hpp  view on Meta::CPAN

            using namespace boost::wave::util;

            defined_op      // parens not required, see C++ standard 16.1.1
                =   ch_p(T_IDENTIFIER)      // token contains 'defined'
                    >>  (
                            (   ch_p(T_LEFTPAREN)
                                >>  identifier
                                >>  ch_p(T_RIGHTPAREN)
                            )
                            |   identifier
                        )
                ;

            identifier
                =   ch_p(T_IDENTIFIER)
                    [
                        spirit_append_actor(self.result_seq)
                    ] 
                |   pattern_p(KeywordTokenType, TokenTypeMask)
                    [
                        spirit_append_actor(self.result_seq)
                    ] 
                |   pattern_p(OperatorTokenType|AltExtTokenType, ExtTokenTypeMask)
                    [
                        spirit_append_actor(self.result_seq)
                    ] 
                ;

            BOOST_SPIRIT_DEBUG_TRACE_RULE(defined_op, TRACE_CPP_DEFINED_GRAMMAR);
            BOOST_SPIRIT_DEBUG_TRACE_RULE(identifier, TRACE_CPP_DEFINED_GRAMMAR);
        }

    // start rule of this grammar
        rule_t const& start() const
        { return defined_op; }
    };

    ContainerT &result_seq;
};

///////////////////////////////////////////////////////////////////////////////
#undef TRACE_CPP_DEFINED_GRAMMAR

///////////////////////////////////////////////////////////////////////////////
//  
//  The following parse function is defined here, to allow the separation of 
//  the compilation of the defined_grammar from the function 
//  using it.
//  
///////////////////////////////////////////////////////////////////////////////

#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#define BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE
#else
#define BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE inline
#endif 

//  The parse_operator_define function is instantiated manually twice to 
//  simplify the explicit specialization of this template. This way the user 
//  has only to specify one template parameter (the lexer type) to correctly
//  formulate the required explicit specialization.
//  This results in no code overhead, because otherwise the function would be
//  generated by the compiler twice anyway.

template <typename LexIteratorT>
BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE 
boost::spirit::parse_info<
    typename defined_grammar_gen<LexIteratorT>::iterator1_t
>
defined_grammar_gen<LexIteratorT>::parse_operator_defined (
    iterator1_t const &first, iterator1_t const &last,
    token_sequence_type &found_qualified_name)
{
    using namespace boost::spirit;
    using namespace boost::wave;
    
    defined_grammar<token_sequence_type> g(found_qualified_name);
    return boost::spirit::parse (
        first, last, g, ch_p(T_SPACE) | ch_p(T_CCOMMENT));
}

template <typename LexIteratorT>
BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE 
boost::spirit::parse_info<
    typename defined_grammar_gen<LexIteratorT>::iterator2_t
>
defined_grammar_gen<LexIteratorT>::parse_operator_defined (
    iterator2_t const &first, iterator2_t const &last,
    token_sequence_type &found_qualified_name)
{
    using namespace boost::spirit;
    using namespace boost::wave;
    
    defined_grammar<token_sequence_type> g(found_qualified_name);
    return boost::spirit::parse (
        first, last, g, ch_p(T_SPACE) | ch_p(T_CCOMMENT));
}

#undef BOOST_WAVE_DEFINED_GRAMMAR_GEN_INLINE

///////////////////////////////////////////////////////////////////////////////
}   // namespace grammars
}   // namespace wave
}   // namespace boost

#endif // !defined(CPP_DEFINED_GRAMMAR_HPP_F48287B2_DC67_40A8_B4A1_800EFBD67869_INCLUDED)



( run in 1.158 second using v1.01-cache-2.11-cpan-39bf76dae61 )