sequential_or.ipp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. Use, modification and distribution is subject to the Boost Software
  7. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. http://www.boost.org/LICENSE_1_0.txt)
  9. =============================================================================*/
  10. #if !defined(BOOST_SPIRIT_SEQUENTIAL_OR_IPP)
  11. #define BOOST_SPIRIT_SEQUENTIAL_OR_IPP
  12. namespace boost { namespace spirit {
  13. BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
  14. ///////////////////////////////////////////////////////////////////////////
  15. //
  16. // sequential-or class implementation
  17. //
  18. ///////////////////////////////////////////////////////////////////////////
  19. template <typename A, typename B>
  20. inline sequential_or<A, B>
  21. operator||(parser<A> const& a, parser<B> const& b)
  22. {
  23. return sequential_or<A, B>(a.derived(), b.derived());
  24. }
  25. template <typename A>
  26. inline sequential_or<A, chlit<char> >
  27. operator||(parser<A> const& a, char b)
  28. {
  29. return sequential_or<A, chlit<char> >(a.derived(), b);
  30. }
  31. template <typename B>
  32. inline sequential_or<chlit<char>, B>
  33. operator||(char a, parser<B> const& b)
  34. {
  35. return sequential_or<chlit<char>, B>(a, b.derived());
  36. }
  37. template <typename A>
  38. inline sequential_or<A, strlit<char const*> >
  39. operator||(parser<A> const& a, char const* b)
  40. {
  41. return sequential_or<A, strlit<char const*> >(a.derived(), b);
  42. }
  43. template <typename B>
  44. inline sequential_or<strlit<char const*>, B>
  45. operator||(char const* a, parser<B> const& b)
  46. {
  47. return sequential_or<strlit<char const*>, B>(a, b.derived());
  48. }
  49. template <typename A>
  50. inline sequential_or<A, chlit<wchar_t> >
  51. operator||(parser<A> const& a, wchar_t b)
  52. {
  53. return sequential_or<A, chlit<wchar_t> >(a.derived(), b);
  54. }
  55. template <typename B>
  56. inline sequential_or<chlit<wchar_t>, B>
  57. operator||(wchar_t a, parser<B> const& b)
  58. {
  59. return sequential_or<chlit<wchar_t>, B>(a, b.derived());
  60. }
  61. template <typename A>
  62. inline sequential_or<A, strlit<wchar_t const*> >
  63. operator||(parser<A> const& a, wchar_t const* b)
  64. {
  65. return sequential_or<A, strlit<wchar_t const*> >(a.derived(), b);
  66. }
  67. template <typename B>
  68. inline sequential_or<strlit<wchar_t const*>, B>
  69. operator||(wchar_t const* a, parser<B> const& b)
  70. {
  71. return sequential_or<strlit<wchar_t const*>, B>(a, b.derived());
  72. }
  73. BOOST_SPIRIT_CLASSIC_NAMESPACE_END
  74. }} // namespace boost::spirit
  75. #endif