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

Function compile_attribute_unicode_utf8

test/compile_attribute.cpp:163–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void compile_attribute_unicode_utf8()
164{
165#if defined(__cpp_char8_t)
166 {
167 char8_t const chars[] = u8"";
168 auto first = std::begin(chars);
169 auto const last = std::end(chars);
170
171 {
172 constexpr auto parser = char_;
173 using attr_t = decltype(prefix_parse(first, last, parser));
174 static_assert(std::is_same_v<attr_t, std::optional<char32_t>>);
175 static_assert(std::is_same_v<
176 attribute_t<
177 decltype(BOOST_PARSER_SUBRANGE(first, last)),
178 decltype(parser)>,
179 char32_t>);
180 }
181 {
182 constexpr auto parser = *char_;
183 using attr_t = decltype(prefix_parse(first, last, parser));
184 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
185 static_assert(std::is_same_v<
186 attribute_t<
187 decltype(BOOST_PARSER_SUBRANGE(first, last)),
188 decltype(parser)>,
189 std::string>);
190 }
191 {
192 constexpr auto parser = string("foo");
193 using attr_t = decltype(prefix_parse(first, last, parser));
194 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
195 static_assert(std::is_same_v<
196 attribute_t<
197 decltype(BOOST_PARSER_SUBRANGE(first, last)),
198 decltype(parser)>,
199 std::string>);
200 }
201 {
202 constexpr auto parser = char_ >> string("foo");
203 using attr_t = decltype(prefix_parse(first, last, parser));
204 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
205 static_assert(std::is_same_v<
206 attribute_t<
207 decltype(BOOST_PARSER_SUBRANGE(first, last)),
208 decltype(parser)>,
209 std::string>);
210 }
211 {
212 constexpr auto parser = string("foo") >> char_;
213 using attr_t = decltype(prefix_parse(first, last, parser));
214 static_assert(std::is_same_v<attr_t, std::optional<std::string>>);
215 static_assert(std::is_same_v<
216 attribute_t<
217 decltype(BOOST_PARSER_SUBRANGE(first, last)),
218 decltype(parser)>,
219 std::string>);
220 }

Callers 1

compile_attributeFunction · 0.85

Calls 6

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

Tested by

no test coverage detected