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

Function compile_attribute_non_unicode

test/compile_attribute.cpp:11–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9using namespace boost::parser;
10
11void compile_attribute_non_unicode()
12{
13 // range
14 {
15 char const r[] = "";
16
17 {
18 constexpr auto parser = char_;
19 using attr_t = decltype(parse(r, parser));
20 static_assert(std::is_same_v<attr_t, std::optional<char>>);
21 static_assert(std::is_same_v<
22 attribute_t<decltype(r), decltype(parser)>,
23 char>);
24 }
25 {
26 constexpr auto parser = *char_;
27 using attr_t = decltype(parse(r, parser));
28 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
29 static_assert(std::is_same_v<
30 attribute_t<decltype(r), decltype(parser)>,
31 std::string>);
32 }
33 {
34 constexpr auto parser = string("foo");
35 using attr_t = decltype(parse(r, parser));
36 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
37 static_assert(std::is_same_v<
38 attribute_t<decltype(r), decltype(parser)>,
39 std::string>);
40 }
41 {
42 constexpr auto parser = char_ >> string("foo");
43 using attr_t = decltype(parse(r, parser));
44 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
45 static_assert(std::is_same_v<
46 attribute_t<decltype(r), decltype(parser)>,
47 std::string>);
48 }
49 {
50 constexpr auto parser = string("foo") >> char_;
51 using attr_t = decltype(parse(r, parser));
52 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
53 static_assert(std::is_same_v<
54 attribute_t<decltype(r), decltype(parser)>,
55 std::string>);
56 }
57 }
58 // pointer-as-range (covers iter/sent case, as that's what gets used
59 // internally)
60 {
61 char const * r = "";
62
63 {
64 constexpr auto parser = char_;
65 using attr_t = decltype(parse(null_term(r), parser));
66 static_assert(std::is_same_v<attr_t, std::optional<char>>);
67 static_assert(std::is_same_v<
68 attribute_t<decltype(r), decltype(parser)>,

Callers 1

compile_attributeFunction · 0.85

Calls 6

null_termFunction · 0.85
prefix_parseFunction · 0.85
parseFunction · 0.50
stringClass · 0.50
beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected