File indexing completed on 2025-01-18 09:53:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
0011 #define BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
0012
0013 #include <boost/url/grammar/error.hpp>
0014 #include <boost/url/grammar/type_traits.hpp>
0015
0016 namespace boost {
0017 namespace urls {
0018 namespace grammar {
0019
0020 template<class R>
0021 BOOST_URL_NO_INLINE
0022 auto
0023 parse(
0024 char const*& it,
0025 char const* end,
0026 R const& r) ->
0027 system::result<typename R::value_type>
0028 {
0029
0030
0031
0032 static_assert(
0033 is_rule<R>::value,
0034 "Rule requirements not met");
0035
0036 return r.parse(it, end);
0037 }
0038
0039 template<class R>
0040 BOOST_URL_NO_INLINE
0041 auto
0042 parse(
0043 core::string_view s,
0044 R const& r) ->
0045 system::result<typename R::value_type>
0046 {
0047
0048
0049
0050 static_assert(
0051 is_rule<R>::value,
0052 "Rule requirements not met");
0053
0054 auto it = s.data();
0055 auto const end = it + s.size();
0056 auto rv = r.parse(it, end);
0057 if( rv &&
0058 it != end)
0059 return error::leftover;
0060 return rv;
0061 }
0062
0063 }
0064 }
0065 }
0066
0067 #endif