MCPcopy Create free account
hub / github.com/boostorg/parser / main

Function main

test/no_case.cpp:15–662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15int 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
34using namespace boost::parser;
35
36constexpr auto capital_sharp_s = u8"ẞ"; // U+1E9E
37constexpr auto small_sharp_s = u8"ß"; // U+00DF
38constexpr 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 {

Callers

nothing calls this directly

Calls 15

_attrFunction · 0.85
null_termFunction · 0.85
no_case_iterClass · 0.85
searchFunction · 0.85
case_foldFunction · 0.85
stringClass · 0.50
parseFunction · 0.50
getFunction · 0.50
mismatchFunction · 0.50
insert_for_next_parseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected