5#ifndef ADA_URL_PATTERN_HELPERS_H
6#define ADA_URL_PATTERN_HELPERS_H
8#include "ada/expected.h"
17enum class errors : uint8_t;
63template <url_pattern_encoding_callback F>
67 std::string_view segment_wildcard_regexp_)
90 token* regexp_or_wildcard_token,
91 std::string_view suyffix,
97 std::vector<url_pattern_part>
parts{};
107 : input(new_input), policy(new_policy) {}
118 size_t value_length);
122 size_t value_position);
141 std::vector<token> token_list{};
145 size_t next_index = 0;
147 char32_t code_point{};
151template <url_pattern_regex::regex_concept regex_prov
ider>
154 std::vector<token>&& new_token_list)
155 : input(new_input), token_list(std::move(new_token_list)) {}
167 static tl::expected<url_pattern_init, errors>
parse(std::string_view input);
223 bool is_non_special_pattern_char(
size_t index, std::string_view value);
226 const token* get_safe_token(
size_t index);
229 std::string make_component_string();
234 std::vector<token> token_list;
239 size_t component_start = 0;
241 size_t token_index = 0;
243 size_t token_increment = 1;
245 size_t group_depth = 0;
248 size_t hostname_ipv6_bracket_depth = 0;
251 bool protocol_matches_a_special_scheme_flag =
false;
270 std::string_view input);
277 std::string_view input, std::string_view protocol);
284 std::string_view input);
293tl::expected<std::vector<token>,
errors>
tokenize(std::string_view input,
298 std::string_view type);
308 std::string_view type)
noexcept;
311template <url_pattern_encoding_callback F>
313 std::string_view input, url_pattern_compile_component_options& options,
314 F& encoding_callback);
318 std::vector<url_pattern_part>& part_list,
319 url_pattern_compile_component_options& options);
323std::tuple<std::string, std::vector<std::string>>
325 const std::vector<url_pattern_part>& part_list,
326 url_pattern_compile_component_options options);
333template <url_pattern_regex::regex_concept regex_prov
ider>
342 url_pattern_compile_component_options options);
void add_token_with_default_length(token_type type, size_t next_position, size_t value_position)
void add_token(token_type type, size_t next_position, size_t value_position, size_t value_length)
void seek_and_get_next_code_point(size_t index)
void get_next_code_point()
std::optional< errors > process_tokenizing_error(size_t next_position, size_t value_position) ada_warn_unused
void add_token_with_defaults(token_type type)
Tokenizer(std::string_view new_input, token_policy new_policy)
friend tl::expected< std::vector< token >, errors > tokenize(std::string_view input, token_policy policy)
token(token_type _type, size_t _index, std::string &&_value)
std::optional< errors > add_part(std::string_view prefix, token *name_token, token *regexp_or_wildcard_token, std::string_view suyffix, token *modifier_token) ada_warn_unused
bool consume_required_token(token_type type)
std::vector< token > tokens
token * try_consume_token(token_type type)
std::string pending_fixed_value
std::vector< url_pattern_part > parts
bool can_continue() const
std::string consume_text()
token * try_consume_regexp_or_wildcard_token(const token *name_token)
url_pattern_parser(F &encoding_callback_, std::string_view segment_wildcard_regexp_)
std::optional< errors > maybe_add_part_from_the_pending_fixed_value() ada_warn_unused
token * try_consume_modifier_token()
std::string segment_wildcard_regexp
Common definitions for cross-platform compiler support.
tl::expected< std::string, errors > canonicalize_opaque_pathname(std::string_view input)
tl::expected< std::string, errors > canonicalize_pathname(std::string_view input)
std::string escape_pattern_string(std::string_view input)
constexpr bool is_absolute_pathname(std::string_view input, std::string_view type) noexcept
std::string to_string(token_type type)
std::string convert_modifier_to_string(url_pattern_part_modifier modifier)
bool protocol_component_matches_special_scheme(url_pattern_component< regex_provider > &component)
tl::expected< std::string, errors > canonicalize_password(std::string_view input)
tl::expected< std::vector< token >, errors > tokenize(std::string_view input, token_policy policy)
std::string process_base_url_string(std::string_view input, std::string_view type)
std::string generate_segment_wildcard_regexp(url_pattern_compile_component_options options)
tl::expected< std::string, errors > canonicalize_protocol(std::string_view input)
tl::expected< std::vector< url_pattern_part >, errors > parse_pattern_string(std::string_view input, url_pattern_compile_component_options &options, F &encoding_callback)
tl::expected< std::string, errors > canonicalize_hostname(std::string_view input)
std::string generate_pattern_string(std::vector< url_pattern_part > &part_list, url_pattern_compile_component_options &options)
tl::expected< std::string, errors > canonicalize_port_with_protocol(std::string_view input, std::string_view protocol)
std::string escape_regexp_string(std::string_view input)
tl::expected< std::string, errors > canonicalize_hash(std::string_view input)
tl::expected< std::string, errors > canonicalize_port(std::string_view input)
bool is_ipv6_address(std::string_view input) noexcept
tl::expected< std::string, errors > canonicalize_search(std::string_view input)
tl::expected< std::string, errors > canonicalize_ipv6_hostname(std::string_view input)
tl::expected< std::string, errors > canonicalize_username(std::string_view input)
std::tuple< std::string, std::vector< std::string > > generate_regular_expression_and_name_list(const std::vector< url_pattern_part > &part_list, url_pattern_compile_component_options options)
url_pattern_part_modifier
tl::expected< result_type, ada::errors > result
std::optional< errors > compute_protocol_matches_special_scheme_flag()
constructor_string_parser(std::string_view new_input, std::vector< token > &&new_token_list)
bool is_protocol_suffix()
bool is_an_identity_terminator()
static tl::expected< url_pattern_init, errors > parse(std::string_view input)
bool is_group_open() const
void change_state(State state, size_t skip)
bool is_group_close() const
bool is_password_prefix()
bool next_is_authority_slashes()
Declaration for the URLPattern implementation.