| 1 | /*============================================================================= |
| 2 | Copyright (c) 1998-2003 Joel de Guzman |
| 3 | Copyright (c) 2001 Daniel Nuffer |
| 4 | Copyright (c) 2002 Hartmut Kaiser |
| 5 | http://spirit.sourceforge.net/ |
| 6 | |
| 7 | Use, modification and distribution is subject to the Boost Software |
| 8 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 9 | http://www.boost.org/LICENSE_1_0.txt) |
| 10 | =============================================================================*/ |
| 11 | #if !defined(BOOST_SPIRIT_LIST_IPP) |
| 12 | #define BOOST_SPIRIT_LIST_IPP |
| 13 | |
| 14 | namespace boost { namespace spirit { |
| 15 | |
| 16 | BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN |
| 17 | |
| 18 | /////////////////////////////////////////////////////////////////////////// |
| 19 | // |
| 20 | // operator% is defined as: |
| 21 | // a % b ---> a >> *(b >> a) |
| 22 | // |
| 23 | /////////////////////////////////////////////////////////////////////////// |
| 24 | template <typename A, typename B> |
| 25 | inline sequence<A, kleene_star<sequence<B, A> > > |
| 26 | operator%(parser<A> const& a, parser<B> const& b) |
| 27 | { |
| 28 | return a.derived() >> *(b.derived() >> a.derived()); |
| 29 | } |
| 30 | |
| 31 | template <typename A> |
| 32 | inline sequence<A, kleene_star<sequence<chlit<char>, A> > > |
| 33 | operator%(parser<A> const& a, char b) |
| 34 | { |
| 35 | return a.derived() >> *(b >> a.derived()); |
| 36 | } |
| 37 | |
| 38 | template <typename B> |
| 39 | inline sequence<chlit<char>, kleene_star<sequence<B, chlit<char> > > > |
| 40 | operator%(char a, parser<B> const& b) |
| 41 | { |
| 42 | return a >> *(b.derived() >> a); |
| 43 | } |
| 44 | |
| 45 | template <typename A> |
| 46 | inline sequence<A, kleene_star<sequence<strlit<char const*>, A> > > |
| 47 | operator%(parser<A> const& a, char const* b) |
| 48 | { |
| 49 | return a.derived() >> *(b >> a.derived()); |
| 50 | } |
| 51 | |
| 52 | template <typename B> |
| 53 | inline sequence<strlit<char const*>, |
| 54 | kleene_star<sequence<B, strlit<char const*> > > > |
| 55 | operator%(char const* a, parser<B> const& b) |
| 56 | { |
| 57 | return a >> *(b.derived() >> a); |
| 58 | } |
| 59 | |
| 60 | template <typename A> |
| 61 | inline sequence<A, kleene_star<sequence<chlit<wchar_t>, A> > > |
| 62 | operator%(parser<A> const& a, wchar_t b) |
| 63 | { |
| 64 | return a.derived() >> *(b >> a.derived()); |
| 65 | } |
| 66 | |
| 67 | template <typename B> |
| 68 | inline sequence<chlit<wchar_t>, kleene_star<sequence<B, chlit<wchar_t> > > > |
| 69 | operator%(wchar_t a, parser<B> const& b) |
| 70 | { |
| 71 | return a >> *(b.derived() >> a); |
| 72 | } |
| 73 | |
| 74 | template <typename A> |
| 75 | inline sequence<A, kleene_star<sequence<strlit<wchar_t const*>, A> > > |
| 76 | operator%(parser<A> const& a, wchar_t const* b) |
| 77 | { |
| 78 | return a.derived() >> *(b >> a.derived()); |
| 79 | } |
| 80 | |
| 81 | template <typename B> |
| 82 | inline sequence<strlit<wchar_t const*>, |
| 83 | kleene_star<sequence<B, strlit<wchar_t const*> > > > |
| 84 | operator%(wchar_t const* a, parser<B> const& b) |
| 85 | { |
| 86 | return a >> *(b.derived() >> a); |
| 87 | } |
| 88 | |
| 89 | BOOST_SPIRIT_CLASSIC_NAMESPACE_END |
| 90 | |
| 91 | }} // namespace boost::spirit |
| 92 | |
| 93 | #endif |
| 94 | |