| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) | ||
| 3 | // | ||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
| 6 | // | ||
| 7 | // Official repository: https://github.com/boostorg/url | ||
| 8 | // | ||
| 9 | |||
| 10 | #ifndef BOOST_URL_GRAMMAR_IMPL_PARSE_HPP | ||
| 11 | #define BOOST_URL_GRAMMAR_IMPL_PARSE_HPP | ||
| 12 | |||
| 13 | #include <boost/url/grammar/error.hpp> | ||
| 14 | #include <boost/url/grammar/type_traits.hpp> | ||
| 15 | |||
| 16 | namespace boost { | ||
| 17 | namespace urls { | ||
| 18 | namespace grammar { | ||
| 19 | |||
| 20 | template<class R> | ||
| 21 | BOOST_URL_NO_INLINE | ||
| 22 | auto | ||
| 23 | 72223 | parse( | |
| 24 | char const*& it, | ||
| 25 | char const* end, | ||
| 26 | R const& r) -> | ||
| 27 | system::result<typename R::value_type> | ||
| 28 | { | ||
| 29 | // If this goes off, it means the rule | ||
| 30 | // passed in did not meet the requirements. | ||
| 31 | // Please check the documentation. | ||
| 32 | static_assert( | ||
| 33 | is_rule<R>::value, | ||
| 34 | "Rule requirements not met"); | ||
| 35 | |||
| 36 | 72223 | return r.parse(it, end); | |
| 37 | } | ||
| 38 | |||
| 39 | template<class R> | ||
| 40 | BOOST_URL_NO_INLINE | ||
| 41 | auto | ||
| 42 | 6646 | parse( | |
| 43 | core::string_view s, | ||
| 44 | R const& r) -> | ||
| 45 | system::result<typename R::value_type> | ||
| 46 | { | ||
| 47 | // If this goes off, it means the rule | ||
| 48 | // passed in did not meet the requirements. | ||
| 49 | // Please check the documentation. | ||
| 50 | static_assert( | ||
| 51 | is_rule<R>::value, | ||
| 52 | "Rule requirements not met"); | ||
| 53 | |||
| 54 | 6646 | auto it = s.data(); | |
| 55 | 6646 | auto const end = it + s.size(); | |
| 56 |
1/2✓ Branch 1 taken 46 times.
✗ Branch 2 not taken.
|
6646 | auto rv = r.parse(it, end); |
| 57 |
4/4✓ Branch 1 taken 1278 times.
✓ Branch 2 taken 703 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 1933 times.
|
12465 | if( rv && |
| 58 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 1230 times.
|
5819 | it != end) |
| 59 | 263 | return error::leftover; | |
| 60 | 6383 | return rv; | |
| 61 | 1254 | } | |
| 62 | |||
| 63 | } // grammar | ||
| 64 | } // urls | ||
| 65 | } // boost | ||
| 66 | |||
| 67 | #endif | ||
| 68 |