|
/*=============================================================================
Wave: A Standard compliant C++ preprocessor
Test the C preprocessor
Explicit instantiation of the lex_functor generation function
Copyright (c) 2001-2003 Hartmut Kaiser
http://spirit.sourceforge.net/
Permission to copy, use, modify, sell and distribute this software
is granted provided this copyright notice appears in all copies.
This software is provided "as is" without express or implied
warranty, and with no claim as to its suitability for any purpose.
See Copyright.txt for full copyright notices and acknowledgements.
=============================================================================*/
#include "cpp.hpp" // config data
#if defined(WAVE_SEPARATE_LEXER_INSTANTIATION) && defined(WAVE_USE_RE2C_CPP_LEXER)
#include <string>
#include "wave/cpplexer/cpp_token_ids.hpp"
#include "wave/cpplexer/cpp_lex_iterator.hpp"
#include "wave/cpplexer/cpp_lex_token.hpp"
///////////////////////////////////////////////////////////////////////////////
// The following file needs to be included only once throughout the whole
// program.
#include "wave/cpplexer/re2clex/cpp_re2c_lexer.hpp"
///////////////////////////////////////////////////////////////////////////////
//
// This instantiates the correct 'new_lexer' function, which generates the
// C++ lexer used in this sample. You will have to instantiate the
// new_lexer_gen<> template with the same iterator type, as you have used for
// instantiating the wave::context<> object.
//
// This is moved into a separate compilation unit to decouple the compilation
// of the C++ lexer from the compilation of the other modules, which helps to
// reduce compilation time.
//
// The template parameter(s) supplied should be identical to the first
// parameter supplied while instantiating the wave::context<> template (see
// the file cpp.cpp).
//
///////////////////////////////////////////////////////////////////////////////
template wave::cpplexer::new_lexer_gen<WAVE_STRINGTYPE::iterator>;
///////////////////////////////////////////////////////////////////////////////
//
// If you've used another iterator type as std::string::iterator, you have to
// instantiate the new_lexer_gen<> template even for this iterator type too.
// The reason is, that the library internally uses the new_lexer_gen<>
// template with a std::string::iterator. (You just have to undefine the
// following line.)
//
///////////////////////////////////////////////////////////////////////////////
template wave::cpplexer::new_lexer_gen<std::string::iterator>;
#endif // defined(WAVE_SEPARATE_LEXER_INSTANTIATION) && defined(WAVE_USE_RE2C_CPP_LEXER)
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Actively involved in Boost and the development of the Spirit parser construction framework.