Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54688 - in trunk/boost/spirit/home/lex: . lexer lexer/lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-05 17:27:23


Author: hkaiser
Date: 2009-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
New Revision: 54688
URL: http://svn.boost.org/trac/boost/changeset/54688

Log:
Spirit.Lex: removed token_set class
Removed:
   trunk/boost/spirit/home/lex/lexer/lexertl/unique_id.hpp
   trunk/boost/spirit/home/lex/lexer/token_set.hpp
Text files modified:
   trunk/boost/spirit/home/lex/lexer.hpp | 1
   trunk/boost/spirit/home/lex/lexer/lexer.hpp | 9 ---
   trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp | 99 ++-------------------------------------
   trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp | 80 +++-----------------------------
   trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp | 4
   5 files changed, 16 insertions(+), 177 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer.hpp 2009-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
@@ -12,7 +12,6 @@
 
 #include <boost/spirit/home/lex/lexer/terminals.hpp>
 #include <boost/spirit/home/lex/lexer/token_def.hpp>
-#include <boost/spirit/home/lex/lexer/token_set.hpp>
 #include <boost/spirit/home/lex/lexer/char_token_def.hpp>
 #include <boost/spirit/home/lex/lexer/string_token_def.hpp>
 #include <boost/spirit/home/lex/lexer/sequence.hpp>

Modified: trunk/boost/spirit/home/lex/lexer/lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexer.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexer.hpp 2009-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
@@ -89,7 +89,7 @@
                     token_type;
 
                     token_type &t = *first;
- if (token_is_valid(t)) {
+ if (token_is_valid(t) && t.state() == first.get_state()) {
                     // any of the token definitions matched
                         qi::detail::assign_to(t, attr);
                         ++first;
@@ -168,13 +168,6 @@
                     return *this;
                 }
 
- template <typename TokenSet>
- adder const& operator()(token_set<TokenSet>& tokset) const
- {
- def.define(tokset);
- return *this;
- }
-
                 lexer_def_& def;
             };
             friend struct adder;

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-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
@@ -22,7 +22,6 @@
 #include <boost/spirit/home/lex/lexer/lexertl/functor.hpp>
 #include <boost/spirit/home/lex/lexer/lexertl/functor_data.hpp>
 #include <boost/spirit/home/lex/lexer/lexertl/iterator.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/unique_id.hpp>
 #if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
 #include <boost/spirit/home/support/detail/lexer/debug.hpp>
 #endif
@@ -92,63 +91,6 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // token_set
- ///////////////////////////////////////////////////////////////////////////
- template <typename Token, typename Iterator = typename Token::iterator_type>
- class token_set
- {
- protected:
- typedef typename boost::detail::iterator_traits<Iterator>::value_type
- char_type;
- typedef std::basic_string<char_type> string_type;
-
- public:
- typedef Token token_type;
- typedef typename Token::id_type id_type;
-
- token_set(unsigned int flags = 0)
- : rules_(detail::map_flags(flags), &unique_id<id_type>::get)
- {}
-
- // interface for token definition management
- std::size_t add_token (char_type const* state, char_type tokendef
- , std::size_t token_id)
- {
- return rules_.add(state, detail::escape(tokendef), token_id, state);
- }
-
- std::size_t add_token (char_type const* state, string_type const& tokendef
- , std::size_t token_id)
- {
- return rules_.add(state, tokendef, token_id, state);
- }
-
- // interface for pattern definition management
- std::size_t add_pattern (char_type const* state, string_type const& name
- , string_type const& patterndef)
- {
- add_state(state);
- return rules_.add_macro(name.c_str(), patterndef);
- }
-
- boost::lexer::rules const& get_rules() const { return rules_; }
-
- void clear() { rules_.clear(); }
-
- std::size_t add_state(char_type const* state)
- {
- return rules_.add_state(state);
- }
- string_type initial_state() const
- {
- return string_type(rules_.initial());
- }
-
- private:
- boost::lexer::basic_rules<char_type> rules_;
- };
-
- ///////////////////////////////////////////////////////////////////////////
     template <typename Lexer>
     bool generate_static(Lexer const& lex, std::ostream& os, char const* name);
 
@@ -161,8 +103,6 @@
     // iterator_type The type of the iterator exposed by this lexer.
     // token_type The type of the tokens returned from the exposed
     // iterators.
- // token_set The type of the token set representing a lexer
- // state.
     //
     // functions:
     // default constructor
@@ -187,9 +127,6 @@
     // Functor The type of the InputPolicy to use to instantiate
     // the multi_pass iterator type to be used as the
     // token iterator (returned from begin()/end()).
