stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
+80
@@ -0,0 +1,80 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
|
||||
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_ITERATOR_ISTREAM_MAY_05_2007_0110PM)
|
||||
#define BOOST_SPIRIT_ITERATOR_ISTREAM_MAY_05_2007_0110PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi { namespace detail
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Iterator>
|
||||
struct iterator_source
|
||||
{
|
||||
typedef typename
|
||||
boost::detail::iterator_traits<Iterator>::value_type
|
||||
char_type;
|
||||
typedef boost::iostreams::seekable_device_tag category;
|
||||
|
||||
iterator_source (Iterator const& first_, Iterator const& last_)
|
||||
: first(first_), last(last_), pos(0)
|
||||
{}
|
||||
|
||||
// Read up to n characters from the input sequence into the buffer s,
|
||||
// returning the number of characters read, or -1 to indicate
|
||||
// end-of-sequence.
|
||||
std::streamsize read (char_type* s, std::streamsize n)
|
||||
{
|
||||
if (first == last)
|
||||
return -1;
|
||||
|
||||
std::streamsize bytes_read = 0;
|
||||
while (n--) {
|
||||
*s = *first;
|
||||
++s; ++bytes_read;
|
||||
if (++first == last)
|
||||
break;
|
||||
}
|
||||
|
||||
pos += bytes_read;
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
// Write is implemented only to satisfy the requirements of a
|
||||
// boost::iostreams::seekable_device. We need to have see support to
|
||||
// be able to figure out how many characters have been actually
|
||||
// consumed by the stream.
|
||||
std::streamsize write(const char_type*, std::streamsize)
|
||||
{
|
||||
BOOST_ASSERT(false); // not supported
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::streampos seek(boost::iostreams::stream_offset, std::ios_base::seekdir way)
|
||||
{
|
||||
BOOST_ASSERT(way == std::ios_base::cur); // only support queries
|
||||
return pos; // return current position
|
||||
}
|
||||
|
||||
Iterator first;
|
||||
Iterator const& last;
|
||||
std::streamsize pos;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
iterator_source& operator= (iterator_source const&);
|
||||
};
|
||||
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
|
||||
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_MATCH_MANIP_MAY_05_2007_1203PM)
|
||||
#define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1203PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/qi/parse.hpp>
|
||||
#include <boost/spirit/home/support/iterators/istream_iterator.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi { namespace detail
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr
|
||||
, typename CopyExpr = mpl::false_, typename CopyAttr = mpl::false_
|
||||
, typename Skipper = unused_type, typename Attribute = unused_type const>
|
||||
struct match_manip
|
||||
{
|
||||
// This assertion makes sure we don't hit the only code path which is
|
||||
// not implemented (because it isn't needed), where both, the
|
||||
// expression and the attribute need to be held as a copy.
|
||||
BOOST_SPIRIT_ASSERT_MSG(!CopyExpr::value || !CopyAttr::value
|
||||
, error_invalid_should_not_happen, ());
|
||||
|
||||
match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
|
||||
: expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
|
||||
|
||||
match_manip(Expr const& xpr, Skipper const& s
|
||||
, BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
|
||||
: expr(xpr), skipper(s), attr(a), post_skip(ps) {}
|
||||
|
||||
Expr const& expr;
|
||||
Skipper const& skipper;
|
||||
Attribute& attr;
|
||||
BOOST_SCOPED_ENUM(skip_flag) const post_skip;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
match_manip& operator= (match_manip const&);
|
||||
};
|
||||
|
||||
template <typename Expr, typename Skipper, typename Attribute>
|
||||
struct match_manip<Expr, mpl::false_, mpl::true_, Skipper, Attribute>
|
||||
{
|
||||
match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
|
||||
: expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
|
||||
|
||||
match_manip(Expr const& xpr, Skipper const& s
|
||||
, BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
|
||||
: expr(xpr), skipper(s), attr(a), post_skip(ps) {}
|
||||
|
||||
Expr const& expr;
|
||||
Skipper const& skipper;
|
||||
Attribute attr;
|
||||
BOOST_SCOPED_ENUM(skip_flag) const post_skip;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
match_manip& operator= (match_manip const&);
|
||||
};
|
||||
|
||||
template <typename Expr, typename Skipper, typename Attribute>
|
||||
struct match_manip<Expr, mpl::true_, mpl::false_, Skipper, Attribute>
|
||||
{
|
||||
match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
|
||||
: expr(xpr), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
|
||||
|
||||
match_manip(Expr const& xpr, Skipper const& s
|
||||
, BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
|
||||
: expr(xpr), skipper(s), attr(a), post_skip(ps) {}
|
||||
|
||||
Expr expr;
|
||||
Skipper const& skipper;
|
||||
Attribute& attr;
|
||||
BOOST_SCOPED_ENUM(skip_flag) const post_skip;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
match_manip& operator= (match_manip const&);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, typename Enable = void>
|
||||
struct match
|
||||
{
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then the expression (expr) is not a valid spirit qi expression.
|
||||
// Did you intend to use the auto_ facilities while forgetting to
|
||||
// #include <boost/spirit/include/qi_match_auto.hpp>?
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
};
|
||||
|
||||
template <typename Expr>
|
||||
struct match<Expr
|
||||
, typename enable_if<traits::matches<qi::domain, Expr> >::type>
|
||||
{
|
||||
typedef match_manip<Expr> type;
|
||||
|
||||
static type call(Expr const& expr)
|
||||
{
|
||||
return type(expr, unused, unused);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, typename Skipper, typename Enable = void>
|
||||
struct phrase_match
|
||||
{
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then the expression (expr) is not a valid spirit qi expression.
|
||||
// Did you intend to use the auto_ facilities while forgetting to
|
||||
// #include <boost/spirit/include/qi_match_auto.hpp>?
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
};
|
||||
|
||||
template <typename Expr, typename Skipper>
|
||||
struct phrase_match<Expr, Skipper
|
||||
, typename enable_if<traits::matches<qi::domain, Expr> >::type>
|
||||
{
|
||||
typedef match_manip<Expr, mpl::false_, mpl::false_, Skipper> type;
|
||||
|
||||
static type call(
|
||||
Expr const& expr
|
||||
, Skipper const& skipper
|
||||
, BOOST_SCOPED_ENUM(skip_flag) post_skip)
|
||||
{
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then the delimiter is not a valid spirit karma expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
|
||||
return type(expr, skipper, post_skip, unused);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename Char, typename Traits, typename Expr
|
||||
, typename CopyExpr, typename CopyAttr>
|
||||
inline std::basic_istream<Char, Traits> &
|
||||
operator>>(std::basic_istream<Char, Traits> &is,
|
||||
match_manip<Expr, CopyExpr, CopyAttr> const& fm)
|
||||
{
|
||||
typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
|
||||
|
||||
input_iterator f(is);
|
||||
input_iterator l;
|
||||
if (!qi::parse(f, l, fm.expr))
|
||||
{
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename Char, typename Traits, typename Expr
|
||||
, typename CopyExpr, typename CopyAttr
|
||||
, typename Attribute>
|
||||
inline std::basic_istream<Char, Traits> &
|
||||
operator>>(std::basic_istream<Char, Traits> &is,
|
||||
match_manip<Expr, CopyExpr, CopyAttr, unused_type, Attribute> const& fm)
|
||||
{
|
||||
typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
|
||||
|
||||
input_iterator f(is);
|
||||
input_iterator l;
|
||||
if (!qi::parse(f, l, fm.expr, fm.attr))
|
||||
{
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename Char, typename Traits, typename Expr
|
||||
, typename CopyExpr, typename CopyAttr
|
||||
, typename Skipper>
|
||||
inline std::basic_istream<Char, Traits> &
|
||||
operator>>(std::basic_istream<Char, Traits> &is,
|
||||
match_manip<Expr, CopyExpr, CopyAttr, Skipper> const& fm)
|
||||
{
|
||||
typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
|
||||
|
||||
input_iterator f(is);
|
||||
input_iterator l;
|
||||
if (!qi::phrase_parse(
|
||||
f, l, fm.expr, fm.skipper, fm.post_skip))
|
||||
{
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename Char, typename Traits, typename Expr
|
||||
, typename CopyExpr, typename CopyAttr
|
||||
, typename Attribute, typename Skipper
|
||||
>
|
||||
inline std::basic_istream<Char, Traits> &
|
||||
operator>>(
|
||||
std::basic_istream<Char, Traits> &is,
|
||||
match_manip<Expr, CopyExpr, CopyAttr, Attribute, Skipper> const& fm)
|
||||
{
|
||||
typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
|
||||
|
||||
input_iterator f(is);
|
||||
input_iterator l;
|
||||
if (!qi::phrase_parse(
|
||||
f, l, fm.expr, fm.skipper, fm.post_skip, fm.attr))
|
||||
{
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
|
||||
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_MATCH_MANIP_AUTO_DEC_02_2009_0813PM)
|
||||
#define BOOST_SPIRIT_MATCH_MANIP_AUTO_DEC_02_2009_0813PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
|
||||
#include <boost/spirit/home/qi/auto/create_parser.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi { namespace detail
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr>
|
||||
struct match<Expr
|
||||
, typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type>
|
||||
{
|
||||
typedef typename result_of::create_parser<Expr>::type expr_type;
|
||||
typedef match_manip<
|
||||
expr_type, mpl::true_, mpl::false_, unused_type, Expr
|
||||
> type;
|
||||
|
||||
static type call(Expr const& expr)
|
||||
{
|
||||
return type(create_parser<Expr>(), unused, const_cast<Expr&>(expr));
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, typename Skipper>
|
||||
struct phrase_match<Expr, Skipper
|
||||
, typename enable_if<traits::meta_create_exists<qi::domain, Expr> >::type>
|
||||
{
|
||||
typedef typename result_of::create_parser<Expr>::type expr_type;
|
||||
typedef match_manip<
|
||||
expr_type, mpl::true_, mpl::false_, Skipper, Expr
|
||||
> type;
|
||||
|
||||
static type call(
|
||||
Expr const& expr
|
||||
, Skipper const& skipper
|
||||
, BOOST_SCOPED_ENUM(skip_flag) post_skip)
|
||||
{
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then the delimiter is not a valid spirit karma expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
|
||||
return type(create_parser<Expr>(), skipper, post_skip
|
||||
, const_cast<Expr&>(expr));
|
||||
}
|
||||
};
|
||||
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,123 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
Copyright (c) 2001-2011 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_MATCH_MANIP_MAY_05_2007_1202PM)
|
||||
#define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/qi/parse.hpp>
|
||||
#include <boost/spirit/home/qi/parser.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr>
|
||||
inline typename detail::match<Expr>::type
|
||||
match(
|
||||
Expr const& expr)
|
||||
{
|
||||
return detail::match<Expr>::call(expr);
|
||||
}
|
||||
|
||||
template <typename Expr, typename Attribute>
|
||||
inline detail::match_manip<
|
||||
Expr, mpl::false_, mpl::false_, unused_type, Attribute
|
||||
>
|
||||
match(
|
||||
Expr const& xpr
|
||||
, Attribute& p)
|
||||
{
|
||||
using qi::detail::match_manip;
|
||||
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then the expression (expr) is not a valid spirit qi expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
return match_manip<Expr, mpl::false_, mpl::false_, unused_type, Attribute>(
|
||||
xpr, unused, p);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, typename Skipper>
|
||||
inline typename detail::phrase_match<Expr, Skipper>::type
|
||||
phrase_match(
|
||||
Expr const& expr
|
||||
, Skipper const& s
|
||||
, BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
|
||||
{
|
||||
return detail::phrase_match<Expr, Skipper>::call(expr, s, post_skip);
|
||||
}
|
||||
|
||||
template <typename Expr, typename Skipper, typename Attribute>
|
||||
inline detail::match_manip<
|
||||
Expr, mpl::false_, mpl::false_, Skipper, Attribute
|
||||
>
|
||||
phrase_match(
|
||||
Expr const& xpr
|
||||
, Skipper const& s
|
||||
, BOOST_SCOPED_ENUM(skip_flag) post_skip
|
||||
, Attribute& p)
|
||||
{
|
||||
using qi::detail::match_manip;
|
||||
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then either the expression (expr) or skipper is not a valid
|
||||
// spirit qi expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
|
||||
return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
|
||||
xpr, s, post_skip, p);
|
||||
}
|
||||
|
||||
template <typename Expr, typename Skipper, typename Attribute>
|
||||
inline detail::match_manip<
|
||||
Expr, mpl::false_, mpl::false_, Skipper, Attribute
|
||||
>
|
||||
phrase_match(
|
||||
Expr const& xpr
|
||||
, Skipper const& s
|
||||
, Attribute& p)
|
||||
{
|
||||
using qi::detail::match_manip;
|
||||
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then either the expression (expr) or skipper is not a valid
|
||||
// spirit qi expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
|
||||
return match_manip<Expr, mpl::false_, mpl::false_, Skipper, Attribute>(
|
||||
xpr, s, p);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename Char, typename Traits, typename Derived>
|
||||
inline std::basic_istream<Char, Traits>&
|
||||
operator>>(std::basic_istream<Char, Traits>& is, parser<Derived> const& p)
|
||||
{
|
||||
typedef spirit::basic_istream_iterator<Char, Traits> input_iterator;
|
||||
|
||||
input_iterator f(is);
|
||||
input_iterator l;
|
||||
if (!p.derived().parse(f, l, unused, unused, unused))
|
||||
{
|
||||
is.setstate(std::ios_base::failbit);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
Copyright (c) 2001-2011 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_PP_IS_ITERATING)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_MATCH_MANIP_ATTR_MAY_05_2007_1202PM)
|
||||
#define BOOST_SPIRIT_MATCH_MANIP_ATTR_MAY_05_2007_1202PM
|
||||
|
||||
#include <boost/spirit/home/qi/stream/match_manip.hpp>
|
||||
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/preprocessor/iterate.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/spirit/home/qi/stream/match_manip_attr.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
#define BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE(z, n, A) BOOST_PP_CAT(A, n) &
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline detail::match_manip<Expr, mpl::false_, mpl::true_, unused_type
|
||||
, fusion::vector<
|
||||
BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
|
||||
> >
|
||||
match(
|
||||
Expr const& xpr
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
|
||||
{
|
||||
using qi::detail::match_manip;
|
||||
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then the expression (expr) is not a valid spirit qi expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
|
||||
typedef fusion::vector<
|
||||
BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
|
||||
> vector_type;
|
||||
|
||||
vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
|
||||
return match_manip<Expr, mpl::false_, mpl::true_, unused_type, vector_type>(
|
||||
xpr, unused, attr);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, typename Skipper
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline detail::match_manip<Expr, mpl::false_, mpl::true_, Skipper
|
||||
, fusion::vector<
|
||||
BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
|
||||
> >
|
||||
phrase_match(
|
||||
Expr const& xpr
|
||||
, Skipper const& s
|
||||
, BOOST_SCOPED_ENUM(skip_flag) post_skip
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
|
||||
{
|
||||
using qi::detail::match_manip;
|
||||
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then either the expression (expr) or skipper is not a valid
|
||||
// spirit qi expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
|
||||
|
||||
typedef fusion::vector<
|
||||
BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
|
||||
> vector_type;
|
||||
|
||||
vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
|
||||
return match_manip<Expr, mpl::false_, mpl::true_, Skipper, vector_type>(
|
||||
xpr, s, post_skip, attr);
|
||||
}
|
||||
|
||||
template <typename Expr, typename Skipper
|
||||
, BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
inline detail::match_manip<Expr, mpl::false_, mpl::true_, Skipper
|
||||
, fusion::vector<
|
||||
BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
|
||||
> >
|
||||
phrase_match(
|
||||
Expr const& xpr
|
||||
, Skipper const& s
|
||||
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
|
||||
{
|
||||
using qi::detail::match_manip;
|
||||
|
||||
// Report invalid expression error as early as possible.
|
||||
// If you got an error_invalid_expression error message here,
|
||||
// then either the expression (expr) or skipper is not a valid
|
||||
// spirit qi expression.
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
|
||||
BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper);
|
||||
|
||||
typedef fusion::vector<
|
||||
BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
|
||||
> vector_type;
|
||||
|
||||
vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
|
||||
return match_manip<Expr, mpl::false_, mpl::true_, Skipper, vector_type>(
|
||||
xpr, s, attr);
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
#undef BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE
|
||||
#undef N
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
|
||||
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_STREAM_MAY_05_2007_1228PM)
|
||||
#define BOOST_SPIRIT_STREAM_MAY_05_2007_1228PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/qi/detail/string_parse.hpp>
|
||||
#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
|
||||
#include <boost/spirit/home/qi/stream/detail/iterator_source.hpp>
|
||||
#include <boost/spirit/home/support/detail/hold_any.hpp>
|
||||
|
||||
#include <iosfwd>
|
||||
#include <sstream>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Enablers
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <>
|
||||
struct use_terminal<qi::domain, tag::stream> // enables stream
|
||||
: mpl::true_ {};
|
||||
|
||||
template <>
|
||||
struct use_terminal<qi::domain, tag::wstream> // enables wstream
|
||||
: mpl::true_ {};
|
||||
}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace qi
|
||||
{
|
||||
#ifndef BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
|
||||
using spirit::stream;
|
||||
using spirit::wstream;
|
||||
#endif
|
||||
using spirit::stream_type;
|
||||
using spirit::wstream_type;
|
||||
|
||||
template <typename Char = char, typename T = spirit::basic_hold_any<char> >
|
||||
struct stream_parser
|
||||
: primitive_parser<stream_parser<Char, T> >
|
||||
{
|
||||
template <typename Context, typename Iterator>
|
||||
struct attribute
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename Iterator, typename Context
|
||||
, typename Skipper, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& /*context*/, Skipper const& skipper
|
||||
, Attribute& attr_) const
|
||||
{
|
||||
typedef qi::detail::iterator_source<Iterator> source_device;
|
||||
typedef boost::iostreams::stream<source_device> instream;
|
||||
|
||||
qi::skip_over(first, last, skipper);
|
||||
|
||||
instream in(first, last); // copies 'first'
|
||||
in >> attr_; // use existing operator>>()
|
||||
|
||||
// advance the iterator if everything is ok
|
||||
if (in) {
|
||||
if (!in.eof()) {
|
||||
std::streamsize pos = in.tellg();
|
||||
std::advance(first, pos);
|
||||
} else {
|
||||
first = last;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
info what(Context& /*context*/) const
|
||||
{
|
||||
return info("stream");
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Char = char>
|
||||
struct typed_stream
|
||||
: proto::terminal<stream_parser<Char, T> >::type
|
||||
{
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Parser generators: make_xxx function (objects)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Char>
|
||||
struct make_stream
|
||||
{
|
||||
typedef stream_parser<Char> result_type;
|
||||
result_type operator()(unused_type, unused_type) const
|
||||
{
|
||||
return result_type();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Modifiers>
|
||||
struct make_primitive<tag::stream, Modifiers> : make_stream<char> {};
|
||||
|
||||
template <typename Modifiers>
|
||||
struct make_primitive<tag::wstream, Modifiers> : make_stream<wchar_t> {};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user