Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54012 - trunk/boost/wave/cpplexer
From: hartmut.kaiser_at_[hidden]
Date: 2009-06-17 11:17:21


Author: hkaiser
Date: 2009-06-17 11:17:21 EDT (Wed, 17 Jun 2009)
New Revision: 54012
URL: http://svn.boost.org/trac/boost/changeset/54012

Log:
Fixed compilation problem caused by recent changes to new version of multi_pass
Text files modified:
   trunk/boost/wave/cpplexer/cpp_lex_token.hpp | 25 +++++++++++++++++++++++++
   1 files changed, 25 insertions(+), 0 deletions(-)

Modified: trunk/boost/wave/cpplexer/cpp_lex_token.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/cpp_lex_token.hpp (original)
+++ trunk/boost/wave/cpplexer/cpp_lex_token.hpp 2009-06-17 11:17:21 EDT (Wed, 17 Jun 2009)
@@ -44,10 +44,16 @@
     typedef StringTypeT string_type;
     typedef PositionT position_type;
 
+ // default constructed tokens correspond to EOI tokens
     token_data()
     : id(T_EOI), refcnt(1)
     {}
 
+ // construct an invalid token
+ explicit token_data(int)
+ : id(T_UNKNOWN), refcnt(1)
+ {}
+
     token_data(token_id id_, string_type const &value_, position_type const &pos_)
     : id(id_), value(value_), pos(pos_), refcnt(1)
     {}
@@ -190,10 +196,16 @@
     typedef impl::token_data<string_type, position_type> data_type;
     
 public:
+ // default constructed tokens correspond to EOI tokens
     lex_token()
     : data(0)
     {}
 
+ // construct an invalid token
+ explicit lex_token(int)
+ : data(new data_type(0))
+ {}
+
     lex_token(lex_token const& rhs)
     : data(rhs.data)
     {
@@ -230,6 +242,7 @@
     string_type const &get_value() const { return data->get_value(); }
     position_type const &get_position() const { return data->get_position(); }
     bool is_eoi() const { return 0 == data || token_id(*data) == T_EOI; }
+ bool is_valid() const { return 0 != data && token_id(*data) != T_UNKNOWN; }
 
     void set_token_id (token_id id_) { make_unique(); data->set_token_id(id_); }
     void set_value (string_type const &value_) { make_unique(); data->set_value(value_); }
@@ -287,6 +300,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(lex_token<Position> const& t)
+{
+ return t.is_valid();
+}
+
+///////////////////////////////////////////////////////////////////////////////
 #if defined(BOOST_SPIRIT_DEBUG)
 template <typename PositionT>
 inline std::ostream &


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