Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:01:54

0001 /*=============================================================================
0002     Copyright (c) 1998-2003 Joel de Guzman
0003     http://spirit.sourceforge.net/
0004 
0005     Use, modification and distribution is subject to the Boost Software
0006     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007     http://www.boost.org/LICENSE_1_0.txt)
0008 =============================================================================*/
0009 #if !defined(BOOST_SPIRIT_PARSER_IPP)
0010 #define BOOST_SPIRIT_PARSER_IPP
0011 
0012 namespace boost { namespace spirit {
0013 
0014 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0015 
0016     ///////////////////////////////////////////////////////////////////////////
0017     //
0018     //  Generic parse function implementation
0019     //
0020     ///////////////////////////////////////////////////////////////////////////
0021     template <typename IteratorT, typename DerivedT>
0022     inline parse_info<IteratorT>
0023     parse(
0024         IteratorT const& first_
0025       , IteratorT const& last
0026       , parser<DerivedT> const& p)
0027     {
0028         IteratorT first = first_;
0029         scanner<IteratorT, scanner_policies<> > scan(first, last);
0030         match<nil_t> hit = p.derived().parse(scan);
0031         return parse_info<IteratorT>(
0032             first, hit, hit && (first == last), hit.length());
0033     }
0034 
0035     ///////////////////////////////////////////////////////////////////////////
0036     //
0037     //  Parse function for null terminated strings implementation
0038     //
0039     ///////////////////////////////////////////////////////////////////////////
0040     template <typename CharT, typename DerivedT>
0041     inline parse_info<CharT const*>
0042     parse(CharT const* str, parser<DerivedT> const& p)
0043     {
0044         CharT const* last = str;
0045         while (*last)
0046             last++;
0047         return parse(str, last, p);
0048     }
0049 
0050 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0051 
0052 }} // namespace boost::spirit
0053 
0054 #endif
0055