template<typename Left, typename Right>
class fcppt::parse::alternative< Left, Right >
Tries the left parser, and if that fails also the right parser. Uses the result of the first one that does not fail.
Let l
and r
be parsers and al = alternative{l,r}
. First, al
saves the current position pos
. Then, al
tries the parser l
. If it succeeds, then its result is returned. If it returns a fatal error then this error is returned. Otherwise, al
backtracks to pos
and returns the result of r
.
See fcppt::parse::alternative_result for this parser's result type.