Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52951 - in trunk/boost/spirit/home/lex: . lexer lexer/lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-12 22:10:49


Author: hkaiser
Date: 2009-05-12 22:10:49 EDT (Tue, 12 May 2009)
New Revision: 52951
URL: http://svn.boost.org/trac/boost/changeset/52951

Log:
Spirit: fixed a lexer regression
Text files modified:
   trunk/boost/spirit/home/lex/lexer/action.hpp | 2 +-
   trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp | 18 +++++++-----------
   trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp | 4 ++--
   trunk/boost/spirit/home/lex/lexer/string_token_def.hpp | 2 +-
   trunk/boost/spirit/home/lex/reference.hpp | 4 ++++
   5 files changed, 15 insertions(+), 15 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer/action.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/action.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/action.hpp 2009-05-12 22:10:49 EDT (Tue, 12 May 2009)
@@ -35,7 +35,7 @@
 
             // retrieve the id of the associated token_def and register the
             // given semantic action with the lexer instance
- lexdef.add_action(subject.id(), f);
+ lexdef.add_action(subject.id(), subject.state(), f);
         }
 
         Subject subject;

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 2009-05-12 22:10:49 EDT (Tue, 12 May 2009)
@@ -311,7 +311,7 @@
 
         // Register a semantic action with the given id
         template <typename F>
- void add_action(std::size_t id, F act)
+ void add_action(id_type id, std::size_t state, F act)
         {
             // If you get compilation errors below stating value_type not being
             // a member of boost::fusion::unused_type, then you are probably
@@ -322,25 +322,21 @@
                 value_type;
             typedef typename Functor::wrap_action_type wrapper_type;
 
- actions.insert(value_type(id, wrapper_type::call(act)));
+ actions.insert(value_type(std::make_pair(id, state)
+ , wrapper_type::call(act)));
         }
 
         bool init_dfa() const
         {
             if (!initialized_dfa) {
                 state_machine.clear();
- try {
- typedef boost::lexer::basic_generator<char_type> generator;
- generator::build (rules, state_machine);
- generator::minimise (state_machine);
+ typedef boost::lexer::basic_generator<char_type> generator;
+ generator::build (rules, state_machine);
+ generator::minimise (state_machine);
 
 #if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
- boost::lexer::debug::dump(state_machine, std::cerr);
+ boost::lexer::debug::dump(state_machine, std::cerr);
 #endif
- }
- catch (std::runtime_error const&) {
- return false;
- }
                 initialized_dfa = true;
             }
             return true;

Modified: trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp 2009-05-12 22:10:49 EDT (Tue, 12 May 2009)
@@ -218,7 +218,7 @@
 
         // register a semantic action with the given id
         template <typename F>
- void add_action(std::size_t id, F act)
+ void add_action(id_type id, std::size_t state, F act)
         {
             // If you get compilation errors below stating value_type not being
             // a member of boost::fusion::unused_type, then you are probably
@@ -228,7 +228,7 @@
             typedef typename Functor::semantic_actions_type::value_type
                 value_type;
 
- actions.insert(value_type(id, act));
+ actions.insert(value_type(std::make_pair(id, state), act));
         }
 
         bool init_dfa() const { return true; }

Modified: trunk/boost/spirit/home/lex/lexer/string_token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/string_token_def.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/string_token_def.hpp 2009-05-12 22:10:49 EDT (Tue, 12 May 2009)
@@ -72,7 +72,7 @@
         std::size_t id() const { return id_; }
 
         string_type str_;
- std::size_t id_;
+ mutable std::size_t id_;
     };
 
     ///////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/spirit/home/lex/reference.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/reference.hpp (original)
+++ trunk/boost/spirit/home/lex/reference.hpp 2009-05-12 22:10:49 EDT (Tue, 12 May 2009)
@@ -51,6 +51,10 @@
         {
             return this->ref.get().id();
         }
+ std::size_t state() const
+ {
+ return this->ref.get().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