instantiate_re2c_lexer.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*=============================================================================
  2. Boost.Wave: A Standard compliant C++ preprocessor library
  3. Explicit instantiation of the lex_functor generation function
  4. http://www.boost.org/
  5. Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
  6. Software License, Version 1.0. (See accompanying file
  7. LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. =============================================================================*/
  9. #include <boost/wave/wave_config.hpp> // configuration data
  10. #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0
  11. #include <string>
  12. #include <boost/wave/token_ids.hpp>
  13. #include "real_position_token.hpp" // token class
  14. #include <boost/wave/cpplexer/cpp_lex_iterator.hpp> // lexer type
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // The following file needs to be included only once throughout the whole
  17. // program.
  18. #include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp>
  19. // this must occur after all of the includes and before any code appears
  20. #ifdef BOOST_HAS_ABI_HEADERS
  21. #include BOOST_ABI_PREFIX
  22. #endif
  23. ///////////////////////////////////////////////////////////////////////////////
  24. //
  25. // This instantiates the correct 'new_lexer' function, which generates the
  26. // C++ lexer used in this sample. You will have to instantiate the
  27. // new_lexer_gen<> template with the same iterator type, as you have used for
  28. // instantiating the boost::wave::context<> object.
  29. //
  30. // This is moved into a separate compilation unit to decouple the compilation
  31. // of the C++ lexer from the compilation of the other modules, which helps to
  32. // reduce compilation time.
  33. //
  34. // The template parameter(s) supplied should be identical to the first
  35. // parameter supplied while instantiating the boost::wave::context<> template
  36. // (see the file cpp.cpp).
  37. //
  38. ///////////////////////////////////////////////////////////////////////////////
  39. template struct boost::wave::cpplexer::new_lexer_gen<
  40. BOOST_WAVE_STRINGTYPE::iterator, boost::wave::util::file_position_type,
  41. lex_token<boost::wave::util::file_position_type> >;
  42. template struct boost::wave::cpplexer::new_lexer_gen<
  43. BOOST_WAVE_STRINGTYPE::const_iterator, boost::wave::util::file_position_type,
  44. lex_token<boost::wave::util::file_position_type> >;
  45. // the suffix header occurs after all of the code
  46. #ifdef BOOST_HAS_ABI_HEADERS
  47. #include BOOST_ABI_SUFFIX
  48. #endif
  49. #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0