1  
//
1  
//
2  
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
2  
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3  
// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com)
3  
// Copyright (c) 2023 Alan de Freitas (alandefreitas@gmail.com)
4  
//
4  
//
5  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
6  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  
//
7  
//
8  
// Official repository: https://github.com/boostorg/url
8  
// Official repository: https://github.com/boostorg/url
9  
//
9  
//
10  

10  

11  
#ifndef BOOST_URL_GRAMMAR_IMPL_DELIM_RULE_HPP
11  
#ifndef BOOST_URL_GRAMMAR_IMPL_DELIM_RULE_HPP
12  
#define BOOST_URL_GRAMMAR_IMPL_DELIM_RULE_HPP
12  
#define BOOST_URL_GRAMMAR_IMPL_DELIM_RULE_HPP
13  

13  

14  
#include <boost/url/detail/config.hpp>
14  
#include <boost/url/detail/config.hpp>
15  

15  

16  
namespace boost {
16  
namespace boost {
17  
namespace urls {
17  
namespace urls {
18  
namespace grammar {
18  
namespace grammar {
19  

19  

20  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
20  
BOOST_URL_CXX20_CONSTEXPR_OR_INLINE
21  
auto
21  
auto
22  
implementation_defined::ch_delim_rule::
22  
implementation_defined::ch_delim_rule::
23  
parse(
23  
parse(
24  
    char const*& it,
24  
    char const*& it,
25  
    char const* end) const noexcept ->
25  
    char const* end) const noexcept ->
26  
        system::result<value_type>
26  
        system::result<value_type>
27  
{
27  
{
28  
    if(it == end)
28  
    if(it == end)
29  
    {
29  
    {
30  
        // end
30  
        // end
31  
        BOOST_URL_CONSTEXPR_RETURN_EC(
31  
        BOOST_URL_CONSTEXPR_RETURN_EC(
32  
            error::need_more);
32  
            error::need_more);
33  
    }
33  
    }
34  
    if(*it != ch_)
34  
    if(*it != ch_)
35  
    {
35  
    {
36  
        // wrong character
36  
        // wrong character
37  
        BOOST_URL_CONSTEXPR_RETURN_EC(
37  
        BOOST_URL_CONSTEXPR_RETURN_EC(
38  
            error::mismatch);
38  
            error::mismatch);
39  
    }
39  
    }
40  
    return core::string_view{
40  
    return core::string_view{
41  
        it++, 1 };
41  
        it++, 1 };
42  
}
42  
}
43  

43  

44  
} // grammar
44  
} // grammar
45  
} // urls
45  
} // urls
46  
} // boost
46  
} // boost
47  

47  

48  
#endif
48  
#endif