| 5590 | // @see https://urlpattern.spec.whatwg.org/#constructor-string-parser |
| 5591 | template <url_pattern_regex::regex_concept regex_provider> |
| 5592 | struct constructor_string_parser { |
| 5593 | explicit constructor_string_parser(std::string_view new_input, |
| 5594 | std::vector<token>&& new_token_list) |
| 5595 | : input(new_input), token_list(std::move(new_token_list)) {} |
| 5596 | // @see https://urlpattern.spec.whatwg.org/#parse-a-constructor-string |
| 5597 | static tl::expected<url_pattern_init, errors> parse(std::string_view input); |
| 5598 | |
| 5599 | // @see https://urlpattern.spec.whatwg.org/#constructor-string-parser-state |
| 5600 | enum class State { |
| 5601 | INIT, |
| 5602 | PROTOCOL, |
| 5603 | AUTHORITY, |
| 5604 | USERNAME, |
| 5605 | PASSWORD, |
| 5606 | HOSTNAME, |
| 5607 | PORT, |
| 5608 | PATHNAME, |
| 5609 | SEARCH, |
| 5610 | HASH, |
| 5611 | DONE, |
| 5612 | }; |
| 5613 | |
| 5614 | // @see |
| 5615 | // https://urlpattern.spec.whatwg.org/#compute-protocol-matches-a-special-scheme-flag |
| 5616 | std::optional<errors> compute_protocol_matches_special_scheme_flag(); |
| 5617 | |
| 5618 | private: |
| 5619 | // @see https://urlpattern.spec.whatwg.org/#rewind |
| 5620 | constexpr void rewind(); |
| 5621 | |
| 5622 | // @see https://urlpattern.spec.whatwg.org/#is-a-hash-prefix |
| 5623 | constexpr bool is_hash_prefix(); |
| 5624 | |
| 5625 | // @see https://urlpattern.spec.whatwg.org/#is-a-search-prefix |
| 5626 | constexpr bool is_search_prefix(); |
| 5627 | |
| 5628 | // @see https://urlpattern.spec.whatwg.org/#change-state |
| 5629 | void change_state(State state, size_t skip); |
| 5630 | |
| 5631 | // @see https://urlpattern.spec.whatwg.org/#is-a-group-open |
| 5632 | constexpr bool is_group_open() const; |
| 5633 | |
| 5634 | // @see https://urlpattern.spec.whatwg.org/#is-a-group-close |
| 5635 | constexpr bool is_group_close() const; |
| 5636 | |
| 5637 | // @see https://urlpattern.spec.whatwg.org/#is-a-protocol-suffix |
| 5638 | constexpr bool is_protocol_suffix() const; |
| 5639 | |
| 5640 | // @see https://urlpattern.spec.whatwg.org/#next-is-authority-slashes |
| 5641 | constexpr bool next_is_authority_slashes() const; |
| 5642 | |
| 5643 | // @see https://urlpattern.spec.whatwg.org/#is-an-identity-terminator |
| 5644 | constexpr bool is_an_identity_terminator() const; |
| 5645 | |
| 5646 | // @see https://urlpattern.spec.whatwg.org/#is-a-pathname-start |
| 5647 | constexpr bool is_pathname_start() const; |
| 5648 | |
| 5649 | // @see https://urlpattern.spec.whatwg.org/#is-a-password-prefix |