update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -24,9 +24,9 @@ namespace boost { namespace spirit { namespace iterator_policies
{
public:
illegal_backtracking() BOOST_NOEXCEPT_OR_NOTHROW {}
~illegal_backtracking() BOOST_NOEXCEPT_OR_NOTHROW {}
~illegal_backtracking() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {}
char const* what() const BOOST_NOEXCEPT_OR_NOTHROW
char const* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
{
return "boost::spirit::multi_pass::illegal_backtracking";
}

View File

@@ -53,7 +53,7 @@ namespace boost { namespace spirit { namespace iterator_policies
protected:
unique() {}
explicit unique(T x) {}
explicit unique(T) {}
void swap(unique&) {}
@@ -83,7 +83,7 @@ namespace boost { namespace spirit { namespace iterator_policies
}
template <typename MultiPass>
static bool input_is_valid(MultiPass const& mp, value_type const& t)
static bool input_is_valid(MultiPass const& mp, value_type const&)
{
return mp.shared()->input_is_valid_;
}

View File

@@ -58,7 +58,7 @@ namespace boost { namespace spirit { namespace iterator_policies
protected:
unique() {}
explicit unique(T x) {}
explicit unique(T) {}
void swap(unique&) {}
@@ -87,7 +87,7 @@ namespace boost { namespace spirit { namespace iterator_policies
}
template <typename MultiPass>
static bool input_is_valid(MultiPass const& mp, value_type const& t)
static bool input_is_valid(MultiPass const&, value_type const& t)
{
using namespace input_iterator_is_valid_test_;
return token_is_valid(t);

View File

@@ -189,10 +189,6 @@ namespace boost { namespace spirit { namespace iterator_policies
mutable typename Functor::second_type ftor;
result_type curtok;
private:
// silence MSVC warning C4512: assignment operator could not be generated
shared& operator= (shared const&);
};
};

View File

@@ -56,9 +56,6 @@ namespace boost { namespace spirit
explicit basic_istream_iterator(std::basic_istream<Elem, Traits>& x)
: base_type(x) {}
basic_istream_iterator(basic_istream_iterator const& x)
: base_type(x) {}
#if BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
basic_istream_iterator(int) // workaround for a bug in the library
: base_type() {} // shipped with gcc 3.1

View File

@@ -2,6 +2,8 @@
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2010 Bryce Lelbach
Copyright (c) 2014 Tomoki Imai
Copyright (c) 2023 Kniazev Nikita
Copyright (c) 2023 Tobias Loew
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)
@@ -11,7 +13,8 @@
#define BOOST_SPIRIT_SUPPORT_LINE_POS_ITERATOR
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <iterator>
namespace boost { namespace spirit
{
@@ -20,7 +23,9 @@ namespace boost { namespace spirit
This iterator adapter only stores the current line number, nothing else.
Unlike __classic__'s `position_iterator`, it does not store the
column number and does not need an end iterator. The current column can
be computed, if needed. */
be computed, if needed.
NOTE: line counting considers position inside multicharacter line-breaks
(such as CRLF and LFCR) as being on the next line already. */
//`[heading Class Reference]
template <class Iterator>
class line_pos_iterator : public boost::iterator_adaptor<
@@ -32,7 +37,7 @@ namespace boost { namespace spirit
public:
line_pos_iterator();
explicit line_pos_iterator(Iterator);
explicit line_pos_iterator(Iterator, std::size_t line_start = 1);
std::size_t position() const;
@@ -42,17 +47,18 @@ namespace boost { namespace spirit
void increment();
std::size_t line; // The line position.
typename std::iterator_traits<Iterator>::value_type prev;
bool prev_n;
bool prev_r;
};
//]
template <class Iterator>
line_pos_iterator<Iterator>::line_pos_iterator() :
line_pos_iterator::iterator_adaptor_(), line(1), prev(0) { }
line_pos_iterator::iterator_adaptor_(), line(1), prev_n(), prev_r() { }
template <class Iterator>
line_pos_iterator<Iterator>::line_pos_iterator(Iterator base) :
line_pos_iterator::iterator_adaptor_(base), line(1), prev(0) { }
line_pos_iterator<Iterator>::line_pos_iterator(Iterator base, std::size_t line_start /* = 1 */ ) :
line_pos_iterator::iterator_adaptor_(base), line(line_start), prev_n(), prev_r() { }
template <class Iterator>
std::size_t line_pos_iterator<Iterator>::position() const
@@ -64,22 +70,13 @@ namespace boost { namespace spirit
void line_pos_iterator<Iterator>::increment()
{
typename std::iterator_traits<Iterator>::reference
ref = *(this->base());
ch = *(this->base());
switch (ref) {
case '\r':
if (prev != '\n')
++line;
break;
case '\n':
if (prev != '\r')
++line;
break;
default:
break;
}
prev = ref;
int newline = ((ch == '\n') & !prev_r) | ((ch == '\r') & !prev_n);
line += newline;
prev_r = (ch == '\r') & newline;
prev_n = (ch == '\n') & newline;
++this->base_reference();
}
@@ -96,6 +93,12 @@ namespace boost { namespace spirit
/*`Get an iterator to the beginning of the line. Applicable to any
iterator. */
//`[heading get_line_end]
template <class Iterator>
inline Iterator get_line_end(Iterator current, Iterator upper_bound);
/*`Get an iterator to the end of the line. Applicable to any
iterator. */
//`[heading get_current_line]
template <class Iterator>
inline iterator_range<Iterator>
@@ -122,22 +125,62 @@ namespace boost { namespace spirit
{
return i.position();
}
namespace detail {
// get_line_start for forward iterators: forward linear search starting from lower-bound
// complexity: linear in length of [lower_bound, current)
template <class Iterator>
inline Iterator get_line_start(Iterator lower_bound,
Iterator current,
std::forward_iterator_tag)
{
Iterator latest = lower_bound;
for (Iterator it = lower_bound; it != current; ) {
if ((*it == '\r') || (*it == '\n')) {
latest = ++it;
}
else {
++it;
}
}
return latest;
}
// get_line_start for forward iterators: backward linear search starting from current
// complexity: linear in avarage line-length
template <class Iterator>
inline Iterator get_line_start(Iterator lower_bound,
Iterator current,
std::bidirectional_iterator_tag)
{
while (current != lower_bound) {
--current;
if ((*current == '\r') || (*current == '\n')) {
return ++current;
}
}
return current;
}
}
template <class Iterator>
inline Iterator get_line_start(Iterator lower_bound, Iterator current)
{
Iterator latest = lower_bound;
bool prev_was_newline = false;
for (Iterator i = lower_bound; i != current; ++i) {
if (prev_was_newline) {
latest = i;
}
prev_was_newline = (*i == '\r') || (*i == '\n');
}
if (prev_was_newline) {
latest = current;
}
return latest;
return detail::get_line_start(
lower_bound,
current,
typename std::iterator_traits<Iterator>::iterator_category()
);
}
template <class Iterator>
inline line_pos_iterator<Iterator>
get_line_start(line_pos_iterator<Iterator> lower_bound,
line_pos_iterator<Iterator> current)
{
// No need in line number counting because it will be the same
Iterator it = get_line_start(lower_bound.base(), current.base());
return line_pos_iterator<Iterator>(it, current.position());
}
template <class Iterator>
@@ -151,6 +194,15 @@ namespace boost { namespace spirit
return upper_bound;
}
template <class Iterator>
inline line_pos_iterator<Iterator>
get_line_end(line_pos_iterator<Iterator> current,
line_pos_iterator<Iterator> upper_bound)
{
// No need in line number counting because it will be the same
Iterator it = get_line_end(current.base(), upper_bound.base());
return line_pos_iterator<Iterator>(it, current.position());
}
template <class Iterator>
inline iterator_range<Iterator>
@@ -162,7 +214,7 @@ namespace boost { namespace spirit
Iterator last = get_line_end(current, upper_bound);
return iterator_range<Iterator>(first, last);
}
template <class Iterator>
inline std::size_t get_column(Iterator lower_bound,
Iterator current,
@@ -184,6 +236,14 @@ namespace boost { namespace spirit
return column;
}
template <class Iterator>
inline std::size_t get_column(line_pos_iterator<Iterator> lower_bound,
line_pos_iterator<Iterator> current,
std::size_t tabs = 4)
{
return get_column(lower_bound.base(), current.base(), tabs);
}
}}
#endif // BOOST_SPIRIT_SUPPORT_LINE_POS_ITERATOR