[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

@@ -13,17 +13,17 @@ SOURCES =
../instantiate_xlex_lexer
../instantiate_cpp_grammar
../instantiate_defined_grammar
../instantiate_has_include_grammar
;
exe token_statistics
:
$(SOURCES)
/boost/wave//boost_wave
/boost/program_options//boost_program_options
/boost/program_options//boost_program_options/<link>static
/boost/filesystem//boost_filesystem
/boost/system//boost_system
/boost/thread//boost_thread
/boost/date_time//boost_date_time
;
for local source in $(SOURCES)

View File

@@ -10,11 +10,12 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(COLLECT_TOKEN_STATISTICS_VERSION_HPP)
#define COLLECT_TOKEN_STATISTICS_VERSION_HPP
#if !defined(BOOST_COLLECT_TOKEN_STATISTICS_VERSION_HPP)
#define BOOST_COLLECT_TOKEN_STATISTICS_VERSION_HPP
#include <algorithm>
#include <map>
#include <iostream>
#include <boost/assert.hpp>
#include <boost/wave/token_ids.hpp>
@@ -38,7 +39,7 @@ public:
{
using boost::wave::token_id;
int id = token_id(token) - boost::wave::T_FIRST_TOKEN;
int id = ID_FROM_TOKEN(token) - boost::wave::T_FIRST_TOKEN;
BOOST_ASSERT(id < count);
++token_count[id];
}
@@ -68,4 +69,4 @@ private:
int token_count[count];
};
#endif // !defined(COLLECT_TOKEN_STATISTICS_VERSION_HPP)
#endif // !defined(BOOST_COLLECT_TOKEN_STATISTICS_VERSION_HPP)

View File

@@ -0,0 +1,42 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
Sample: Collect token statistics
Explicit instantiation of the has_include_grammar template
http://www.boost.org/
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#include "token_statistics.hpp"
#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0
#include <string>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/cpplexer/cpp_lex_token.hpp>
#include "xlex_iterator.hpp"
#include <boost/wave/grammars/cpp_has_include_grammar.hpp>
///////////////////////////////////////////////////////////////////////////////
//
// Explicit instantiation of the has_include_grammar_gen template
// with the correct token type. This instantiates the corresponding parse
// function, which in turn instantiates the has_include_grammar
// object (see wave/grammars/cpp_has_include_grammar.hpp)
//
///////////////////////////////////////////////////////////////////////////////
typedef boost::wave::cpplexer::xlex::xlex_iterator<
boost::wave::cpplexer::lex_token<> >
lexer_type;
template struct boost::wave::grammars::has_include_grammar_gen<lexer_type>;
#endif // #if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION != 0

View File

@@ -19,7 +19,6 @@
#include <boost/wave/token_ids.hpp>
#include <boost/wave/cpplexer/cpp_lex_token.hpp>
#include "xlex_iterator.hpp"
///////////////////////////////////////////////////////////////////////////////
// The following file needs to be included only once throughout the whole

View File

@@ -26,6 +26,8 @@
#include "collect_token_statistics.hpp"
#include <iostream>
///////////////////////////////////////////////////////////////////////////////
// import required names
using namespace boost::spirit::classic;

View File

@@ -10,12 +10,12 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(TOKEN_STATISTICS_HPP)
#define TOKEN_STATISTICS_HPP
#if !defined(BOOST_TOKEN_STATISTICS_HPP)
#define BOOST_TOKEN_STATISTICS_HPP
///////////////////////////////////////////////////////////////////////////////
// include often used files from the stdlib
#include <iostream>
#include <iosfwd>
#include <fstream>
#include <string>
#include <vector>
@@ -46,4 +46,4 @@
// include required boost libraries
#include <boost/pool/pool_alloc.hpp>
#endif // !defined(TOKEN_STATISTICS_HPP)
#endif // !defined(BOOST_TOKEN_STATISTICS_HPP)

View File

