common.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef BOOST_PARSER_TEST_COMMON_H
  2. #define BOOST_PARSER_TEST_COMMON_H
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/metaparse/lit.hpp>
  8. #include <boost/metaparse/lit_c.hpp>
  9. #include <boost/mpl/list.hpp>
  10. #include <boost/mpl/list_c.hpp>
  11. #include <boost/mpl/char.hpp>
  12. #include <boost/mpl/int.hpp>
  13. #include <boost/mpl/vector.hpp>
  14. #include <boost/mpl/at.hpp>
  15. #include <boost/mpl/equal.hpp>
  16. #include <string>
  17. typedef boost::mpl::list_c<char> str_;
  18. typedef boost::mpl::list_c<char, '0'> str_0;
  19. typedef boost::mpl::list_c<char, '1'> str_1;
  20. typedef boost::mpl::list_c<char, '1', '9', '8', '3'> str_1983;
  21. typedef boost::mpl::list_c<char, 'a'> str_a;
  22. typedef boost::mpl::list_c<char, 'a', 'b'> str_ab;
  23. typedef boost::mpl::list_c<char, 'a', 'a', 'a', 'a', 'b'> str_aaaab;
  24. typedef boost::mpl::list_c<char, 'a', 'c'> str_ac;
  25. typedef boost::mpl::list_c<char, 'b'> str_b;
  26. typedef boost::mpl::list_c<char, 'b', 'a'> str_ba;
  27. typedef boost::mpl::list_c<char, 'b', 'a', 'a', 'a', 'a'> str_baaaa;
  28. typedef boost::mpl::list_c<char, 'c'> str_c;
  29. typedef boost::mpl::list_c<char, 'c', 'a'> str_ca;
  30. typedef boost::mpl::list_c<char, 'h'> str_h;
  31. typedef boost::mpl::list_c<char, 'e'> str_e;
  32. typedef boost::mpl::list_c<char, 'l'> str_l;
  33. typedef boost::mpl::list_c<char, 'b', 'e', 'l', 'l', 'o'> str_bello;
  34. typedef boost::mpl::list_c<char, 'h', 'e', 'l', 'l', 'o'> str_hello;
  35. typedef boost::mpl::list_c<char, ' ', 'e', 'l', 'l', 'o'> str__ello;
  36. typedef boost::mpl::list_c<char, '0', 'e', 'l', 'l', 'o'> chars0;
  37. typedef boost::mpl::list_c<char, 'h', '0', 'l', 'l', 'o'> chars1;
  38. typedef boost::mpl::list_c<char, 'h', 'e', '0', 'l', 'o'> chars2;
  39. typedef boost::mpl::list_c<char, 'h', 'e', 'l', '0', 'o'> chars3;
  40. typedef boost::mpl::list_c<char, 'h', 'e', 'l', 'l', '0'> chars4;
  41. typedef boost::mpl::list_c<char, 'h', 'e', 'l', 'l', 'o'> chars5;
  42. typedef boost::mpl::char_<'0'> char_0;
  43. typedef boost::mpl::char_<'1'> char_1;
  44. typedef boost::mpl::char_<'7'> char_7;
  45. typedef boost::mpl::char_<'9'> char_9;
  46. typedef boost::mpl::char_<'a'> char_a;
  47. typedef boost::mpl::char_<'b'> char_b;
  48. typedef boost::mpl::char_<'e'> char_e;
  49. typedef boost::mpl::char_<'h'> char_h;
  50. typedef boost::mpl::char_<'k'> char_k;
  51. typedef boost::mpl::char_<'K'> char_K;
  52. typedef boost::mpl::char_<'l'> char_l;
  53. typedef boost::mpl::char_<'o'> char_o;
  54. typedef boost::mpl::char_<'x'> char_x;
  55. typedef boost::mpl::char_<' '> char_space;
  56. typedef boost::mpl::char_<'\t'> char_tab;
  57. typedef boost::mpl::char_<'\n'> char_new_line;
  58. typedef boost::mpl::char_<'\r'> char_cret;
  59. typedef boost::mpl::int_<0> int0;
  60. typedef boost::mpl::int_<1> int1;
  61. typedef boost::mpl::int_<2> int2;
  62. typedef boost::mpl::int_<3> int3;
  63. typedef boost::mpl::int_<9> int9;
  64. typedef boost::mpl::int_<10> int10;
  65. typedef boost::mpl::int_<11> int11;
  66. typedef boost::mpl::int_<12> int12;
  67. typedef boost::mpl::int_<13> int13;
  68. typedef boost::mpl::int_<14> int14;
  69. typedef boost::mpl::int_<28> int28;
  70. typedef boost::metaparse::lit<char_e> lit_e;
  71. typedef boost::metaparse::lit<char_h> lit_h;
  72. typedef boost::metaparse::lit<char_l> lit_l;
  73. typedef boost::metaparse::lit<char_x> lit_x;
  74. typedef boost::metaparse::lit_c<'e'> lit_c_e;
  75. typedef boost::metaparse::lit_c<'h'> lit_c_h;
  76. typedef boost::mpl::list< > empty_list;
  77. typedef
  78. boost::mpl::at<boost::mpl::vector<int, double>, int11>
  79. can_not_be_instantiated;
  80. struct test_failure
  81. {
  82. typedef test_failure type;
  83. static std::string get_value() { return "fail"; }
  84. };
  85. struct equal_sequences
  86. {
  87. typedef equal_sequences type;
  88. template <class A, class B>
  89. struct apply : boost::mpl::equal<typename A::type, typename B::type> {};
  90. };
  91. #endif