|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56141 - trunk/libs/spirit/example/lex/static_lexer
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-10 14:36:58
Author: hkaiser
Date: 2009-09-10 14:36:57 EDT (Thu, 10 Sep 2009)
New Revision: 56141
URL: http://svn.boost.org/trac/boost/changeset/56141
Log:
Spirit: fixing lexer issue inhibiting usage of more than one instance of a static lexer
Text files modified:
trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_static.hpp | 16 ++++++++++++----
trunk/libs/spirit/example/lex/static_lexer/word_count_static.hpp | 16 ++++++++++++----
2 files changed, 24 insertions(+), 8 deletions(-)
Modified: trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_static.hpp
==============================================================================
--- trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_static.hpp (original)
+++ trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_static.hpp 2009-09-10 14:36:57 EDT (Thu, 10 Sep 2009)
@@ -6,25 +6,29 @@
// Auto-generated by boost::lexer, do not edit
-#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_WCL_MAY_24_2009_18_48_18)
-#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_WCL_MAY_24_2009_18_48_18
+#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_WCL_SEP_10_2009_13_33_36)
+#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_WCL_SEP_10_2009_13_33_36
#include <boost/detail/iterator.hpp>
#include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
+////////////////////////////////////////////////////////////////////////////////
// the generated table of state names and the tokenizer have to be
// defined in the boost::spirit::lex::lexertl::static_ namespace
namespace boost { namespace spirit { namespace lex { namespace lexertl { namespace static_ {
+////////////////////////////////////////////////////////////////////////////////
// this table defines the names of the lexer states
char const* const lexer_state_names_wcl[1] =
{
"INITIAL"
};
+////////////////////////////////////////////////////////////////////////////////
// this variable defines the number of lexer states
std::size_t const lexer_state_count_wcl = 1;
+////////////////////////////////////////////////////////////////////////////////
// this function returns the next matched token
template<typename Iterator>
std::size_t next_token_wcl (std::size_t &start_state_, Iterator const& start_,
@@ -119,24 +123,28 @@
return id_;
}
-// this defines a generic accessor for the information above
+////////////////////////////////////////////////////////////////////////////////
+// this defines a generic accessors for the information above
struct lexer_wcl
{
+ // return the number of lexer states
static std::size_t const state_count()
{
return lexer_state_count_wcl;
}
+ // return the name of the lexer state as given by 'idx'
static char const* const state_name(std::size_t idx)
{
return lexer_state_names_wcl[idx];
}
+ // return the next matched token
template<typename Iterator>
static std::size_t next(std::size_t &start_state_, Iterator const& start_
, Iterator &start_token_, Iterator const& end_, std::size_t& unique_id_)
{
- return next_token_wcl(start_state_, start_, start_token_, end_, unique_id_);
+ return next_token_wcl(start_state_, start_, start_token_, end_, unique_id_);
}
};
Modified: trunk/libs/spirit/example/lex/static_lexer/word_count_static.hpp
==============================================================================
--- trunk/libs/spirit/example/lex/static_lexer/word_count_static.hpp (original)
+++ trunk/libs/spirit/example/lex/static_lexer/word_count_static.hpp 2009-09-10 14:36:57 EDT (Thu, 10 Sep 2009)
@@ -6,25 +6,29 @@
// Auto-generated by boost::lexer, do not edit
-#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_MAY_24_2009_18_48_54)
-#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_MAY_24_2009_18_48_54
+#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_SEP_10_2009_13_34_06)
+#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_SEP_10_2009_13_34_06
#include <boost/detail/iterator.hpp>
#include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
+////////////////////////////////////////////////////////////////////////////////
// the generated table of state names and the tokenizer have to be
// defined in the boost::spirit::lex::lexertl::static_ namespace
namespace boost { namespace spirit { namespace lex { namespace lexertl { namespace static_ {
+////////////////////////////////////////////////////////////////////////////////
// this table defines the names of the lexer states
char const* const lexer_state_names_wc[1] =
{
"INITIAL"
};
+////////////////////////////////////////////////////////////////////////////////
// this variable defines the number of lexer states
std::size_t const lexer_state_count_wc = 1;
+////////////////////////////////////////////////////////////////////////////////
// this function returns the next matched token
template<typename Iterator>
std::size_t next_token_wc (std::size_t &start_state_, Iterator const& start_,
@@ -119,24 +123,28 @@
return id_;
}
-// this defines a generic accessor for the information above
+////////////////////////////////////////////////////////////////////////////////
+// this defines a generic accessors for the information above
struct lexer_wc
{
+ // return the number of lexer states
static std::size_t const state_count()
{
return lexer_state_count_wc;
}
+ // return the name of the lexer state as given by 'idx'
static char const* const state_name(std::size_t idx)
{
return lexer_state_names_wc[idx];
}
+ // return the next matched token
template<typename Iterator>
static std::size_t next(std::size_t &start_state_, Iterator const& start_
, Iterator &start_token_, Iterator const& end_, std::size_t& unique_id_)
{
- return next_token_wc(start_state_, start_, start_token_, end_, unique_id_);
+ return next_token_wc(start_state_, start_, start_token_, end_, unique_id_);
}
};
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