cpp_lex_interface.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*=============================================================================
  2. Boost.Wave: A Standard compliant C++ preprocessor library
  3. Definition of the abstract lexer interface
  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. #if !defined(CPP_LEX_INTERFACE_HPP_E83F52A4_90AC_4FBE_A9A7_B65F7F94C497_INCLUDED)
  10. #define CPP_LEX_INTERFACE_HPP_E83F52A4_90AC_4FBE_A9A7_B65F7F94C497_INCLUDED
  11. #include <boost/wave/wave_config.hpp>
  12. #include <boost/wave/util/file_position.hpp>
  13. #include <boost/wave/language_support.hpp>
  14. // this must occur after all of the includes and before any code appears
  15. #ifdef BOOST_HAS_ABI_HEADERS
  16. #include BOOST_ABI_PREFIX
  17. #endif
  18. // suppress warnings about dependent classes not being exported from the dll
  19. #ifdef BOOST_MSVC
  20. #pragma warning(push)
  21. #pragma warning(disable : 4251 4231 4660)
  22. #endif
  23. ///////////////////////////////////////////////////////////////////////////////
  24. namespace boost {
  25. namespace wave {
  26. namespace cpplexer {
  27. ///////////////////////////////////////////////////////////////////////////////
  28. //
  29. // The lex_input_interface decouples the lex_iterator_shim from the actual
  30. // lexer. This is done to allow compile time reduction.
  31. // Thanks to JCAB for having this idea.
  32. //
  33. ///////////////////////////////////////////////////////////////////////////////
  34. template <typename TokenT>
  35. struct lex_input_interface
  36. {
  37. typedef typename TokenT::position_type position_type;
  38. lex_input_interface() {}
  39. virtual ~lex_input_interface() {}
  40. virtual TokenT& get(TokenT&) = 0;
  41. virtual void set_position(position_type const &pos) = 0;
  42. #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
  43. virtual bool has_include_guards(std::string& guard_name) const = 0;
  44. #endif
  45. };
  46. ///////////////////////////////////////////////////////////////////////////////
  47. } // namespace cpplexer
  48. } // namespace wave
  49. } // namespace boost
  50. #ifdef BOOST_MSVC
  51. #pragma warning(pop)
  52. #endif
  53. // the suffix header occurs after all of the code
  54. #ifdef BOOST_HAS_ABI_HEADERS
  55. #include BOOST_ABI_SUFFIX
  56. #endif
  57. #endif // !defined(CPP_LEX_INTERFACE_HPP_E83F52A4_90AC_4FBE_A9A7_B65F7F94C497_INCLUDED)