| 9 | using namespace boost::parser; |
| 10 | |
| 11 | void compile_seq_attribute() |
| 12 | { |
| 13 | char const chars[] = ""; |
| 14 | auto first = std::begin(chars); |
| 15 | auto const last = std::end(chars); |
| 16 | |
| 17 | // scalar and eps |
| 18 | { |
| 19 | constexpr auto parser = int_ >> eps; |
| 20 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 21 | static_assert(std::is_same_v<attr_t, std::optional<int>>); |
| 22 | } |
| 23 | { |
| 24 | constexpr auto parser = eps >> int_; |
| 25 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 26 | static_assert(std::is_same_v<attr_t, std::optional<int>>); |
| 27 | } |
| 28 | |
| 29 | // scalar >> scalar |
| 30 | { |
| 31 | constexpr auto parser = char_ >> char_; |
| 32 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 33 | static_assert(std::is_same_v<attr_t, std::optional<std::string>>); |
| 34 | } |
| 35 | { |
| 36 | constexpr auto parser = eps >> char_ >> char_; |
| 37 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 38 | static_assert(std::is_same_v<attr_t, std::optional<std::string>>); |
| 39 | } |
| 40 | { |
| 41 | constexpr auto parser = char_ >> eps >> char_; |
| 42 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 43 | static_assert(std::is_same_v<attr_t, std::optional<std::string>>); |
| 44 | } |
| 45 | { |
| 46 | constexpr auto parser = char_ >> char_ >> eps; |
| 47 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 48 | static_assert(std::is_same_v<attr_t, std::optional<std::string>>); |
| 49 | } |
| 50 | { |
| 51 | constexpr auto parser = int_ >> char_; |
| 52 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 53 | static_assert(std::is_same_v<attr_t, std::optional<tuple<int, char>>>); |
| 54 | } |
| 55 | { |
| 56 | constexpr auto parser = eps >> int_ >> char_; |
| 57 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 58 | static_assert(std::is_same_v<attr_t, std::optional<tuple<int, char>>>); |
| 59 | } |
| 60 | { |
| 61 | constexpr auto parser = int_ >> eps >> char_; |
| 62 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 63 | static_assert(std::is_same_v<attr_t, std::optional<tuple<int, char>>>); |
| 64 | } |
| 65 | { |
| 66 | constexpr auto parser = int_ >> char_ >> eps; |
| 67 | using attr_t = decltype(prefix_parse(first, last, parser)); |
| 68 | static_assert(std::is_same_v<attr_t, std::optional<tuple<int, char>>>); |