- // TokenSet The type of the token set to use in conjunction
- // with this lexer type. This is used for the
- // token_set typedef described above only.
     //
     ///////////////////////////////////////////////////////////////////////////
 
@@ -205,8 +142,7 @@
     ///////////////////////////////////////////////////////////////////////////
     template <typename Token = token<>
       , typename Iterator = typename Token::iterator_type
- , typename Functor = functor<Token, lexertl::detail::data, Iterator>
- , typename TokenSet = lex::token_set<token_set<Token, Iterator> > >
+ , typename Functor = functor<Token, lexertl::detail::data, Iterator> >
     class lexer
     {
     public:
@@ -223,7 +159,6 @@
         // a public interface .
         typedef Token token_type;
         typedef typename Token::id_type id_type;
- typedef TokenSet token_set;
         typedef iterator<Functor> iterator_type;
 
     private:
@@ -259,7 +194,7 @@
         // Lexer instances can be created by means of a derived class only.
         lexer(unsigned int flags)
           : flags_(detail::map_flags(flags))
- , rules_(flags_, &unique_id<id_type>::get)
+ , rules_(flags_)
           , initialized_dfa_(false)
         {}
 
@@ -280,29 +215,6 @@
             return rules_.add(state, tokendef, token_id, state);
         }
 
- // Allow a token_set to be associated with this lexer instance. This
- // copies all token definitions of the right hand side into this lexer
- // instance.
- void add_token(char_type const* state, token_set const& tokset)
- {
- add_state(state);
- initialized_dfa_ = false;
- rules_.add("*", tokset.get_rules(), state, state);
- }
-
- // Allow to associate a whole lexer instance with another lexer
- // instance. This copies all token definitions of the right hand side
- // lexer into this instance.
- template <typename Token_, typename Iterator_, typename Functor_
- , typename TokenSet_>
- void add_token(char_type const* state
- , lexer<Token_, Iterator_, Functor_, TokenSet_> const& lexer_def)
- {
- add_state(state);
- initialized_dfa_ = false;
- rules_.add("*", lexer_def.get_rules(), state, state);
- }
-
         // interface for pattern definition management
         void add_pattern (char_type const* state, string_type const& name,
             string_type const& patterndef)
@@ -393,14 +305,13 @@
     ///////////////////////////////////////////////////////////////////////////
     template <typename Token = token<>
       , typename Iterator = typename Token::iterator_type
- , typename Functor = functor<Token, lexertl::detail::data, Iterator, mpl::true_>
- , typename TokenSet = lex::token_set<token_set<Token, Iterator> > >
- class actor_lexer : public lexer<Token, Iterator, Functor, TokenSet>
+ , typename Functor = functor<Token, lexertl::detail::data, Iterator, mpl::true_> >
+ class actor_lexer : public lexer<Token, Iterator, Functor>
     {
     protected:
         // Lexer instances can be created by means of a derived class only.
         actor_lexer(unsigned int flags)
- : lexer<Token, Iterator, Functor, TokenSet>(flags) {}
+ : lexer<Token, Iterator, Functor>(flags) {}
     };
 
 }}}}

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-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
@@ -15,7 +15,6 @@
 #include <boost/spirit/home/lex/lexer/lexertl/functor.hpp>
 #include <boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp>
 #include <boost/spirit/home/lex/lexer/lexertl/iterator.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/unique_id.hpp>
 #if defined(BOOST_SPIRIT_DEBUG)
 #include <boost/spirit/home/support/detail/lexer/debug.hpp>
 #endif
