/*============================================================================= Copyright (c) 2002 2004 2006Joel de Guzman Copyright (c) 2004 Eric Niebler http://spirit.sourceforge.net/ Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #if !defined(BOOST_SPIRIT_QUICKBOOK_GRAMMARS_HPP) #define BOOST_SPIRIT_QUICKBOOK_GRAMMARS_HPP #include #include "fwd.hpp" #include "iterator.hpp" namespace quickbook { namespace cl = boost::spirit::classic; // The spirit scanner for explicitly instantiating grammars. This is a // spirit implementation detail, but since classic is no longer under // development, it won't change. And spirit 2 won't require such a hack. typedef cl::scanner< parse_iterator, cl::scanner_policies< cl::iteration_policy, cl::match_policy, cl::action_policy> > scanner; template struct Scanner_must_be_the_quickbook_scanner_typedef; template <> struct Scanner_must_be_the_quickbook_scanner_typedef { }; struct grammar : public cl::grammar { grammar(cl::rule const& start_rule_, char const* /* name */) : start_rule(start_rule_) { } template struct definition : Scanner_must_be_the_quickbook_scanner_typedef { definition(grammar const& self) : start_rule(self.start_rule) {} cl::rule const& start() const { return start_rule; } cl::rule const& start_rule; }; cl::rule const& start_rule; }; struct quickbook_grammar { public: struct impl; private: boost::scoped_ptr impl_; public: grammar command_line_macro; grammar inline_phrase; grammar phrase_start; grammar block_start; grammar attribute_template_body; grammar doc_info; quickbook_grammar(quickbook::state&); ~quickbook_grammar(); }; } #endif