internals.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // internals.hpp
  2. // Copyright (c) 2009 Ben Hanson (http://www.benhanson.net/)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_LEXER_INTERNALS_HPP
  7. #define BOOST_LEXER_INTERNALS_HPP
  8. #include "containers/ptr_vector.hpp"
  9. namespace boost
  10. {
  11. namespace lexer
  12. {
  13. namespace detail
  14. {
  15. struct internals
  16. {
  17. typedef std::vector<std::size_t> size_t_vector;
  18. typedef ptr_vector<size_t_vector> size_t_vector_vector;
  19. size_t_vector_vector _lookup;
  20. size_t_vector _dfa_alphabet;
  21. size_t_vector_vector _dfa;
  22. bool _seen_BOL_assertion;
  23. bool _seen_EOL_assertion;
  24. internals () :
  25. _seen_BOL_assertion (false),
  26. _seen_EOL_assertion (false)
  27. {
  28. }
  29. void clear ()
  30. {
  31. _lookup.clear ();
  32. _dfa_alphabet.clear ();
  33. _dfa.clear ();
  34. _seen_BOL_assertion = false;
  35. _seen_EOL_assertion = false;
  36. }
  37. void swap (internals &internals_)
  38. {
  39. _lookup->swap (*internals_._lookup);
  40. _dfa_alphabet.swap (internals_._dfa_alphabet);
  41. _dfa->swap (*internals_._dfa);
  42. std::swap (_seen_BOL_assertion, internals_._seen_BOL_assertion);
  43. std::swap (_seen_EOL_assertion, internals_._seen_EOL_assertion);
  44. }
  45. private:
  46. internals (const internals &); // No copy construction.
  47. internals &operator = (const internals &); // No assignment.
  48. };
  49. }
  50. }
  51. }
  52. #endif