sequence_function.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // silence MSVC warning C4512: assignment operator could not be generated
  30. BOOST_DELETED_FUNCTION(sequence_collect_function& operator= (sequence_collect_function const&))
  31. };
  32. template <typename LexerDef>
  33. struct sequence_add_actions_function
  34. {
  35. sequence_add_actions_function(LexerDef& def_)
  36. : def(def_) {}
  37. template <typename Component>
  38. bool operator()(Component const& component) const
  39. {
  40. component.add_actions(def);
  41. return false; // execute for all sequence elements
  42. }
  43. LexerDef& def;
  44. // silence MSVC warning C4512: assignment operator could not be generated
  45. BOOST_DELETED_FUNCTION(sequence_add_actions_function& operator= (sequence_add_actions_function const&))
  46. };
  47. }}}}
  48. #endif