12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #ifndef BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
- #define BOOST_URL_GRAMMAR_IMPL_PARSE_HPP
- #include <boost/url/grammar/error.hpp>
- #include <boost/url/grammar/type_traits.hpp>
- namespace boost {
- namespace urls {
- namespace grammar {
- template<class R>
- BOOST_URL_NO_INLINE
- auto
- parse(
- char const*& it,
- char const* end,
- R const& r) ->
- system::result<typename R::value_type>
- {
-
-
-
- static_assert(
- is_rule<R>::value,
- "Rule requirements not met");
- return r.parse(it, end);
- }
- template<class R>
- BOOST_URL_NO_INLINE
- auto
- parse(
- core::string_view s,
- R const& r) ->
- system::result<typename R::value_type>
- {
-
-
-
- static_assert(
- is_rule<R>::value,
- "Rule requirements not met");
- auto it = s.data();
- auto const end = it + s.size();
- auto rv = r.parse(it, end);
- if( rv &&
- it != end)
- return error::leftover;
- return rv;
- }
- }
- }
- }
- #endif
|