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

Function compile_attribute_sentinel

test/compile_attribute.cpp:473–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471BOOST_PARSER_DEFINE_RULES(ints);
472
473void compile_attribute_sentinel()
474{
475 char const * chars = "";
476 auto first = chars;
477 boost::parser::detail::text::null_sentinel_t last;
478
479 {
480 constexpr auto parser = eps;
481 using attr_t = decltype(prefix_parse(first, last, parser));
482 static_assert(std::is_same_v<attr_t, bool>);
483 static_assert(std::is_same_v<
484 attribute_t<
485 decltype(BOOST_PARSER_SUBRANGE(first, last)),
486 decltype(parser)>,
487 none>);
488 }
489 {
490 constexpr auto parser = eol;
491 using attr_t = decltype(prefix_parse(first, last, parser));
492 static_assert(std::is_same_v<attr_t, bool>);
493 static_assert(std::is_same_v<
494 attribute_t<
495 decltype(BOOST_PARSER_SUBRANGE(first, last)),
496 decltype(parser)>,
497 none>);
498 }
499 {
500 constexpr auto parser = eoi;
501 using attr_t = decltype(prefix_parse(first, last, parser));
502 static_assert(std::is_same_v<attr_t, bool>);
503 static_assert(std::is_same_v<
504 attribute_t<
505 decltype(BOOST_PARSER_SUBRANGE(first, last)),
506 decltype(parser)>,
507 none>);
508 }
509 {
510 constexpr auto parser = attr(3.0);
511 using attr_t = decltype(prefix_parse(first, last, parser));
512 static_assert(std::is_same_v<attr_t, std::optional<double>>);
513 static_assert(std::is_same_v<
514 attribute_t<
515 decltype(BOOST_PARSER_SUBRANGE(first, last)),
516 decltype(parser)>,
517 double>);
518 }
519 {
520 constexpr auto parser = attr('c');
521 using attr_t = decltype(prefix_parse(first, last, parser));
522 static_assert(std::is_same_v<attr_t, std::optional<char>>);
523 static_assert(std::is_same_v<
524 attribute_t<
525 decltype(BOOST_PARSER_SUBRANGE(first, last)),
526 decltype(parser)>,
527 char>);
528 }
529 {
530 constexpr auto parser = cp;

Callers 1

compile_attributeFunction · 0.85

Calls 6

prefix_parseFunction · 0.85
attrFunction · 0.85
litFunction · 0.85
if_Function · 0.85
switch_Function · 0.85
stringClass · 0.50

Tested by

no test coverage detected