|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58859 - trunk/boost/spirit/home/lex/lexer/lexertl
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-09 20:45:58
Author: hkaiser
Date: 2010-01-09 20:45:56 EST (Sat, 09 Jan 2010)
New Revision: 58859
URL: http://svn.boost.org/trac/boost/changeset/58859
Log:
Spirit: added compile time assertion diagnosing a configuration mismatch
Text files modified:
trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp | 10 +++++++++-
trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp | 10 +++++++++-
2 files changed, 18 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-01-09 20:45:56 EST (Sat, 09 Jan 2010)
@@ -59,7 +59,15 @@
// The following functions are used by the implementation of the
// placeholder '_state'.
- void set_state_name (char_type const*) {}
+ template <typename Char>
+ void set_state_name (Char const*)
+ {
+ // If you see a compile time assertion below you're probably
+ // using a token type not supporting lexer states (the 3rd
+ // template parameter of the token is mpl::false_), but your
+ // code uses state changes anyways.
+ BOOST_STATIC_ASSERT(false);
+ }
char_type const* get_state_name() const { return rules_.initial(); }
std::size_t get_state_id (char_type const*) const
{
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-01-09 20:45:56 EST (Sat, 09 Jan 2010)
@@ -75,7 +75,15 @@
// The following functions are used by the implementation of the
// placeholder '_state'.
- void set_state_name (char_type const*) {}
+ template <typename Char>
+ void set_state_name (Char const*)
+ {
+ // If you see a compile time assertion below you're probably
+ // using a token type not supporting lexer states (the 3rd
+ // template parameter of the token is mpl::false_), but your
+ // code uses state changes anyways.
+ BOOST_STATIC_ASSERT(false);
+ }
char_type const* get_state_name() const
{
return get_state_name_(0);
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