@@ -44,22 +44,22 @@ inline std::string to_string(token_type type) {
44
44
#endif // ADA_TESTING
45
45
46
46
template <url_pattern_regex::regex_concept regex_provider>
47
- void constructor_string_parser<regex_provider>::rewind() {
47
+ constexpr void constructor_string_parser<regex_provider>::rewind() {
48
48
// Set parser’s token index to parser’s component start.
49
49
token_index = component_start;
50
50
// Set parser’s token increment to 0.
51
51
token_increment = 0 ;
52
52
}
53
53
54
54
template <url_pattern_regex::regex_concept regex_provider>
55
- bool constructor_string_parser<regex_provider>::is_hash_prefix() {
55
+ constexpr bool constructor_string_parser<regex_provider>::is_hash_prefix() {
56
56
// Return the result of running is a non-special pattern char given parser,
57
57
// parser’s token index and "#".
58
58
return is_non_special_pattern_char (token_index, ' #' );
59
59
}
60
60
61
61
template <url_pattern_regex::regex_concept regex_provider>
62
- bool constructor_string_parser<regex_provider>::is_search_prefix() {
62
+ constexpr bool constructor_string_parser<regex_provider>::is_search_prefix() {
63
63
// If result of running is a non-special pattern char given parser, parser’s
64
64
// token index and "?" is true, then return true.
65
65
if (is_non_special_pattern_char (token_index, ' ?' )) {
@@ -92,7 +92,8 @@ bool constructor_string_parser<regex_provider>::is_search_prefix() {
92
92
}
93
93
94
94
template <url_pattern_regex::regex_concept regex_provider>
95
- bool constructor_string_parser<regex_provider>::is_non_special_pattern_char(
95
+ constexpr bool
96
+ constructor_string_parser<regex_provider>::is_non_special_pattern_char(
96
97
size_t index, uint32_t value) const {
97
98
// Let token be the result of running get a safe token given parser and index.
98
99
auto token = get_safe_token (index );
@@ -116,8 +117,8 @@ bool constructor_string_parser<regex_provider>::is_non_special_pattern_char(
116
117
}
117
118
118
119
template <url_pattern_regex::regex_concept regex_provider>
119
- const token* constructor_string_parser<regex_provider>::get_safe_token(
120
- size_t index) const {
120
+ constexpr const token*
121
+ constructor_string_parser<regex_provider>::get_safe_token( size_t index) const {
121
122
// If index is less than parser’s token list's size, then return parser’s
122
123
// token list[index].
123
124
if (index < token_list.size ()) [[likely]] {
@@ -136,22 +137,24 @@ const token* constructor_string_parser<regex_provider>::get_safe_token(
136
137
}
137
138
138
139
template <url_pattern_regex::regex_concept regex_provider>
139
- bool constructor_string_parser<regex_provider>::is_group_open() const {
140
+ constexpr bool constructor_string_parser<regex_provider>::is_group_open()
141
+ const {
140
142
// If parser’s token list[parser’s token index]'s type is "open", then return
141
143
// true.
142
144
return token_list[token_index].type == token_type::OPEN;
143
145
}
144
146
145
147
template <url_pattern_regex::regex_concept regex_provider>
146
- bool constructor_string_parser<regex_provider>::is_group_close() const {
148
+ constexpr bool constructor_string_parser<regex_provider>::is_group_close()
149
+ const {
147
150
// If parser’s token list[parser’s token index]'s type is "close", then return
148
151
// true.
149
152
return token_list[token_index].type == token_type::CLOSE;
150
153
}
151
154
152
155
template <url_pattern_regex::regex_concept regex_provider>
153
- bool constructor_string_parser<regex_provider>::next_is_authority_slashes()
154
- const {
156
+ constexpr bool
157
+ constructor_string_parser<regex_provider>::next_is_authority_slashes() const {
155
158
// If the result of running is a non-special pattern char given parser,
156
159
// parser’s token index + 1, and "/" is false, then return false.
157
160
if (!is_non_special_pattern_char (token_index + 1 , ' /' )) {
@@ -166,7 +169,8 @@ bool constructor_string_parser<regex_provider>::next_is_authority_slashes()
166
169
}
167
170
168
171
template <url_pattern_regex::regex_concept regex_provider>
169
- bool constructor_string_parser<regex_provider>::is_protocol_suffix() const {
172
+ constexpr bool constructor_string_parser<regex_provider>::is_protocol_suffix()
173
+ const {
170
174
// Return the result of running is a non-special pattern char given parser,
171
175
// parser’s token index, and ":".
172
176
return is_non_special_pattern_char (token_index, ' :' );
@@ -293,49 +297,54 @@ std::string constructor_string_parser<regex_provider>::make_component_string() {
293
297
}
294
298
295
299
template <url_pattern_regex::regex_concept regex_provider>
296
- bool constructor_string_parser<regex_provider>::is_an_identity_terminator()
297
- const {
300
+ constexpr bool
301
+ constructor_string_parser<regex_provider>::is_an_identity_terminator() const {
298
302
// Return the result of running is a non-special pattern char given parser,
299
303
// parser’s token index, and "@".
300
304
return is_non_special_pattern_char (token_index, ' @' );
301
305
}
302
306
303
307
template <url_pattern_regex::regex_concept regex_provider>
304
- bool constructor_string_parser<regex_provider>::is_pathname_start() const {
308
+ constexpr bool constructor_string_parser<regex_provider>::is_pathname_start()
309
+ const {
305
310
// Return the result of running is a non-special pattern char given parser,
306
311
// parser’s token index, and "/".
307
312
return is_non_special_pattern_char (token_index, ' /' );
308
313
}
309
314
310
315
template <url_pattern_regex::regex_concept regex_provider>
311
- bool constructor_string_parser<regex_provider>::is_password_prefix() const {
316
+ constexpr bool constructor_string_parser<regex_provider>::is_password_prefix()
317
+ const {
312
318
// Return the result of running is a non-special pattern char given parser,
313
319
// parser’s token index, and ":".
314
320
return is_non_special_pattern_char (token_index, ' :' );
315
321
}
316
322
317
323
template <url_pattern_regex::regex_concept regex_provider>
318
- bool constructor_string_parser<regex_provider>::is_an_ipv6_open() const {
324
+ constexpr bool constructor_string_parser<regex_provider>::is_an_ipv6_open()
325
+ const {
319
326
// Return the result of running is a non-special pattern char given parser,
320
327
// parser’s token index, and "[".
321
328
return is_non_special_pattern_char (token_index, ' [' );
322
329
}
323
330
324
331
template <url_pattern_regex::regex_concept regex_provider>
325
- bool constructor_string_parser<regex_provider>::is_an_ipv6_close() const {
332
+ constexpr bool constructor_string_parser<regex_provider>::is_an_ipv6_close()
333
+ const {
326
334
// Return the result of running is a non-special pattern char given parser,
327
335
// parser’s token index, and "]".
328
336
return is_non_special_pattern_char (token_index, ' ]' );
329
337
}
330
338
331
339
template <url_pattern_regex::regex_concept regex_provider>
332
- bool constructor_string_parser<regex_provider>::is_port_prefix() const {
340
+ constexpr bool constructor_string_parser<regex_provider>::is_port_prefix()
341
+ const {
333
342
// Return the result of running is a non-special pattern char given parser,
334
343
// parser’s token index, and ":".
335
344
return is_non_special_pattern_char (token_index, ' :' );
336
345
}
337
346
338
- inline void Tokenizer::get_next_code_point () {
347
+ constexpr void Tokenizer::get_next_code_point () {
339
348
ada_log (" Tokenizer::get_next_code_point called with index=" , next_index);
340
349
ADA_ASSERT_TRUE (next_index < input.size ());
341
350
// this assumes that we have a valid, non-truncated UTF-8 stream.
@@ -382,7 +391,7 @@ inline void Tokenizer::get_next_code_point() {
382
391
next_index += number_bytes;
383
392
}
384
393
385
- inline void Tokenizer::seek_and_get_next_code_point (size_t new_index) {
394
+ constexpr void Tokenizer::seek_and_get_next_code_point (size_t new_index) {
386
395
ada_log (" Tokenizer::seek_and_get_next_code_point called with new_index=" ,
387
396
new_index);
388
397
// Set tokenizer’s next index to index.
0 commit comments