~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/spirit/core/impl/parser.ipp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=============================================================================
 
2
    Spirit v1.6.1
 
3
    Copyright (c) 1998-2003 Joel de Guzman
 
4
    http://spirit.sourceforge.net/
 
5
 
 
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
 
13
 
 
14
///////////////////////////////////////////////////////////////////////////////
 
15
namespace boost { namespace spirit {
 
16
 
 
17
    ///////////////////////////////////////////////////////////////////////////
 
18
    //
 
19
    //  Generic parse function implementation
 
20
    //
 
21
    ///////////////////////////////////////////////////////////////////////////
 
22
    template <typename IteratorT, typename DerivedT>
 
23
    inline parse_info<IteratorT>
 
24
    parse(
 
25
        IteratorT const&        first_,
 
26
        IteratorT const&        last,
 
27
        parser<DerivedT> const& p)
 
28
    {
 
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());
 
34
    }
 
35
 
 
36
    ///////////////////////////////////////////////////////////////////////////
 
37
    //
 
38
    //  Parse function for null terminated strings implementation
 
39
    //
 
40
    ///////////////////////////////////////////////////////////////////////////
 
41
    template <typename CharT, typename DerivedT>
 
42
    inline parse_info<CharT const*>
 
43
    parse(
 
44
        CharT const*            str,
 
45
        parser<DerivedT> const& p)
 
46
    {
 
47
        CharT const* last = str;
 
48
        while (*last)
 
49
            last++;
 
50
        return parse(str, last, p);
 
51
    }
 
52
 
 
53
}} // namespace boost::spirit
 
54
 
 
55
#endif
 
56