updated boost on windows
This commit is contained in:
@@ -40,8 +40,8 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context
|
||||
, typename RuleContext, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context const& context, RuleContext&, Attribute& attr_) const
|
||||
bool parse(Iterator& /* first */, Iterator const& /* last */
|
||||
, Context const& /* context */, RuleContext&, Attribute& attr_) const
|
||||
{
|
||||
// $$$ Change to copy_to once we have it $$$
|
||||
traits::move_to(value_, attr_);
|
||||
@@ -76,8 +76,8 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context
|
||||
, typename RuleContext, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context const& context, RuleContext&, Attribute& attr_) const
|
||||
bool parse(Iterator& /* first */, Iterator const& /* last */
|
||||
, Context const& /* context */, RuleContext&, Attribute& attr_) const
|
||||
{
|
||||
// $$$ Change to copy_to once we have it $$$
|
||||
traits::move_to(value_ + 0, value_ + N, attr_);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context const& context, unused_type, Attribute& attr) const
|
||||
, Context const& context, unused_type, Attribute& /* attr */) const
|
||||
{
|
||||
x3::skip_over(first, last, context);
|
||||
return f(x3::get<rule_context_tag>(context));
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/endian/arithmetic.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
@@ -37,7 +36,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, unused_type, Attribute& attr_param) const
|
||||
, Context const& context, unused_type, Attribute& attr_param) const
|
||||
{
|
||||
x3::skip_over(first, last, context);
|
||||
|
||||
@@ -69,7 +68,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, unused_type, Attribute& attr_param) const
|
||||
, Context const& context, unused_type, Attribute& attr_param) const
|
||||
{
|
||||
x3::skip_over(first, last, context);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
using standard::char_;
|
||||
using standard::lit;
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
namespace standard_wide
|
||||
{
|
||||
typedef any_char<char_encoding::standard_wide> char_type;
|
||||
@@ -49,6 +50,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
return { ch };
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace ascii
|
||||
{
|
||||
@@ -103,6 +105,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
template <>
|
||||
struct as_parser<wchar_t>
|
||||
{
|
||||
@@ -117,6 +120,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
return { ch };
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct as_parser<char [2]>
|
||||
@@ -133,6 +137,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
template <>
|
||||
struct as_parser<wchar_t [2]>
|
||||
{
|
||||
@@ -147,6 +152,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
return { ch[0] };
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,9 @@ namespace boost { namespace spirit { namespace x3
|
||||
/***/
|
||||
|
||||
BOOST_SPIRIT_X3_CHAR_CLASSES(standard)
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
BOOST_SPIRIT_X3_CHAR_CLASSES(standard_wide)
|
||||
#endif
|
||||
BOOST_SPIRIT_X3_CHAR_CLASSES(ascii)
|
||||
BOOST_SPIRIT_X3_CHAR_CLASSES(iso8859_1)
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
: from(from_), to(to_) {}
|
||||
|
||||
template <typename Char, typename Context>
|
||||
bool test(Char ch_, Context& context) const
|
||||
bool test(Char ch_, Context const& context) const
|
||||
{
|
||||
|
||||
char_type ch = char_type(ch_); // optimize for token based parsing
|
||||
@@ -115,7 +115,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
struct get_info<char_set<Encoding, Attribute>>
|
||||
{
|
||||
typedef std::string result_type;
|
||||
std::string operator()(char_set<Encoding, Attribute> const& p) const
|
||||
std::string operator()(char_set<Encoding, Attribute> const& /* p */) const
|
||||
{
|
||||
return "char-set";
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
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(SPIRIT_ACTION_JANUARY_07_2007_1128AM)
|
||||
#define SPIRIT_ACTION_JANUARY_07_2007_1128AM
|
||||
#if !defined(BOOST_SPIRIT_X3_ACTION_JANUARY_07_2007_1128AM)
|
||||
#define BOOST_SPIRIT_X3_ACTION_JANUARY_07_2007_1128AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/make_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/core/call.hpp>
|
||||
#include <boost/spirit/home/x3/nonterminal/detail/transform_attribute.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
@@ -82,14 +81,9 @@ namespace boost { namespace spirit { namespace x3
|
||||
typedef typename
|
||||
traits::attribute_of<action<Subject, Action>, Context>::type
|
||||
attribute_type;
|
||||
typedef traits::make_attribute<attribute_type, unused_type> make_attribute;
|
||||
typedef traits::transform_attribute<
|
||||
typename make_attribute::type, attribute_type, parser_id>
|
||||
transform;
|
||||
|
||||
// synthesize the attribute since one is not supplied
|
||||
typename make_attribute::type made_attr = make_attribute::call(unused_type());
|
||||
typename transform::type attr = transform::pre(made_attr);
|
||||
attribute_type attr{};
|
||||
return parse_main(first, last, context, rcontext, attr);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_CALL_CONTEXT_MAY_26_2014_0234PM)
|
||||
#define SPIRIT_CALL_CONTEXT_MAY_26_2014_0234PM
|
||||
#if !defined(BOOST_SPIRIT_X3_CALL_CONTEXT_MAY_26_2014_0234PM)
|
||||
#define BOOST_SPIRIT_X3_CALL_CONTEXT_MAY_26_2014_0234PM
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
|
||||
template <typename F, typename Context>
|
||||
auto call(F f, Context const& context, mpl::false_)
|
||||
auto call(F f, Context const& /* context */, mpl::false_)
|
||||
{
|
||||
return f();
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM)
|
||||
#define SPIRIT_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM
|
||||
#if !defined(BOOST_SPIRIT_X3_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM)
|
||||
#define BOOST_SPIRIT_X3_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/move_to.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/fusion/include/at_key.hpp>
|
||||
#include <boost/fusion/include/front.hpp>
|
||||
#include <boost/fusion/include/back.hpp>
|
||||
#include <boost/variant/apply_visitor.hpp>
|
||||
#include <iterator> // for std::make_move_iterator
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
{
|
||||
@@ -37,10 +39,6 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
/* $$$ clang reports: warning: class template partial specialization contains
|
||||
* a template parameter that can not be deduced; this partial specialization
|
||||
* will never be used $$$
|
||||
*
|
||||
// save to associative fusion container where Key
|
||||
// is variant over possible keys
|
||||
template <typename ...T>
|
||||
@@ -54,7 +52,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
apply_visitor(saver_visitor<Attribute, Value>(attr, value), key);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
template <typename Attribute, typename Value>
|
||||
struct saver_visitor : boost::static_visitor<void>
|
||||
{
|
||||
@@ -102,7 +100,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
return false;
|
||||
|
||||
// push the parsed value into our attribute
|
||||
traits::push_back(attr, val);
|
||||
traits::push_back(attr, static_cast<value_type&&>(val));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -202,7 +200,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
static bool call(
|
||||
Parser const& parser
|
||||
, Iterator& first, Iterator const& last, Context const& context
|
||||
, RContext& rcontext, Attribute& attr, mpl::false_)
|
||||
, RContext& rcontext, Attribute& /* attr */, mpl::false_)
|
||||
{
|
||||
return parser.parse(first, last, context, rcontext, unused);
|
||||
}
|
||||
@@ -245,13 +243,29 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
parser, first, last, context, rcontext, attr);
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
static bool call(
|
||||
Parser const& parser
|
||||
, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, unused_type attr, mpl::true_)
|
||||
{
|
||||
return parser.parse(first, last, context, rcontext, attr);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Attribute>
|
||||
static bool call(
|
||||
Parser const& parser
|
||||
, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, Attribute& attr, mpl::true_)
|
||||
{
|
||||
return parser.parse(first, last, context, rcontext, attr);
|
||||
if (traits::is_empty(attr))
|
||||
return parser.parse(first, last, context, rcontext, attr);
|
||||
Attribute rest;
|
||||
bool r = parser.parse(first, last, context, rcontext, rest);
|
||||
if (r)
|
||||
traits::append(attr, std::make_move_iterator(rest.begin()),
|
||||
std::make_move_iterator(rest.end()));
|
||||
return r;
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Attribute>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/core/skip_over.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/iterator/iterator_concepts.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
@@ -23,11 +23,12 @@ namespace boost { namespace spirit { namespace x3
|
||||
, Parser const& p
|
||||
, Attribute& attr)
|
||||
{
|
||||
// Make sure the iterator is at least a forward_iterator. If you got a
|
||||
// compilation error here, then you are using an input_iterator while
|
||||
// calling this function. You need to supply at least a forward_iterator
|
||||
// instead.
|
||||
BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
|
||||
// Make sure the iterator is at least a readable forward traversal iterator.
|
||||
// If you got a compilation error here, then you are using a weaker iterator
|
||||
// while calling this function, you need to supply a readable forward traversal
|
||||
// iterator instead.
|
||||
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<Iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept<Iterator>));
|
||||
|
||||
// If you get an error no matching function for call to 'as_parser'
|
||||
// here, then p is not a parser or there is no suitable conversion
|
||||
@@ -101,11 +102,12 @@ namespace boost { namespace spirit { namespace x3
|
||||
, Attribute& attr
|
||||
, skip_flag post_skip = skip_flag::post_skip)
|
||||
{
|
||||
// Make sure the iterator is at least a forward_iterator. If you got a
|
||||
// compilation error here, then you are using an input_iterator while
|
||||
// calling this function. You need to supply at least a forward_iterator
|
||||
// instead.
|
||||
BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));
|
||||
// Make sure the iterator is at least a readable forward traversal iterator.
|
||||
// If you got a compilation error here, then you are using a weaker iterator
|
||||
// while calling this function, you need to supply a readable forward traversal
|
||||
// iterator instead.
|
||||
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIteratorConcept<Iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversalConcept<Iterator>));
|
||||
|
||||
static_assert(!std::is_same<Skipper, unused_type>::value,
|
||||
"Error! Skipper cannot be unused_type.");
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/support/utility/sfinae.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <string>
|
||||
|
||||
#if !defined(BOOST_SPIRIT_X3_NO_RTTI)
|
||||
@@ -49,20 +51,35 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
|
||||
template <typename Action>
|
||||
action<Derived, Action>
|
||||
operator[](Action f) const
|
||||
action<Derived, Action> operator[](Action f) const
|
||||
{
|
||||
return action<Derived, Action>(this->derived(), f);
|
||||
return { this->derived(), f };
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
guard<Derived, Handler>
|
||||
on_error(Handler f) const
|
||||
guard<Derived, Handler> on_error(Handler f) const
|
||||
{
|
||||
return guard<Derived, Handler>(this->derived(), f);
|
||||
return { this->derived(), f };
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
template <typename Parser>
|
||||
static void assert_initialized_rule(Parser const& p) {
|
||||
boost::ignore_unused(p);
|
||||
|
||||
// Assert that we are not copying an unitialized static rule. If
|
||||
// the static is in another TU, it may be initialized after we copy
|
||||
// it. If so, its name member will be nullptr.
|
||||
//
|
||||
// Rather than hardcoding behaviour for rule-type subject parsers,
|
||||
// we simply allow get_info<> to do the check in debug builds.
|
||||
#ifndef NDEBUG
|
||||
what(p); // note: allows get_info<> to diagnose the issue
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
struct unary_category;
|
||||
struct binary_category;
|
||||
|
||||
@@ -74,7 +91,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
static bool const has_action = Subject::has_action;
|
||||
|
||||
unary_parser(Subject const& subject)
|
||||
: subject(subject) {}
|
||||
: subject(subject) { detail::assert_initialized_rule(subject); }
|
||||
|
||||
unary_parser const& get_unary() const { return *this; }
|
||||
|
||||
@@ -91,7 +108,11 @@ namespace boost { namespace spirit { namespace x3
|
||||
left_type::has_action || right_type::has_action;
|
||||
|
||||
binary_parser(Left const& left, Right const& right)
|
||||
: left(left), right(right) {}
|
||||
: left(left), right(right)
|
||||
{
|
||||
detail::assert_initialized_rule(left);
|
||||
detail::assert_initialized_rule(right);
|
||||
}
|
||||
|
||||
binary_parser const& get_binary() const { return *this; }
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
inline void skip_over(
|
||||
Iterator& first, Iterator const& last, Skipper const& skipper)
|
||||
{
|
||||
while (first != last && skipper.parse(first, last, unused, unused, unused))
|
||||
while (skipper.parse(first, last, unused, unused, unused))
|
||||
/***/;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
, typename RContext, typename Attribute>
|
||||
bool parse(
|
||||
Iterator& first, Iterator const& last
|
||||
, Context& context, RContext& rcontext, Attribute& attr) const
|
||||
, Context const& context, RContext& rcontext, Attribute& attr) const
|
||||
{
|
||||
Iterator save = first;
|
||||
|
||||
|
||||
@@ -4,20 +4,21 @@
|
||||
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(SPIRIT_EXPECT_MARCH_16_2012_1024PM)
|
||||
#define SPIRIT_EXPECT_MARCH_16_2012_1024PM
|
||||
#if !defined(BOOST_SPIRIT_X3_EXPECT_MARCH_16_2012_1024PM)
|
||||
#define BOOST_SPIRIT_X3_EXPECT_MARCH_16_2012_1024PM
|
||||
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_SYMBOL_VISIBLE
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
template <typename Iterator>
|
||||
struct expectation_failure : std::runtime_error
|
||||
struct BOOST_SYMBOL_VISIBLE expectation_failure : std::runtime_error
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
: std::runtime_error("boost::spirit::x3::expectation_failure")
|
||||
, where_(where), which_(which)
|
||||
{}
|
||||
~expectation_failure() throw() {}
|
||||
~expectation_failure() {}
|
||||
|
||||
std::string which() const { return which_; }
|
||||
Iterator const& where() const { return where_; }
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_LEXEME_MARCH_24_2007_0802AM)
|
||||
#define SPIRIT_LEXEME_MARCH_24_2007_0802AM
|
||||
#if !defined(BOOST_SPIRIT_X3_LEXEME_MARCH_24_2007_0802AM)
|
||||
#define BOOST_SPIRIT_X3_LEXEME_MARCH_24_2007_0802AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_NO_CASE_SEPT_16_2014_0912PM)
|
||||
#define SPIRIT_NO_CASE_SEPT_16_2014_0912PM
|
||||
#if !defined(BOOST_SPIRIT_X3_NO_CASE_SEPT_16_2014_0912PM)
|
||||
#define BOOST_SPIRIT_X3_NO_CASE_SEPT_16_2014_0912PM
|
||||
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
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(SPIRIT_NO_SKIP_JAN_16_2010_0802PM)
|
||||
#define SPIRIT_NO_SKIP_JAN_16_2010_0802PM
|
||||
#if !defined(BOOST_SPIRIT_X3_NO_SKIP_JAN_16_2010_0802PM)
|
||||
#define BOOST_SPIRIT_X3_NO_SKIP_JAN_16_2010_0802PM
|
||||
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_OMIT_MARCH_24_2007_0802AM)
|
||||
#define SPIRIT_OMIT_MARCH_24_2007_0802AM
|
||||
#if !defined(BOOST_SPIRIT_X3_OMIT_MARCH_24_2007_0802AM)
|
||||
#define BOOST_SPIRIT_X3_OMIT_MARCH_24_2007_0802AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#if !defined(SPIRIT_X3_REPEAT_APRIL_16_2014_0848AM)
|
||||
#define SPIRIT_X3_REPEAT_APRIL_16_2014_0848AM
|
||||
|
||||
#include <boost/function_types/function_type.hpp>
|
||||
#include <boost/function_types/parameter_types.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/operator/kleene.hpp>
|
||||
|
||||
@@ -98,10 +96,9 @@ namespace boost { namespace spirit { namespace x3
|
||||
struct repeat_gen
|
||||
{
|
||||
template<typename Subject>
|
||||
kleene<typename extension::as_parser<Subject>::value_type>
|
||||
operator[](Subject const& subject) const
|
||||
auto operator[](Subject const& subject) const
|
||||
{
|
||||
return { as_parser(subject) };
|
||||
return *as_parser(subject);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_SKIP_JANUARY_26_2008_0422PM)
|
||||
#define SPIRIT_SKIP_JANUARY_26_2008_0422PM
|
||||
#if !defined(BOOST_SPIRIT_X3_SKIP_JANUARY_26_2008_0422PM)
|
||||
#define BOOST_SPIRIT_X3_SKIP_JANUARY_26_2008_0422PM
|
||||
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
|
||||
@@ -21,18 +21,18 @@ namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
typedef unary_parser<Subject, Derived> base_type;
|
||||
mutable T val;
|
||||
with_value_holder(Subject const& subject, T const& val)
|
||||
with_value_holder(Subject const& subject, T&& val)
|
||||
: base_type(subject)
|
||||
, val(val) {}
|
||||
, val(std::forward<T>(val)) {}
|
||||
};
|
||||
|
||||
template <typename Subject, typename Derived, typename T>
|
||||
struct with_value_holder<Subject, Derived, T const>
|
||||
struct with_value_holder<Subject, Derived, T&>
|
||||
: unary_parser<Subject, Derived>
|
||||
{
|
||||
typedef unary_parser<Subject, Derived> base_type;
|
||||
T val;
|
||||
with_value_holder(Subject const& subject, T const& val)
|
||||
T& val;
|
||||
with_value_holder(Subject const& subject, T& val)
|
||||
: base_type(subject)
|
||||
, val(val) {}
|
||||
};
|
||||
@@ -47,8 +47,8 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
typedef Subject subject_type;
|
||||
|
||||
with_directive(Subject const& subject, T const& val)
|
||||
: base_type(subject, val) {}
|
||||
with_directive(Subject const& subject, T&& val)
|
||||
: base_type(subject, std::forward<T>(val)) {}
|
||||
|
||||
template <typename Iterator, typename Context
|
||||
, typename RContext, typename Attribute>
|
||||
@@ -63,44 +63,23 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ID, typename T, typename NextContext = unused_type>
|
||||
struct with_context
|
||||
{
|
||||
typedef context<ID, T, NextContext> type;
|
||||
};
|
||||
|
||||
template <typename ID, typename T>
|
||||
struct with_context<ID, T, unused_type>
|
||||
{
|
||||
typedef context<ID, T> type;
|
||||
};
|
||||
|
||||
template <typename ID, typename T>
|
||||
struct with_gen
|
||||
{
|
||||
T& val;
|
||||
|
||||
with_gen(T& val)
|
||||
: val(val) {}
|
||||
T&& val;
|
||||
|
||||
template <typename Subject>
|
||||
with_directive<typename extension::as_parser<Subject>::value_type, ID, T>
|
||||
operator[](Subject const& subject) const
|
||||
{
|
||||
return { as_parser(subject), val };
|
||||
return { as_parser(subject), std::forward<T>(val) };
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ID, typename T>
|
||||
inline with_gen<ID, T> with(T& val)
|
||||
inline with_gen<ID, T> with(T&& val)
|
||||
{
|
||||
return { val };
|
||||
}
|
||||
|
||||
template <typename ID, typename T>
|
||||
inline with_gen<ID, T const> with(T const& val)
|
||||
{
|
||||
return { val };
|
||||
return { std::forward<T>(val) };
|
||||
}
|
||||
}}}
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
#if !defined(BOOST_SPIRIT_X3_DETAIL_RULE_JAN_08_2012_0326PM)
|
||||
#define BOOST_SPIRIT_X3_DETAIL_RULE_JAN_08_2012_0326PM
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
#include <boost/spirit/home/x3/auxiliary/guard.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/core/skip_over.hpp>
|
||||
#include <boost/spirit/home/x3/directive/expect.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/make_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/support/utility/sfinae.hpp>
|
||||
#include <boost/spirit/home/x3/nonterminal/detail/transform_attribute.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
@@ -138,7 +138,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
|
||||
template <typename ID, typename RHS, typename Context>
|
||||
Context const&
|
||||
make_rule_context(RHS const& rhs, Context const& context
|
||||
make_rule_context(RHS const& /* rhs */, Context const& context
|
||||
, mpl::false_ /* is_default_parse_rule */)
|
||||
{
|
||||
return context;
|
||||
@@ -156,8 +156,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
{
|
||||
template <typename Iterator, typename Context, typename ActualAttribute>
|
||||
static bool call_on_success(
|
||||
Iterator& first, Iterator const& last
|
||||
, Context const& context, ActualAttribute& attr
|
||||
Iterator& /* first */, Iterator const& /* last */
|
||||
, Context const& /* context */, ActualAttribute& /* attr */
|
||||
, mpl::false_ /* No on_success handler */ )
|
||||
{
|
||||
return true;
|
||||
@@ -285,7 +285,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
static bool parse_rhs(
|
||||
RHS const& rhs
|
||||
, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, ActualAttribute& attr
|
||||
, Context const& context, RContext& rcontext, ActualAttribute& /* attr */
|
||||
, mpl::true_)
|
||||
{
|
||||
return parse_rhs_main(rhs, first, last, context, rcontext, unused);
|
||||
@@ -300,18 +300,16 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
, Context const& context, ActualAttribute& attr
|
||||
, ExplicitAttrPropagation)
|
||||
{
|
||||
typedef traits::make_attribute<Attribute, ActualAttribute> make_attribute;
|
||||
boost::ignore_unused(rule_name);
|
||||
|
||||
// do down-stream transformation, provides attribute for
|
||||
// rhs parser
|
||||
typedef traits::transform_attribute<
|
||||
typename make_attribute::type, Attribute, parser_id>
|
||||
ActualAttribute, Attribute, parser_id>
|
||||
transform;
|
||||
|
||||
typedef typename make_attribute::value_type value_type;
|
||||
typedef typename transform::type transform_attr;
|
||||
value_type made_attr = make_attribute::call(attr);
|
||||
transform_attr attr_ = transform::pre(made_attr);
|
||||
transform_attr attr_ = transform::pre(attr);
|
||||
|
||||
bool ok_parse
|
||||
//Creates a place to hold the result of parse_rhs
|
||||
@@ -322,12 +320,11 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
// the #if...#endif) to call it's DTOR before any
|
||||
// modifications are made to the attribute, attr_ passed
|
||||
// to parse_rhs (such as might be done in
|
||||
// traits::post_transform when, for example,
|
||||
// transform::post when, for example,
|
||||
// ActualAttribute is a recursive variant).
|
||||
#if defined(BOOST_SPIRIT_X3_DEBUG)
|
||||
typedef typename make_attribute::type dbg_attribute_type;
|
||||
context_debug<Iterator, dbg_attribute_type>
|
||||
dbg(rule_name, first, last, dbg_attribute_type(attr_), ok_parse);
|
||||
context_debug<Iterator, transform_attr>
|
||||
dbg(rule_name, first, last, attr_, ok_parse);
|
||||
#endif
|
||||
ok_parse = parse_rhs(rhs, first, last, context, attr_, attr_
|
||||
, mpl::bool_
|
||||
@@ -341,7 +338,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
{
|
||||
// do up-stream transformation, this integrates the results
|
||||
// back into the original attribute value, if appropriate
|
||||
traits::post_transform(attr, std::forward<transform_attr>(attr_));
|
||||
transform::post(attr, std::forward<transform_attr>(attr_));
|
||||
}
|
||||
return ok_parse;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/transform_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/move_to.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -44,15 +45,6 @@ namespace boost { namespace spirit { namespace x3
|
||||
struct transform_attribute
|
||||
: default_transform_attribute<Exposed, Transformed> {};
|
||||
|
||||
// reference types need special handling
|
||||
template <typename Attribute>
|
||||
struct transform_attribute<Attribute&, Attribute>
|
||||
{
|
||||
typedef Attribute& type;
|
||||
static Attribute& pre(Attribute& val) { return val; }
|
||||
static void post(Attribute&, Attribute const&) {}
|
||||
};
|
||||
|
||||
// unused_type needs some special handling as well
|
||||
template <>
|
||||
struct transform_attribute<unused_type, unused_type>
|
||||
@@ -88,23 +80,13 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
template <typename Exposed, typename Transformed>
|
||||
struct transform_attribute<Exposed, Transformed, x3::parser_id>
|
||||
: x3::transform_attribute<Exposed, Transformed> {};
|
||||
|
||||
template <typename Exposed, typename Transformed>
|
||||
struct transform_attribute<Exposed&, Transformed, x3::parser_id>
|
||||
: transform_attribute<Exposed, Transformed, x3::parser_id> {};
|
||||
|
||||
template <typename Attribute>
|
||||
struct transform_attribute<Attribute&, Attribute, x3::parser_id>
|
||||
: x3::transform_attribute<Attribute&, Attribute> {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Exposed, typename Transformed>
|
||||
void post_transform(Exposed& dest, Transformed&& attr)
|
||||
: x3::transform_attribute<Exposed, Transformed>
|
||||
{
|
||||
return transform_attribute<Exposed, Transformed, x3::parser_id>
|
||||
::post(dest, std::forward<Transformed>(attr));
|
||||
}
|
||||
static_assert(!std::is_reference<Exposed>::value,
|
||||
"Exposed cannot be a reference type");
|
||||
static_assert(!std::is_reference<Transformed>::value,
|
||||
"Transformed cannot be a reference type");
|
||||
};
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <boost/preprocessor/variadic/to_seq.hpp>
|
||||
#include <boost/preprocessor/variadic/elem.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(BOOST_SPIRIT_X3_NO_RTTI)
|
||||
#include <typeinfo>
|
||||
@@ -20,15 +21,12 @@
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
template <typename ID>
|
||||
struct identity {};
|
||||
|
||||
// default parse_rule implementation
|
||||
template <typename ID, typename Attribute, typename Iterator
|
||||
, typename Context, typename ActualAttribute>
|
||||
inline detail::default_parse_rule_result
|
||||
parse_rule(
|
||||
rule<ID, Attribute> rule_
|
||||
rule<ID, Attribute> /* rule_ */
|
||||
, Iterator& first, Iterator const& last
|
||||
, Context const& context, ActualAttribute& attr)
|
||||
{
|
||||
@@ -78,7 +76,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
typedef ID id;
|
||||
typedef Attribute attribute_type;
|
||||
static bool const has_attribute =
|
||||
!is_same<Attribute, unused_type>::value;
|
||||
!std::is_same<std::remove_const_t<Attribute>, unused_type>::value;
|
||||
static bool const handles_container =
|
||||
traits::is_container<Attribute>::value;
|
||||
static bool const force_attribute = force_attribute_;
|
||||
@@ -113,7 +111,32 @@ namespace boost { namespace spirit { namespace x3
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context const& context, unused_type, Attribute_& attr) const
|
||||
{
|
||||
return parse_rule(*this, first, last, context, attr);
|
||||
static_assert(has_attribute,
|
||||
"The rule does not have an attribute. Check your parser.");
|
||||
|
||||
using transform = traits::transform_attribute<
|
||||
Attribute_, attribute_type, parser_id>;
|
||||
|
||||
using transform_attr = typename transform::type;
|
||||
transform_attr attr_ = transform::pre(attr);
|
||||
|
||||
if (parse_rule(*this, first, last, context, attr_)) {
|
||||
transform::post(attr, std::forward<transform_attr>(attr_));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Context>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context const& context, unused_type, unused_type) const
|
||||
{
|
||||
static_assert(!has_attribute,
|
||||
"The rule requires an input attribute. Check your parser.");
|
||||
|
||||
// make sure we pass exactly the rule attribute type
|
||||
attribute_type no_attr;
|
||||
return parse_rule(*this, first, last, context, no_attr);
|
||||
}
|
||||
|
||||
char const* name;
|
||||
@@ -137,44 +160,61 @@ namespace boost { namespace spirit { namespace x3
|
||||
typedef std::string result_type;
|
||||
std::string operator()(T const& r) const
|
||||
{
|
||||
return r.name;
|
||||
BOOST_ASSERT_MSG(r.name, "uninitialized rule"); // static initialization order fiasco
|
||||
return r.name? r.name : "uninitialized";
|
||||
}
|
||||
};
|
||||
|
||||
#define BOOST_SPIRIT_DECLARE_(r, data, rule_type) \
|
||||
template <typename Iterator, typename Context, typename Attribute> \
|
||||
template <typename Iterator, typename Context> \
|
||||
bool parse_rule( \
|
||||
rule_type rule_ \
|
||||
, Iterator& first, Iterator const& last \
|
||||
, Context const& context, Attribute& attr); \
|
||||
, Context const& context, rule_type::attribute_type& attr); \
|
||||
/***/
|
||||
|
||||
#define BOOST_SPIRIT_DECLARE(...) BOOST_PP_SEQ_FOR_EACH( \
|
||||
BOOST_SPIRIT_DECLARE_, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \
|
||||
/***/
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1910)
|
||||
#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
|
||||
template <typename Iterator, typename Context, typename Attribute> \
|
||||
using BOOST_PP_CAT(rule_name, _synonym) = decltype(rule_name); \
|
||||
template <typename Iterator, typename Context> \
|
||||
inline bool parse_rule( \
|
||||
decltype(rule_name) rule_ \
|
||||
BOOST_PP_CAT(rule_name, _synonym) /* rule_ */ \
|
||||
, Iterator& first, Iterator const& last \
|
||||
, Context const& context, Attribute& attr) \
|
||||
, Context const& context, BOOST_PP_CAT(rule_name, _synonym)::attribute_type& attr) \
|
||||
{ \
|
||||
using boost::spirit::x3::unused; \
|
||||
static auto const def_ = (rule_name = BOOST_PP_CAT(rule_name, _def)); \
|
||||
return def_.parse(first, last, context, unused, attr); \
|
||||
} \
|
||||
/***/
|
||||
#else
|
||||
#define BOOST_SPIRIT_DEFINE_(r, data, rule_name) \
|
||||
template <typename Iterator, typename Context> \
|
||||
inline bool parse_rule( \
|
||||
decltype(rule_name) /* rule_ */ \
|
||||
, Iterator& first, Iterator const& last \
|
||||
, Context const& context, decltype(rule_name)::attribute_type& attr) \
|
||||
{ \
|
||||
using boost::spirit::x3::unused; \
|
||||
static auto const def_ = (rule_name = BOOST_PP_CAT(rule_name, _def)); \
|
||||
return def_.parse(first, last, context, unused, attr); \
|
||||
} \
|
||||
/***/
|
||||
#endif
|
||||
|
||||
#define BOOST_SPIRIT_DEFINE(...) BOOST_PP_SEQ_FOR_EACH( \
|
||||
BOOST_SPIRIT_DEFINE_, _, BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__)) \
|
||||
/***/
|
||||
|
||||
#define BOOST_SPIRIT_INSTANTIATE(rule_type, Iterator, Context) \
|
||||
template bool parse_rule<Iterator, Context, rule_type::attribute_type>( \
|
||||
template bool parse_rule<Iterator, Context>( \
|
||||
rule_type rule_ \
|
||||
, Iterator& first, Iterator const& last \
|
||||
, Context const& context, rule_type::attribute_type& attr); \
|
||||
, Context const& context, rule_type::attribute_type&); \
|
||||
/***/
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <boost/spirit/home/x3/support/traits/print_token.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/print_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/nonterminal/debug_handler_state.hpp>
|
||||
#include <boost/fusion/include/out.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <iostream>
|
||||
|
||||
@@ -102,11 +101,6 @@ namespace boost { namespace spirit { namespace x3
|
||||
<< "</attributes>";
|
||||
out << std::endl;
|
||||
}
|
||||
//~ if (!fusion::empty(context.locals))
|
||||
//~ out
|
||||
//~ << "<locals>"
|
||||
//~ << context.locals
|
||||
//~ << "</locals>";
|
||||
print_indent(--indent);
|
||||
out
|
||||
<< "</" << rule_name << '>'
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <boost/spirit/home/x3/numeric/bool.hpp>
|
||||
#include <boost/spirit/home/x3/numeric/int.hpp>
|
||||
#include <boost/spirit/home/x3/numeric/uint.hpp>
|
||||
#ifndef BOOST_SPIRIT_NO_REAL_NUMBERS
|
||||
#include <boost/spirit/home/x3/numeric/real.hpp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context>
|
||||
bool parse_main(Iterator& first, Iterator const& last
|
||||
, Context& context, T& attr) const
|
||||
, Context const& context, T& attr) const
|
||||
{
|
||||
x3::skip_over(first, last, context);
|
||||
return (n_ && policies.parse_true(first, last, attr, get_case_compare<encoding>(context)))
|
||||
@@ -79,7 +79,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, unused_type, T& attr) const
|
||||
, Context const& context, unused_type, T& attr) const
|
||||
{
|
||||
return parse_main(first, last, context, attr);
|
||||
}
|
||||
@@ -114,6 +114,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
false_type const false_ = { false };
|
||||
}
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
namespace standard_wide
|
||||
{
|
||||
typedef bool_parser<bool, char_encoding::standard_wide> bool_type;
|
||||
@@ -125,6 +126,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
typedef literal_bool_parser<bool, char_encoding::standard_wide> false_type;
|
||||
false_type const false_ = { false };
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace ascii
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_QI_BOOL_POLICIES_SEP_29_2009_0710AM)
|
||||
#define SPIRIT_QI_BOOL_POLICIES_SEP_29_2009_0710AM
|
||||
#if !defined(BOOST_SPIRIT_X3_BOOL_POLICIES_SEP_29_2009_0710AM)
|
||||
#define BOOST_SPIRIT_X3_BOOL_POLICIES_SEP_29_2009_0710AM
|
||||
|
||||
#include <boost/spirit/home/x3/string/detail/string_parse.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/move_to.hpp>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, unused_type, T& attr_) const
|
||||
, Context const& context, unused_type, T& attr_) const
|
||||
{
|
||||
x3::skip_over(first, last, context);
|
||||
return extract_real<T, RealPolicies>::parse(first, last, attr_, policies);
|
||||
@@ -36,7 +36,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Iterator, typename Context, typename Attribute>
|
||||
bool parse(Iterator& first, Iterator const& last
|
||||
, Context& context, unused_type, Attribute& attr_param) const
|
||||
, Context const& context, unused_type, Attribute& attr_param) const
|
||||
{
|
||||
// this case is called when Attribute is not T
|
||||
T attr_;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_REAL_POLICIES_APRIL_17_2006_1158PM)
|
||||
#define SPIRIT_REAL_POLICIES_APRIL_17_2006_1158PM
|
||||
#if !defined(BOOST_SPIRIT_X3_REAL_POLICIES_APRIL_17_2006_1158PM)
|
||||
#define BOOST_SPIRIT_X3_REAL_POLICIES_APRIL_17_2006_1158PM
|
||||
|
||||
#include <boost/spirit/home/x3/string/detail/string_parse.hpp>
|
||||
#include <boost/spirit/home/x3/support/numeric_utils/extract_int.hpp>
|
||||
@@ -73,22 +73,9 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// The parse_nan() and parse_inf() functions get called whenever:
|
||||
//
|
||||
// - a number to parse does not start with a digit (after having
|
||||
// successfully parsed an optional sign)
|
||||
//
|
||||
// or
|
||||
//
|
||||
// - after a floating point number of the value 1 (having no
|
||||
// exponential part and a fractional part value of 0) has been
|
||||
// parsed.
|
||||
//
|
||||
// The first call allows to recognize representations of NaN or Inf
|
||||
// starting with a non-digit character (such as NaN, Inf, QNaN etc.).
|
||||
//
|
||||
// The second call allows to recognize representation formats starting
|
||||
// with a 1.0 (such as 1.0#NAN or 1.0#INF etc.).
|
||||
// The parse_nan() and parse_inf() functions get called whenever
|
||||
// a number to parse does not start with a digit (after having
|
||||
// successfully parsed an optional sign).
|
||||
//
|
||||
// The functions should return true if a Nan or Inf has been found. In
|
||||
// this case the attr should be set to the matched value (NaN or
|
||||
@@ -112,7 +99,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
// nan[(...)] ?
|
||||
if (detail::string_parse("nan", "NAN", first, last, unused))
|
||||
{
|
||||
if (*first == '(')
|
||||
if (first != last && *first == '(')
|
||||
{
|
||||
// skip trailing (...) part
|
||||
Iterator i = first;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_ALTERNATIVE_JAN_07_2013_1131AM)
|
||||
#define SPIRIT_ALTERNATIVE_JAN_07_2013_1131AM
|
||||
#if !defined(BOOST_SPIRIT_X3_ALTERNATIVE_JAN_07_2013_1131AM)
|
||||
#define BOOST_SPIRIT_X3_ALTERNATIVE_JAN_07_2013_1131AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_AND_PREDICATE_MARCH_23_2007_0617PM)
|
||||
#define SPIRIT_AND_PREDICATE_MARCH_23_2007_0617PM
|
||||
#if !defined(BOOST_SPIRIT_X3_AND_PREDICATE_MARCH_23_2007_0617PM)
|
||||
#define BOOST_SPIRIT_X3_AND_PREDICATE_MARCH_23_2007_0617PM
|
||||
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM)
|
||||
#define SPIRIT_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM
|
||||
#if !defined(BOOST_SPIRIT_X3_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM)
|
||||
#define BOOST_SPIRIT_X3_ALTERNATIVE_DETAIL_JAN_07_2013_1245PM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/is_variant.hpp>
|
||||
@@ -226,7 +226,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
struct move_if_not_alternative
|
||||
{
|
||||
template<typename T1, typename T2>
|
||||
static void call(T1& attr_, T2& attr) {}
|
||||
static void call(T1& /* attr_ */, T2& /* attr */) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -4,20 +4,21 @@
|
||||
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(SPIRIT_SEQUENCE_DETAIL_JAN_06_2013_1015AM)
|
||||
#define SPIRIT_SEQUENCE_DETAIL_JAN_06_2013_1015AM
|
||||
#if !defined(BOOST_SPIRIT_X3_SEQUENCE_DETAIL_JAN_06_2013_1015AM)
|
||||
#define BOOST_SPIRIT_X3_SEQUENCE_DETAIL_JAN_06_2013_1015AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_category.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/make_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/tuple_traits.hpp>
|
||||
#include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
|
||||
|
||||
#include <boost/fusion/include/begin.hpp>
|
||||
#include <boost/fusion/include/end.hpp>
|
||||
#include <boost/fusion/include/advance.hpp>
|
||||
#include <boost/fusion/include/deref.hpp>
|
||||
#include <boost/fusion/include/empty.hpp>
|
||||
#include <boost/fusion/include/front.hpp>
|
||||
#include <boost/fusion/include/iterator_range.hpp>
|
||||
@@ -35,6 +36,8 @@
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <iterator> // for std::make_move_iterator
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
template <typename Left, typename Right>
|
||||
@@ -79,14 +82,15 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
};
|
||||
|
||||
template <typename Attribute>
|
||||
struct pass_sequence_attribute_front
|
||||
struct pass_sequence_attribute_size_one_view
|
||||
{
|
||||
typedef typename fusion::result_of::front<Attribute>::type type;
|
||||
typedef typename fusion::result_of::deref<
|
||||
typename fusion::result_of::begin<Attribute>::type
|
||||
>::type type;
|
||||
|
||||
static typename add_reference<type>::type
|
||||
call(Attribute& attr)
|
||||
static type call(Attribute& attr)
|
||||
{
|
||||
return fusion::front(attr);
|
||||
return fusion::deref(fusion::begin(attr));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -103,30 +107,23 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Parser, typename Attribute, bool pass_through>
|
||||
struct pass_sequence_attribute_used :
|
||||
mpl::if_c<
|
||||
(!pass_through && traits::is_size_one_sequence<Attribute>::value)
|
||||
, pass_sequence_attribute_front<Attribute>
|
||||
, pass_through_sequence_attribute<Attribute>>::type {};
|
||||
|
||||
template <typename Parser, typename Attribute, bool pass_through = false, typename Enable = void>
|
||||
template <typename Parser, typename Attribute, typename Enable = void>
|
||||
struct pass_sequence_attribute :
|
||||
mpl::if_<
|
||||
fusion::result_of::empty<Attribute>
|
||||
, pass_sequence_attribute_unused
|
||||
, pass_sequence_attribute_used<Parser, Attribute, pass_through>>::type {};
|
||||
traits::is_size_one_view<Attribute>
|
||||
, pass_sequence_attribute_size_one_view<Attribute>
|
||||
, pass_through_sequence_attribute<Attribute>>::type {};
|
||||
|
||||
template <typename L, typename R, typename Attribute, bool pass_through>
|
||||
struct pass_sequence_attribute<sequence<L, R>, Attribute, pass_through>
|
||||
template <typename L, typename R, typename Attribute>
|
||||
struct pass_sequence_attribute<sequence<L, R>, Attribute>
|
||||
: pass_through_sequence_attribute<Attribute> {};
|
||||
|
||||
template <typename Parser, typename Attribute>
|
||||
struct pass_sequence_attribute_subject :
|
||||
pass_sequence_attribute<typename Parser::subject_type, Attribute> {};
|
||||
|
||||
template <typename Parser, typename Attribute, bool pass_through>
|
||||
struct pass_sequence_attribute<Parser, Attribute, pass_through
|
||||
template <typename Parser, typename Attribute>
|
||||
struct pass_sequence_attribute<Parser, Attribute
|
||||
, typename enable_if_c<(Parser::is_pass_through_unary)>::type>
|
||||
: pass_sequence_attribute_subject<Parser, Attribute> {};
|
||||
|
||||
@@ -134,15 +131,26 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
, typename Enable = void>
|
||||
struct partition_attribute
|
||||
{
|
||||
using attr_category = typename traits::attribute_category<Attribute>::type;
|
||||
static_assert(is_same<traits::tuple_attribute, attr_category>::value,
|
||||
"The parser expects tuple-like attribute type");
|
||||
|
||||
static int const l_size = sequence_size<L, Context>::value;
|
||||
static int const r_size = sequence_size<R, Context>::value;
|
||||
|
||||
static int constexpr actual_size = fusion::result_of::size<Attribute>::value;
|
||||
static int constexpr expected_size = l_size + r_size;
|
||||
|
||||
// If you got an error here, then you are trying to pass
|
||||
// a fusion sequence with the wrong number of elements
|
||||
// as that expected by the (sequence) parser.
|
||||
static_assert(
|
||||
fusion::result_of::size<Attribute>::value == (l_size + r_size)
|
||||
, "Attribute does not have the expected size."
|
||||
actual_size >= expected_size
|
||||
, "Size of the passed attribute is less than expected."
|
||||
);
|
||||
static_assert(
|
||||
actual_size <= expected_size
|
||||
, "Size of the passed attribute is bigger than expected."
|
||||
);
|
||||
|
||||
typedef typename fusion::result_of::begin<Attribute>::type l_begin;
|
||||
@@ -150,8 +158,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
typedef typename fusion::result_of::end<Attribute>::type r_end;
|
||||
typedef fusion::iterator_range<l_begin, l_end> l_part;
|
||||
typedef fusion::iterator_range<l_end, r_end> r_part;
|
||||
typedef pass_sequence_attribute<L, l_part, false> l_pass;
|
||||
typedef pass_sequence_attribute<R, r_part, false> r_pass;
|
||||
typedef pass_sequence_attribute<L, l_part> l_pass;
|
||||
typedef pass_sequence_attribute<R, r_part> r_pass;
|
||||
|
||||
static l_part left(Attribute& s)
|
||||
{
|
||||
@@ -175,7 +183,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
typedef unused_type l_part;
|
||||
typedef Attribute& r_part;
|
||||
typedef pass_sequence_attribute_unused l_pass;
|
||||
typedef pass_sequence_attribute<R, Attribute, true> r_pass;
|
||||
typedef pass_sequence_attribute<R, Attribute> r_pass;
|
||||
|
||||
static unused_type left(Attribute&)
|
||||
{
|
||||
@@ -195,7 +203,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
{
|
||||
typedef Attribute& l_part;
|
||||
typedef unused_type r_part;
|
||||
typedef pass_sequence_attribute<L, Attribute, true> l_pass;
|
||||
typedef pass_sequence_attribute<L, Attribute> l_pass;
|
||||
typedef pass_sequence_attribute_unused r_pass;
|
||||
|
||||
static Attribute& left(Attribute& s)
|
||||
@@ -290,11 +298,11 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
};
|
||||
|
||||
template <typename Parser, typename Iterator, typename Context
|
||||
, typename RContext, typename Attribute>
|
||||
, typename RContext, typename Attribute, typename AttributeCategory>
|
||||
bool parse_sequence(
|
||||
Parser const& parser, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, Attribute& attr
|
||||
, traits::tuple_attribute)
|
||||
, AttributeCategory)
|
||||
{
|
||||
typedef typename Parser::left_type Left;
|
||||
typedef typename Parser::right_type Right;
|
||||
@@ -315,58 +323,32 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Parser, typename Context>
|
||||
constexpr bool pass_sequence_container_attribute
|
||||
= sequence_size<Parser, Context>::value > 1;
|
||||
|
||||
template <typename Parser, typename Iterator, typename Context
|
||||
, typename RContext, typename Attribute>
|
||||
bool parse_sequence_plain(
|
||||
Parser const& parser, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, Attribute& attr)
|
||||
typename enable_if_c<pass_sequence_container_attribute<Parser, Context>, bool>::type
|
||||
parse_sequence_container(
|
||||
Parser const& parser
|
||||
, Iterator& first, Iterator const& last, Context const& context
|
||||
, RContext& rcontext, Attribute& attr)
|
||||
{
|
||||
typedef typename Parser::left_type Left;
|
||||
typedef typename Parser::right_type Right;
|
||||
typedef typename traits::attribute_of<Left, Context>::type l_attr_type;
|
||||
typedef typename traits::attribute_of<Right, Context>::type r_attr_type;
|
||||
typedef traits::make_attribute<l_attr_type, Attribute> l_make_attribute;
|
||||
typedef traits::make_attribute<r_attr_type, Attribute> r_make_attribute;
|
||||
|
||||
typename l_make_attribute::type l_attr = l_make_attribute::call(attr);
|
||||
typename r_make_attribute::type r_attr = r_make_attribute::call(attr);
|
||||
|
||||
Iterator save = first;
|
||||
if (parser.left.parse(first, last, context, rcontext, l_attr)
|
||||
&& parser.right.parse(first, last, context, rcontext, r_attr))
|
||||
return true;
|
||||
first = save;
|
||||
return false;
|
||||
return parser.parse(first, last, context, rcontext, attr);
|
||||
}
|
||||
|
||||
template <typename Parser, typename Iterator, typename Context
|
||||
, typename RContext, typename Attribute>
|
||||
bool parse_sequence(
|
||||
Parser const& parser, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, Attribute& attr
|
||||
, traits::plain_attribute)
|
||||
typename disable_if_c<pass_sequence_container_attribute<Parser, Context>, bool>::type
|
||||
parse_sequence_container(
|
||||
Parser const& parser
|
||||
, Iterator& first, Iterator const& last, Context const& context
|
||||
, RContext& rcontext, Attribute& attr)
|
||||
{
|
||||
return parse_sequence_plain(parser, first, last, context, rcontext, attr);
|
||||
return parse_into_container(parser, first, last, context, rcontext, attr);
|
||||
}
|
||||
|
||||
template <typename Parser, typename Iterator, typename Context
|
||||
, typename RContext, typename Attribute>
|
||||
bool parse_sequence(
|
||||
Parser const& parser, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, Attribute& attr
|
||||
, traits::variant_attribute)
|
||||
{
|
||||
return parse_sequence_plain(parser, first, last, context, rcontext, attr);
|
||||
}
|
||||
|
||||
template <typename Left, typename Right, typename Iterator
|
||||
, typename Context, typename RContext, typename Attribute>
|
||||
bool parse_sequence(
|
||||
Left const& left, Right const& right
|
||||
, Iterator& first, Iterator const& last
|
||||
, Context const& context, RContext& rcontext, Attribute& attr
|
||||
, traits::container_attribute);
|
||||
|
||||
template <typename Parser, typename Iterator, typename Context
|
||||
, typename RContext, typename Attribute>
|
||||
bool parse_sequence(
|
||||
@@ -375,8 +357,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
, traits::container_attribute)
|
||||
{
|
||||
Iterator save = first;
|
||||
if (parse_into_container(parser.left, first, last, context, rcontext, attr)
|
||||
&& parse_into_container(parser.right, first, last, context, rcontext, attr))
|
||||
if (parse_sequence_container(parser.left, first, last, context, rcontext, attr)
|
||||
&& parse_sequence_container(parser.right, first, last, context, rcontext, attr))
|
||||
return true;
|
||||
first = save;
|
||||
return false;
|
||||
@@ -465,7 +447,8 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
{
|
||||
return false;
|
||||
}
|
||||
traits::append(attr, traits::begin(attr_), traits::end(attr_));
|
||||
traits::append(attr, std::make_move_iterator(traits::begin(attr_)),
|
||||
std::make_move_iterator(traits::end(attr_)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_DIFFERENCE_FEBRUARY_11_2007_1250PM)
|
||||
#define SPIRIT_DIFFERENCE_FEBRUARY_11_2007_1250PM
|
||||
#if !defined(BOOST_SPIRIT_X3_DIFFERENCE_FEBRUARY_11_2007_1250PM)
|
||||
#define BOOST_SPIRIT_X3_DIFFERENCE_FEBRUARY_11_2007_1250PM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/has_attribute.hpp>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_KLEENE_JANUARY_07_2007_0818AM)
|
||||
#define SPIRIT_KLEENE_JANUARY_07_2007_0818AM
|
||||
#if !defined(BOOST_SPIRIT_X3_KLEENE_JANUARY_07_2007_0818AM)
|
||||
#define BOOST_SPIRIT_X3_KLEENE_JANUARY_07_2007_0818AM
|
||||
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_LIST_MARCH_24_2007_1031AM)
|
||||
#define SPIRIT_LIST_MARCH_24_2007_1031AM
|
||||
#if !defined(BOOST_SPIRIT_X3_LIST_MARCH_24_2007_1031AM)
|
||||
#define BOOST_SPIRIT_X3_LIST_MARCH_24_2007_1031AM
|
||||
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
|
||||
@@ -35,15 +35,14 @@ namespace boost { namespace spirit { namespace x3
|
||||
this->left, first, last, context, rcontext, attr))
|
||||
return false;
|
||||
|
||||
Iterator save = first;
|
||||
while (this->right.parse(first, last, context, rcontext, unused)
|
||||
Iterator iter = first;
|
||||
while (this->right.parse(iter, last, context, rcontext, unused)
|
||||
&& detail::parse_into_container(
|
||||
this->left, first, last, context, rcontext, attr))
|
||||
this->left, iter, last, context, rcontext, attr))
|
||||
{
|
||||
save = first;
|
||||
first = iter;
|
||||
}
|
||||
|
||||
first = save;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM)
|
||||
#define SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM
|
||||
#if !defined(BOOST_SPIRIT_X3_NOT_PREDICATE_MARCH_23_2007_0618PM)
|
||||
#define BOOST_SPIRIT_X3_NOT_PREDICATE_MARCH_23_2007_0618PM
|
||||
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_OPTIONAL_MARCH_23_2007_1117PM)
|
||||
#define SPIRIT_OPTIONAL_MARCH_23_2007_1117PM
|
||||
#if !defined(BOOST_SPIRIT_X3_OPTIONAL_MARCH_23_2007_1117PM)
|
||||
#define BOOST_SPIRIT_X3_OPTIONAL_MARCH_23_2007_1117PM
|
||||
|
||||
#include <boost/spirit/home/x3/core/proxy.hpp>
|
||||
#include <boost/spirit/home/x3/core/detail/parse_into_container.hpp>
|
||||
@@ -52,7 +52,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
value_type;
|
||||
|
||||
// create a local value
|
||||
value_type val = value_type();
|
||||
value_type val{};
|
||||
|
||||
if (this->subject.parse(first, last, context, rcontext, val))
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_PLUS_MARCH_13_2007_0127PM)
|
||||
#define SPIRIT_PLUS_MARCH_13_2007_0127PM
|
||||
#if !defined(BOOST_SPIRIT_X3_PLUS_MARCH_13_2007_0127PM)
|
||||
#define BOOST_SPIRIT_X3_PLUS_MARCH_13_2007_0127PM
|
||||
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
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(SPIRIT_SEQUENCE_JAN_06_2013_1015AM)
|
||||
#define SPIRIT_SEQUENCE_JAN_06_2013_1015AM
|
||||
#if !defined(BOOST_SPIRIT_X3_SEQUENCE_JAN_06_2013_1015AM)
|
||||
#define BOOST_SPIRIT_X3_SEQUENCE_JAN_06_2013_1015AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/attribute_of.hpp>
|
||||
#include <boost/spirit/home/x3/core/parser.hpp>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define BOOST_SPIRIT_X3_TST_MARCH_09_2007_0905AM
|
||||
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
@@ -111,9 +110,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
tst_node** pp = &start;
|
||||
for (;;)
|
||||
{
|
||||
typename
|
||||
boost::detail::iterator_traits<Iterator>::value_type
|
||||
c = *first;
|
||||
auto c = *first;
|
||||
|
||||
if (*pp == 0)
|
||||
*pp = alloc->new_node(c);
|
||||
@@ -147,9 +144,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
if (p == 0 || first == last)
|
||||
return;
|
||||
|
||||
typename
|
||||
boost::detail::iterator_traits<Iterator>::value_type
|
||||
c = *first;
|
||||
auto c = *first;
|
||||
|
||||
if (c == p->id)
|
||||
{
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
namespace standard_wide
|
||||
{
|
||||
inline literal_string<wchar_t const*, char_encoding::standard_wide>
|
||||
@@ -103,6 +104,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
return { s };
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace ascii
|
||||
{
|
||||
@@ -162,8 +164,10 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
using standard::string;
|
||||
using standard::lit;
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
using standard_wide::string;
|
||||
using standard_wide::lit;
|
||||
#endif
|
||||
|
||||
namespace extension
|
||||
{
|
||||
@@ -185,6 +189,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
template <int N>
|
||||
struct as_parser<char const[N]> : as_parser<char[N]> {};
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
template <int N>
|
||||
struct as_parser<wchar_t[N]>
|
||||
{
|
||||
@@ -202,6 +207,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <int N>
|
||||
struct as_parser<wchar_t const[N]> : as_parser<wchar_t[N]> {};
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct as_parser<char const*>
|
||||
|
||||
@@ -21,13 +21,10 @@
|
||||
#include <boost/spirit/home/support/char_encoding/standard.hpp>
|
||||
#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
|
||||
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <iterator> // std::begin
|
||||
#include <memory> // std::shared_ptr
|
||||
#include <type_traits>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
@@ -48,21 +45,21 @@ namespace boost { namespace spirit { namespace x3
|
||||
typedef value_type attribute_type;
|
||||
|
||||
static bool const has_attribute =
|
||||
!is_same<unused_type, attribute_type>::value;
|
||||
!std::is_same<unused_type, attribute_type>::value;
|
||||
static bool const handles_container =
|
||||
traits::is_container<attribute_type>::value;
|
||||
|
||||
symbols_parser(std::string const& name = "symbols")
|
||||
: add(*this)
|
||||
, remove(*this)
|
||||
, lookup(new Lookup())
|
||||
: add{*this}
|
||||
, remove{*this}
|
||||
, lookup(std::make_shared<Lookup>())
|
||||
, name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
symbols_parser(symbols_parser const& syms)
|
||||
: add(*this)
|
||||
, remove(*this)
|
||||
: add{*this}
|
||||
, remove{*this}
|
||||
, lookup(syms.lookup)
|
||||
, name_(syms.name_)
|
||||
{
|
||||
@@ -70,54 +67,37 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
template <typename Symbols>
|
||||
symbols_parser(Symbols const& syms, std::string const& name = "symbols")
|
||||
: add(*this)
|
||||
, remove(*this)
|
||||
, lookup(new Lookup())
|
||||
, name_(name)
|
||||
: symbols_parser(name)
|
||||
{
|
||||
typename range_const_iterator<Symbols>::type si = boost::begin(syms);
|
||||
while (si != boost::end(syms))
|
||||
add(*si++);
|
||||
for (auto& sym : syms)
|
||||
add(sym);
|
||||
}
|
||||
|
||||
template <typename Symbols, typename Data>
|
||||
symbols_parser(Symbols const& syms, Data const& data
|
||||
, std::string const& name = "symbols")
|
||||
: add(*this)
|
||||
, remove(*this)
|
||||
, lookup(new Lookup())
|
||||
, name_(name)
|
||||
: symbols_parser(name)
|
||||
{
|
||||
typename range_const_iterator<Symbols>::type si = boost::begin(syms);
|
||||
typename range_const_iterator<Data>::type di = boost::begin(data);
|
||||
while (si != boost::end(syms))
|
||||
add(*si++, *di++);
|
||||
using std::begin;
|
||||
auto di = begin(data);
|
||||
for (auto& sym : syms)
|
||||
add(sym, *di++);
|
||||
}
|
||||
|
||||
symbols_parser(std::initializer_list<std::pair<char_type const*, T>> syms
|
||||
, std::string const & name="symbols")
|
||||
: add(*this)
|
||||
, remove(*this)
|
||||
, lookup(new Lookup())
|
||||
, name_(name)
|
||||
: symbols_parser(name)
|
||||
{
|
||||
typedef std::initializer_list<std::pair<char_type const*, T>> symbols_t;
|
||||
typename range_const_iterator<symbols_t>::type si = boost::begin(syms);
|
||||
for (;si != boost::end(syms); ++si)
|
||||
add(si->first, si->second);
|
||||
for (auto& sym : syms)
|
||||
add(sym.first, sym.second);
|
||||
}
|
||||
|
||||
symbols_parser(std::initializer_list<char_type const*> syms
|
||||
, std::string const &name="symbols")
|
||||
: add(*this)
|
||||
, remove(*this)
|
||||
, lookup(new Lookup())
|
||||
, name_(name)
|
||||
: symbols_parser(name)
|
||||
{
|
||||
typedef std::initializer_list<char_type const*> symbols_t;
|
||||
typename range_const_iterator<symbols_t>::type si = boost::begin(syms);
|
||||
while (si != boost::end(syms))
|
||||
add(*si++);
|
||||
for (auto str : syms)
|
||||
add(str);
|
||||
}
|
||||
|
||||
symbols_parser&
|
||||
@@ -241,14 +221,6 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
struct adder
|
||||
{
|
||||
template <typename, typename = unused_type, typename = unused_type>
|
||||
struct result { typedef adder const& type; };
|
||||
|
||||
adder(symbols_parser& sym)
|
||||
: sym(sym)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
adder const&
|
||||
operator()(Iterator first, Iterator last, T const& val) const
|
||||
@@ -280,14 +252,6 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
struct remover
|
||||
{
|
||||
template <typename, typename = unused_type, typename = unused_type>
|
||||
struct result { typedef remover const& type; };
|
||||
|
||||
remover(symbols_parser& sym)
|
||||
: sym(sym)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
remover const&
|
||||
operator()(Iterator const& first, Iterator const& last) const
|
||||
@@ -319,7 +283,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
adder add;
|
||||
remover remove;
|
||||
shared_ptr<Lookup> lookup;
|
||||
std::shared_ptr<Lookup> lookup;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
@@ -343,11 +307,13 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
using standard::symbols;
|
||||
|
||||
#ifndef BOOST_SPIRIT_NO_STANDARD_WIDE
|
||||
namespace standard_wide
|
||||
{
|
||||
template <typename T = unused_type>
|
||||
using symbols = symbols_parser<char_encoding::standard_wide, T>;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace ascii
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <boost/range.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
@@ -46,16 +47,19 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
// This will catch all nodes except those inheriting from position_tagged
|
||||
template <typename AST>
|
||||
boost::iterator_range<iterator_type>
|
||||
position_of(AST const& ast) const
|
||||
typename boost::enable_if_c<
|
||||
(!is_base_of<position_tagged, AST>::value)
|
||||
, boost::iterator_range<iterator_type>
|
||||
>::type
|
||||
position_of(AST const& /* ast */) const
|
||||
{
|
||||
// returns an empty position
|
||||
return boost::iterator_range<iterator_type>();
|
||||
}
|
||||
|
||||
|
||||
// This will catch all nodes except those inheriting from position_tagged
|
||||
template <typename AST>
|
||||
void annotate(AST& ast, iterator_type first, iterator_type last, mpl::false_)
|
||||
void annotate(AST& /* ast */, iterator_type /* first */, iterator_type /* last */, mpl::false_)
|
||||
{
|
||||
// (no-op) no need for tags
|
||||
}
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
#if !defined(BOOST_SPIRIT_X3_VARIANT_AUGUST_6_2011_0859AM)
|
||||
#define BOOST_SPIRIT_X3_VARIANT_AUGUST_6_2011_0859AM
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/mpl/list.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -29,7 +30,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
forward_ast(forward_ast const& operand)
|
||||
: p_(new T(operand.get())) {}
|
||||
|
||||
forward_ast(forward_ast&& operand)
|
||||
forward_ast(forward_ast&& operand) BOOST_NOEXCEPT
|
||||
: p_(operand.p_)
|
||||
{
|
||||
operand.p_ = 0;
|
||||
@@ -46,7 +47,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
boost::checked_delete(p_);
|
||||
}
|
||||
|
||||
forward_ast& operator=(forward_ast const& rhs)
|
||||
forward_ast& operator=(forward_ast const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<T>::value)
|
||||
{
|
||||
assign(rhs.get());
|
||||
return *this;
|
||||
@@ -59,7 +60,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
p_ = temp;
|
||||
}
|
||||
|
||||
forward_ast& operator=(T const& rhs)
|
||||
forward_ast& operator=(T const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<T>::value)
|
||||
{
|
||||
assign(rhs);
|
||||
return *this;
|
||||
@@ -71,24 +72,24 @@ namespace boost { namespace spirit { namespace x3
|
||||
return *this;
|
||||
}
|
||||
|
||||
forward_ast& operator=(T&& rhs)
|
||||
forward_ast& operator=(T&& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_move_assignable<T>::value)
|
||||
{
|
||||
get() = std::move(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
T& get() { return *get_pointer(); }
|
||||
const T& get() const { return *get_pointer(); }
|
||||
T& get() BOOST_NOEXCEPT { return *get_pointer(); }
|
||||
const T& get() const BOOST_NOEXCEPT { return *get_pointer(); }
|
||||
|
||||
T* get_pointer() { return p_; }
|
||||
const T* get_pointer() const { return p_; }
|
||||
T* get_pointer() BOOST_NOEXCEPT { return p_; }
|
||||
const T* get_pointer() const BOOST_NOEXCEPT { return p_; }
|
||||
|
||||
operator T const&() const { return this->get(); }
|
||||
operator T&() { return this->get(); }
|
||||
operator T const&() const BOOST_NOEXCEPT { return this->get(); }
|
||||
operator T&() BOOST_NOEXCEPT { return this->get(); }
|
||||
|
||||
private:
|
||||
|
||||
void assign(const T& rhs)
|
||||
void assign(const T& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<T>::value)
|
||||
{
|
||||
this->get() = rhs;
|
||||
}
|
||||
@@ -117,6 +118,10 @@ namespace boost { namespace spirit { namespace x3
|
||||
{};
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4521) // multiple copy constructors specified
|
||||
#endif
|
||||
template <typename ...Types>
|
||||
struct variant
|
||||
{
|
||||
@@ -135,46 +140,46 @@ namespace boost { namespace spirit { namespace x3
|
||||
::value)
|
||||
>;
|
||||
|
||||
variant() : var() {}
|
||||
variant() BOOST_NOEXCEPT_IF(std::is_nothrow_default_constructible<variant_type>::value) : var() {}
|
||||
|
||||
template <typename T, class = non_self_t<T>>
|
||||
explicit variant(T const& rhs)
|
||||
explicit variant(T const& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_constructible<variant_type, T const&>::value))
|
||||
: var(rhs) {}
|
||||
|
||||
template <typename T, class = non_self_t<T>>
|
||||
explicit variant(T&& rhs)
|
||||
explicit variant(T&& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_constructible<variant_type, T&&>::value))
|
||||
: var(std::forward<T>(rhs)) {}
|
||||
|
||||
variant(variant const& rhs)
|
||||
variant(variant const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_constructible<variant_type>::value)
|
||||
: var(rhs.var) {}
|
||||
|
||||
variant(variant& rhs)
|
||||
variant(variant& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_constructible<variant_type, variant_type&>::value))
|
||||
: var(rhs.var) {}
|
||||
|
||||
variant(variant&& rhs)
|
||||
: var(std::forward<variant_type>(rhs.var)) {}
|
||||
variant(variant&& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_move_constructible<variant_type>::value)
|
||||
: var(std::move(rhs.var)) {}
|
||||
|
||||
variant& operator=(variant const& rhs)
|
||||
variant& operator=(variant const& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_copy_assignable<variant_type>::value)
|
||||
{
|
||||
var = rhs.get();
|
||||
return *this;
|
||||
}
|
||||
|
||||
variant& operator=(variant&& rhs)
|
||||
variant& operator=(variant&& rhs) BOOST_NOEXCEPT_IF(std::is_nothrow_move_assignable<variant_type>::value)
|
||||
{
|
||||
var = std::forward<variant_type>(rhs.get());
|
||||
var = std::move(rhs.get());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, class = non_self_t<T>>
|
||||
variant& operator=(T const& rhs)
|
||||
variant& operator=(T const& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_assignable<variant_type, T const&>::value))
|
||||
{
|
||||
var = rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, class = non_self_t<T>>
|
||||
variant& operator=(T&& rhs)
|
||||
variant& operator=(T&& rhs) BOOST_NOEXCEPT_IF((std::is_nothrow_assignable<variant_type, T&&>::value))
|
||||
{
|
||||
var = std::forward<T>(rhs);
|
||||
return *this;
|
||||
@@ -204,12 +209,12 @@ namespace boost { namespace spirit { namespace x3
|
||||
return var.apply_visitor(v);
|
||||
}
|
||||
|
||||
variant_type const& get() const
|
||||
variant_type const& get() const BOOST_NOEXCEPT
|
||||
{
|
||||
return var;
|
||||
}
|
||||
|
||||
variant_type& get()
|
||||
variant_type& get() BOOST_NOEXCEPT
|
||||
{
|
||||
return var;
|
||||
}
|
||||
@@ -221,34 +226,37 @@ namespace boost { namespace spirit { namespace x3
|
||||
|
||||
variant_type var;
|
||||
};
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}}}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <typename T, typename ...Types>
|
||||
inline T const&
|
||||
get(boost::spirit::x3::variant<Types...> const& x)
|
||||
get(boost::spirit::x3::variant<Types...> const& x) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost::get<T>(x.get());
|
||||
}
|
||||
|
||||
template <typename T, typename ...Types>
|
||||
inline T&
|
||||
get(boost::spirit::x3::variant<Types...>& x)
|
||||
get(boost::spirit::x3::variant<Types...>& x) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost::get<T>(x.get());
|
||||
}
|
||||
|
||||
template <typename T, typename ...Types>
|
||||
inline T const*
|
||||
get(boost::spirit::x3::variant<Types...> const* x)
|
||||
get(boost::spirit::x3::variant<Types...> const* x) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost::get<T>(&x->get());
|
||||
}
|
||||
|
||||
template <typename T, typename ...Types>
|
||||
inline T*
|
||||
get(boost::spirit::x3::variant<Types...>* x)
|
||||
get(boost::spirit::x3::variant<Types...>* x) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost::get<T>(&x->get());
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
return { val };
|
||||
}
|
||||
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <typename ID, typename T, typename Next, typename FoundVal>
|
||||
inline Next const&
|
||||
make_unique_context(T& val, Next const& next, FoundVal&)
|
||||
make_unique_context(T& /* val */, Next const& next, FoundVal&)
|
||||
{
|
||||
return next;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
return { val, next };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename ID, typename T, typename Next>
|
||||
inline auto
|
||||
make_unique_context(T& val, Next const& next)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
@@ -34,6 +33,8 @@
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
#include <iterator> // for std::iterator_traits
|
||||
|
||||
#if !defined(SPIRIT_NUMERICS_LOOP_UNROLL)
|
||||
# define SPIRIT_NUMERICS_LOOP_UNROLL 3
|
||||
#endif
|
||||
@@ -52,6 +53,9 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
template <typename T, unsigned Radix>
|
||||
struct digits_traits;
|
||||
|
||||
template <int Digits, unsigned Radix>
|
||||
struct digits2_to_n;
|
||||
|
||||
// lookup table for log2(x) : 2 <= x <= 36
|
||||
#define BOOST_SPIRIT_X3_LOG2 (#error)(#error) \
|
||||
(1000000)(1584960)(2000000)(2321920)(2584960)(2807350) \
|
||||
@@ -63,11 +67,10 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
/***/
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(Radix) \
|
||||
template <typename T> struct digits_traits<T, Radix> \
|
||||
template <int Digits> struct digits2_to_n<Digits, Radix> \
|
||||
{ \
|
||||
typedef std::numeric_limits<T> numeric_limits_type; \
|
||||
BOOST_STATIC_CONSTANT(int, value = static_cast<int>( \
|
||||
(numeric_limits_type::digits * 1000000) / \
|
||||
(Digits * 1000000) / \
|
||||
BOOST_PP_SEQ_ELEM(Radix, BOOST_SPIRIT_X3_LOG2))); \
|
||||
}; \
|
||||
/***/
|
||||
@@ -77,6 +80,18 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
|
||||
#undef BOOST_SPIRIT_X3_LOG2
|
||||
|
||||
template <typename T, unsigned Radix>
|
||||
struct digits_traits : digits2_to_n<std::numeric_limits<T>::digits, Radix>
|
||||
{
|
||||
static_assert(std::numeric_limits<T>::radix == 2, "");
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct digits_traits<T, 10>
|
||||
{
|
||||
static int constexpr value = std::numeric_limits<T>::digits10;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Traits class for radix specific number conversion
|
||||
@@ -132,19 +147,19 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
inline static bool add(T& n, Char ch, mpl::true_) // checked add
|
||||
{
|
||||
// Ensure n *= Radix will not overflow
|
||||
static T const max = (std::numeric_limits<T>::max)();
|
||||
static T const val = max / Radix;
|
||||
T const max = (std::numeric_limits<T>::max)();
|
||||
T const val = max / Radix;
|
||||
if (n > val)
|
||||
return false;
|
||||
|
||||
n *= Radix;
|
||||
T tmp = n * Radix;
|
||||
|
||||
// Ensure n += digit will not overflow
|
||||
const int digit = radix_traits<Radix>::digit(ch);
|
||||
if (n > max - digit)
|
||||
if (tmp > max - digit)
|
||||
return false;
|
||||
|
||||
n += static_cast<T>(digit);
|
||||
n = tmp + static_cast<T>(digit);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -163,19 +178,19 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
inline static bool add(T& n, Char ch, mpl::true_) // checked subtract
|
||||
{
|
||||
// Ensure n *= Radix will not underflow
|
||||
static T const min = (std::numeric_limits<T>::min)();
|
||||
static T const val = (min + 1) / T(Radix);
|
||||
T const min = (std::numeric_limits<T>::min)();
|
||||
T const val = min / T(Radix);
|
||||
if (n < val)
|
||||
return false;
|
||||
|
||||
n *= Radix;
|
||||
T tmp = n * Radix;
|
||||
|
||||
// Ensure n -= digit will not underflow
|
||||
int const digit = radix_traits<Radix>::digit(ch);
|
||||
if (n < min + digit)
|
||||
if (tmp < min + digit)
|
||||
return false;
|
||||
|
||||
n -= static_cast<T>(digit);
|
||||
n = tmp - static_cast<T>(digit);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -190,7 +205,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
inline static bool
|
||||
call(Char ch, std::size_t count, T& n, mpl::true_)
|
||||
{
|
||||
static std::size_t const
|
||||
std::size_t constexpr
|
||||
overflow_free = digits_traits<T, Radix>::value - 1;
|
||||
|
||||
if (count < overflow_free)
|
||||
@@ -296,7 +311,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
typedef radix_traits<Radix> radix_check;
|
||||
typedef int_extractor<Radix, Accumulator, MaxDigits> extractor;
|
||||
typedef typename
|
||||
boost::detail::iterator_traits<Iterator>::value_type
|
||||
std::iterator_traits<Iterator>::value_type
|
||||
char_type;
|
||||
|
||||
Iterator it = first;
|
||||
@@ -394,7 +409,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
typedef radix_traits<Radix> radix_check;
|
||||
typedef int_extractor<Radix, Accumulator, -1> extractor;
|
||||
typedef typename
|
||||
boost::detail::iterator_traits<Iterator>::value_type
|
||||
std::iterator_traits<Iterator>::value_type
|
||||
char_type;
|
||||
|
||||
Iterator it = first;
|
||||
@@ -474,35 +489,6 @@ namespace boost { namespace spirit { namespace x3 { namespace detail
|
||||
};
|
||||
|
||||
#undef SPIRIT_NUMERIC_INNER_LOOP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Cast an signed integer to an unsigned integer
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T,
|
||||
bool force_unsigned
|
||||
= mpl::and_<is_integral<T>, is_signed<T> >::value>
|
||||
struct cast_unsigned;
|
||||
|
||||
template <typename T>
|
||||
struct cast_unsigned<T, true>
|
||||
{
|
||||
typedef typename make_unsigned<T>::type unsigned_type;
|
||||
typedef typename make_unsigned<T>::type& unsigned_type_ref;
|
||||
|
||||
inline static unsigned_type_ref call(T& n)
|
||||
{
|
||||
return unsigned_type_ref(n);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct cast_unsigned<T, false>
|
||||
{
|
||||
inline static T& call(T& n)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
};
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -62,8 +62,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
extract_type;
|
||||
|
||||
Iterator save = first;
|
||||
if (!extract_type::parse(first, last,
|
||||
detail::cast_unsigned<T>::call(attr)))
|
||||
if (!extract_type::parse(first, last, attr))
|
||||
{
|
||||
first = save;
|
||||
return false;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
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(SPIRIT_EXTRACT_REAL_APRIL_18_2006_0901AM)
|
||||
#define SPIRIT_EXTRACT_REAL_APRIL_18_2006_0901AM
|
||||
#if !defined(BOOST_SPIRIT_X3_EXTRACT_REAL_APRIL_18_2006_0901AM)
|
||||
#define BOOST_SPIRIT_X3_EXTRACT_REAL_APRIL_18_2006_0901AM
|
||||
|
||||
#include <cmath>
|
||||
#include <boost/limits.hpp>
|
||||
@@ -103,20 +103,6 @@ namespace boost { namespace spirit { namespace x3 { namespace extension
|
||||
// no-op for unused_type
|
||||
return n;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool
|
||||
is_equal_to_one(T const& value)
|
||||
{
|
||||
return value == 1.0;
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_equal_to_one(unused_type)
|
||||
{
|
||||
// no-op for unused_type
|
||||
return false;
|
||||
}
|
||||
}}}}
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
@@ -180,6 +166,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
if (!is_same<T, unused_type>::value)
|
||||
frac_digits =
|
||||
static_cast<int>(std::distance(savef, first));
|
||||
BOOST_ASSERT(frac_digits >= 0);
|
||||
}
|
||||
else if (!got_a_number || !p.allow_trailing_dot)
|
||||
{
|
||||
@@ -235,20 +222,6 @@ namespace boost { namespace spirit { namespace x3
|
||||
// No exponent found. Scale the number by -frac_digits.
|
||||
extension::scale(-frac_digits, n);
|
||||
}
|
||||
else if (extension::is_equal_to_one(n))
|
||||
{
|
||||
// There is a chance of having to parse one of the 1.0#...
|
||||
// styles some implementations use for representing NaN or Inf.
|
||||
|
||||
// Check whether the number to parse is a NaN or Inf
|
||||
if (p.parse_nan(first, last, n) ||
|
||||
p.parse_inf(first, last, n))
|
||||
{
|
||||
// If we got a negative sign, negate the number
|
||||
traits::move_to(extension::negate(neg, n), attr);
|
||||
return true; // got a NaN or Inf, return immediately
|
||||
}
|
||||
}
|
||||
|
||||
// If we got a negative sign, negate the number
|
||||
traits::move_to(extension::negate(neg, n), attr);
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
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(SPIRIT_SIGN_MAR_11_2009_0734PM)
|
||||
#define SPIRIT_SIGN_MAR_11_2009_0734PM
|
||||
#if !defined(BOOST_SPIRIT_X3_SIGN_MAR_11_2009_0734PM)
|
||||
#define BOOST_SPIRIT_X3_SIGN_MAR_11_2009_0734PM
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/math/special_functions/sign.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
@@ -21,22 +19,10 @@ namespace boost { namespace spirit { namespace x3
|
||||
return (boost::math::signbit)(x) ? true : false;
|
||||
}
|
||||
|
||||
// This routine has been taken and adapted from Johan Rade's fp_traits
|
||||
// library
|
||||
template<typename T>
|
||||
inline T (changesign)(T x)
|
||||
{
|
||||
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
|
||||
return -x;
|
||||
#else
|
||||
typedef typename math::detail::fp_traits<T>::type traits_type;
|
||||
|
||||
typename traits_type::bits a;
|
||||
traits_type::get_bits(x, a);
|
||||
a ^= traits_type::sign;
|
||||
traits_type::set_bits(x, a);
|
||||
return x;
|
||||
#endif
|
||||
return (boost::math::changesign)(x);
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#if !defined(BOOST_SPIRIT_X3_SUBCONTEXT_APR_15_2013_0840AM)
|
||||
#define BOOST_SPIRIT_X3_SUBCONTEXT_APR_15_2013_0840AM
|
||||
|
||||
#include <boost/fusion/support/pair.hpp>
|
||||
#include <boost/spirit/home/x3/support/context.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/logical.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/fusion/include/copy.hpp>
|
||||
#include <boost/fusion/include/is_sequence.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/is_variant.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/is_range.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/container_traits.hpp>
|
||||
#include <boost/spirit/home/x3/support/traits/optional_traits.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3
|
||||
{
|
||||
@@ -31,6 +32,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
struct associative_attribute {};
|
||||
struct variant_attribute {};
|
||||
struct optional_attribute {};
|
||||
struct range_attribute {};
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct attribute_category
|
||||
@@ -46,21 +48,21 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
|
||||
template <typename T>
|
||||
struct attribute_category< T
|
||||
, typename enable_if<
|
||||
typename mpl::eval_if<
|
||||
fusion::traits::is_sequence<T>
|
||||
, fusion::traits::is_associative<T>
|
||||
, mpl::false_
|
||||
>::type >::type >
|
||||
, typename enable_if<
|
||||
typename mpl::eval_if<
|
||||
fusion::traits::is_sequence<T>
|
||||
, fusion::traits::is_associative<T>
|
||||
, mpl::false_
|
||||
>::type >::type >
|
||||
: mpl::identity<associative_attribute> {};
|
||||
|
||||
template <typename T>
|
||||
struct attribute_category< T
|
||||
, typename enable_if<
|
||||
mpl::and_<
|
||||
fusion::traits::is_sequence<T>
|
||||
, mpl::not_<fusion::traits::is_associative<T> >
|
||||
> >::type >
|
||||
, typename enable_if<
|
||||
mpl::and_<
|
||||
fusion::traits::is_sequence<T>
|
||||
, mpl::not_<fusion::traits::is_associative<T> >
|
||||
> >::type >
|
||||
: mpl::identity<tuple_attribute> {};
|
||||
|
||||
template <typename T>
|
||||
@@ -70,7 +72,22 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
|
||||
template <typename T>
|
||||
struct attribute_category<T,
|
||||
typename enable_if<traits::is_container<T>>::type>
|
||||
typename enable_if<traits::is_optional<T>>::type>
|
||||
: mpl::identity<optional_attribute> {};
|
||||
|
||||
template <typename T>
|
||||
struct attribute_category<T,
|
||||
typename enable_if<traits::is_range<T>>::type>
|
||||
: mpl::identity<range_attribute> {};
|
||||
|
||||
template <typename T>
|
||||
struct attribute_category< T
|
||||
, typename enable_if<
|
||||
mpl::and_<
|
||||
traits::is_container<T>
|
||||
, mpl::not_<fusion::traits::is_sequence<T> >
|
||||
, mpl::not_<traits::is_range<T> >
|
||||
> >::type >
|
||||
: mpl::identity<container_attribute> {};
|
||||
|
||||
}}}}
|
||||
|
||||
@@ -11,10 +11,8 @@
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/fusion/include/deque.hpp>
|
||||
#include <boost/tti/has_type.hpp>
|
||||
#include <boost/tti/has_member_function.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <vector>
|
||||
@@ -35,7 +33,6 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
BOOST_TTI_HAS_TYPE(size_type)
|
||||
BOOST_TTI_HAS_TYPE(reference)
|
||||
BOOST_TTI_HAS_TYPE(key_type)
|
||||
BOOST_TTI_HAS_MEMBER_FUNCTION(reserve)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -49,9 +46,12 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
using is_associative = mpl::bool_<
|
||||
detail::has_type_key_type<T>::value>;
|
||||
|
||||
template <typename T>
|
||||
using is_reservable = mpl::bool_<
|
||||
detail::has_member_function_reserve<T, void, mpl::vector<size_t>>::value>;
|
||||
template<typename T, typename Enable = void>
|
||||
struct is_reservable : mpl::false_ {};
|
||||
|
||||
template<typename T>
|
||||
struct is_reservable<T, decltype(std::declval<T&>().reserve(0))>
|
||||
: mpl::true_ {};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
namespace detail
|
||||
@@ -122,7 +122,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
template <typename T>
|
||||
static bool call(Container& c, T&& val)
|
||||
{
|
||||
c.insert(c.end(), std::move(val));
|
||||
c.insert(c.end(), static_cast<T&&>(val));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -130,7 +130,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
template <typename Container, typename T>
|
||||
inline bool push_back(Container& c, T&& val)
|
||||
{
|
||||
return push_back_container<Container>::call(c, std::move(val));
|
||||
return push_back_container<Container>::call(c, static_cast<T&&>(val));
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
@@ -159,7 +159,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
private:
|
||||
template <typename Iterator>
|
||||
static void reserve(Container& c, Iterator first, Iterator last, mpl::false_)
|
||||
static void reserve(Container& /* c */, Iterator /* first */, Iterator /* last */, mpl::false_)
|
||||
{
|
||||
// Not all containers have "reserve"
|
||||
}
|
||||
@@ -199,7 +199,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline bool append(unused_type, Iterator first, Iterator last)
|
||||
inline bool append(unused_type, Iterator /* first */, Iterator /* last */)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
template <typename Iterator, typename Enable = void>
|
||||
struct deref_iterator
|
||||
{
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::reference type;
|
||||
typedef typename std::iterator_traits<Iterator>::reference type;
|
||||
static type call(Iterator& it)
|
||||
{
|
||||
return *it;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2014 Joel de Guzman
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_X3_IS_RANGE_DEC_06_2017_1900PM)
|
||||
#define BOOST_SPIRIT_X3_IS_RANGE_DEC_06_2017_1900PM
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
template <typename T, typename Enable = void>
|
||||
struct is_range
|
||||
: mpl::false_
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct is_range<boost::iterator_range<T>>
|
||||
: mpl::true_
|
||||
{};
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
@@ -1,82 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2014 Joel de Guzman
|
||||
Copyright (c) 2001-2012 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_X3_MAKE_ATTRIBUTE_JAN_8_2012_0721PM)
|
||||
#define BOOST_SPIRIT_X3_MAKE_ATTRIBUTE_JAN_8_2012_0721PM
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/spirit/home/x3/support/unused.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
template <typename Attribute>
|
||||
struct make_attribute_base
|
||||
{
|
||||
static Attribute call(unused_type)
|
||||
{
|
||||
// synthesize the attribute/parameter
|
||||
return Attribute();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T& call(T& value)
|
||||
{
|
||||
return value; // just pass the one provided
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Attribute, typename ActualAttribute>
|
||||
struct make_attribute : make_attribute_base<Attribute>
|
||||
{
|
||||
typedef ActualAttribute& type;
|
||||
typedef ActualAttribute value_type;
|
||||
};
|
||||
|
||||
template <typename Attribute>
|
||||
struct make_attribute<Attribute, unused_type>
|
||||
: make_attribute_base<Attribute>
|
||||
{
|
||||
typedef typename remove_const<Attribute>::type attribute_type;
|
||||
typedef attribute_type type;
|
||||
typedef attribute_type value_type;
|
||||
};
|
||||
|
||||
template <typename Attribute, typename ActualAttribute>
|
||||
struct make_attribute<Attribute&, ActualAttribute>
|
||||
: make_attribute<Attribute, ActualAttribute> {};
|
||||
|
||||
template <typename Attribute, typename ActualAttribute>
|
||||
struct make_attribute<Attribute const&, ActualAttribute>
|
||||
: make_attribute<Attribute const, ActualAttribute> {};
|
||||
|
||||
template <typename ActualAttribute>
|
||||
struct make_attribute<unused_type, ActualAttribute>
|
||||
{
|
||||
typedef unused_type type;
|
||||
typedef unused_type value_type;
|
||||
static unused_type call(unused_type)
|
||||
{
|
||||
return unused;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_attribute<unused_type, unused_type>
|
||||
{
|
||||
typedef unused_type type;
|
||||
typedef unused_type value_type;
|
||||
static unused_type call(unused_type)
|
||||
{
|
||||
return unused;
|
||||
}
|
||||
};
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
@@ -14,10 +14,8 @@
|
||||
#include <boost/spirit/home/x3/support/traits/variant_has_substitute.hpp>
|
||||
#include <boost/fusion/include/is_sequence.hpp>
|
||||
#include <boost/fusion/include/front.hpp>
|
||||
#include <boost/fusion/include/size.hpp>
|
||||
#include <boost/fusion/include/move.hpp>
|
||||
#include <boost/fusion/include/is_sequence.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
@@ -152,6 +150,13 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
move_to(src, dest, tag, is_size_one_sequence<Source>());
|
||||
}
|
||||
|
||||
template <typename Source, typename Dest>
|
||||
inline void
|
||||
move_to(Source&& src, Dest& dest, optional_attribute)
|
||||
{
|
||||
dest = std::move(src);
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline void
|
||||
move_to(Iterator, Iterator, unused_type, unused_attribute) {}
|
||||
@@ -165,10 +170,19 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
else
|
||||
append(dest, first, last);
|
||||
}
|
||||
|
||||
template <typename Iterator, typename Dest>
|
||||
inline typename enable_if<
|
||||
is_size_one_sequence<Dest>
|
||||
>::type
|
||||
move_to(Iterator first, Iterator last, Dest& dest, tuple_attribute)
|
||||
{
|
||||
traits::move_to(first, last, fusion::front(dest));
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline void
|
||||
move_to(Iterator first, Iterator last, boost::iterator_range<Iterator>& rng, container_attribute)
|
||||
move_to(Iterator first, Iterator last, boost::iterator_range<Iterator>& rng, range_attribute)
|
||||
{
|
||||
rng = {first, last};
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
#define BOOST_SPIRIT_X3_NUMERIC_TRAITS_JAN_07_2011_0722AM
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <limits>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
@@ -112,13 +111,9 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct is_infinite;
|
||||
|
||||
|
||||
template <typename T, typename Enable = void>
|
||||
struct check_overflow : mpl::false_ {};
|
||||
|
||||
template <typename T>
|
||||
struct check_overflow<T, typename enable_if_c<integer_traits<T>::is_integral>::type>
|
||||
: mpl::true_ {};
|
||||
struct check_overflow : mpl::bool_<std::numeric_limits<T>::is_bounded> {};
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,21 +24,6 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
template <typename Exposed, typename Transformed, typename Tag
|
||||
, typename Enable = void>
|
||||
struct transform_attribute;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Tag, typename Transformed, typename Exposed>
|
||||
typename transform_attribute<Exposed, Transformed, Tag>::type
|
||||
pre_transform(Exposed& attr)
|
||||
{
|
||||
return transform_attribute<Exposed, Transformed, Tag>::pre(attr);
|
||||
}
|
||||
|
||||
template <typename Tag, typename Transformed, typename Exposed>
|
||||
typename transform_attribute<Exposed, Transformed, Tag>::type
|
||||
pre_transform(Exposed const& attr)
|
||||
{
|
||||
return transform_attribute<Exposed const, Transformed, Tag>::pre(attr);
|
||||
}
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define BOOST_SPIRIT_X3_TUPLE_TRAITS_JANUARY_2012_1132PM
|
||||
|
||||
#include <boost/fusion/include/is_sequence.hpp>
|
||||
#include <boost/fusion/include/is_view.hpp>
|
||||
#include <boost/fusion/include/size.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
@@ -43,6 +44,14 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
, has_size<Seq, 1>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename View>
|
||||
struct is_size_one_view
|
||||
: mpl::and_<
|
||||
fusion::traits::is_view<View>
|
||||
, has_size<View, 1>
|
||||
>
|
||||
{};
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#if !defined(BOOST_SPIRIT_X3_VALUE_TRAITS_MAY_07_2013_0203PM)
|
||||
#define BOOST_SPIRIT_X3_VALUE_TRAITS_MAY_07_2013_0203PM
|
||||
|
||||
#include <boost/utility/value_init.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
template <typename T, typename Enable = void>
|
||||
@@ -18,7 +16,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
static T call()
|
||||
{
|
||||
return boost::value_initialized<T>();
|
||||
return {};
|
||||
}
|
||||
};
|
||||
}}}}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define BOOST_SPIRIT_X3_VARIANT_FIND_SUBSTITUTE_APR_18_2014_930AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
@@ -22,9 +23,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
typedef typename variant_type::types types;
|
||||
typedef typename mpl::end<types>::type end;
|
||||
|
||||
typedef typename
|
||||
mpl::find_if<types, is_same<mpl::_1, Attribute> >::type
|
||||
iter_1;
|
||||
typedef typename mpl::find<types, Attribute>::type iter_1;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define BOOST_SPIRIT_X3_VARIANT_HAS_SUBSTITUTE_APR_18_2014_925AM
|
||||
|
||||
#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
{
|
||||
@@ -22,9 +23,7 @@ namespace boost { namespace spirit { namespace x3 { namespace traits
|
||||
typedef typename variant_type::types types;
|
||||
typedef typename mpl::end<types>::type end;
|
||||
|
||||
typedef typename
|
||||
mpl::find_if<types, is_same<mpl::_1, Attribute>>::type
|
||||
iter_1;
|
||||
typedef typename mpl::find<types, Attribute>::type iter_1;
|
||||
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
#if !defined(BOOST_SPIRIT_X3_UNUSED_APRIL_16_2006_0616PM)
|
||||
#define BOOST_SPIRIT_X3_UNUSED_APRIL_16_2006_0616PM
|
||||
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <iosfwd>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
|
||||
@@ -58,6 +58,11 @@ namespace boost { namespace spirit { namespace x3
|
||||
return pos_cache.position_of(pos);
|
||||
}
|
||||
|
||||
position_cache<std::vector<Iterator>> const& get_position_cache() const
|
||||
{
|
||||
return pos_cache;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void print_file_line(std::size_t line) const;
|
||||
@@ -178,7 +183,7 @@ namespace boost { namespace spirit { namespace x3
|
||||
if (prev != '\r') ++line;
|
||||
break;
|
||||
case '\r':
|
||||
if (prev != '\n') ++line;
|
||||
++line;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace boost { namespace spirit { namespace x3 { namespace testing
|
||||
std::string output = f(load(input_path), input_path);
|
||||
std::string expected = load(expect_path);
|
||||
|
||||
auto result = compare(output, expected);
|
||||
auto result = compare(output, expected, re_prefix, re_suffix);
|
||||
if (!result.full_match)
|
||||
{
|
||||
std::cout << "=============================================" << std::endl;
|
||||
|
||||
@@ -62,6 +62,44 @@ namespace boost { namespace spirit { namespace x3
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Assume wchar_t content is UTF-16 on Windows and UCS-4 on Unix
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
inline utf8_string to_utf8(wchar_t value)
|
||||
{
|
||||
utf8_string result;
|
||||
typedef std::back_insert_iterator<utf8_string> insert_iter;
|
||||
insert_iter out_iter(result);
|
||||
utf8_output_iterator<insert_iter> utf8_iter(out_iter);
|
||||
|
||||
u16_to_u32_iterator<wchar_t const*, ucs4_char> ucs4_iter(&value);
|
||||
*utf8_iter++ = *ucs4_iter;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline utf8_string to_utf8(wchar_t const* str)
|
||||
{
|
||||
utf8_string result;
|
||||
typedef std::back_insert_iterator<utf8_string> insert_iter;
|
||||
insert_iter out_iter(result);
|
||||
utf8_output_iterator<insert_iter> utf8_iter(out_iter);
|
||||
|
||||
u16_to_u32_iterator<wchar_t const*, ucs4_char> ucs4_iter(str);
|
||||
for (ucs4_char c; (c = *ucs4_iter) != ucs4_char(); ++ucs4_iter) {
|
||||
*utf8_iter++ = c;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Traits, typename Allocator>
|
||||
inline utf8_string
|
||||
to_utf8(std::basic_string<wchar_t, Traits, Allocator> const& str)
|
||||
{
|
||||
return to_utf8(str.c_str());
|
||||
}
|
||||
#endif
|
||||
}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
// This is the version of the current Spirit X3 distribution
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define SPIRIT_X3_VERSION 0x3000
|
||||
#define SPIRIT_X3_VERSION 0x3004
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user