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) 2022 Alan de Freitas (alandefreitas@gmail.com)
3  
//
4  
//
4  
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5  
// 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  
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6  
//
7  
//
7  
// Official repository: https://github.com/boostorg/url
8  
// Official repository: https://github.com/boostorg/url
8  
//
9  
//
9  

10  

10  
#ifndef BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
11  
#ifndef BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
11  
#define BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
12  
#define BOOST_URL_GRAMMAR_IMPL_NOT_EMPTY_RULE_HPP
12  

13  

13  
#include <boost/url/grammar/error.hpp>
14  
#include <boost/url/grammar/error.hpp>
14  
#include <boost/url/grammar/parse.hpp>
15  
#include <boost/url/grammar/parse.hpp>
15  

16  

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

20  

20  
namespace implementation_defined {
21  
namespace implementation_defined {
21  
template<class R>
22  
template<class R>
 
23 +
BOOST_URL_CXX14_CONSTEXPR
22  
auto
24  
auto
23  
not_empty_rule_t<R>::
25  
not_empty_rule_t<R>::
24  
parse(
26  
parse(
25  
    char const*& it,
27  
    char const*& it,
26  
    char const* end) const ->
28  
    char const* end) const ->
27  
        system::result<value_type>
29  
        system::result<value_type>
28  
{
30  
{
29  
    if(it == end)
31  
    if(it == end)
30  
    {
32  
    {
31  
        // empty
33  
        // empty
32 -
        BOOST_URL_RETURN_EC(
34 +
        BOOST_URL_CONSTEXPR_RETURN_EC(
33  
            error::mismatch);
35  
            error::mismatch);
34  
    }
36  
    }
35  
    auto const it0 = it;
37  
    auto const it0 = it;
36  
    auto rv = r_.parse(it, end);
38  
    auto rv = r_.parse(it, end);
37  
    if(  !rv )
39  
    if(  !rv )
38  
    {
40  
    {
39  
        // error
41  
        // error
40  
        return rv;
42  
        return rv;
41  
    }
43  
    }
42  
    if(it == it0)
44  
    if(it == it0)
43  
    {
45  
    {
44  
        // empty
46  
        // empty
45 -
        BOOST_URL_RETURN_EC(
47 +
        BOOST_URL_CONSTEXPR_RETURN_EC(
46  
            error::mismatch);
48  
            error::mismatch);
47  
    }
49  
    }
48  
    // value
50  
    // value
49  
    return rv;
51  
    return rv;
50  
}
52  
}
51  
}
53  
}
52  

54  

53  
} // grammar
55  
} // grammar
54  
} // urls
56  
} // urls
55  
} // boost
57  
} // boost
56  

58  

57  
#endif
59  
#endif