instantiate_re2c_lexer.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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-2012 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. #define BOOST_WAVE_SOURCE 1
  10. // disable stupid compiler warnings
  11. #include <boost/config/warning_disable.hpp>
  12. #include <boost/wave/wave_config.hpp> // configuration data
  13. #if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0
  14. #include <string>
  15. #include <boost/wave/token_ids.hpp>
  16. #include <boost/wave/cpplexer/cpp_lex_token.hpp>
  17. #include <boost/wave/cpplexer/cpp_lex_iterator.hpp>
  18. ///////////////////////////////////////////////////////////////////////////////
  19. // The following file needs to be included only once throughout the whole
  20. // program.
  21. #include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp>
  22. // this must occur after all of the includes and before any code appears
  23. #ifdef BOOST_HAS_ABI_HEADERS
  24. #include BOOST_ABI_PREFIX
  25. #endif
  26. ///////////////////////////////////////////////////////////////////////////////
  27. //
  28. // This instantiates the correct 'new_lexer' function, which generates the
  29. // C++ lexer used in this sample. You will have to instantiate the
  30. // new_lexer_gen<> template with the same iterator type, as you have used for
  31. // instantiating the boost::wave::context<> object.
  32. //
  33. // This is moved into a separate compilation unit to decouple the compilation
  34. // of the C++ lexer from the compilation of the other modules, which helps to
  35. // reduce compilation time.
  36. //
  37. // The template parameter(s) supplied should be identical to the first
  38. // parameter supplied while instantiating the boost::wave::context<> template
  39. // (see the file cpp.cpp).
  40. //
  41. ///////////////////////////////////////////////////////////////////////////////
  42. // if you want to use another iterator type for the underlying input stream
  43. // a corresponding explicit template instantiation needs to be added below
  44. template struct BOOST_SYMBOL_VISIBLE boost::wave::cpplexer::new_lexer_gen<
  45. BOOST_WAVE_STRINGTYPE::iterator>;
  46. template struct BOOST_SYMBOL_VISIBLE boost::wave::cpplexer::new_lexer_gen<
  47. BOOST_WAVE_STRINGTYPE::const_iterator>;
  48. // the suffix header occurs after all of the code
  49. #ifdef BOOST_HAS_ABI_HEADERS
  50. #include BOOST_ABI_SUFFIX
  51. #endif
  52. #endif // BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION != 0