summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/spirit/test/qi/match_manip.hpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/spirit/test/qi/match_manip.hpp
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/spirit/test/qi/match_manip.hpp')
-rw-r--r--src/boost/libs/spirit/test/qi/match_manip.hpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/boost/libs/spirit/test/qi/match_manip.hpp b/src/boost/libs/spirit/test/qi/match_manip.hpp
new file mode 100644
index 00000000..b40ac67f
--- /dev/null
+++ b/src/boost/libs/spirit/test/qi/match_manip.hpp
@@ -0,0 +1,70 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Hartmut Kaiser
+ Copyright (c) 2001-2010 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_TEST_MATCH_MANIP_HPP)
+#define BOOST_SPIRIT_TEST_MATCH_MANIP_HPP
+
+#include <boost/config/warning_disable.hpp>
+
+#include <boost/spirit/include/support_argument.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_numeric.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_stream.hpp>
+#include <boost/spirit/include/qi_match.hpp>
+#include <boost/spirit/include/qi_match_auto.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_statement.hpp>
+
+#include <string>
+#include <sstream>
+#include <vector>
+#include <list>
+
+#include <boost/detail/lightweight_test.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+template <typename Char, typename Expr>
+bool test(Char const *toparse, Expr const& expr)
+{
+ namespace spirit = boost::spirit;
+ BOOST_SPIRIT_ASSERT_MATCH(spirit::qi::domain, Expr);
+
+ std::istringstream istrm(toparse);
+ istrm.unsetf(std::ios::skipws);
+ istrm >> spirit::qi::compile<spirit::qi::domain>(expr);
+ return istrm.good() || istrm.eof();
+}
+
+template <typename Char, typename Expr, typename CopyExpr, typename CopyAttr
+ , typename Skipper, typename Attribute>
+bool test(Char const *toparse,
+ boost::spirit::qi::detail::match_manip<
+ Expr, CopyExpr, CopyAttr, Skipper, Attribute> const& mm)
+{
+ std::istringstream istrm(toparse);
+ istrm.unsetf(std::ios::skipws);
+ istrm >> mm;
+ return istrm.good() || istrm.eof();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+bool is_list_ok(std::list<char> const& l)
+{
+ std::list<char>::const_iterator cit = l.begin();
+ if (cit == l.end() || *cit != 'a')
+ return false;
+ if (++cit == l.end() || *cit != 'b')
+ return false;
+
+ return ++cit != l.end() && *cit == 'c';
+}
+
+#endif