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

Method append

include/boost/parser/parser.hpp:6417–6440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6415 template<typename ParserTuple>
6416 template<typename Parser>
6417 constexpr auto or_parser<ParserTuple>::append(
6418 parser_interface<Parser> parser) const noexcept
6419 {
6420 // If you're seeing this as a compile- or run-time failure, you've
6421 // tried to put an eps parser in the middle of an alternative-parser,
6422 // such as "int_ | eps | double_". This is not what you meant. Since
6423 // eps always matches any input, "int_ | eps | double_" is just an
6424 // awkward spelling for "int_ | eps". To fix this this, put the eps
6425 // as the last alternative, so the other alternatives get a chance.
6426 // Possibly, you may have meant to add a condition to the eps, like
6427 // "int_ | eps(condition) | double_", which also is meaningful, and so
6428 // is allowed.
6429 BOOST_PARSER_ASSERT(!detail::is_unconditional_eps_v<decltype(
6430 detail::hl::back(parsers_))>);
6431 if constexpr (detail::is_or_p<Parser>{}) {
6432 return parser_interface{or_parser<decltype(
6433 detail::hl::concat(parsers_, parser.parser_.parsers_))>{
6434 detail::hl::concat(parsers_, parser.parser_.parsers_)}};
6435 } else {
6436 return parser_interface{or_parser<decltype(
6437 detail::hl::append(parsers_, parser.parser_))>{
6438 detail::hl::append(parsers_, parser.parser_)}};
6439 }
6440 }
6441
6442 template<typename ParserTuple, typename DelimiterParser>
6443 template<typename Parser>

Callers 4

operator|Function · 0.80
operator||Function · 0.80

Calls 5

backFunction · 0.85
concatFunction · 0.85
appendFunction · 0.85
prependFunction · 0.85
drop_frontFunction · 0.85

Tested by

no test coverage detected