support_functions_expression.hpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. #if !defined(SPIRIT_LEX_SUPPORT_FUNCTIONS_EXPRESSION_MAR_22_2011_0711PM)
  7. #define SPIRIT_LEX_SUPPORT_FUNCTIONS_EXPRESSION_MAR_22_2011_0711PM
  8. #if defined(_MSC_VER)
  9. #pragma once
  10. #endif
  11. #include <boost/spirit/include/phoenix_core.hpp>
  12. namespace boost { namespace spirit { namespace lex
  13. {
  14. template <typename> struct less_type;
  15. struct more_type;
  16. template <typename, typename> struct lookahead_type;
  17. }}}
  18. ///////////////////////////////////////////////////////////////////////////////
  19. BOOST_PHOENIX_DEFINE_EXPRESSION(
  20. (boost)(spirit)(lex)(less)
  21. , (boost::phoenix::meta_grammar)
  22. )
  23. BOOST_PHOENIX_DEFINE_EXPRESSION(
  24. (boost)(spirit)(lex)(lookahead)
  25. , (boost::phoenix::meta_grammar)
  26. (boost::phoenix::meta_grammar)
  27. )
  28. namespace boost { namespace phoenix
  29. {
  30. namespace result_of
  31. {
  32. template <>
  33. struct is_nullary<custom_terminal<boost::spirit::lex::more_type> >
  34. : mpl::false_
  35. {};
  36. }
  37. template <typename Dummy>
  38. struct is_custom_terminal<boost::spirit::lex::more_type, Dummy> : mpl::true_ {};
  39. template <typename Dummy>
  40. struct custom_terminal<boost::spirit::lex::more_type, Dummy>
  41. : proto::call<
  42. v2_eval(
  43. proto::make<boost::spirit::lex::more_type()>
  44. , proto::call<functional::env(proto::_state)>
  45. )
  46. >
  47. {};
  48. template <typename Dummy>
  49. struct is_nullary::when<spirit::lex::rule::less, Dummy>
  50. : proto::make<mpl::false_()>
  51. {};
  52. template <typename Dummy>
  53. struct default_actions::when<spirit::lex::rule::less, Dummy>
  54. : proto::call<
  55. v2_eval(
  56. proto::make<
  57. spirit::lex::less_type<proto::_child0>(proto::_child0)
  58. >
  59. , _env
  60. )
  61. >
  62. {};
  63. template <typename Dummy>
  64. struct is_nullary::when<spirit::lex::rule::lookahead, Dummy>
  65. : proto::make<mpl::false_()>
  66. {};
  67. template <typename Dummy>
  68. struct default_actions::when<spirit::lex::rule::lookahead, Dummy>
  69. : proto::call<
  70. v2_eval(
  71. proto::make<
  72. spirit::lex::lookahead_type<
  73. proto::_child0
  74. , proto::_child1
  75. >(
  76. proto::_child0
  77. , proto::_child1
  78. )
  79. >
  80. , _env
  81. )
  82. >
  83. {};
  84. }}
  85. #endif