@@ -10,11 +10,11 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(TOKEN_STATISTICS_VERSION_HPP)
#define TOKEN_STATISTICS_VERSION_HPP
#if !defined(BOOST_TOKEN_STATISTICS_VERSION_HPP)
#define BOOST_TOKEN_STATISTICS_VERSION_HPP
#define TOKEN_STATISTICS_VERSION_MAJOR 0
#define TOKEN_STATISTICS_VERSION_MINOR 1
#define TOKEN_STATISTICS_VERSION_SUBMINOR 0
#endif // !defined(TOKEN_STATISTICS_VERSION_HPP)
#endif // !defined(BOOST_TOKEN_STATISTICS_VERSION_HPP)

View File

@@ -10,8 +10,8 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(XLEX_LEXER_HPP)
#define XLEX_LEXER_HPP
#if !defined(BOOST_XLEX_LEXER_HPP)
#define BOOST_XLEX_LEXER_HPP
#include <string>
#include <cstdio>
@@ -35,7 +35,7 @@
#include <boost/wave/cpplexer/cpp_lex_interface.hpp>
// reuse the default token type
#include "../xlex_iterator.hpp"
#include "../xlex_interface.hpp"
// include the xpressive headers
#include "xpressive_lexer.hpp"
@@ -71,9 +71,9 @@ public:
token_type& get(token_type& t);
void set_position(Position const &pos)
{
// set position has to change the file name and line number only
filename = pos.get_file();
line = pos.get_line();
column = pos.get_column();
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
@@ -91,6 +91,7 @@ private:
string_type filename;
int line;
int column;
bool at_eof;
boost::wave::language_support language;
@@ -103,6 +104,8 @@ private:
static lexer_data const init_data[]; // common patterns
static lexer_data const init_data_cpp[]; // C++ only patterns
static lexer_data const init_data_cpp0x[]; // C++11 only patterns
static lexer_data const init_data_cpp2a[]; // C++20 only patterns
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
boost::wave::cpplexer::include_guards<token_type> guards;
@@ -124,7 +127,7 @@ private:
#define TRI(c) Q("?") Q("?") c
// definition of some subtoken regexps to simplify the regex definitions
#define BLANK "[ \t]"
#define BLANK "[ \t\v\f]"
#define CCOMMENT Q("/") Q("*") ".*?" Q("*") Q("/")
#define PPSPACE "(" BLANK OR CCOMMENT ")*"
@@ -143,16 +146,17 @@ 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]?|[lL][fF]?" ")"
#define CHAR_SPEC "L?"
#define EXTCHAR_SPEC "(" "[uU]" OR "u8" ")"
#define BACKSLASH "(" Q("\\") OR TRI(Q("/")) ")"
#define ESCAPESEQ BACKSLASH "(" \
@@ -360,7 +364,6 @@ lexer<Iterator, Position>::init_data[] =
TOKEN_DATA(T_IDENTIFIER, "([a-zA-Z_$]" OR UNIVERSALCHAR ")([a-zA-Z0-9_$]" OR UNIVERSALCHAR ")*"),
#endif
TOKEN_DATA(T_SPACE, BLANK "+"),
TOKEN_DATA(T_SPACE2, "[\v\f]+"),
TOKEN_DATA(T_CONTLINE, Q("\\") "\n"),
TOKEN_DATA(T_NEWLINE, NEWLINEDEF),
TOKEN_DATA(T_POUND_POUND, "##"),
@@ -397,6 +400,56 @@ lexer<Iterator, Position>::init_data_cpp[] =
{ token_id(0) } // this should be the last entry
};
///////////////////////////////////////////////////////////////////////////////
// C++11 only token definitions
#define T_EXTCHARLIT token_id(T_CHARLIT|AltTokenType)
#define T_EXTSTRINGLIT token_id(T_STRINGLIT|AltTokenType)
#define T_EXTRAWSTRINGLIT token_id(T_RAWSTRINGLIT|AltTokenType)
template <typename Iterator, typename Position>
typename lexer<Iterator, Position>::lexer_data const
lexer<Iterator, Position>::init_data_cpp0x[] =
{
TOKEN_DATA(T_EXTCHARLIT, EXTCHAR_SPEC "'"
"(" ESCAPESEQ OR UNIVERSALCHAR OR "[^\\n\\r\\\\']" ")+" "'"),
TOKEN_DATA(T_EXTSTRINGLIT, EXTCHAR_SPEC Q("\"")
"(" ESCAPESEQ OR UNIVERSALCHAR OR "[^\\n\\r\\\\\"]" ")*" Q("\"")),
TOKEN_DATA(T_RAWSTRINGLIT, CHAR_SPEC "R" Q("\"")
"(" ESCAPESEQ OR UNIVERSALCHAR OR "[^\\\\\"]" ")*" Q("\"")),
TOKEN_DATA(T_EXTRAWSTRINGLIT, EXTCHAR_SPEC "R" Q("\"")
"(" ESCAPESEQ OR UNIVERSALCHAR OR "[^\\\\\"]" ")*" Q("\"")),
TOKEN_DATA(T_ALIGNAS, "alignas"),
TOKEN_DATA(T_ALIGNOF, "alignof"),
TOKEN_DATA(T_CHAR16_T, "char16_t"),
TOKEN_DATA(T_CHAR32_T, "char32_t"),
TOKEN_DATA(T_CONSTEXPR, "constexpr"),
TOKEN_DATA(T_DECLTYPE, "decltype"),
TOKEN_DATA(T_NOEXCEPT, "noexcept"),
TOKEN_DATA(T_NULLPTR, "nullptr"),
TOKEN_DATA(T_STATICASSERT, "static_assert"),
TOKEN_DATA(T_THREADLOCAL, "thread_local"),
{ token_id(0) } // this should be the last entry
};
///////////////////////////////////////////////////////////////////////////////
// C++11 only token definitions
template <typename Iterator, typename Position>
typename lexer<Iterator, Position>::lexer_data const
lexer<Iterator, Position>::init_data_cpp2a[] =
{
TOKEN_DATA(T_CHAR8_T, "char8_t"),
TOKEN_DATA(T_CONCEPT, "concept"),
TOKEN_DATA(T_CONSTEVAL, "consteval"),
TOKEN_DATA(T_CONSTINIT, "constinit"),
TOKEN_DATA(T_CO_AWAIT, "co_await"),
TOKEN_DATA(T_CO_RETURN, "co_return"),
TOKEN_DATA(T_CO_YIELD, "co_yield"),
TOKEN_DATA(T_REQUIRES, "requires"),
TOKEN_DATA(T_SPACESHIP, "<=>"),
{ token_id(0) } // this should be the last entry
};
///////////////////////////////////////////////////////////////////////////////
// undefine macros, required for regular expression definitions
#undef INCLUDEDEF
@@ -413,6 +466,7 @@ lexer<Iterator, Position>::init_data_cpp[] =
#undef INTEGER
#undef FLOAT_SUFFIX
#undef CHAR_SPEC
#undef EXTCHAR_SPEC
#undef BACKSLASH
#undef ESCAPESEQ
#undef HEXQUAD
@@ -425,6 +479,9 @@ lexer<Iterator, Position>::init_data_cpp[] =
#undef TOKEN_DATA
#undef TOKEN_DATA_EX
#undef T_EXTCHARLIT
#undef T_EXTSTRINGLIT
#undef T_EXTRAWSTRINGLIT
///////////////////////////////////////////////////////////////////////////////
// initialize cpp lexer
template <typename Iterator, typename Position>
@@ -433,7 +490,8 @@ lexer<Iterator, Position>::lexer(Iterator const &first,
Iterator const &last, Position const &pos,
boost::wave::language_support language)
: first(first), last(last),
filename(pos.get_file()), line(0), at_eof(false), language(language)
filename(pos.get_file()), line(pos.get_line()), column(pos.get_column()),
at_eof(false), language(language)
{
// if in C99 mode, some of the keywords/operators are not valid
if (!boost::wave::need_c99(language)) {
@@ -443,6 +501,24 @@ lexer<Iterator, Position>::lexer(Iterator const &first,
}
}
#if BOOST_WAVE_SUPPORT_CPP0X != 0
if (boost::wave::need_cpp0x(language) || boost::wave::need_cpp2a(language)) {
for (int j = 0; 0 != init_data_cpp0x[j].tokenid; ++j) {
xlexer.register_regex(init_data_cpp0x[j].tokenregex,
init_data_cpp0x[j].tokenid, init_data_cpp[j].tokencb);
}
}
#endif
#if BOOST_WAVE_SUPPORT_CPP2A != 0
if (boost::wave::need_cpp2a(language) || boost::wave::need_cpp2a(language)) {
for (int j = 0; 0 != init_data_cpp2a[j].tokenid; ++j) {
xlexer.register_regex(init_data_cpp2a[j].tokenregex,
init_data_cpp2a[j].tokenid, init_data_cpp[j].tokencb);
}
}
#endif
// tokens valid for C++ and C99
for (int i = 0; 0 != init_data[i].tokenid; ++i) {
xlexer.register_regex(init_data[i].tokenregex, init_data[i].tokenid,
@@ -486,13 +562,19 @@ lexer<Iterator, Position>::get(boost::wave::cpplexer::lex_token<Position>& t)
at_eof = true;
value.clear();
}
else if (T_NEWLINE == id) {
++line;
column = 1;
} else {
column += value.size();
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
cpplexer::lex_token<Position> tok(id, value, Position(filename, line, -1));
cpplexer::lex_token<Position> tok(id, value, Position(filename, line, column));
return t = guards.detect_guard(tok);
#else
return t = cpplexer::lex_token<Position>(id, value,
Position(filename, line, -1));
Position(filename, line, column));
#endif
}
@@ -519,11 +601,11 @@ public:
virtual ~xlex_functor() {}
// get the next token from the input stream
token_type& get(token_type& t) { return lexer_.get(t); }
void set_position(Position const &pos) { lexer_.set_position(pos); }
token_type& get(token_type& t) BOOST_OVERRIDE { return lexer_.get(t); }
void set_position(Position const &pos) BOOST_OVERRIDE { lexer_.set_position(pos); }
#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 lexer_.has_include_guards(guard_name); }
#endif
@@ -585,4 +667,4 @@ new_lexer_gen<Iterator, Position>::new_lexer(Iterator const &first,
} // namespace wave
} // namespace boost
#endif // !defined(XLEX_LEXER_HPP)
#endif // !defined(BOOST_XLEX_LEXER_HPP)

