[DEV] add v1.76.0

This commit is contained in:
2021-10-05 21:37:46 +02:00
parent a97e9ae7d4
commit d0115b733d
45133 changed files with 4744437 additions and 1026325 deletions

View File

@@ -10,8 +10,8 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(SLEX_LEXER_HPP_5E8E1DF0_BB41_4938_B7E5_A4BB68222FF6_INCLUDED)
#define SLEX_LEXER_HPP_5E8E1DF0_BB41_4938_B7E5_A4BB68222FF6_INCLUDED
#if !defined(BOOST_SLEX_LEXER_HPP_5E8E1DF0_BB41_4938_B7E5_A4BB68222FF6_INCLUDED)
#define BOOST_SLEX_LEXER_HPP_5E8E1DF0_BB41_4938_B7E5_A4BB68222FF6_INCLUDED
#include <string>
#if defined(BOOST_SPIRIT_DEBUG)
@@ -58,6 +58,7 @@ namespace lexer {
#define INIT_DATA_CPP_SIZE 15
#define INIT_DATA_PP_NUMBER_SIZE 2
#define INIT_DATA_CPP0X_SIZE 15
#define INIT_DATA_CPP2A_SIZE 10
///////////////////////////////////////////////////////////////////////////////
//
@@ -114,6 +115,7 @@ private:
static typename base_type::lexer_data const init_data_cpp[INIT_DATA_CPP_SIZE]; // C++ only patterns
static typename base_type::lexer_data const init_data_pp_number[INIT_DATA_PP_NUMBER_SIZE]; // pp-number only patterns
static typename base_type::lexer_data const init_data_cpp0x[INIT_DATA_CPP0X_SIZE]; // C++0X only patterns
static typename base_type::lexer_data const init_data_cpp2a[INIT_DATA_CPP2A_SIZE]; // C++2A only patterns
};
///////////////////////////////////////////////////////////////////////////////
@@ -142,13 +144,13 @@ private:
#define INTEGER_SUFFIX "(" "[uU][lL]?|[lL][uU]?" ")"
#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0
#define LONGINTEGER_SUFFIX "(" "[uU]" "(" "[lL][lL]" ")" OR \
"(" "[lL][lL]" ")" "[uU]" "?" OR \
#define LONGINTEGER_SUFFIX "(" "[uU]" "(" "ll" OR "LL" ")" OR \
"(" "ll" OR "LL" ")" "[uU]" "?" OR \
"i64" \
")"
#else
#define LONGINTEGER_SUFFIX "(" "[uU]" "(" "[lL][lL]" ")" OR \
"(" "[lL][lL]" ")" "[uU]" "?" ")"
#define LONGINTEGER_SUFFIX "(" "[uU]" "(" "ll" OR "LL" ")" OR \
"(" "ll" OR "LL" ")" "[uU]" "?" ")"
#endif
#define FLOAT_SUFFIX "(" "[fF][lL]?" OR "[lL][fF]?" ")"
#define CHAR_SPEC "L?"
@@ -432,7 +434,7 @@ lexer<IteratorT, PositionT>::init_data_pp_number[INIT_DATA_PP_NUMBER_SIZE] =
};
///////////////////////////////////////////////////////////////////////////////
// C++ only token definitions
// C++11 only token definitions
#define T_EXTCHARLIT token_id(T_CHARLIT|AltTokenType)
#define T_EXTSTRINGLIT token_id(T_STRINGLIT|AltTokenType)
@@ -459,10 +461,31 @@ lexer<IteratorT, PositionT>::init_data_cpp0x[INIT_DATA_CPP0X_SIZE] =
TOKEN_DATA(NOEXCEPT, "noexcept"),
TOKEN_DATA(NULLPTR, "nullptr"),
TOKEN_DATA(STATICASSERT, "static_assert"),
TOKEN_DATA(THREADLOCAL, "threadlocal"),
TOKEN_DATA(THREADLOCAL, "thread_local"),
{ token_id(0) } // this should be the last entry
};
///////////////////////////////////////////////////////////////////////////////
// C++20 only token definitions
template <typename IteratorT, typename PositionT>
typename lexer_base<IteratorT, PositionT>::lexer_data const
lexer<IteratorT, PositionT>::init_data_cpp2a[INIT_DATA_CPP2A_SIZE] =
{
TOKEN_DATA(CHAR8_T, "char8_t"),
TOKEN_DATA(CONCEPT, "concept"),
TOKEN_DATA(CONSTEVAL, "consteval"),
TOKEN_DATA(CONSTINIT, "constinit"),
TOKEN_DATA(CO_AWAIT, "co_await"),
TOKEN_DATA(CO_RETURN, "co_return"),
TOKEN_DATA(CO_YIELD, "co_yield"),
TOKEN_DATA(REQUIRES, "requires"),
TOKEN_DATA(SPACESHIP, "<=>"),
{ token_id(0) } // this should be the last entry
};
///////////////////////////////////////////////////////////////////////////////
// undefine macros, required for regular expression definitions
#undef INCLUDEDEF
@@ -528,9 +551,9 @@ lexer<IteratorT, PositionT>::init_dfa(boost::wave::language_support lang)
}
}
// if in C++0x mode, add all new keywords
// if in C++0x mode, add appropriate keywords
#if BOOST_WAVE_SUPPORT_CPP0X != 0
if (boost::wave::need_cpp0x(lang)) {
if (boost::wave::need_cpp0x(lang) || boost::wave::need_cpp2a(lang)) {
for (int j = 0; 0 != init_data_cpp0x[j].tokenid; ++j) {
this->register_regex(init_data_cpp0x[j].tokenregex,
init_data_cpp0x[j].tokenid, init_data_cpp0x[j].tokencb,
@@ -539,6 +562,18 @@ lexer<IteratorT, PositionT>::init_dfa(boost::wave::language_support lang)
}
#endif
// if in C++2a mode, add those keywords
#if BOOST_WAVE_SUPPORT_CPP2A != 0
if (wave::need_cpp2a(lang)) {
for (int j = 0; 0 != init_data_cpp2a[j].tokenid; ++j) {
this->register_regex(init_data_cpp2a[j].tokenregex,
init_data_cpp2a[j].tokenid,
init_data_cpp2a[j].tokencb,
init_data_cpp2a[j].lexerstate);
}
}
#endif
for (int i = 0; 0 != init_data[i].tokenid; ++i) {
this->register_regex(init_data[i].tokenregex, init_data[i].tokenid,
init_data[i].tokencb, init_data[i].lexerstate);
@@ -624,7 +659,7 @@ public:
virtual ~slex_functor() {}
// get the next token from the input stream
token_type& get(token_type& result)
token_type& get(token_type& result) BOOST_OVERRIDE
{
if (!at_eof) {
do {
@@ -687,20 +722,20 @@ public:
}
break;
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
case T_PP_HHEADER:
case T_PP_QHEADER:
case T_PP_INCLUDE:
// convert to the corresponding ..._next token, if appropriate
{
#if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
// Skip '#' and whitespace and see whether we find an
// 'include_next' here.
typename string_type::size_type start = value.find("include");
if (0 == value.compare(start, 12, "include_next", 12))
id = token_id(id | AltTokenType);
#endif // BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
break;
}
#endif // BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
case T_EOF:
// T_EOF is returned as a valid token, the next call will
@@ -740,7 +775,7 @@ public:
return result = token_type(); // return T_EOI
}
void set_position(PositionT const &pos)
void set_position(PositionT const &pos) BOOST_OVERRIDE
{
// set position has to change the file name and line number only
first.get_position().set_file(pos.get_file());
@@ -748,7 +783,7 @@ public:
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
bool has_include_guards(std::string& guard_name) const
bool has_include_guards(std::string& guard_name) const BOOST_OVERRIDE
{ return guards.detected(guard_name); }
#endif
@@ -824,4 +859,4 @@ new_lexer_gen<IteratorT, PositionT>::new_lexer(IteratorT const &first,
} // namespace wave
} // namespace boost
#endif // !defined(SLEX_LEXER_HPP_5E8E1DF0_BB41_4938_B7E5_A4BB68222FF6_INCLUDED)
#endif // !defined(BOOST_SLEX_LEXER_HPP_5E8E1DF0_BB41_4938_B7E5_A4BB68222FF6_INCLUDED)

View File

@@ -40,6 +40,7 @@
#define BOOST_SPIRIT_LEXER_HPP
///////////////////////////////////////////////////////////////////////////////
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/spirit/include/classic_core.hpp>
@@ -49,10 +50,13 @@
#include <set>
#include <map>
#include <memory> // for auto_ptr/unique_ptr
#include <vector>
#include <stack>
#include <utility> // for pair
#if defined(BOOST_SPIRIT_DEBUG)
#include <iostream>
#endif
#include <fstream>
#include <boost/assert.hpp>
#include <boost/limits.hpp>
@@ -115,16 +119,16 @@ public:
char_node(const char_node& x);
virtual ~char_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
@@ -231,16 +235,16 @@ public:
epsilon_node(const epsilon_node& x);
virtual ~epsilon_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
@@ -341,21 +345,21 @@ public:
or_node(const or_node& x);
virtual ~or_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
std::unique_ptr<node> m_left;
std::unique_ptr<node> m_right;
#else
@@ -474,21 +478,21 @@ public:
cat_node(const cat_node& x);
virtual ~cat_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
std::unique_ptr<node> m_left;
std::unique_ptr<node> m_right;
#else
@@ -630,21 +634,21 @@ public:
star_node(const star_node& x);
virtual ~star_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
std::unique_ptr<node> m_left;
#else
std::auto_ptr<node> m_left;
@@ -753,16 +757,16 @@ public:
eof_node(const eof_node& x);
virtual ~eof_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
@@ -867,16 +871,16 @@ public:
ccl_node(const ccl_node& x);
virtual ~ccl_node(){}
virtual node* clone() const;
virtual bool nullable() const;
virtual node_set firstpos() const;
virtual node_set lastpos() const;
virtual void compute_followpos(followpos_t& followpos) const;
virtual void compute_state_match(state_match_t& state_match ) const;
virtual void get_eof_ids(node_set& eof_set) const;
virtual void assign_node_ids(node_id_t& node_count);
node* clone() const BOOST_OVERRIDE;
bool nullable() const BOOST_OVERRIDE;
node_set firstpos() const BOOST_OVERRIDE;
node_set lastpos() const BOOST_OVERRIDE;
void compute_followpos(followpos_t& followpos) const BOOST_OVERRIDE;
void compute_state_match(state_match_t& state_match ) const BOOST_OVERRIDE;
void get_eof_ids(node_set& eof_set) const BOOST_OVERRIDE;
void assign_node_ids(node_id_t& node_count) BOOST_OVERRIDE;
#if defined(BOOST_SPIRIT_DEBUG) && (BOOST_SPIRIT_DEBUG_FLAGS & BOOST_SPIRIT_DEBUG_FLAGS_SLEX)
virtual void dump(std::ostream& out) const;
void dump(std::ostream& out) const BOOST_OVERRIDE;
#endif
private:
@@ -2417,7 +2421,7 @@ bool find_acceptance_state(const node_set& eof_node_ids,
}
template <typename RegexListT, typename GrammarT>
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
inline std::unique_ptr<node>
#else
inline std::auto_ptr<node>
@@ -2429,7 +2433,7 @@ parse_regexes(const RegexListT& regex_list, GrammarT& g)
boost::throw_exception(bad_regex());
typename RegexListT::const_iterator ri = regex_list.begin();
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
std::unique_ptr<node> tree(lexerimpl::parse(g, (*ri).str));
#else
std::auto_ptr<node> tree(lexerimpl::parse(g, (*ri).str));
@@ -2440,14 +2444,14 @@ parse_regexes(const RegexListT& regex_list, GrammarT& g)
++ri;
for (/**/; ri != regex_list.end(); ++ri)
{
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
std::unique_ptr<node> next_tree(lexerimpl::parse(g, (*ri).str));
#else
std::auto_ptr<node> next_tree(lexerimpl::parse(g, (*ri).str));
#endif
if (next_tree.get() == 0)
boost::throw_exception(bad_regex());
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
tree = std::unique_ptr<node>(new or_node(tree.release(), next_tree.release()));
#else
tree = std::auto_ptr<node>(new or_node(tree.release(), next_tree.release()));
@@ -2473,7 +2477,7 @@ inline void
lexer<IteratorT, TokenT, CallbackT>::create_dfa_for_state(int state)
{
using lexerimpl::node;
#ifdef BOOST_NO_AUTO_PTR
#ifndef BOOST_NO_CXX11_SMART_PTR
std::unique_ptr<node> tree = lexerimpl::parse_regexes(m_regex_list[state], g);
#else
std::auto_ptr<node> tree = lexerimpl::parse_regexes(m_regex_list[state], g);