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