MCPcopy Create free account
hub / github.com/boostorg/parser / operator|

Function operator|

include/boost/parser/parser.hpp:5829–5852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5827 `or_parser` containing `parser_` followed by `rhs.parser_`. */
5828 template<typename ParserType2>
5829 constexpr auto
5830 operator|(parser_interface<ParserType2> rhs) const noexcept
5831 {
5832 if constexpr (detail::is_or_p<parser_type>{}) {
5833 return parser_.append(rhs);
5834 } else if constexpr (detail::is_or_p<ParserType2>{}) {
5835 return rhs.parser_.prepend(*this);
5836 } else {
5837 // If you're seeing this as a compile- or run-time failure,
5838 // you've tried to put an eps parser at the beginning of an
5839 // alternative-parser, such as "eps | int_". This is not what
5840 // you meant. Since eps always matches any input, "eps |
5841 // int_" is just an awkward spelling for "eps". To fix this
5842 // this, put the eps as the last alternative, so the other
5843 // alternatives get a chance. Possibly, you may have meant to
5844 // add a condition to the eps, like "eps(condition) | int_",
5845 // which also is meaningful, and so is allowed.
5846 BOOST_PARSER_ASSERT(
5847 !detail::is_unconditional_eps<parser_type>{});
5848 return parser::parser_interface{
5849 or_parser<tuple<parser_type, ParserType2>>{
5850 tuple<parser_type, ParserType2>{parser_, rhs.parser_}}};
5851 }
5852 }
5853
5854 /** Returns a `parser_interface` containing a parser equivalent to a
5855 `perm_parser` containing `parser_` followed by `rhs.parser_`. It

Callers

nothing calls this directly

Calls 3

litFunction · 0.85
appendMethod · 0.80
prependMethod · 0.80

Tested by

no test coverage detected