Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73496 - in trunk/boost/spirit/home/lex/lexer: . lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2011-08-02 14:09:30


Author: hkaiser
Date: 2011-08-02 14:09:29 EDT (Tue, 02 Aug 2011)
New Revision: 73496
URL: http://svn.boost.org/trac/boost/changeset/73496

Log:
Spirit: disambiguate boost::get in lexer code, add more specializations required for utree integration
Text files modified:
   trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp | 7 ++++++-
   trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp | 14 +++++++++++---
   trunk/boost/spirit/home/lex/lexer/token_def.hpp | 11 ++++++-----
   3 files changed, 23 insertions(+), 9 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp 2011-08-02 14:09:29 EDT (Tue, 02 Aug 2011)
@@ -337,6 +337,11 @@
                 boost::lexer::debug::dump(state_machine_, std::cerr);
 #endif
                 initialized_dfa_ = true;
+
+// // release memory held by rules description
+// basic_rules_type rules;
+// rules.init_state_info(rules_); // preserve states
+// std::swap(rules, rules_);
             }
             return true;
         }
@@ -345,7 +350,7 @@
         // lexertl specific data
         mutable boost::lexer::basic_state_machine<char_type> state_machine_;
         boost::lexer::regex_flags flags_;
- basic_rules_type rules_;
+ /*mutable*/ basic_rules_type rules_;
 
         typename Functor::semantic_actions_type actions_;
         mutable bool initialized_dfa_;

Modified: trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp 2011-08-02 14:09:29 EDT (Tue, 02 Aug 2011)
@@ -446,7 +446,7 @@
             if (0 == t.value().which()) {
             // first access to the token value
                 typedef iterator_range<Iterator> iterpair_type;
- iterpair_type const& ip = get<iterpair_type>(t.value());
+ iterpair_type const& ip = boost::get<iterpair_type>(t.value());
 
             // Interestingly enough we use the assign_to() framework defined in
             // Spirit.Qi allowing to convert the pair of iterators to almost any
@@ -489,7 +489,7 @@
             }
             else {
             // reuse the already assigned value
- spirit::traits::assign_to(get<Attribute>(t.value()), attr);
+ spirit::traits::assign_to(boost::get<Attribute>(t.value()), attr);
             }
         }
     };
@@ -502,6 +502,14 @@
           , lex::lexertl::token<Iterator, AttributeTypes, HasState, Idtype> >
     {};
 
+ template <typename Iterator, typename AttributeTypes
+ , typename HasState, typename Idtype>
+ struct assign_to_container_from_value<utree
+ , lex::lexertl::token<Iterator, AttributeTypes, HasState, Idtype> >
+ : assign_to_attribute_from_value<utree
+ , lex::lexertl::token<Iterator, AttributeTypes, HasState, Idtype> >
+ {};
+
     template <typename Iterator>
     struct assign_to_container_from_value<
         iterator_range<Iterator>, iterator_range<Iterator> >
@@ -607,7 +615,7 @@
             typedef fusion::vector2<Idtype_, iterator_range<Iterator> >
                 attribute_type;
 
- iterpair_type const& ip = get<iterpair_type>(t.value());
+ iterpair_type const& ip = boost::get<iterpair_type>(t.value());
             attr = attribute_type(t.id(), ip);
         }
     };

Modified: trunk/boost/spirit/home/lex/lexer/token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/token_def.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/token_def.hpp 2011-08-02 14:09:29 EDT (Tue, 02 Aug 2011)
@@ -115,9 +115,9 @@
         info what(Context& /*context*/) const
         {
             if (0 == def_.which())
- return info("token_def", get<string_type>(def_));
+ return info("token_def", boost::get<string_type>(def_));
 
- return info("token_def", get<char_type>(def_));
+ return info("token_def", boost::get<char_type>(def_));
         }
 
         ///////////////////////////////////////////////////////////////////////
@@ -148,11 +148,11 @@
 
             if (0 == def_.which()) {
                 unique_id_ = lexdef.add_token(state.c_str()
- , get<string_type>(def_), token_id_, target);
+ , boost::get<string_type>(def_), token_id_, target);
             }
             else {
                 unique_id_ = lexdef.add_token(state.c_str()
- , get<char_type>(def_), token_id_, target);
+ , boost::get<char_type>(def_), token_id_, target);
             }
         }
 
@@ -212,7 +212,8 @@
         string_type definition() const
         {
             return (0 == def_.which()) ?
- get<string_type>(def_) : string_type(1, get<char_type>(def_));
+ boost::get<string_type>(def_) :
+ string_type(1, boost::get<char_type>(def_));
         }
         std::size_t state() const { return token_state_; }
 


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