| 13 | |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | |
| 18 | // doc_example) |
| 19 | { |
| 20 | namespace bp = boost::parser; |
| 21 | auto const street_parser = bp::string(u8"Tobias Straße"); |
| 22 | assert(!bp::parse("Tobias Strasse" | bp::as_utf32, street_parser)); // No match. |
| 23 | assert(bp::parse("Tobias Strasse" | bp::as_utf32, bp::no_case[street_parser])); // Match! |
| 24 | |
| 25 | auto const alpha_parser = bp::no_case[bp::char_('a', 'z')]; |
| 26 | assert(bp::parse("a" | bp::as_utf32, bp::no_case[alpha_parser])); // Match! |
| 27 | assert(bp::parse("B" | bp::as_utf32, bp::no_case[alpha_parser])); // Match! |
| 28 | |
| 29 | (void)street_parser; |
| 30 | (void)alpha_parser; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | using namespace boost::parser; |
| 35 | |
| 36 | constexpr auto capital_sharp_s = u8"ẞ"; // U+1E9E |
| 37 | constexpr auto small_sharp_s = u8"ß"; // U+00DF |
| 38 | constexpr auto double_s = u8"sS"; // U+0073 U+0073 |
| 39 | |
| 40 | // basic) |
| 41 | { |
| 42 | constexpr auto char_p = no_case[char_('a') | char_('B')]; |
| 43 | |
| 44 | { |
| 45 | auto const result = parse("a", char_p); |
| 46 | BOOST_TEST(result); |
| 47 | BOOST_TEST(*result == 'a'); |
| 48 | } |
| 49 | { |
| 50 | auto const result = parse("A", char_p); |
| 51 | BOOST_TEST(result); |
| 52 | BOOST_TEST(*result == 'A'); |
| 53 | } |
| 54 | |
| 55 | { |
| 56 | auto const result = parse("b", char_p); |
| 57 | BOOST_TEST(result); |
| 58 | BOOST_TEST(*result == 'b'); |
| 59 | } |
| 60 | { |
| 61 | auto const result = parse("B", char_p); |
| 62 | BOOST_TEST(result); |
| 63 | BOOST_TEST(*result == 'B'); |
| 64 | } |
| 65 | |
| 66 | constexpr auto str_p = string("sOmE TeXT"); |
| 67 | |
| 68 | { |
| 69 | auto const result = parse("some text", str_p); |
| 70 | BOOST_TEST(!result); |
| 71 | } |
| 72 | { |
nothing calls this directly
no test coverage detected