@@ -31,59 +30,6 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // static_token_set
- ///////////////////////////////////////////////////////////////////////////
- template <typename Token
- , typename LexerTables = static_::lexer
- , typename Iterator = typename Token::iterator_type>
- class static_token_set
- {
- protected:
- typedef typename boost::detail::iterator_traits<Iterator>::value_type
- char_type;
- typedef std::basic_string<char_type> string_type;
- typedef LexerTables tables_type;
-
- static std::size_t get_state_id(char const* state)
- {
- for (std::size_t i = 0; i < tables_type::state_count(); ++i)
- {
- if (boost::equals(tables_type::state_name(i), state))
- return i;
- }
- return ~0;
- }
-
- public:
- typedef Token token_type;
- typedef typename Token::id_type id_type;
-
- static_token_set(unsigned int flags = 0) {}
-
- // interface for token definition management
- std::size_t add_token (char_type const* state
- , string_type const& tokendef, std::size_t token_id)
- {
- return unique_id<id_type>::get();
- }
-
- // interface for pattern definition management
- void add_pattern (char_type const* state, string_type const& name
- , string_type const& patterndef) {}
-
- void clear() {}
-
- std::size_t add_state(char_type const* state)
- {
- return get_state_id(state);
- }
- string_type initial_state() const
- {
- return tables_type::state_name(0);
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
     //
     // Every lexer type to be used as a lexer for Spirit has to conform to
     // the following public interface:
@@ -92,8 +38,6 @@
     // iterator_type The type of the iterator exposed by this lexer.
     // token_type The type of the tokens returned from the exposed
     // iterators.
- // token_set The type of the token set representing a lexer
- // state.
     //
     // functions:
     // default constructor
@@ -119,9 +63,6 @@
     // Functor The type of the InputPolicy to use to instantiate
     // the multi_pass iterator type to be used as the
     // token iterator (returned from begin()/end()).
- // TokenSet The type of the token set to use in conjunction
- // with this lexer type. This is used for the
- // token_set typedef described above only.
     //
     // Additionally, this implementation of a static lexer has a template
     // parameter LexerTables allowing to customize the static lexer tables
@@ -167,9 +108,7 @@
     template <typename Token = token<>
       , typename LexerTables = static_::lexer
       , typename Iterator = typename Token::iterator_type
- , typename Functor = functor<Token, detail::static_data, Iterator>
- , typename TokenSet
- = lex::token_set<static_token_set<Token, LexerTables, Iterator> > >
+ , typename Functor = functor<Token, detail::static_data, Iterator> >
     class static_lexer
     {
     public:
@@ -187,7 +126,6 @@
         // a public interface
         typedef Token token_type;
         typedef typename Token::id_type id_type;
- typedef TokenSet token_set;
         typedef iterator<Functor> iterator_type;
 
     private:
@@ -226,21 +164,20 @@
 
     protected:
         // Lexer instances can be created by means of a derived class only.
- static_lexer(unsigned int flags) {}
+ static_lexer(unsigned int flags) : unique_id_(0) {}
 
     public:
         // interface for token definition management
         std::size_t add_token (char_type const* state, char_type tokendef
           , std::size_t token_id)
         {
- return unique_id<id_type>::get();
+ return unique_id_++;
         }
         std::size_t add_token (char_type const* state, string_type const& tokendef
           , std::size_t token_id)
         {
- return unique_id<id_type>::get();
+ return unique_id_++;
         }
- void add_token(char_type const* state, token_set& tokset) {}
 
         // interface for pattern definition management
         void add_pattern (char_type const* state, string_type const& name
@@ -270,6 +207,7 @@
 
     private:
         typename Functor::semantic_actions_type actions_;
+ std::size_t unique_id_;
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -298,16 +236,14 @@
       , typename LexerTables = static_::lexer
       , typename Iterator = typename Token::iterator_type
       , typename Functor
- = functor<Token, detail::static_data, Iterator, mpl::true_>
- , typename TokenSet
- = lex::token_set<static_token_set<Token, LexerTables, Iterator> > >
+ = functor<Token, detail::static_data, Iterator, mpl::true_> >
     class static_actor_lexer
- : public static_lexer<Token, LexerTables, Iterator, Functor, TokenSet>
+ : public static_lexer<Token, LexerTables, Iterator, Functor>
     {
     protected:
         // Lexer instances can be created by means of a derived class only.
         static_actor_lexer(unsigned int flags)
- : static_lexer<Token, LexerTables, Iterator, Functor, TokenSet>(flags)
+ : static_lexer<Token, LexerTables, Iterator, Functor>(flags)
         {}
     };
 

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 2009-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
@@ -445,13 +445,13 @@
     inline void
     construct(Attribute& attr, token<Iterator, omitted, HasState>& t) {}
 
- // This is called from the parse function of token_set or lexer_def_
+ // This is called from the parse function of lexer_def_
     template <typename Iterator, typename AttributeTypes, typename HasState>
     inline void
     construct(fusion::vector2<std::size_t, iterator_range<Iterator> >& attr,
         token<Iterator, AttributeTypes, HasState> const& t)
     {
- // The type returned by the token_set and lexer_def_ parser components
+ // The type returned by the lexer_def_ parser components
     // is a fusion::vector containing the token id of the matched token
     // and the pair of iterators to the matched character sequence.
 

Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/unique_id.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/unique_id.hpp 2009-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
+++ (empty file)
@@ -1,39 +0,0 @@
-// Copyright (c) 2001-2009 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#if !defined(BOOST_SPIRIT_LEX_UNIQUE_ID_MAY_24_2009_0313PM)
-#define BOOST_SPIRIT_LEX_UNIQUE_ID_MAY_24_2009_0313PM
-
-#if defined(_MSC_VER)
-#pragma once
-#endif
-
-namespace boost { namespace spirit { namespace lex { namespace lexertl
-{
- ///////////////////////////////////////////////////////////////////////////
- // The next_id template needs to be specialized for any non-default token
- // id type used by a custom token type. It needs to expose a function
- // 'static Idtype get()' returning the next available unique id each time
- // it is called.
- template <typename Idtype>
- struct unique_id;
-
- ///////////////////////////////////////////////////////////////////////////
- // Default specialization for the next_id template returning the next
- // available token id.
- template <>
- struct unique_id<std::size_t>
- {
- static std::size_t get()
- {
- static std::size_t unique_id_ = 0;
- return unique_id_++;
- }
- };
-
-}}}}
-
-#endif
-

Deleted: trunk/boost/spirit/home/lex/lexer/token_set.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/token_set.hpp 2009-07-05 17:27:22 EDT (Sun, 05 Jul 2009)
+++ (empty file)
@@ -1,292 +0,0 @@
-// Copyright (c) 2001-2009 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#if !defined(BOOST_SPIRIT_LEX_TOKEN_SET_MAR_13_2007_0145PM)
-#define BOOST_SPIRIT_LEX_TOKEN_SET_MAR_13_2007_0145PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/argument.hpp>
-#include <boost/spirit/home/support/info.hpp>
-#include <boost/spirit/home/qi/parser.hpp>
-#include <boost/spirit/home/qi/skip_over.hpp>
-#include <boost/spirit/home/lex/reference.hpp>
-#include <boost/spirit/home/lex/lexer_type.hpp>
-#include <boost/spirit/home/lex/lexer/token_def.hpp>
-#include <boost/detail/iterator.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/mpl/assert.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <cstdlib>
-
-namespace boost { namespace spirit { namespace lex
-{
- ///////////////////////////////////////////////////////////////////////////
- // token_set
- ///////////////////////////////////////////////////////////////////////////
- template <typename TokenSet>
- struct token_set
- : proto::extends<
- typename proto::terminal<
- lex::reference<token_set<TokenSet> const>
- >::type
- , token_set<TokenSet> >
- , TokenSet
- , qi::parser<token_set<TokenSet> >
- , lex::lexer_type<token_set<TokenSet> >
- , noncopyable
- {
- protected:
- typedef typename TokenSet::char_type char_type;
- typedef typename TokenSet::string_type string_type;
-
- private:
- // avoid warnings about using 'this' in constructor
- token_set& this_() { return *this; }
-
- typedef TokenSet base_token_set;
-
- // initialize proto base class
- typedef lex::reference<token_set const> reference_;
- typedef typename proto::terminal<reference_>::type terminal_type;
- typedef proto::extends<terminal_type, token_set> proto_base_type;
-
- reference_ alias() const
- {
- return reference_(*this);
- }
-
- public:
- typedef typename TokenSet::id_type id_type;
-
- // Qi interface: metafunction calculating parser return type
- template <typename Context, typename Iterator>
- struct attribute
- {
- // the return value of a token set contains the matched token id,
- // and the corresponding pair of iterators
- typedef typename Iterator::base_iterator_type iterator_type;
- typedef fusion::vector2<id_type, iterator_range<iterator_type> >
- type;
- };
-
- // Qi interface: parse functionality
- template <typename Iterator, typename Context
- , typename Skipper, typename Attribute_>
- bool parse(Iterator& first, Iterator const& last
- , Context& /*context*/, Skipper const& skipper
- , Attribute_& attr) const
- {
- qi::skip_over(first, last, skipper); // always do a pre-skip
-
- if (first != last) {
- typedef typename
- boost::detail::iterator_traits<Iterator>::value_type
- token_type;
-
- // If the following assertion fires you probably forgot to
- // associate this token set definition with a lexer instance.
- BOOST_ASSERT(~0 != token_state_);
-
- token_type &t = *first;
- if (token_is_valid(t) && token_state_ == t.state()) {
- // any of the token definitions matched
- qi::detail::assign_to(t, attr);
- ++first;
- return true;
- }
- }
- return false;
- }
-
- template <typename Context>
- info what(Context& /*context*/) const
- {
- return info("token_set");
- }
-
- ///////////////////////////////////////////////////////////////////////
- // Lex interface: collect token definitions and put it into the
- // provided lexer def
- template <typename LexerDef, typename String>
- void collect(LexerDef& lexdef, String const& state) const
- {
- std::size_t state_id = lexdef.add_state(state.c_str());
-
- // If the following assertion fires you are probably trying to use
- // a single token_set instance in more than one lexer state. This
- // is not possible. Please create a separate token_set instance
- // from the same set of regular expressions for each lexer state it
- // needs to be associated with.
- BOOST_ASSERT(~0 == token_state_ || state_id == token_state_);
-
- token_state_ = state_id;
- lexdef.add_token (state.c_str(), *this);
- }
-
- template <typename LexerDef>
- void add_actions(LexerDef& lexdef) const {}
-
- private:
- // allow to use the tokset.add("regex1", id1)("regex2", id2);
- // syntax
- struct adder
- {
- adder(token_set& def_) : def(def_) {}
-
- adder const& operator()(char_type c
- , id_type token_id = id_type()) const
- {
- if (id_type() == token_id)
- token_id = static_cast<std::size_t>(c);
- def.add_token (def.initial_state().c_str(), c, token_id);
- return *this;
- }
-
- adder const& operator()(string_type const& s
- , id_type token_id = id_type()) const
- {
- if (id_type() == token_id)
- token_id = next_id<id_type>::get();
- def.add_token (def.initial_state().c_str(), s, token_id);
- return *this;
- }
-
- template <typename Attribute>
- adder const& operator()(
- token_def<Attribute, char_type, id_type>& tokdef
- , id_type token_id = id_type()) const
- {
- // make sure we have a token id
- if (id_type() == token_id) {
- if (id_type() == tokdef.id()) {
- token_id = next_id<id_type>::get();
- tokdef.id(token_id);
- }
- else {
- token_id = tokdef.id();
- }
- }
- else {
- // the following assertion makes sure, that the token_def
- // instance has not been assigned a different id earlier
- BOOST_ASSERT(0 == tokdef.id() || token_id == tokdef.id());
- tokdef.id(token_id);
- }
-
- def.add_token(def.initial_state().c_str(), tokdef.definition()
- , token_id);
- return *this;
- }
-
- template <typename TokenSet_>
- adder const& operator()(token_set<TokenSet_> const& tokset) const
- {
- def.add_token(def.initial_state().c_str(), tokset);
- return *this;
- }
-
- token_set& def;
- };
- friend struct adder;
-
- // allow to use tokset.add_pattern("pattern1", "regex1")(...);
- // syntax
- struct pattern_adder
- {
- pattern_adder(token_set& def_) : def(def_) {}
-
- pattern_adder const&
- operator()(string_type const& p, string_type const& s) const
- {
- def.add_pattern (def.state.c_str(), p, s);
- return *this;
- }
-
- token_set& def;
- };
- friend struct pattern_adder;
-
- private:
- // Helper function to invoke the necessary 2 step compilation process
- // on token definition expressions
- template <typename TokenExpr>
- void compile2pass(TokenExpr const& expr)
- {
- expr.collect(*this, base_token_set::initial_state());
- expr.add_actions(*this);
- }
-
- public:
- ///////////////////////////////////////////////////////////////////
- template <typename Expr>
- void define(Expr const& expr)
- {
- compile2pass(compile<lex::domain>(expr));
- }
-
- token_set()
- : proto_base_type(terminal_type::make(alias()))
- , add(this_()), add_pattern(this_()), token_state_(~0) {}
-
- // allow to assign a token definition expression
- template <typename Expr>
- token_set& operator= (Expr const& xpr)
- {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit lex
- // expression.
- BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr);
-
- this->clear();
- define(xpr);
- return *this;
- }
-
- adder add;
- pattern_adder add_pattern;
-
- std::size_t state() const { return token_state_; }
-
- private:
- mutable std::size_t token_state_;
- };
-
- // allow to assign a token definition expression
- template <typename TokenSet, typename Expr>
- inline token_set<TokenSet>&
- operator+= (token_set<TokenSet>& tokset, Expr& xpr)
- {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit lex
- // expression.
- BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr);
-
- tokset.define(xpr);
- return tokset;
- }
-
- template <typename TokenSet, typename Expr>
- inline token_set<TokenSet>&
- operator+= (token_set<TokenSet>& tokset, Expr const& xpr)
- {
- // Report invalid expression error as early as possible.
- // If you got an error_invalid_expression error message here,
- // then the expression (expr) is not a valid spirit lex
- // expression.
- BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr);
-
- tokset.define(xpr);
- return tokset;
- }
-
-}}}
-
-#endif


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