Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/ada/url_pattern_helpers-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ std::string constructor_string_parser<regex_provider>::make_component_string() {
const auto component_start_input_index = component_start_token->index;
// Return the code point substring from component start input index to end
// index within parser's input.
return input.substr(component_start_input_index,
end_index - component_start_input_index);
return std::string(input.substr(component_start_input_index,
end_index - component_start_input_index));
}

template <url_pattern_regex::regex_concept regex_provider>
Expand Down
10 changes: 5 additions & 5 deletions include/ada/url_pattern_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ enum class token_policy {
// @see https://urlpattern.spec.whatwg.org/#tokens
class token {
public:
token(token_type _type, size_t _index, std::string&& _value)
: type(_type), index(_index), value(std::move(_value)) {}
token(token_type _type, size_t _index, std::string_view _value)
: type(_type), index(_index), value(_value) {}

// A token has an associated type, a string, initially "invalid-char".
token_type type = token_type::INVALID_CHAR;
Expand All @@ -59,7 +59,7 @@ class token {

// A token has an associated value, a string, initially the empty string. It
// contains the code points from the pattern string represented by the token.
std::string value{};
std::string_view value{};
};

// @see https://urlpattern.spec.whatwg.org/#pattern-parser
Expand Down Expand Up @@ -137,7 +137,7 @@ class Tokenizer {

private:
// has an associated input, a pattern string, initially the empty string.
std::string input;
std::string_view input;
// has an associated policy, a tokenize policy, initially "strict".
token_policy policy;
// has an associated token list, a token list, initially an empty list.
Expand Down Expand Up @@ -231,7 +231,7 @@ struct constructor_string_parser {
// @see https://urlpattern.spec.whatwg.org/#make-a-component-string
std::string make_component_string();
// has an associated input, a string, which must be set upon creation.
std::string input;
std::string_view input;
// has an associated token list, a token list, which must be set upon
// creation.
std::vector<token> token_list;
Expand Down
Loading