sequence_function.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #if !defined(BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM)
  6. #define BOOST_SPIRIT_LEX_SEQUENCE_FUNCTION_FEB_28_2007_0249PM
  7. #if defined(_MSC_VER)
  8. #pragma once
  9. #endif
  10. #include <boost/spirit/home/lex/domain.hpp>
  11. #include <boost/spirit/home/support/unused.hpp>
  12. namespace boost { namespace spirit { namespace lex { namespace detail
  13. {
  14. template <typename LexerDef, typename String>
  15. struct sequence_collect_function
  16. {
  17. sequence_collect_function(LexerDef& def_, String const& state_
  18. , String const& targetstate_)
  19. : def(def_), state(state_), targetstate(targetstate_) {}
  20. template <typename Component>
  21. bool operator()(Component const& component) const
  22. {
  23. component.collect(def, state, targetstate);
  24. return false; // execute for all sequence elements
  25. }
  26. LexerDef& def;
  27. String const& state;
  28. String const& targetstate;
  29. private:
  30. // silence MSVC warning C4512: assignment operator could not be generated
  31. sequence_collect_function& operator= (sequence_collect_function const&);
  32. };
  33. template <typename LexerDef>
  34. struct sequence_add_actions_function
  35. {
  36. sequence_add_actions_function(LexerDef& def_)
  37. : def(def_) {}
  38. template <typename Component>
  39. bool operator()(Component const& component) const
  40. {
  41. component.add_actions(def);
  42. return false; // execute for all sequence elements
  43. }
  44. LexerDef& def;
  45. private:
  46. // silence MSVC warning C4512: assignment operator could not be generated
  47. sequence_add_actions_function& operator= (sequence_add_actions_function const&);
  48. };
  49. }}}}
  50. #endif