Update of /cvsroot/boost/boost/libs/wave/samples/cpp_tokens
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30735/libs/wave/samples/cpp_tokens
Modified Files:
slex_interface.hpp slex_iterator.hpp
Log Message:
Factored out the pure lex_input_interface to simplify writing different lexer
types for Wave.
Index: slex_interface.hpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/wave/samples/cpp_tokens/slex_interface.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- slex_interface.hpp 17 Mar 2006 22:40:01 -0000 1.7
+++ slex_interface.hpp 22 Nov 2006 02:33:44 -0000 1.8
@@ -15,6 +15,7 @@
#include <boost/wave/language_support.hpp>
#include <boost/wave/util/file_position.hpp>
+#include <boost/wave/cpplexer/cpp_lex_interface.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost {
@@ -33,8 +34,6 @@
// new_lexer_gen: generates a new instance of the required C++ lexer
//
///////////////////////////////////////////////////////////////////////////////
-template <typename TokenT> struct slex_input_interface;
-
template <
typename IteratorT,
typename PositionT = boost::wave::util::file_position_type
@@ -44,7 +43,7 @@
// The NewLexer function allows the opaque generation of a new lexer object.
// It is coupled to the token type to allow to decouple the lexer/token
// configurations at compile time.
- static slex_input_interface<slex_token<PositionT> > *
+ static lex_input_interface<slex_token<PositionT> > *
new_lexer(IteratorT const &first, IteratorT const &last,
PositionT const &pos, boost::wave::language_support language);
};
@@ -53,31 +52,25 @@
///////////////////////////////////////////////////////////////////////////////
//
-// The lex_input_interface decouples the lex_iterator_shim from the actual
-// lexer. This is done to allow compile time reduction.
-// Thanks to JCAB for having this idea.
+// The slex_input_interface helps to instantiate a concrete lexer to be used
+// by the Wave preprocessor module.
+// This is done to allow compile time reduction.
//
///////////////////////////////////////////////////////////////////////////////
template <typename TokenT>
struct slex_input_interface
+: lex_input_interface<TokenT>
{
- typedef typename TokenT::position_type position_type;
+ typedef typename lex_input_interface<TokenT>::position_type position_type;
- virtual TokenT get() = 0;
- virtual void set_position(position_type const &pos) = 0;
-
- virtual ~slex_input_interface() {}
+ ~slex_input_interface() {}
-#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- virtual bool has_include_guards(std::string& guard_name) const = 0;
-#endif
-
// The new_lexer function allows the opaque generation of a new lexer object.
// It is coupled to the token type to allow to distinguish different
// lexer/token configurations at compile time.
template <typename IteratorT>
- static slex_input_interface *
+ static lex_input_interface<TokenT> *
new_lexer(IteratorT const &first, IteratorT const &last,
position_type const &pos, boost::wave::language_support language)
{
Index: slex_iterator.hpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/wave/samples/cpp_tokens/slex_iterator.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- slex_iterator.hpp 17 Mar 2006 22:40:01 -0000 1.9
+++ slex_iterator.hpp 22 Nov 2006 02:33:44 -0000 1.10
@@ -84,7 +84,7 @@
#endif
private:
- boost::shared_ptr<slex_input_interface<TokenT> > functor_ptr;
+ boost::shared_ptr<lex_input_interface<TokenT> > functor_ptr;
};
#if 0 != __COMO_VERSION__
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs