mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibURL/Pattern: Add a representation of a URL Pattern 'component'
A URL pattern consists of components such as the 'port', 'password' 'hostname', etc. A component is compiled from the input to the URLPattern constructor and is what is used for matching against URLs to produce a match result. This is also where the regex dependency is introduced into LibURL to support the URLPattern implementation.
This commit is contained in:
parent
93253e993b
commit
5521836929
Notes:
github-actions[bot]
2025-02-18 00:11:46 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/55218369298 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3547
2 changed files with 35 additions and 1 deletions
|
@ -10,5 +10,5 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_lib(LibURL url)
|
||||
target_link_libraries(LibURL PRIVATE LibUnicode LibTextCodec)
|
||||
target_link_libraries(LibURL PRIVATE LibUnicode LibTextCodec LibRegex)
|
||||
target_compile_definitions(LibURL PRIVATE ENABLE_PUBLIC_SUFFIX=$<BOOL:${ENABLE_PUBLIC_SUFFIX_DOWNLOAD}>)
|
||||
|
|
34
Libraries/LibURL/Pattern/Component.h
Normal file
34
Libraries/LibURL/Pattern/Component.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibRegex/Regex.h>
|
||||
|
||||
namespace URL::Pattern {
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#component
|
||||
struct Component {
|
||||
// https://urlpattern.spec.whatwg.org/#component-pattern-string
|
||||
// pattern string, a well formed pattern string
|
||||
String pattern_string;
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#component-regular-expression
|
||||
// regular expression, a RegExp
|
||||
OwnPtr<Regex<ECMA262>> regular_expression;
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#component-group-name-list
|
||||
// group name list, a list of strings
|
||||
Vector<String> group_name_list;
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#component-has-regexp-groups
|
||||
// has regexp groups, a boolean
|
||||
bool has_regexp_groups {};
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue