/*============================================================================= 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) =============================================================================*/ #include #include #include #include "misc_rules.hpp" namespace quickbook { namespace qi = boost::spirit::qi; qi::rule macro_identifier; qi::rule dummy_block; qi::rule comment; qi::rule hard_space; qi::rule space; qi::rule blank; qi::rule eol; qi::rule position; struct get_position { template void operator()(Range const& it, Context& c, bool& x) const { boost::spirit::_val(it, c, x) = it.begin().get_position(); } }; void init_misc_rules() { macro_identifier = +(qi::char_ - (qi::space | ']')) ; dummy_block = '[' >> *(dummy_block | (qi::char_ - ']')) >> ']' ; comment = "[/" >> *(dummy_block | (qi::char_ - ']')) >> ']' ; // Used after an identifier that must not be immediately // followed by an alpha-numeric character or underscore. hard_space = !(qi::alnum | '_') >> space ; space = *(qi::space | comment) ; blank = *(qi::blank | comment) ; eol = blank >> qi::eol ; position = qi::raw[qi::eps] [get_position()]; } }