1
/*=============================================================================
3
Copyright (c) 1998-2003 Joel de Guzman
4
http://spirit.sourceforge.net/
6
Permission to copy, use, modify, sell and distribute this software is
7
granted provided this copyright notice appears in all copies. This
8
software is provided "as is" without express or implied warranty, and
9
with no claim as to its suitability for any purpose.
10
=============================================================================*/
11
#if !defined(BOOST_SPIRIT_PARSER_IPP)
12
#define BOOST_SPIRIT_PARSER_IPP
14
///////////////////////////////////////////////////////////////////////////////
15
namespace boost { namespace spirit {
17
///////////////////////////////////////////////////////////////////////////
19
// Generic parse function implementation
21
///////////////////////////////////////////////////////////////////////////
22
template <typename IteratorT, typename DerivedT>
23
inline parse_info<IteratorT>
25
IteratorT const& first_,
26
IteratorT const& last,
27
parser<DerivedT> const& p)
29
IteratorT first = first_;
30
scanner<IteratorT, scanner_policies<> > scan(first, last);
31
match<nil_t> hit = p.derived().parse(scan);
32
return parse_info<IteratorT>(
33
first, hit, hit && (first == last), hit.length());
36
///////////////////////////////////////////////////////////////////////////
38
// Parse function for null terminated strings implementation
40
///////////////////////////////////////////////////////////////////////////
41
template <typename CharT, typename DerivedT>
42
inline parse_info<CharT const*>
45
parser<DerivedT> const& p)
47
CharT const* last = str;
50
return parse(str, last, p);
53
}} // namespace boost::spirit