Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:30

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 // 
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_REPOSITORY_QI_ITER_POS_NOV_20_2009_1245PM)
0007 #define BOOST_SPIRIT_REPOSITORY_QI_ITER_POS_NOV_20_2009_1245PM
0008 
0009 #include <boost/spirit/include/qi_parse.hpp>
0010 
0011 ///////////////////////////////////////////////////////////////////////////////
0012 // definition the place holder 
0013 namespace boost { namespace spirit { namespace repository { namespace qi
0014 {
0015     BOOST_SPIRIT_TERMINAL(iter_pos)
0016 }}}} 
0017 
0018 ///////////////////////////////////////////////////////////////////////////////
0019 // implementation the enabler
0020 namespace boost { namespace spirit 
0021 { 
0022     // We want custom_parser::iter_pos to be usable as a terminal only, 
0023     // and only for parser expressions (qi::domain).
0024     template <>
0025     struct use_terminal<qi::domain, repository::qi::tag::iter_pos> 
0026       : mpl::true_ 
0027     {}; 
0028 }}
0029 
0030 ///////////////////////////////////////////////////////////////////////////////
0031 // implementation of the parser
0032 namespace boost { namespace spirit { namespace repository { namespace qi
0033 {
0034     struct iter_pos_parser 
0035       : boost::spirit::qi::primitive_parser<iter_pos_parser>
0036     {
0037         // Define the attribute type exposed by this parser component
0038         template <typename Context, typename Iterator>
0039         struct attribute
0040         {
0041             typedef Iterator type;
0042         };
0043 
0044         // This function is called during the actual parsing process
0045         template <typename Iterator, typename Context
0046           , typename Skipper, typename Attribute>
0047         bool parse(Iterator& first, Iterator const& last
0048           , Context&, Skipper const& skipper, Attribute& attr) const
0049         {
0050             boost::spirit::qi::skip_over(first, last, skipper);
0051             boost::spirit::traits::assign_to(first, attr);
0052             return true;
0053         }
0054 
0055         // This function is called during error handling to create
0056         // a human readable string for the error context.
0057         template <typename Context>
0058         boost::spirit::info what(Context&) const
0059         {
0060             return boost::spirit::info("iter_pos");
0061         }
0062     };
0063 }}}}
0064 
0065 ///////////////////////////////////////////////////////////////////////////////
0066 // instantiation of the parser
0067 namespace boost { namespace spirit { namespace qi
0068 {
0069     // This is the factory function object invoked in order to create 
0070     // an instance of our iter_pos_parser.
0071     template <typename Modifiers>
0072     struct make_primitive<repository::qi::tag::iter_pos, Modifiers>
0073     {
0074         typedef repository::qi::iter_pos_parser result_type;
0075 
0076         result_type operator()(unused_type, unused_type) const
0077         {
0078             return result_type();
0079         }
0080     };
0081 }}}
0082 
0083 #endif