|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62183 - trunk/boost/spirit/home/lex/lexer/lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2010-05-24 22:54:53
Author: hkaiser
Date: 2010-05-24 22:54:51 EDT (Mon, 24 May 2010)
New Revision: 62183
URL: http://svn.boost.org/trac/boost/changeset/62183
Log:
Spirit: fixed #4253: Error with lex::_val
Text files modified:
trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp | 11 ++++++++++-
trunk/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp | 3 +++
trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp | 11 ++++++++++-
3 files changed, 23 insertions(+), 2 deletions(-)
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp 2010-05-24 22:54:51 EDT (Mon, 24 May 2010)
@@ -351,6 +351,10 @@
TokenValue const& get_value() const
{
+ if (!has_value_) {
+ value_ = iterator_range<Iterator>(this->get_first(), end_);
+ has_value_ = true;
+ }
return value_;
}
template <typename Value>
@@ -359,15 +363,20 @@
value_ = val;
has_value_ = true;
}
+ void set_end(Iterator const& it)
+ {
+ end_ = it;
+ }
bool has_value() const { return has_value_; }
void reset_value() { has_value_ = false; }
protected:
semantic_actions_type const& actions_;
Iterator hold_; // iterator needed to support lex::more()
+ Iterator end_; // iterator pointing to end of matched token
mutable TokenValue value_; // token value to use
+ mutable bool has_value_; // 'true' if value_ is valid
bool has_hold_; // 'true' if hold_ is valid
- bool has_value_; // 'true' if value_ is valid
private:
// silence MSVC warning C4512: assignment operator could not be generated
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp 2010-05-24 22:54:51 EDT (Mon, 24 May 2010)
@@ -102,6 +102,9 @@
if (unique_id >= actions.size() || !actions[unique_id])
return pass_flags::pass_normal;
+ // set token value
+ data.set_end(end);
+
// Note: all arguments might be changed by the invoked semantic
// action
BOOST_SCOPED_ENUM(pass_flags) match = pass_flags::pass_normal;
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp 2010-05-24 22:54:51 EDT (Mon, 24 May 2010)
@@ -373,6 +373,10 @@
TokenValue const& get_value() const
{
+ if (!has_value_) {
+ value_ = iterator_range<Iterator>(this->get_first(), end_);
+ has_value_ = true;
+ }
return value_;
}
template <typename Value>
@@ -381,15 +385,20 @@
value_ = val;
has_value_ = true;
}
+ void set_end(Iterator const& it)
+ {
+ end_ = it;
+ }
bool has_value() const { return has_value_; }
void reset_value() { has_value_ = false; }
protected:
semantic_actions_type const& actions_;
Iterator hold_; // iterator needed to support lex::more()
+ Iterator end_; // iterator pointing to end of matched token
mutable TokenValue value_; // token value to use
+ mutable bool has_value_; // 'true' if value_ is valid
bool has_hold_; // 'true' if hold_ is valid
- bool has_value_; // 'true' if value_ is valid
private:
// silence MSVC warning C4512: assignment operator could not be generated
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