update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Grammar for universal character validation (see C++ standard: Annex E)
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -32,12 +32,12 @@ namespace impl {
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
inline bool
inline bool
is_trigraph(StringT const& trigraph)
{
if (trigraph.size() < 3 || '?' != trigraph[0] || '?' != trigraph[1])
return false;
switch (trigraph[2]) {
case '\'': case '=': case '/': case '(':
case ')': case '<': case '>': case '!':
@@ -55,11 +55,11 @@ is_trigraph(StringT const& trigraph)
//
// convert_trigraph
//
// The function convert_trigraph() converts a single trigraph character
// The function convert_trigraph() converts a single trigraph character
// sequence into the corresponding character.
//
// If the given character sequence doesn't form a valid trigraph sequence
// no conversion is performed.
// no conversion is performed.
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
@@ -88,11 +88,11 @@ StringT result (trigraph);
//
// convert_trigraphs
//
// The function convert_trigraph() converts all trigraphs in the given
// The function convert_trigraph() converts all trigraphs in the given
// string into the corresponding characters.
//
// If one of the given character sequences doesn't form a valid trigraph
// sequence no conversion is performed.
// If one of the given character sequences doesn't form a valid trigraph
// sequence no conversion is performed.
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
@@ -105,7 +105,7 @@ convert_trigraphs(StringT const &value)
if (StringT::npos != pos1) {
do {
result += value.substr(pos, pos1-pos);
StringT trigraph (value.substr(pos1));
StringT trigraph (value.substr(pos1));
if (is_trigraph(trigraph)) {
result += convert_trigraph(trigraph);
pos1 = value.find_first_of ("?", pos = pos1+3);
@@ -124,7 +124,7 @@ convert_trigraphs(StringT const &value)
}
///////////////////////////////////////////////////////////////////////////////
} // namespace impl
} // namespace impl
} // namespace cpplexer
} // namespace wave
} // namespace boost

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the abstract lexer interface
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -35,14 +35,14 @@ namespace cpplexer {
///////////////////////////////////////////////////////////////////////////////
//
// The lex_input_interface decouples the lex_iterator_shim from the actual
// The lex_input_interface decouples the lex_iterator_shim from the actual
// lexer. This is done to allow compile time reduction.
// Thanks to JCAB for having this idea.
//
///////////////////////////////////////////////////////////////////////////////
template <typename TokenT>
struct lex_input_interface
struct lex_input_interface
{
typedef typename TokenT::position_type position_type;
@@ -59,7 +59,7 @@ struct lex_input_interface
///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace wave
} // namespace boost
} // namespace boost
#ifdef BOOST_MSVC
#pragma warning(pop)

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the abstract lexer interface
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -17,7 +17,7 @@
#include <boost/wave/util/file_position.hpp>
#include <boost/wave/language_support.hpp>
#include <boost/wave/cpplexer/cpp_lex_interface.hpp>
#include <boost/wave/cpplexer/cpp_lex_token.hpp> // lex_token
#include <boost/wave/cpplexer/cpp_lex_token.hpp> // lex_token
// this must occur after all of the includes and before any code appears
#ifdef BOOST_HAS_ABI_HEADERS
@@ -39,25 +39,25 @@ namespace cpplexer {
#define BOOST_WAVE_NEW_LEXER_DECL BOOST_WAVE_DECL
#else
#define BOOST_WAVE_NEW_LEXER_DECL
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
//
//
// new_lexer_gen: generates a new instance of the required C++ lexer
//
///////////////////////////////////////////////////////////////////////////////
template <
typename IteratorT,
typename IteratorT,
typename PositionT = boost::wave::util::file_position_type,
typename TokenT = lex_token<PositionT>
typename TokenT = lex_token<PositionT>
>
struct BOOST_WAVE_NEW_LEXER_DECL new_lexer_gen
{
// The NewLexer function allows the opaque generation of a new lexer object.
// It is coupled to the token type to allow to decouple the lexer/token
// It is coupled to the token type to allow to decouple the lexer/token
// configurations at compile time.
static lex_input_interface<TokenT> *
new_lexer(IteratorT const &first, IteratorT const &last,
new_lexer(IteratorT const &first, IteratorT const &last,
PositionT const &pos, boost::wave::language_support language);
};
@@ -81,22 +81,22 @@ struct lex_input_interface_generator
~lex_input_interface_generator() {}
// The new_lexer function allows the opaque generation of a new lexer object.
// It is coupled to the token type to allow to distinguish different
// It is coupled to the token type to allow to distinguish different
// lexer/token configurations at compile time.
template <typename IteratorT>
static lex_input_interface<TokenT> *
new_lexer(IteratorT const &first, IteratorT const &last,
new_lexer(IteratorT const &first, IteratorT const &last,
position_type const &pos, boost::wave::language_support language)
{
{
return new_lexer_gen<IteratorT, position_type, TokenT>::new_lexer (
first, last, pos, language);
first, last, pos, language);
}
};
///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace wave
} // namespace boost
} // namespace boost
#ifdef BOOST_MSVC
#pragma warning(pop)

