Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:26

0001 //
0002 // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_DETAIL_REPLACEMENT_FIELD_RULE_HPP
0011 #define BOOST_URL_DETAIL_REPLACEMENT_FIELD_RULE_HPP
0012 
0013 #include <boost/url/error.hpp>
0014 #include <boost/core/detail/string_view.hpp>
0015 #include <boost/url/grammar/variant_rule.hpp>
0016 #include <boost/url/grammar/unsigned_rule.hpp>
0017 
0018 namespace boost {
0019 namespace urls {
0020 namespace detail {
0021 
0022 // replacement_field ::=  "{" [arg_id] [":" format_spec "}"
0023 struct replacement_field_rule_t
0024 {
0025     using value_type = core::string_view;
0026 
0027     BOOST_URL_DECL
0028     system::result<value_type>
0029     parse(
0030         char const*& it,
0031         char const* end) const noexcept;
0032 };
0033 
0034 constexpr replacement_field_rule_t replacement_field_rule{};
0035 
0036 // identifier        ::=  id_start id_continue*
0037 // id_start          ::=  "a"..."z" | "A"..."Z" | "_"
0038 // id_continue       ::=  id_start | digit
0039 struct identifier_rule_t
0040 {
0041     using value_type = core::string_view;
0042 
0043     BOOST_URL_DECL
0044     system::result<value_type>
0045     parse(
0046         char const*& it,
0047         char const* end) const noexcept;
0048 };
0049 
0050 constexpr identifier_rule_t identifier_rule{};
0051 
0052 // arg_id            ::=  integer | identifier
0053 // integer           ::=  digit+
0054 // digit             ::=  "0"..."9"
0055 static constexpr auto arg_id_rule =
0056     grammar::variant_rule(
0057         identifier_rule,
0058         grammar::unsigned_rule<std::size_t>{});
0059 
0060 struct format_spec_rule_t
0061 {
0062     using value_type = core::string_view;
0063 
0064     system::result<value_type>
0065     parse(
0066         char const*& it,
0067         char const* end) const noexcept;
0068 };
0069 
0070 constexpr format_spec_rule_t format_spec_rule{};
0071 
0072 } // detail
0073 } // urls
0074 } // boost
0075 
0076 #endif