8 This is a [link parser parser].
12 It accepts one character in the range `0-9`. The result of the parser is the
13 value represented by the accepted character.
17 #include <boost/metaparse/digit_val.hpp>
19 [h1 Expression semantics]
21 The following are equivalent:
25 transform<digit, util::digit_to_int<>>
29 #include <boost/metaparse/digit_val.hpp>
30 #include <boost/metaparse/start.hpp>
31 #include <boost/metaparse/string.hpp>
32 #include <boost/metaparse/is_error.hpp>
33 #include <boost/metaparse/get_result.hpp>
35 using namespace boost::metaparse;
38 !is_error<digit_val::apply<BOOST_METAPARSE_STRING("0"), start>>::type::value,
39 "digit_val should accept a digit"
43 is_error<digit_val::apply<BOOST_METAPARSE_STRING("x"), start>>::type::value,
44 "digit_val should reject a character"
49 digit_val::apply<BOOST_METAPARSE_STRING("0"), start>
51 "the result of parsing should be the int value"