View File

@@ -1,8 +1,8 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the lexer iterator
Definition of the lexer iterator
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -35,7 +35,7 @@
#if 0 != __COMO_VERSION__ || !BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
#define BOOST_WAVE_EOF_PREFIX static
#else
#define BOOST_WAVE_EOF_PREFIX
#define BOOST_WAVE_EOF_PREFIX
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -45,18 +45,18 @@ namespace cpplexer {
namespace impl {
///////////////////////////////////////////////////////////////////////////////
//
//
// lex_iterator_functor_shim
//
///////////////////////////////////////////////////////////////////////////////
template <typename TokenT>
class lex_iterator_functor_shim
template <typename TokenT>
class lex_iterator_functor_shim
{
typedef typename TokenT::position_type position_type;
public:
lex_iterator_functor_shim()
lex_iterator_functor_shim()
#if /*0 != __DECCXX_VER || */defined(__PGI)
: eof()
#endif
@@ -76,16 +76,16 @@ public:
template <typename MultiPass>
static result_type& get_next(MultiPass& mp, result_type& result)
{
return mp.shared()->ftor->get(result);
{
return mp.shared()->ftor->get(result);
}
// this will be called whenever the last reference to a multi_pass will
// be released
template <typename MultiPass>
static void destroy(MultiPass& mp)
{
delete mp.shared()->ftor;
{
delete mp.shared()->ftor;
}
template <typename MultiPass>
@@ -95,7 +95,7 @@ public:
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
template <typename MultiPass>
static bool has_include_guards(MultiPass& mp, std::string& guard_name)
static bool has_include_guards(MultiPass& mp, std::string& guard_name)
{
return mp.shared()->ftor->has_include_guards(guard_name);
}
@@ -114,12 +114,12 @@ typename lex_iterator_functor_shim<TokenT>::result_type const
} // namespace impl
///////////////////////////////////////////////////////////////////////////////
//
//
// lex_iterator
//
// A generic C++ lexer interface class, which allows to plug in different
// lexer implementations. The interface between the lexer type used and
// the preprocessor component depends on the token type only (template
// lexer implementations. The interface between the lexer type used and
// the preprocessor component depends on the token type only (template
// parameter TokenT).
// Additionally, the following requirements apply:
//
@@ -130,7 +130,7 @@ typename lex_iterator_functor_shim<TokenT>::result_type const
// eof token equivalent
// - the lexer should implement a constructor taking two iterators
// pointing to the beginning and the end of the input stream,
// a third parameter containing the name of the parsed input file
// a third parameter containing the name of the parsed input file
// and a 4th parameter of the type boost::wave::language_support
// which specifies, which language subset should be supported (C++,
// C99, C++11 etc.).
@@ -138,13 +138,13 @@ typename lex_iterator_functor_shim<TokenT>::result_type const
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Divide the given functor type into its components (unique and shared)
// Divide the given functor type into its components (unique and shared)
// and build a std::pair from these parts
template <typename FunctorData>
struct make_multi_pass
{
typedef
std::pair<typename FunctorData::unique, typename FunctorData::shared>
typedef
std::pair<typename FunctorData::unique, typename FunctorData::shared>
functor_data_type;
typedef typename FunctorData::result_type result_type;
@@ -165,13 +165,13 @@ struct make_multi_pass
///////////////////////////////////////////////////////////////////////////////
template <typename TokenT>
class lex_iterator
class lex_iterator
: public make_multi_pass<impl::lex_iterator_functor_shim<TokenT> >::type
{
typedef impl::lex_iterator_functor_shim<TokenT> input_policy_type;
typedef typename make_multi_pass<input_policy_type>::type base_type;
typedef typename make_multi_pass<input_policy_type>::functor_data_type
typedef typename make_multi_pass<input_policy_type>::functor_data_type
functor_data_type;
typedef typename input_policy_type::unique unique_functor_type;
@@ -184,8 +184,8 @@ public:
{}
template <typename IteratorT>
lex_iterator(IteratorT const &first, IteratorT const &last,
typename TokenT::position_type const &pos,
lex_iterator(IteratorT const &first, IteratorT const &last,
typename TokenT::position_type const &pos,
boost::wave::language_support language)
: base_type(
functor_data_type(
@@ -209,7 +209,7 @@ public:
const_cast<token_type&>(currtoken).set_position(currpos);
// set the new position for future tokens as well
if (token_type::string_type::npos !=
if (token_type::string_type::npos !=
currtoken.get_value().find_first_of('\n'))
{
currpos.set_line(pos.get_line() + 1);
@@ -219,7 +219,7 @@ public:
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
// return, whether the current file has include guards
// this function returns meaningful results only if the file was scanned
// this function returns meaningful results only if the file was scanned
// completely
bool has_include_guards(std::string& guard_name) const
{

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
A generic C++ lexer token definition
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -18,7 +18,7 @@
#include <boost/serialization/serialization.hpp>
#endif
#include <boost/wave/util/file_position.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/language_support.hpp>
#include <boost/throw_exception.hpp>
@@ -80,7 +80,7 @@ public:
friend bool operator== (token_data const& lhs, token_data const& rhs)
{
// two tokens are considered equal even if they refer to different
// two tokens are considered equal even if they refer to different
// positions
return (lhs.id == rhs.id && lhs.value == rhs.value) ? true : false;
}
@@ -89,7 +89,7 @@ public:
{
BOOST_ASSERT(refcnt == 1);
id = id_;
value = value_;
value = value_;
pos = pos_;
}
@@ -97,7 +97,7 @@ public:
{
BOOST_ASSERT(refcnt == 1);
id = rhs.id;
value = rhs.value;
value = rhs.value;
pos = rhs.pos;
}
@@ -114,7 +114,7 @@ public:
case '\r': stream << "\\r"; break;
case '\n': stream << "\\n"; break;
default:
stream << value[i];
stream << value[i];
break;
}
}
@@ -160,7 +160,7 @@ token_data<StringTypeT, PositionT>::operator new(std::size_t size)
}
template <typename StringTypeT, typename PositionT>
inline void
inline void
token_data<StringTypeT, PositionT>::operator delete(void *p, std::size_t size)
{
BOOST_ASSERT(sizeof(token_data<StringTypeT, PositionT>) == size);
@@ -168,7 +168,7 @@ token_data<StringTypeT, PositionT>::operator delete(void *p, std::size_t size)
token_data_tag, sizeof(token_data<StringTypeT, PositionT>)
> pool_type;
if (0 != p)
if (0 != p)
pool_type::free(p);
}
@@ -180,13 +180,13 @@ template <typename PositionT = boost::wave::util::file_position_type>
class lex_token;
///////////////////////////////////////////////////////////////////////////////
//
//
// lex_token
//
///////////////////////////////////////////////////////////////////////////////
template <typename PositionT>
class lex_token
class lex_token
{
public:
typedef BOOST_WAVE_STRINGTYPE string_type;
@@ -194,7 +194,7 @@ public:
private:
typedef impl::token_data<string_type, position_type> data_type;
public:
// default constructed tokens correspond to EOI tokens
lex_token()
@@ -209,7 +209,7 @@ public:
lex_token(lex_token const& rhs)
: data(rhs.data)
{
if (0 != data)
if (0 != data)
data->addref();
}
@@ -219,7 +219,7 @@ public:
~lex_token()
{
if (0 != data && 0 == data->release())
if (0 != data && 0 == data->release())
delete data;
data = 0;
}
@@ -227,11 +227,11 @@ public:
lex_token& operator=(lex_token const& rhs)
{
if (&rhs != this) {
if (0 != data && 0 == data->release())
if (0 != data && 0 == data->release())
delete data;
data = rhs.data;
if (0 != data)
if (0 != data)
data->addref();
}
return *this;
@@ -260,11 +260,11 @@ public:
// debug support
#if BOOST_WAVE_DUMP_PARSE_TREE != 0
// access functions for the tree_to_xml functionality
static int get_token_id(lex_token const &t)
static int get_token_id(lex_token const &t)
{ return token_id(t); }
static string_type get_token_value(lex_token const &t)
static string_type get_token_value(lex_token const &t)
{ return t.get_value(); }
#endif
#endif
#if defined(BOOST_SPIRIT_DEBUG)
// debug support
@@ -292,7 +292,7 @@ private:
data_type* newdata = new data_type(*data) ;
data->release(); // release this reference, can't get zero
data->release(); // release this reference, can't get zero
data = newdata;
}
@@ -300,12 +300,12 @@ private:
};
///////////////////////////////////////////////////////////////////////////////
// This overload is needed by the multi_pass/functor_input_policy to
// validate a token instance. It has to be defined in the same namespace
// This overload is needed by the multi_pass/functor_input_policy to
// validate a token instance. It has to be defined in the same namespace
// as the token class itself to allow ADL to find it.
///////////////////////////////////////////////////////////////////////////////
template <typename Position>
inline bool
inline bool
token_is_valid(lex_token<Position> const& t)
{
return t.is_valid();

View File

@@ -3,7 +3,7 @@
http://www.boost.org/
State machine detecting include guards in an included file.
State machine detecting include guards in an included file.
This detects two forms of include guards:
#ifndef INCLUDE_GUARD_MACRO
@@ -19,7 +19,7 @@
#endif
note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO
will work as well). The code allows for any whitespace, newline and single
will work as well). The code allows for any whitespace, newline and single
'#' tokens before the #if/#ifndef and after the final #endif.
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -47,19 +47,19 @@ class include_guards
{
public:
include_guards()
: state(&include_guards::state_0), detected_guards(false),
: state(&include_guards::state_0), detected_guards(false),
current_state(true), if_depth(0)
{}
Token& detect_guard(Token& t)
Token& detect_guard(Token& t)
{ return current_state ? (this->*state)(t) : t; }
bool detected(std::string& guard_name_) const
bool detected(std::string& guard_name_) const
{
if (detected_guards) {
guard_name_ = guard_name.c_str();
return true;
}
return false;
return false;
}
private:
@@ -76,7 +76,7 @@ private:
bool is_skippable(token_id id) const
{
return (T_POUND == BASE_TOKEN(id) ||
return (T_POUND == BASE_TOKEN(id) ||
IS_CATEGORY(id, WhiteSpaceTokenType) ||
IS_CATEGORY(id, EOLTokenType));
}
@@ -85,7 +85,7 @@ private:
///////////////////////////////////////////////////////////////////////////////
// state 0: beginning of a file, tries to recognize #ifndef or #if tokens
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_0(Token& t)
{
token_id id = token_id(t);
@@ -101,7 +101,7 @@ include_guards<Token>::state_0(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 1: found #ifndef, looking for T_IDENTIFIER
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_1(Token& t)
{
token_id id = token_id(t);
@@ -117,11 +117,11 @@ include_guards<Token>::state_1(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 1a: found T_PP_IF, looking for T_NOT ("!")
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_1a(Token& t)
{
token_id id = token_id(t);
if (T_NOT == BASE_TOKEN(id))
if (T_NOT == BASE_TOKEN(id))
state = &include_guards::state_1b;
else if (!is_skippable(id))
current_state = false;
@@ -131,11 +131,11 @@ include_guards<Token>::state_1a(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 1b: found T_NOT, looking for 'defined'
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_1b(Token& t)
{
token_id id = token_id(t);
if (T_IDENTIFIER == id && t.get_value() == "defined")
if (T_IDENTIFIER == id && t.get_value() == "defined")
state = &include_guards::state_1c;
else if (!is_skippable(id))
current_state = false;
@@ -145,11 +145,11 @@ include_guards<Token>::state_1b(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 1c: found 'defined', looking for (optional) T_LEFTPAREN
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_1c(Token& t)
{
token_id id = token_id(t);
if (T_LEFTPAREN == id)
if (T_LEFTPAREN == id)
state = &include_guards::state_1d;
else if (T_IDENTIFIER == id) {
guard_name = t.get_value();
@@ -163,7 +163,7 @@ include_guards<Token>::state_1c(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 1d: found T_LEFTPAREN, looking for T_IDENTIFIER guard
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_1d(Token& t)
{
token_id id = token_id(t);
@@ -179,11 +179,11 @@ include_guards<Token>::state_1d(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 1e: found T_IDENTIFIER guard, looking for T_RIGHTPAREN
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_1e(Token& t)
{
token_id id = token_id(t);
if (T_RIGHTPAREN == id)
if (T_RIGHTPAREN == id)
state = &include_guards::state_2;
else if (!is_skippable(id))
current_state = false;
@@ -193,11 +193,11 @@ include_guards<Token>::state_1e(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 2: found T_IDENTIFIER, looking for #define
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_2(Token& t)
{
token_id id = token_id(t);
if (T_PP_DEFINE == id)
if (T_PP_DEFINE == id)
state = &include_guards::state_3;
else if (!is_skippable(id))
current_state = false;
@@ -207,7 +207,7 @@ include_guards<Token>::state_2(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 3: found #define, looking for T_IDENTIFIER as recognized by state 1
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_3(Token& t)
{
token_id id = token_id(t);
@@ -221,7 +221,7 @@ include_guards<Token>::state_3(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 4: found guard T_IDENTIFIER, looking for #endif
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_4(Token& t)
{
token_id id = token_id(t);
@@ -239,11 +239,11 @@ include_guards<Token>::state_4(Token& t)
///////////////////////////////////////////////////////////////////////////////
// state 5: found final #endif, looking for T_EOF
template <typename Token>
inline Token&
inline Token&
include_guards<Token>::state_5(Token& t)
{
token_id id = token_id(t);
if (T_EOF == id)
if (T_EOF == id)
detected_guards = current_state;
else if (!is_skippable(id))
current_state = false;

View File

@@ -2,10 +2,10 @@
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/
Copyright (c) 2001 Daniel C. Nuffer.
Copyright (c) 2001-2012 Hartmut Kaiser.
Distributed under the Boost Software License, Version 1.0. (See accompanying
Copyright (c) 2001-2012 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)
=============================================================================*/
@@ -39,10 +39,10 @@ typedef struct tag_aq_queuetype
typedef aq_queuetype* aq_queue;
int aq_enqueue(aq_queue q, aq_stdelement e);
BOOST_WAVE_DECL int aq_enqueue(aq_queue q, aq_stdelement e);
int aq_enqueue_front(aq_queue q, aq_stdelement e);
int aq_serve(aq_queue q, aq_stdelement *e);
int aq_pop(aq_queue q);
BOOST_WAVE_DECL int aq_pop(aq_queue q);
#define AQ_EMPTY(q) (q->size == 0)
#define AQ_FULL(q) (q->size == q->max_size)
int aq_grow(aq_queue q);
@@ -54,7 +54,7 @@ BOOST_WAVE_DECL void aq_terminate(aq_queue q);
} // namespace re2clex
} // namespace cpplexer
} // namespace wave
} // namespace boost
} // namespace boost
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS

View File

@@ -2,7 +2,7 @@
Boost.Wave: A Standard compliant C++ preprocessor library
Re2C based C++ lexer
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -13,8 +13,11 @@
#if !defined(CPP_RE_HPP_B76C4F5E_63E9_4B8A_9975_EC32FA6BF027_INCLUDED)
#define CPP_RE_HPP_B76C4F5E_63E9_4B8A_9975_EC32FA6BF027_INCLUDED
#include <boost/assert.hpp>
#include <boost/wave/wave_config.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/cpplexer/cpplexer_exceptions.hpp>
// this must occur after all of the includes and before any code appears
#ifdef BOOST_HAS_ABI_HEADERS
@@ -28,18 +31,361 @@
#endif
///////////////////////////////////////////////////////////////////////////////
#define YYCTYPE uchar
#define YYCURSOR cursor
#define YYLIMIT limit
#define YYMARKER marker
#define YYFILL(n) \
{ \
cursor = uchar_wrapper(fill(s, cursor), cursor.column); \
limit = uchar_wrapper (s->lim); \
} \
/**/
#include <iostream>
///////////////////////////////////////////////////////////////////////////////
#define BOOST_WAVE_UPDATE_CURSOR() \
{ \
s->line += count_backslash_newlines(s, cursor); \
s->curr_column = cursor.column; \
s->cur = cursor; \
s->lim = limit; \
s->ptr = marker; \
} \
/**/
///////////////////////////////////////////////////////////////////////////////
#define BOOST_WAVE_RET(i) \
{ \
BOOST_WAVE_UPDATE_CURSOR() \
if (s->cur > s->lim) \
return T_EOF; /* may happen for empty files */ \
return (i); \
} \
/**/
///////////////////////////////////////////////////////////////////////////////
namespace boost {
namespace wave {
namespace cpplexer {
namespace re2clex {
struct Scanner;
template<typename Iterator>
struct Scanner;
///////////////////////////////////////////////////////////////////////////////
// The scanner function to call whenever a new token is requested
BOOST_WAVE_DECL boost::wave::token_id scan(Scanner *s);
template<typename Iterator>
BOOST_WAVE_DECL boost::wave::token_id scan(Scanner<Iterator> *s);
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Utility functions
#define RE2C_ASSERT BOOST_ASSERT
template<typename Iterator>
int get_one_char(Scanner<Iterator> *s)
{
RE2C_ASSERT(s->first <= s->act && s->act <= s->last);
if (s->act < s->last)
return *(s->act)++;
return -1;
}
template<typename Iterator>
std::ptrdiff_t rewind_stream (Scanner<Iterator> *s, int cnt)
{
std::advance(s->act, cnt);
RE2C_ASSERT(s->first <= s->act && s->act <= s->last);
return std::distance(s->first, s->act);
}
template<typename Iterator>
std::size_t get_first_eol_offset(Scanner<Iterator>* s)
{
if (!AQ_EMPTY(s->eol_offsets))
{
return s->eol_offsets->queue[s->eol_offsets->head];
}
else
{
return (unsigned int)-1;
}
}
template<typename Iterator>
void adjust_eol_offsets(Scanner<Iterator>* s, std::size_t adjustment)
{
aq_queue q;
std::size_t i;
if (!s->eol_offsets)
s->eol_offsets = aq_create();
q = s->eol_offsets;
if (AQ_EMPTY(q))
return;
i = q->head;
while (i != q->tail)
{
if (adjustment > q->queue[i])
q->queue[i] = 0;
else
q->queue[i] -= adjustment;
++i;
if (i == q->max_size)
i = 0;
}
if (adjustment > q->queue[i])
q->queue[i] = 0;
else
q->queue[i] -= adjustment;
}
template<typename Iterator>
int count_backslash_newlines(Scanner<Iterator> *s, uchar *cursor)
{
std::size_t diff, offset;
int skipped = 0;
/* figure out how many backslash-newlines skipped over unknowingly. */
diff = cursor - s->bot;
offset = get_first_eol_offset(s);
while (offset <= diff && offset != (unsigned int)-1)
{
skipped++;
aq_pop(s->eol_offsets);
offset = get_first_eol_offset(s);
}
return skipped;
}
BOOST_WAVE_DECL bool is_backslash(uchar *p, uchar *end, int &len);
#define BOOST_WAVE_BSIZE 196608
template<typename Iterator>
uchar *fill(Scanner<Iterator> *s, uchar *cursor)
{
using namespace std; // some systems have memcpy etc. in namespace std
if(!s->eof)
{
uchar* p;
std::ptrdiff_t cnt = s->tok - s->bot;
if(cnt)
{
if (NULL == s->lim)
s->lim = s->top;
memmove(s->bot, s->tok, s->lim - s->tok);
s->tok = s->cur = s->bot;
s->ptr -= cnt;
cursor -= cnt;
s->lim -= cnt;
adjust_eol_offsets(s, cnt);
}
if((s->top - s->lim) < BOOST_WAVE_BSIZE)
{
uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BOOST_WAVE_BSIZE)*sizeof(uchar));
if (buf == 0)
{
(*s->error_proc)(s, lexing_exception::unexpected_error,
"Out of memory!");
/* get the scanner to stop */
*cursor = 0;
return cursor;
}
memmove(buf, s->tok, s->lim - s->tok);
s->tok = s->cur = buf;
s->ptr = &buf[s->ptr - s->bot];
cursor = &buf[cursor - s->bot];
s->lim = &buf[s->lim - s->bot];
s->top = &s->lim[BOOST_WAVE_BSIZE];
free(s->bot);
s->bot = buf;
}
cnt = std::distance(s->act, s->last);
if (cnt > BOOST_WAVE_BSIZE)
cnt = BOOST_WAVE_BSIZE;
uchar * dst = s->lim;
for (std::ptrdiff_t idx = 0; idx < cnt; ++idx)
{
*dst++ = *s->act++;
}
if (cnt != BOOST_WAVE_BSIZE)
{
s->eof = &s->lim[cnt]; *(s->eof)++ = '\0';
}
/* backslash-newline erasing time */
/* first scan for backslash-newline and erase them */
for (p = s->lim; p < s->lim + cnt - 2; ++p)
{
int len = 0;
if (is_backslash(p, s->lim + cnt, len))
{
if (*(p+len) == '\n')
{
int offset = len + 1;
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
aq_enqueue(s->eol_offsets, p - s->bot + 1);
}
else if (*(p+len) == '\r')
{
if (*(p+len+1) == '\n')
{
int offset = len + 2;
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
}
else
{
int offset = len + 1;
memmove(p, p + offset, s->lim + cnt - p - offset);
cnt -= offset;
--p;
}
aq_enqueue(s->eol_offsets, p - s->bot + 1);
}
}
}
/* FIXME: the following code should be fixed to recognize correctly the
trigraph backslash token */
/* check to see if what we just read ends in a backslash */
if (cnt >= 2)
{
uchar last = s->lim[cnt-1];
uchar last2 = s->lim[cnt-2];
/* check \ EOB */
if (last == '\\')
{
int next = get_one_char(s);
/* check for \ \n or \ \r or \ \r \n straddling the border */
if (next == '\n')
{
--cnt; /* chop the final \, we've already read the \n. */
aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
else if (next == '\r')
{
int next2 = get_one_char(s);
if (next2 == '\n')
{
--cnt; /* skip the backslash */
}
else
{
/* rewind one, and skip one char */
rewind_stream(s, -1);
--cnt;
}
aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
else if (next != -1) /* -1 means end of file */
{
/* next was something else, so rewind the stream */
rewind_stream(s, -1);
}
}
/* check \ \r EOB */
else if (last == '\r' && last2 == '\\')
{
int next = get_one_char(s);
if (next == '\n')
{
cnt -= 2; /* skip the \ \r */
}
else
{
/* rewind one, and skip two chars */
rewind_stream(s, -1);
cnt -= 2;
}
aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
/* check \ \n EOB */
else if (last == '\n' && last2 == '\\')
{
cnt -= 2;
aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
}
}
s->lim += cnt;
if (s->eof) /* eof needs adjusting if we erased backslash-newlines */
{
s->eof = s->lim;
*(s->eof)++ = '\0';
}
}
return cursor;
}
#undef BOOST_WAVE_BSIZE
///////////////////////////////////////////////////////////////////////////////
// Special wrapper class holding the current cursor position
struct BOOST_WAVE_DECL uchar_wrapper
{
uchar_wrapper (uchar *base_cursor, std::size_t column = 1);
uchar_wrapper& operator++();
uchar_wrapper& operator--();
uchar operator* () const;
operator uchar *() const;
friend BOOST_WAVE_DECL std::ptrdiff_t
operator- (uchar_wrapper const& lhs, uchar_wrapper const& rhs);
uchar *base_cursor;
std::size_t column;
};
///////////////////////////////////////////////////////////////////////////////
template<typename Iterator>
boost::wave::token_id scan(Scanner<Iterator> *s)
{
BOOST_ASSERT(0 != s->error_proc); // error handler must be given
uchar_wrapper cursor (s->tok = s->cur, s->column = s->curr_column);
uchar_wrapper marker (s->ptr);
uchar_wrapper limit (s->lim);
typedef BOOST_WAVE_STRINGTYPE string_type;
string_type rawstringdelim; // for use with C++11 raw string literals
// include the correct Re2C token definition rules
#if (defined (__FreeBSD__) || defined (__DragonFly__) || defined (__OpenBSD__)) && defined (T_DIVIDE)
#undef T_DIVIDE
#endif
#if BOOST_WAVE_USE_STRICT_LEXER != 0
#include "strict_cpp_re.inc"
#else
#include "cpp_re.inc"
#endif
} /* end of scan */
///////////////////////////////////////////////////////////////////////////////
} // namespace re2clex
} // namespace cpplexer
} // namespace wave
@@ -49,6 +395,13 @@ BOOST_WAVE_DECL boost::wave::token_id scan(Scanner *s);
#pragma warning(pop)
#endif
#undef BOOST_WAVE_RET
#undef YYCTYPE
#undef YYCURSOR
#undef YYLIMIT
#undef YYMARKER
#undef YYFILL
// the suffix header occurs after all of the code
#ifdef BOOST_HAS_ABI_HEADERS
#include BOOST_ABI_SUFFIX

File diff suppressed because it is too large Load Diff

View File

@@ -89,12 +89,12 @@ public:
#endif
// error reporting from the re2c generated lexer
static int report_error(Scanner const* s, int code, char const *, ...);
static int report_error(Scanner<IteratorT> const* s, int code, char const *, ...);
private:
static char const *tok_names[];
Scanner scanner;
Scanner<IteratorT> scanner;
string_type filename;
string_type value;
bool at_eof;
@@ -117,18 +117,13 @@ inline
lexer<IteratorT, PositionT, TokenT>::lexer(IteratorT const &first,
IteratorT const &last, PositionT const &pos,
boost::wave::language_support language_)
: filename(pos.get_file()), at_eof(false), language(language_)
: scanner(first, last),
filename(pos.get_file()), at_eof(false), language(language_)
#if BOOST_WAVE_SUPPORT_THREADING != 0
, cache()
#endif
{
using namespace std; // some systems have memset in std
memset(&scanner, '\0', sizeof(Scanner));
scanner.eol_offsets = aq_create();
if (first != last) {
scanner.first = scanner.act = (uchar *)&(*first);
scanner.last = scanner.first + std::distance(first, last);
}
scanner.line = pos.get_line();
scanner.column = scanner.curr_column = pos.get_column();
scanner.error_proc = report_error;
@@ -165,7 +160,6 @@ inline
lexer<IteratorT, PositionT, TokenT>::~lexer()
{
using namespace std; // some systems have free in std
aq_terminate(scanner.eol_offsets);
free(scanner.bot);
}
@@ -181,7 +175,7 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
std::size_t actline = scanner.line;
token_id id = token_id(scan(&scanner));
switch (static_cast<unsigned int>(id)) {
switch (id) {
case T_IDENTIFIER:
// test identifier characters for validity (throws if invalid chars found)
value = string_type((char const *)scanner.tok,
@@ -307,7 +301,7 @@ lexer<IteratorT, PositionT, TokenT>::get(TokenT& result)
template <typename IteratorT, typename PositionT, typename TokenT>
inline int
lexer<IteratorT, PositionT, TokenT>::report_error(Scanner const *s, int errcode,
lexer<IteratorT, PositionT, TokenT>::report_error(Scanner<IteratorT> const *s, int errcode,
char const *msg, ...)
{
BOOST_ASSERT(0 != s);

View File

@@ -26,15 +26,31 @@ namespace wave {
namespace cpplexer {
namespace re2clex {
template<typename Iterator>
struct Scanner;
typedef unsigned char uchar;
typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
char const *, ...);
typedef struct Scanner {
uchar* first; /* start of input buffer */
uchar* act; /* act position of input buffer */
uchar* last; /* end (one past last char) of input buffer */
template<typename Iterator>
struct Scanner {
typedef int (* ReportErrorProc)(struct Scanner const *, int errorcode,
char const *, ...);
Scanner(Iterator const & f, Iterator const & l)
: first(f), act(f), last(l),
bot(0), top(0), eof(0), tok(0), ptr(0), cur(0), lim(0),
eol_offsets(aq_create())
// remaining data members externally initialized
{}
~Scanner()
{
aq_terminate(eol_offsets);
}
Iterator first; /* start of input buffer */
Iterator act; /* act position of input buffer */
Iterator last; /* end (one past last char) of input buffer */
uchar* bot; /* beginning of the current buffer */
uchar* top; /* top of the current buffer */
uchar* eof; /* when we read in the last buffer, will point 1 past the
@@ -58,7 +74,7 @@ typedef struct Scanner {
bool enable_import_keyword; /* recognize import as a keyword */
bool single_line_only; /* don't report missing eol's in C++ comments */
bool act_in_cpp0x_mode; /* lexer works in C++11 mode */
} Scanner;
};
///////////////////////////////////////////////////////////////////////////////
} // namespace re2clex

File diff suppressed because it is too large Load Diff

View File

@@ -32,12 +32,12 @@ namespace cpplexer {
// keywords, operators and other constant language elements.
//
// This avoids repeated construction of these tokens, which is especially
// effective when used in conjunction with a copy on write string
// effective when used in conjunction with a copy on write string
// implementation (COW string).
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
class token_cache
class token_cache
{
public:
token_cache()
@@ -60,7 +60,7 @@ private:
};
///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace cpplexer
} // namespace wave
} // namespace boost

View File

@@ -219,7 +219,7 @@ classify_universal_char (unsigned long ch)
///////////////////////////////////////////////////////////////////////////////
template <typename StringT>
inline void
validate_identifier_name (StringT const &name, std::size_t line,
validate_identifier_name (StringT const &name, std::size_t line,
std::size_t column, StringT const &file_name)
{
using namespace std; // some systems have strtoul in namespace std::