/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman Distributed under 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_GRAMMAR_FEB_19_2007_0236PM) #define BOOST_SPIRIT_GRAMMAR_FEB_19_2007_0236PM #include #include #include #include #include #include #include #include #include namespace boost { namespace spirit { namespace qi { template struct grammar : nonterminal< grammar , typename qi::rule::sig_type , typename qi::rule::locals_type >, noncopyable { typedef Iterator iterator_type; typedef qi::rule start_type; typedef typename start_type::sig_type sig_type; typedef typename start_type::locals_type locals_type; typedef typename start_type::skipper_type skipper_type; typedef grammar base_type; grammar(start_type const& start, std::string const& name_ = std::string()) : start(start), name_(name_) {} std::string name() const { return name_; } void name(std::string const& name__) { name_ = name__; } start_type const& start; std::string name_; private: template bool parse( Iterator_& first, Iterator_ const& last , Context& context, Skipper const& skipper) const { return start.parse(first, last, context, skipper); } std::string what() const { if (name().empty()) { return start.what(); } else { return name(); } } friend struct nonterminal_director; }; }}} #endif