support_functions_expression.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Copyright (c) 2001-2011 Hartmut Kaiser
  2. // Copyright (c) 2011 Thomas Heller
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_SPIRIT_LEX_LEXER_SUPPORT_FUNCTIONS_EXPRESSION_HPP
  7. #define BOOST_SPIRIT_LEX_LEXER_SUPPORT_FUNCTIONS_EXPRESSION_HPP
  8. #if defined(_MSC_VER)
  9. #pragma once
  10. #endif
  11. #include <boost/phoenix/core/expression.hpp>
  12. #include <boost/phoenix/core/v2_eval.hpp>
  13. #include <boost/proto/proto_fwd.hpp> // for transform placeholders
  14. namespace boost { namespace spirit { namespace lex
  15. {
  16. template <typename> struct less_type;
  17. struct more_type;
  18. template <typename, typename> struct lookahead_type;
  19. }}}
  20. ///////////////////////////////////////////////////////////////////////////////
  21. BOOST_PHOENIX_DEFINE_EXPRESSION(
  22. (boost)(spirit)(lex)(less)
  23. , (boost::phoenix::meta_grammar)
  24. )
  25. BOOST_PHOENIX_DEFINE_EXPRESSION(
  26. (boost)(spirit)(lex)(lookahead)
  27. , (boost::phoenix::meta_grammar)
  28. (boost::phoenix::meta_grammar)
  29. )
  30. namespace boost { namespace phoenix
  31. {
  32. namespace result_of
  33. {
  34. template <>
  35. struct is_nullary<custom_terminal<boost::spirit::lex::more_type> >
  36. : mpl::false_
  37. {};
  38. }
  39. template <typename Dummy>
  40. struct is_custom_terminal<boost::spirit::lex::more_type, Dummy> : mpl::true_ {};
  41. template <typename Dummy>
  42. struct custom_terminal<boost::spirit::lex::more_type, Dummy>
  43. : proto::call<
  44. v2_eval(
  45. proto::make<boost::spirit::lex::more_type()>
  46. , proto::call<functional::env(proto::_state)>
  47. )
  48. >
  49. {};
  50. template <typename Dummy>
  51. struct is_nullary::when<spirit::lex::rule::less, Dummy>
  52. : proto::make<mpl::false_()>
  53. {};
  54. template <typename Dummy>
  55. struct default_actions::when<spirit::lex::rule::less, Dummy>
  56. : proto::call<
  57. v2_eval(
  58. proto::make<
  59. spirit::lex::less_type<proto::_child0>(proto::_child0)
  60. >
  61. , _env
  62. )
  63. >
  64. {};
  65. template <typename Dummy>
  66. struct is_nullary::when<spirit::lex::rule::lookahead, Dummy>
  67. : proto::make<mpl::false_()>
  68. {};
  69. template <typename Dummy>
  70. struct default_actions::when<spirit::lex::rule::lookahead, Dummy>
  71. : proto::call<
  72. v2_eval(
  73. proto::make<
  74. spirit::lex::lookahead_type<
  75. proto::_child0
  76. , proto::_child1
  77. >(
  78. proto::_child0
  79. , proto::_child1
  80. )
  81. >
  82. , _env
  83. )
  84. >
  85. {};
  86. }}
  87. #endif