View File

@@ -10,15 +10,15 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(XPRESSIVE_LEXER_HPP)
#define XPRESSIVE_LEXER_HPP
#if !defined(BOOST_XPRESSIVE_LEXER_HPP)
#define BOOST_XPRESSIVE_LEXER_HPP
#include <string>
#include <vector>
#include <utility>
#include <iterator>
#include <algorithm>
#include <boost/detail/iterator.hpp>
#include <boost/xpressive/xpressive.hpp>
namespace boost {
@@ -36,7 +36,7 @@ template <
class xpressive_lexer
{
private:
typedef typename boost::detail::iterator_traits<Iterator>::value_type
typedef typename std::iterator_traits<Iterator>::value_type
char_type;
typedef std::basic_string<char_type> string_type;
@@ -130,6 +130,6 @@ xpressive_lexer<Iterator, Token, Callback>::next_token(
///////////////////////////////////////////////////////////////////////////////
}}}} // boost::wave::cpplexer::xlex
#endif // !defined(XPRESSIVE_LEXER_HPP)
#endif // !defined(BOOST_XPRESSIVE_LEXER_HPP)

View File

@@ -10,8 +10,8 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(XLEX_INTERFACE_HPP)
#define XLEX_INTERFACE_HPP
#if !defined(BOOST_XLEX_INTERFACE_HPP)
#define BOOST_XLEX_INTERFACE_HPP
#include <boost/wave/language_support.hpp>
#include <boost/wave/util/file_position.hpp>
@@ -86,4 +86,4 @@ struct xlex_input_interface
} // namespace wave
} // namespace boost
#endif // !defined(XLEX_INTERFACE_HPP)
#endif // !defined(BOOST_XLEX_INTERFACE_HPP)

View File

@@ -14,7 +14,7 @@
#define XLEX_ITERATOR_HPP
#include <string>
#include <iostream>
#include <iosfwd>
#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>