|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54222 - in trunk/libs/wave/samples: advanced_hooks cpp_tokens cpp_tokens/slex hannibal list_includes list_includes/lexertl real_positions token_statistics token_statistics/xlex waveidl/idllexer
From: hartmut.kaiser_at_[hidden]
Date: 2009-06-22 15:46:15
Author: hkaiser
Date: 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
New Revision: 54222
URL: http://svn.boost.org/trac/boost/changeset/54222
Log:
Wave: adjustments for recent multi_pass changes
Text files modified:
trunk/libs/wave/samples/advanced_hooks/advanced_hooks.cpp | 10 +++---
trunk/libs/wave/samples/cpp_tokens/cpp_tokens.cpp | 4 +-
trunk/libs/wave/samples/cpp_tokens/instantiate_slex_lexer.cpp | 2
trunk/libs/wave/samples/cpp_tokens/slex/cpp_slex_lexer.hpp | 2
trunk/libs/wave/samples/cpp_tokens/slex_interface.hpp | 4 +-
trunk/libs/wave/samples/cpp_tokens/slex_iterator.hpp | 8 ++--
trunk/libs/wave/samples/cpp_tokens/slex_token.hpp | 22 ++++++++++++++-
trunk/libs/wave/samples/hannibal/hannibal.cpp | 9 ++---
trunk/libs/wave/samples/list_includes/lexertl/lexertl_lexer.hpp | 14 +++++-----
trunk/libs/wave/samples/list_includes/lexertl_iterator.hpp | 8 ++--
trunk/libs/wave/samples/real_positions/correct_token_positions.hpp | 16 +++++-----
trunk/libs/wave/samples/real_positions/real_position_token.hpp | 56 ++++++++++++++++++++++++++++-----------
trunk/libs/wave/samples/real_positions/real_positions.cpp | 30 ++++++++++----------
trunk/libs/wave/samples/token_statistics/xlex/xlex_lexer.hpp | 18 ++++++------
trunk/libs/wave/samples/token_statistics/xlex/xpressive_lexer.hpp | 6 ++--
trunk/libs/wave/samples/token_statistics/xlex_interface.hpp | 4 +-
trunk/libs/wave/samples/token_statistics/xlex_iterator.hpp | 26 +++++++++---------
trunk/libs/wave/samples/waveidl/idllexer/idl_lex_interface.hpp | 2
trunk/libs/wave/samples/waveidl/idllexer/idl_lex_iterator.hpp | 22 +++++++-------
trunk/libs/wave/samples/waveidl/idllexer/idl_re2c_lexer.hpp | 12 ++++----
20 files changed, 158 insertions(+), 117 deletions(-)
Modified: trunk/libs/wave/samples/advanced_hooks/advanced_hooks.cpp
==============================================================================
--- trunk/libs/wave/samples/advanced_hooks/advanced_hooks.cpp (original)
+++ trunk/libs/wave/samples/advanced_hooks/advanced_hooks.cpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -40,7 +40,7 @@
std::cerr << "Usage: advanced_hooks infile" << std::endl;
return -1;
}
-
+
// current file position is saved for exception handling
boost::wave::util::file_position_type current_position;
@@ -56,15 +56,15 @@
instream.unsetf(std::ios::skipws);
instring = std::string(std::istreambuf_iterator<char>(instream.rdbuf()),
std::istreambuf_iterator<char>());
-
+
// The template boost::wave::cpplexer::lex_token<> is the token type to be
// used by the Wave library.
typedef boost::wave::cpplexer::lex_token<> token_type;
-
+
// The template boost::wave::cpplexer::lex_iterator<> is the lexer type to
// be used by the Wave library.
typedef boost::wave::cpplexer::lex_iterator<token_type> lex_iterator_type;
-
+
// This is the resulting context type to use. The first template parameter
// should match the iterator type to be used during construction of the
// corresponding context object (see below).
@@ -89,7 +89,7 @@
// analyze the input file, print out the preprocessed tokens
context_type::iterator_type first = ctx.begin();
context_type::iterator_type last = ctx.end();
-
+
while (first != last) {
current_position = (*first).get_position();
std::cout << (*first).get_value();
Modified: trunk/libs/wave/samples/cpp_tokens/cpp_tokens.cpp
==============================================================================
--- trunk/libs/wave/samples/cpp_tokens/cpp_tokens.cpp (original)
+++ trunk/libs/wave/samples/cpp_tokens/cpp_tokens.cpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -5,7 +5,7 @@
This sample shows, how it is possible to use a custom lexer type and a
custom token type with the Wave library.
-
+
http://www.boost.org/
Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
@@ -101,7 +101,7 @@
while (first != last) {
// retrieve next token
current_token = *first;
-
+
// output token info
cout << "matched " << current_token << endl;
++first;
Modified: trunk/libs/wave/samples/cpp_tokens/instantiate_slex_lexer.cpp
==============================================================================
--- trunk/libs/wave/samples/cpp_tokens/instantiate_slex_lexer.cpp (original)
+++ trunk/libs/wave/samples/cpp_tokens/instantiate_slex_lexer.cpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -3,7 +3,7 @@
Sample: Print out the preprocessed tokens returned by the Wave iterator
Explicit instantiation of the lex_functor generation function
-
+
http://www.boost.org/
Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
Modified: trunk/libs/wave/samples/cpp_tokens/slex/cpp_slex_lexer.hpp
==============================================================================
--- trunk/libs/wave/samples/cpp_tokens/slex/cpp_slex_lexer.hpp (original)
+++ trunk/libs/wave/samples/cpp_tokens/slex/cpp_slex_lexer.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -79,7 +79,7 @@
typedef boost::spirit::classic::lexer<iterator_type> base_type;
lexer_base();
-
+
// initialization data (regular expressions for the token definitions)
struct lexer_data {
token_id tokenid; // token data
Modified: trunk/libs/wave/samples/cpp_tokens/slex_interface.hpp
==============================================================================
--- trunk/libs/wave/samples/cpp_tokens/slex_interface.hpp (original)
+++ trunk/libs/wave/samples/cpp_tokens/slex_interface.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -63,9 +63,9 @@
: lex_input_interface<TokenT>
{
typedef typename lex_input_interface<TokenT>::position_type position_type;
-
+
~slex_input_interface() {}
-
+
// 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
// lexer/token configurations at compile time.
Modified: trunk/libs/wave/samples/cpp_tokens/slex_iterator.hpp
==============================================================================
--- trunk/libs/wave/samples/cpp_tokens/slex_iterator.hpp (original)
+++ trunk/libs/wave/samples/cpp_tokens/slex_iterator.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -68,7 +68,7 @@
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
@@ -76,20 +76,20 @@
template <typename MultiPass>
static void destroy(MultiPass& mp)
{
- delete mp.shared->ftor;
+ delete mp.shared()->ftor;
}
template <typename MultiPass>
static void set_position(MultiPass& mp, position_type const &pos)
{
- mp.shared->ftor->set_position(pos);
+ mp.shared()->ftor->set_position(pos);
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
template <typename MultiPass>
static bool has_include_guards(MultiPass& mp, std::string& guard_name)
{
- return mp.shared->ftor->has_include_guards(guard_name);
+ return mp.shared()->ftor->has_include_guards(guard_name);
}
#endif
Modified: trunk/libs/wave/samples/cpp_tokens/slex_token.hpp
==============================================================================
--- trunk/libs/wave/samples/cpp_tokens/slex_token.hpp (original)
+++ trunk/libs/wave/samples/cpp_tokens/slex_token.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -43,11 +43,16 @@
public:
typedef BOOST_WAVE_STRINGTYPE string_type;
typedef PositionT position_type;
-
+
slex_token()
: id(T_EOI)
{}
-
+
+ // construct an invalid token
+ explicit slex_token(int)
+ : id(T_UNKNOWN)
+ {}
+
slex_token(token_id id_, string_type const &value_, PositionT const &pos_)
: id(id_), value(value_), pos(pos_)
{}
@@ -57,6 +62,7 @@
string_type const &get_value() const { return value; }
position_type const &get_position() const { return pos; }
bool is_eoi() const { return id == T_EOI; }
+ bool is_valid() const { return id != T_UNKNOWN; }
void set_token_id (token_id id_) { id = id_; }
void set_value (string_type const &newval) { value = newval; }
@@ -120,6 +126,18 @@
}
///////////////////////////////////////////////////////////////////////////////
+// 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
+token_is_valid(slex_token<Position> const& t)
+{
+ return t.is_valid();
+}
+
+///////////////////////////////////////////////////////////////////////////////
} // namespace cpplexer
} // namespace wave
} // namespace boost
Modified: trunk/libs/wave/samples/hannibal/hannibal.cpp
==============================================================================
--- trunk/libs/wave/samples/hannibal/hannibal.cpp (original)
+++ trunk/libs/wave/samples/hannibal/hannibal.cpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -117,7 +117,7 @@
return true;
}
}
-
+
///////////////////////////////////////////////////////////////////////////////
} // unnamed namespace
@@ -125,7 +125,6 @@
// main entry point
int main(int argc, char *argv[])
{
-
po::variables_map vm;
if (!parse_command_line( argc, argv, vm))
@@ -151,7 +150,7 @@
instream.unsetf(std::ios::skipws);
instring = std::string(std::istreambuf_iterator<char>(instream.rdbuf()),
std::istreambuf_iterator<char>());
-
+
// The template boost::wave::cpplexer::lex_token<> is the token type to be
// used by the Wave library.
typedef boost::wave::cpplexer::lex_token<> token_type;
@@ -159,7 +158,7 @@
// The template boost::wave::cpplexer::lex_iterator<> is the lexer type to
// be used by the Wave library.
typedef boost::wave::cpplexer::lex_iterator<token_type> lex_iterator_type;
-
+
// This is the resulting context type to use. The first template parameter
// should match the iterator type to be used during construction of the
// corresponding context object (see below).
@@ -240,7 +239,7 @@
// analyze the input file
context_type::iterator_type first = ctx.begin();
context_type::iterator_type last = ctx.end();
-
+
translation_unit_skipper s;
#if HANNIBAL_DUMP_PARSE_TREE != 0
Modified: trunk/libs/wave/samples/list_includes/lexertl/lexertl_lexer.hpp
==============================================================================
--- trunk/libs/wave/samples/list_includes/lexertl/lexertl_lexer.hpp (original)
+++ trunk/libs/wave/samples/list_includes/lexertl/lexertl_lexer.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -96,13 +96,13 @@
static std::time_t get_compilation_time()
{ return compilation_time.get_time(); }
- bool load (istream& instrm);
- bool save (ostream& outstrm);
-
+ bool load (std::istream& instrm);
+ bool save (std::ostream& outstrm);
+
private:
boost::lexer::state_machine state_machine_;
bool has_compiled_dfa_;
-
+
// initialization data (regular expressions for the token definitions)
struct lexer_macro_data {
char_type const *name; // macro name
@@ -458,7 +458,7 @@
init_data_cpp[j].tokenid);
}
}
-
+
for (int i = 0; 0 != init_data[i].tokenid; ++i) {
rules.add(init_data[i].tokenregex, init_data[i].tokenid);
}
@@ -483,7 +483,7 @@
if (dfa_out.is_open())
save (dfa_out);
}
-
+
has_compiled_dfa_ = true;
return true;
}
@@ -512,7 +512,7 @@
size_t id = *(ptr + 1);
while (curr != last) {
- size_t const state = ptr[lookup[*curr]];
+ size_t const state = ptr[lookup[int(*curr)]];
if (0 == state)
break;
++curr;
Modified: trunk/libs/wave/samples/list_includes/lexertl_iterator.hpp
==============================================================================
--- trunk/libs/wave/samples/list_includes/lexertl_iterator.hpp (original)
+++ trunk/libs/wave/samples/list_includes/lexertl_iterator.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -67,7 +67,7 @@
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
@@ -75,20 +75,20 @@
template <typename MultiPass>
static void destroy(MultiPass& mp)
{
- delete mp.shared->ftor;
+ delete mp.shared()->ftor;
}
template <typename MultiPass>
static void set_position(MultiPass& mp, position_type const &pos)
{
- mp.shared->ftor->set_position(pos);
+ mp.shared()->ftor->set_position(pos);
}
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
template <typename MultiPass>
static bool has_include_guards(MultiPass& mp, std::string& guard_name)
{
- return mp.shared->ftor->has_include_guards(guard_name);
+ return mp.shared()->ftor->has_include_guards(guard_name);
}
#endif
Modified: trunk/libs/wave/samples/real_positions/correct_token_positions.hpp
==============================================================================
--- trunk/libs/wave/samples/real_positions/correct_token_positions.hpp (original)
+++ trunk/libs/wave/samples/real_positions/correct_token_positions.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -29,7 +29,7 @@
}
return newlines;
}
-
+
// return the length of the last line in a C style comment
template <typename String>
unsigned last_line_length(String const& str)
@@ -50,7 +50,7 @@
{
correct_token_position(typename Token::string_type filename)
: pos(filename) {}
-
+
///////////////////////////////////////////////////////////////////////////
//
// The function 'generated_token' will be called by the library whenever a
@@ -78,15 +78,15 @@
{
typedef typename Token::string_type string_type;
typedef typename Token::position_type position_type;
-
+
using namespace boost::wave;
-
+
// adjust the current position
position_type current_pos(pos);
token_id id = token_id(token);
string_type const& v (token.get_value());
-
+
switch (id) {
case T_NEWLINE:
case T_CPPCOMMENT:
@@ -107,17 +107,17 @@
}
}
break;
-
+
default:
pos.set_column(current_pos.get_column() + v.size());
break;
}
-
+
// set the new position in the token to be returned
token.set_corrected_position(current_pos);
return token;
}
-
+
typename Token::position_type pos;
};
Modified: trunk/libs/wave/samples/real_positions/real_position_token.hpp
==============================================================================
--- trunk/libs/wave/samples/real_positions/real_position_token.hpp (original)
+++ trunk/libs/wave/samples/real_positions/real_position_token.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -17,6 +17,7 @@
#include <boost/wave/util/file_position.hpp>
#include <boost/wave/token_ids.hpp>
#include <boost/wave/language_support.hpp>
+#include <boost/detail/atomic_count.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace impl {
@@ -27,11 +28,16 @@
public:
typedef StringTypeT string_type;
typedef PositionT position_type;
-
+
token_data()
: id(boost::wave::T_EOI), refcnt(1)
{}
-
+
+ // construct an invalid token
+ explicit token_data(int)
+ : id(T_UNKNOWN), refcnt(1)
+ {}
+
token_data(boost::wave::token_id id_, string_type const &value_,
position_type const &pos_)
: id(id_), value(value_), pos(pos_), corrected_pos(pos_), refcnt(1)
@@ -41,14 +47,14 @@
: id(rhs.id), value(rhs.value), pos(rhs.pos),
corrected_pos(rhs.corrected_pos), refcnt(1)
{}
-
+
~token_data()
{}
-
+
std::size_t addref() { return ++refcnt; }
std::size_t release() { return --refcnt; }
std::size_t get_refcnt() const { return refcnt; }
-
+
// accessors
operator boost::wave::token_id() const { return id; }
string_type const &get_value() const { return value; }
@@ -69,13 +75,13 @@
// positions
return (lhs.id == rhs.id && lhs.value == rhs.value) ? true : false;
}
-
+
private:
boost::wave::token_id id; // the token id
string_type value; // the text, which was parsed into this token
position_type pos; // the original file position
position_type corrected_pos; // the original file position
- std::size_t refcnt;
+ boost::detail::atomic_count refcnt;
};
///////////////////////////////////////////////////////////////////////////////
@@ -98,11 +104,16 @@
public:
typedef BOOST_WAVE_STRINGTYPE string_type;
typedef PositionT position_type;
-
+
lex_token()
: data(new impl::token_data<string_type, position_type>())
{}
-
+
+ // construct an invalid token
+ explicit lex_token(int)
+ : data(new data_type(0))
+ {}
+
lex_token(lex_token const& rhs)
: data(rhs.data)
{
@@ -120,7 +131,7 @@
delete data;
data = 0;
}
-
+
lex_token& operator=(lex_token const& rhs)
{
if (&rhs != this) {
@@ -132,7 +143,7 @@
}
return *this;
}
-
+
// accessors
operator boost::wave::token_id() const
{ return boost::wave::token_id(*data); }
@@ -142,6 +153,7 @@
{ return data->get_position(); }
position_type const &get_corrected_position() const
{ return data->get_corrected_position(); }
+ bool is_valid() const { return 0 != data && token_id(*data) != T_UNKNOWN; }
void set_token_id (boost::wave::token_id id_)
{ make_unique(); data->set_token_id(id_); }
@@ -156,8 +168,8 @@
{
return *(lhs.data) == *(rhs.data);
}
-
-// debug support
+
+// 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)
@@ -165,22 +177,34 @@
static string_type get_token_value(lex_token const &t)
{ return t.get_value(); }
#endif
-
+
private:
// make a unique copy of the current object
void make_unique()
{
if (1 == data->get_refcnt())
return;
-
+
impl::token_data<string_type, position_type> *newdata =
new impl::token_data<string_type, position_type>(*data);
data->release(); // release this reference, can't get zero
data = newdata;
}
-
+
impl::token_data<string_type, position_type> *data;
};
+///////////////////////////////////////////////////////////////////////////////
+// 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
+token_is_valid(lex_token<Position> const& t)
+{
+ return t.is_valid();
+}
+
#endif // !defined(REAL_POSITION_TOKEN_HPP_HK_061109_INCLUDED)
Modified: trunk/libs/wave/samples/real_positions/real_positions.cpp
==============================================================================
--- trunk/libs/wave/samples/real_positions/real_positions.cpp (original)
+++ trunk/libs/wave/samples/real_positions/real_positions.cpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -42,7 +42,7 @@
{
using namespace std;
using namespace boost::wave;
-
+
token_id id = token_id(t);
stream << setw(16)
<< left << boost::wave::get_token_name(id) << " ("
@@ -60,11 +60,11 @@
stream << ", AltExtTokenType";
}
}
-
+
stream << "): >";
-
+
typedef typename lex_token<PositionT>::string_type string_type;
-
+
string_type const& value = t.get_value();
for (std::size_t i = 0; i < value.size(); ++i) {
switch (value[i]) {
@@ -85,7 +85,7 @@
<< setw(3) << right << t.get_corrected_position().get_line() << "/"
<< setw(2) << right << t.get_corrected_position().get_column()
<< ")";
-
+
return stream;
}
@@ -97,7 +97,7 @@
std::cerr << "Usage: real_positions infile" << std::endl;
return -1;
}
-
+
// current file position is saved for exception handling
boost::wave::util::file_position_type current_position;
@@ -113,29 +113,29 @@
instream.unsetf(std::ios::skipws);
instring = std::string(std::istreambuf_iterator<char>(instream.rdbuf()),
std::istreambuf_iterator<char>());
-
+
// The template real_positions::lex_token<> is the token type to be
// used by the Wave library.
typedef lex_token<> token_type;
-
+
// The template boost::wave::cpplexer::lex_iterator<> is the lexer type to
// be used by the Wave library.
typedef boost::wave::cpplexer::lex_iterator<token_type>
lex_iterator_type;
-
+
// This is the resulting context type to use. The first template parameter
// should match the iterator type to be used during construction of the
// corresponding context object (see below).
- typedef boost::wave::context<
- std::string::iterator, lex_iterator_type,
- boost::wave::iteration_context_policies::load_file_to_string,
- correct_token_position<token_type> >
- context_type;
+ typedef boost::wave::context<
+ std::string::iterator, lex_iterator_type,
+ boost::wave::iteration_context_policies::load_file_to_string,
+ correct_token_position<token_type> >
+ context_type;
// This preprocessor hooks are used to correct the file positions inside
// the tokens returned from the library
correct_token_position<token_type> hooks(argv[1]);
-
+
// The preprocessor iterator shouldn't be constructed directly. It is
// to be generated through a wave::context<> object. This wave:context<>
// object is to be used additionally to initialize and define different
Modified: trunk/libs/wave/samples/token_statistics/xlex/xlex_lexer.hpp
==============================================================================
--- trunk/libs/wave/samples/token_statistics/xlex/xlex_lexer.hpp (original)
+++ trunk/libs/wave/samples/token_statistics/xlex/xlex_lexer.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -464,7 +464,7 @@
std::string tokval;
token_id id = xlexer.next_token(first, last, tokval);
string_type value = tokval.c_str();
-
+
if ((token_id)(-1) == id)
id = T_EOF; // end of input reached
@@ -486,10 +486,10 @@
at_eof = true;
value.clear();
}
-
+
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- return t = guards.detect_guard(cpplexer::lex_token<Position>(id, value,
- Position(filename, line, -1)));
+ cpplexer::lex_token<Position> tok(id, value, Position(filename, line, -1));
+ return t = guards.detect_guard(tok);
#else
return t = cpplexer::lex_token<Position>(id, value,
Position(filename, line, -1));
@@ -514,21 +514,21 @@
xlex_functor(Iterator const &first, Iterator const &last,
Position const &pos, boost::wave::language_support language)
- : lexer(first, last, pos, language)
+ : lexer_(first, last, pos, language)
{}
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) { return lexer_.get(t); }
+ void set_position(Position const &pos) { lexer_.set_position(pos); }
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
bool has_include_guards(std::string& guard_name) const
- { return lexer.has_include_guards(guard_name); }
+ { return lexer_.has_include_guards(guard_name); }
#endif
private:
- lexer<Iterator, Position> lexer;
+ lexer<Iterator, Position> lexer_;
};
} // namespace lexer
Modified: trunk/libs/wave/samples/token_statistics/xlex/xpressive_lexer.hpp
==============================================================================
--- trunk/libs/wave/samples/token_statistics/xlex/xpressive_lexer.hpp (original)
+++ trunk/libs/wave/samples/token_statistics/xlex/xpressive_lexer.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -103,9 +103,9 @@
for (iterator it = regex_list.begin(), end = regex_list.end(); it != end; ++it)
{
namespace xpressive = boost::xpressive;
-
- regex_info const& curr_regex = *it;
-// xpressive::match_results<Iterator> regex_result;
+
+// regex_info const& curr_regex = *it;
+// xpressive::match_results<Iterator> regex_result;
if (xpressive::regex_search(first, last, regex_result, (*it).regex,
xpressive::regex_constants::match_continuous))
{
Modified: trunk/libs/wave/samples/token_statistics/xlex_interface.hpp
==============================================================================
--- trunk/libs/wave/samples/token_statistics/xlex_interface.hpp (original)
+++ trunk/libs/wave/samples/token_statistics/xlex_interface.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -64,9 +64,9 @@
{
typedef typename wave::cpplexer::lex_input_interface<TokenT>::position_type
position_type;
-
+
~xlex_input_interface() {}
-
+
// 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
// lexer/token configurations at compile time.
Modified: trunk/libs/wave/samples/token_statistics/xlex_iterator.hpp
==============================================================================
--- trunk/libs/wave/samples/token_statistics/xlex_iterator.hpp (original)
+++ trunk/libs/wave/samples/token_statistics/xlex_iterator.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -64,11 +64,11 @@
BOOST_WAVE_EOF_PREFIX result_type const eof;
typedef xlex_iterator_functor_shim unique;
typedef lex_input_interface<TokenT>* shared;
-
+
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
@@ -76,20 +76,20 @@
template <typename MultiPass>
static void destroy(MultiPass& mp)
{
- delete mp.shared->ftor;
+ delete mp.shared()->ftor;
}
template <typename MultiPass>
static void set_position(MultiPass& mp, position_type const &pos)
{
- mp.shared->ftor->set_position(pos);
+ mp.shared()->ftor->set_position(pos);
}
-
+
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
template <typename MultiPass>
static bool has_include_guards(MultiPass& mp, std::string& guard_name)
{
- return mp.shared->ftor->has_include_guards(guard_name);
+ return mp.shared()->ftor->has_include_guards(guard_name);
}
#endif
@@ -169,13 +169,13 @@
typedef typename input_policy_type::unique unique_functor_type;
typedef typename input_policy_type::shared shared_functor_type;
-
+
public:
typedef TokenT token_type;
-
+
xlex_iterator()
{}
-
+
template <typename IteratorT>
xlex_iterator(IteratorT const &first, IteratorT const &last,
typename TokenT::position_type const &pos,
@@ -192,15 +192,15 @@
void set_position(typename TokenT::position_type const &pos)
{
typedef typename token_type::position_type position_type;
-
+
// set the new position in the current token
token_type& currtoken = this->base_type::dereference(*this);
position_type currpos = currtoken.get_position();
-
+
currpos.set_file(pos.get_file());
currpos.set_line(pos.get_line());
currtoken.set_position(currpos);
-
+
// set the new position for future tokens as well
if (token_type::string_type::npos !=
currtoken.get_value().find_first_of('\n'))
@@ -218,7 +218,7 @@
{
return unique_functor_type::has_include_guards(*this, guard_name);
}
-#endif
+#endif
};
///////////////////////////////////////////////////////////////////////////////
Modified: trunk/libs/wave/samples/waveidl/idllexer/idl_lex_interface.hpp
==============================================================================
--- trunk/libs/wave/samples/waveidl/idllexer/idl_lex_interface.hpp (original)
+++ trunk/libs/wave/samples/waveidl/idllexer/idl_lex_interface.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -56,7 +56,7 @@
: cpplexer::lex_input_interface<TokenT>
{
typedef typename cpplexer::lex_input_interface<TokenT>::position_type position_type;
-
+
// 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
// lexer/token configurations at compile time.
Modified: trunk/libs/wave/samples/waveidl/idllexer/idl_lex_iterator.hpp
==============================================================================
--- trunk/libs/wave/samples/waveidl/idllexer/idl_lex_iterator.hpp (original)
+++ trunk/libs/wave/samples/waveidl/idllexer/idl_lex_iterator.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -49,7 +49,7 @@
class lex_iterator_functor_shim
{
typedef typename TokenT::position_type position_type;
-
+
public:
lex_iterator_functor_shim()
#if /*0 != __DECCXX_VER || */defined(__PGI)
@@ -68,23 +68,23 @@
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>
static void set_position(MultiPass& mp, position_type const &pos)
{
- mp.shared->ftor->set_position(pos);
+ mp.shared()->ftor->set_position(pos);
}
-
+
private:
boost::shared_ptr<cpplexer::lex_input_interface<TokenT> > functor_ptr;
};
@@ -159,13 +159,13 @@
typedef typename input_policy_type::unique unique_functor_type;
typedef typename input_policy_type::shared shared_functor_type;
-
+
public:
typedef TokenT token_type;
-
+
lex_iterator()
{}
-
+
template <typename IteratorT>
lex_iterator(IteratorT const &first, IteratorT const &last,
typename TokenT::position_type const &pos,
@@ -182,14 +182,14 @@
void set_position(typename TokenT::position_type const &pos)
{
typedef typename TokenT::position_type position_type;
-
+
// set the new position in the current token
token_type& currtoken = this->base_type::dereference(*this);
position_type currpos = currtoken.get_position();
currpos.set_file(pos.get_file());
currpos.set_line(pos.get_line());
currtoken.set_position(currpos);
-
+
// set the new position for future tokens as well
unique_functor_type::set_position(*this, currpos);
}
Modified: trunk/libs/wave/samples/waveidl/idllexer/idl_re2c_lexer.hpp
==============================================================================
--- trunk/libs/wave/samples/waveidl/idllexer/idl_re2c_lexer.hpp (original)
+++ trunk/libs/wave/samples/waveidl/idllexer/idl_re2c_lexer.hpp 2009-06-22 15:46:11 EDT (Mon, 22 Jun 2009)
@@ -56,7 +56,7 @@
class lexer
{
typedef boost::wave::cpplexer::re2clex::Scanner scanner_t;
-
+
public:
typedef char char_t;
@@ -82,7 +82,7 @@
private:
static char const *tok_names[];
-
+
scanner_t scanner;
string_type filename;
bool at_eof;
@@ -100,7 +100,7 @@
{
using namespace std; // some systems have memset in std
using namespace boost::wave::cpplexer::re2clex;
-
+
memset(&scanner, '\0', sizeof(scanner_t));
scanner.eol_offsets = aq_create();
scanner.first = scanner.act = (uchar *)&(*first);
@@ -137,7 +137,7 @@
token_id id = token_id(scan(&scanner));
string_type value((char const *)scanner.tok, scanner.cur-scanner.tok);
-
+
if (T_IDENTIFIER == id) {
// test identifier characters for validity (throws if invalid chars found)
if (!boost::wave::need_no_character_validation(language)) {
@@ -197,7 +197,7 @@
: public lex_input_interface_generator<
typename lexer<IteratorT, PositionT>::token_type
>
-{
+{
public:
typedef typename lexer<IteratorT, PositionT>::token_type token_type;
@@ -207,7 +207,7 @@
: lexer(first, last, pos, language)
{}
virtual ~lex_functor() {}
-
+
// get the next token from the input stream
token_type& get(token_type& t) { return lexer.get(t); }
void set_position(PositionT const &pos)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk