6 template <class P1, /* ... */, class Pn>
9 This is a [link parser_combinator parser combinator].
13 [[`P1` .. `Pn`] [[link parser parser]]]
18 `first_of` applies the `P1` ... `Pn` parsers in sequence. It accepts an input
19 when all parsers accept it. The result of parsing is the result of the first
24 #include <boost/metaparse/first_of.hpp>
26 [h1 Expression semantics]
28 For any `p1`, ... `pn` parsers
34 nth_of_c<0, p1, ..., pn>
38 #include <boost/metaparse/first_of.hpp>
39 #include <boost/metaparse/int_.hpp>
40 #include <boost/metaparse/lit_c.hpp>
41 #include <boost/metaparse/string.hpp>
42 #include <boost/metaparse/start.hpp>
43 #include <boost/metaparse/is_error.hpp>
44 #include <boost/metaparse/get_result.hpp>
46 #include <type_traits>
48 using namespace boost::metaparse;
50 using int_with_semicolon = first_of<int_, lit_c<';'>>;
54 int_with_semicolon::apply<BOOST_METAPARSE_STRING("13"), start>
56 "int without semicolon is rejected"
61 int_with_semicolon::apply<BOOST_METAPARSE_STRING("13;"), start>
63 "the result is the result of the first parser"