annotate DEPENDENCIES/generic/include/boost/spirit/home/qi/stream/match_manip.hpp @ 118:770eb830ec19 emscripten

Typo fix
author Chris Cannam
date Wed, 18 May 2016 16:14:08 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Copyright (c) 2001-2011 Hartmut Kaiser
Chris@16 3 Copyright (c) 2001-2011 Joel de Guzman
Chris@16 4
Chris@16 5 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 ==============================================================================*/
Chris@16 8 #if !defined(BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM)
Chris@16 9 #define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM
Chris@16 10
Chris@16 11 #if defined(_MSC_VER)
Chris@16 12 #pragma once
Chris@16 13 #endif
Chris@16 14
Chris@16 15 #include <boost/spirit/home/qi/parse.hpp>
Chris@16 16 #include <boost/spirit/home/qi/parser.hpp>
Chris@16 17 #include <boost/spirit/home/support/unused.hpp>
Chris@16 18 #include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
Chris@16 19
Chris@16 20 ///////////////////////////////////////////////////////////////////////////////
Chris@16 21 namespace boost { namespace spirit { namespace qi
Chris@16 22 {
Chris@16 23 ///////////////////////////////////////////////////////////////////////////
Chris@16 24 template <typename Expr>
Chris@16 25 inline typename detail::match<Expr>::type
Chris@16 26 match(
Chris@16 27 Expr const& expr)
Chris@16 28 {
Chris@16 29 return detail::match<Expr>::call(expr);
Chris@16 30 }
Chris@16 31
Chris@16 32 template <typename Expr, typename Attribute>
Chris@16 33 inline detail::match_manip<
Chris@16 34 Expr, mpl::false_, mpl::false_, unused_type, Attribute
Chris@16 35 >
Chris@16 36 match(
Chris@16 37 Expr const& xpr
Chris@16 38 , Attribute& p)
Chris@16 39 {
Chris@16 40 using qi::detail::match_manip;
Chris@16 41
Chris@16 42 // Report invalid expression error as early as possible.
Chris@16 43 // If you got an error_invalid_expression error message here,
Chris@16 44 // then the expression (expr) is not a valid spirit qi expression.
Chris@16 45 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
Chris@16 46 return match_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>(
Chris@16 47 xpr, unused, p);
Chris@16 48 }
Chris@16 49
Chris@16 50 ///////////////////////////////////////////////////////////////////////////
Chris@16 51 template <typename Expr, typename Skipper>
Chris@16 52 inline typename detail::phrase_match<Expr, Skipper>::type
Chris@16 53 phrase_match(
Chris@16 54 Expr const& expr
Chris@16 55 , Skipper const& s
Chris@16 56 , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
Chris@16 57 {
Chris@16 58 return detail::phrase_match<Expr, Skipper>::call(expr, s, post_skip);
Chris@16 59 }
Chris@16 60
Chris@16 61 template <typename Expr, typename Skipper, typename Attribute>
Chris@16 62 inline detail::match_manip<
Chris@16 63 Expr, mpl::false_, mpl::false_, Skipper, Attribute
Chris@16 64 >
Chris@16 65 phrase_match(
Chris@16 66 Expr const& xpr
Chris@16 67 , Skipper const& s
Chris@16 68 , BOOST_SCOPED_ENUM(skip_flag) post_skip
Chris@16 69 , Attribute& p)
Chris@16 70 {
Chris@16 71 using qi::detail::match_manip;
Chris@16 72
Chris@16 73 // Report invalid expression error as early as possible.
Chris@16 74 // If you got an error_invalid_expression error message here,
Chris@16 75 // then either the expression (expr) or skipper is not a valid
Chris@16 76 // spirit qi expression.
Chris@16 77 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
Chris@16 78 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
Chris@16 79 return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
Chris@16 80 xpr, s, post_skip, p);
Chris@16 81 }
Chris@16 82
Chris@16 83 template <typename Expr, typename Skipper, typename Attribute>
Chris@16 84 inline detail::match_manip<
Chris@16 85 Expr, mpl::false_, mpl::false_, Skipper, Attribute
Chris@16 86 >
Chris@16 87 phrase_match(
Chris@16 88 Expr const& xpr
Chris@16 89 , Skipper const& s
Chris@16 90 , Attribute& p)
Chris@16 91 {
Chris@16 92 using qi::detail::match_manip;
Chris@16 93
Chris@16 94 // Report invalid expression error as early as possible.
Chris@16 95 // If you got an error_invalid_expression error message here,
Chris@16 96 // then either the expression (expr) or skipper is not a valid
Chris@16 97 // spirit qi expression.
Chris@16 98 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
Chris@16 99 BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
Chris@16 100 return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
Chris@16 101 xpr, s, p);
Chris@16 102 }
Chris@16 103
Chris@16 104 ///////////////////////////////////////////////////////////////////////////
Chris@16 105 template<typename Char, typename Traits, typename Derived>
Chris@16 106 inline std::basic_istream<Char, Traits>&
Chris@16 107 operator>>(std::basic_istream<Char, Traits>& is, parser<Derived> const& p)
Chris@16 108 {
Chris@16 109 typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
Chris@16 110
Chris@16 111 input_iterator f(is);
Chris@16 112 input_iterator l;
Chris@16 113 if (!p.derived().parse(f, l, unused, unused, unused))
Chris@16 114 {
Chris@16 115 is.setstate(std::ios_base::failbit);
Chris@16 116 }
Chris@16 117 return is;
Chris@16 118 }
Chris@16 119
Chris@16 120 }}}
Chris@16 121
Chris@16 122 #endif
Chris@16 123