LibURL/Pattern: Implement generating a component match result

This commit is contained in:
Shannon Booth 2025-03-18 19:45:08 +13:00 committed by Tim Flynn
commit 2a44420e52
Notes: github-actions[bot] 2025-04-06 12:27:13 +00:00
3 changed files with 55 additions and 16 deletions

View file

@ -15,6 +15,16 @@ namespace URL::Pattern {
// https://urlpattern.spec.whatwg.org/#component
struct Component {
static PatternErrorOr<Component> compile(Utf8View const& input, PatternParser::EncodingCallback, Options const&);
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatterncomponentresult
struct Result {
String input;
OrderedHashMap<String, Variant<String, Empty>> groups;
};
Result create_match_result(String const& input, regex::RegexResult const& exec_result) const;
// https://urlpattern.spec.whatwg.org/#component-pattern-string
// pattern string, a well formed pattern string
String pattern_string;
@ -30,8 +40,6 @@ struct Component {
// https://urlpattern.spec.whatwg.org/#component-has-regexp-groups
// has regexp groups, a boolean
bool has_regexp_groups {};
static PatternErrorOr<Component> compile(Utf8View const& input, PatternParser::EncodingCallback, Options const&);
};
bool protocol_component_matches_a_special_scheme(Component const& protocol_component);