sequence_function.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifdef _MSC_VER
  15. # pragma warning(push)
  16. # pragma warning(disable: 4512) // assignment operator could not be generated.
  17. #endif
  18. template <typename LexerDef, typename String>
  19. struct sequence_collect_function
  20. {
  21. sequence_collect_function(LexerDef& def_, String const& state_
  22. , String const& targetstate_)
  23. : def(def_), state(state_), targetstate(targetstate_) {}
  24. template <typename Component>
  25. bool operator()(Component const& component) const
  26. {
  27. component.collect(def, state, targetstate);
  28. return false; // execute for all sequence elements
  29. }
  30. LexerDef& def;
  31. String const& state;
  32. String const& targetstate;
  33. };
  34. template <typename LexerDef>
  35. struct sequence_add_actions_function
  36. {
  37. sequence_add_actions_function(LexerDef& def_)
  38. : def(def_) {}
  39. template <typename Component>
  40. bool operator()(Component const& component) const
  41. {
  42. component.add_actions(def);
  43. return false; // execute for all sequence elements
  44. }
  45. LexerDef& def;
  46. };
  47. #ifdef _MSC_VER
  48. # pragma warning(pop)
  49. #endif
  50. }}}}
  51. #endif