MCPcopy Create free account
hub / github.com/NativeScript/android / parse

Method parse

test-app/runtime/src/main/cpp/ada/ada.h:10254–10502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10252
10253template <url_pattern_regex::regex_concept regex_provider>
10254tl::expected<url_pattern_init, errors>
10255constructor_string_parser<regex_provider>::parse(std::string_view input) {
10256 ada_log("constructor_string_parser::parse input=", input);
10257 // Let parser be a new constructor string parser whose input is input and
10258 // token list is the result of running tokenize given input and "lenient".
10259 auto token_list = tokenize(input, token_policy::lenient);
10260 if (!token_list) {
10261 return tl::unexpected(token_list.error());
10262 }
10263 auto parser = constructor_string_parser(input, std::move(*token_list));
10264
10265 // While parser's token index is less than parser's token list size:
10266 while (parser.token_index < parser.token_list.size()) {
10267 // Set parser's token increment to 1.
10268 parser.token_increment = 1;
10269
10270 // If parser's token list[parser's token index]'s type is "end" then:
10271 if (parser.token_list[parser.token_index].type == token_type::END) {
10272 // If parser's state is "init":
10273 if (parser.state == State::INIT) {
10274 // Run rewind given parser.
10275 parser.rewind();
10276 // If the result of running is a hash prefix given parser is true, then
10277 // run change state given parser, "hash" and 1.
10278 if (parser.is_hash_prefix()) {
10279 parser.change_state(State::HASH, 1);
10280 } else if (parser.is_search_prefix()) {
10281 // Otherwise if the result of running is a search prefix given parser
10282 // is true: Run change state given parser, "search" and 1.
10283 parser.change_state(State::SEARCH, 1);
10284 } else {
10285 // Run change state given parser, "pathname" and 0.
10286 parser.change_state(State::PATHNAME, 0);
10287 }
10288 // Increment parser's token index by parser's token increment.
10289 parser.token_index += parser.token_increment;
10290 // Continue.
10291 continue;
10292 }
10293
10294 if (parser.state == State::AUTHORITY) {
10295 // If parser's state is "authority":
10296 // Run rewind and set state given parser, and "hostname".
10297 parser.rewind();
10298 parser.change_state(State::HOSTNAME, 0);
10299 // Increment parser's token index by parser's token increment.
10300 parser.token_index += parser.token_increment;
10301 // Continue.
10302 continue;
10303 }
10304
10305 // Run change state given parser, "done" and 0.
10306 parser.change_state(State::DONE, 0);
10307 // Break.
10308 break;
10309 }
10310
10311 // If the result of running is a group open given parser is true:

Callers 7

validateNpmTagFunction · 0.45
getNpmTagFunction · 0.45
setPreReleaseFunction · 0.45
gitHubResponseFunction · 0.45
tests.jsFile · 0.45

Calls 15

tokenizeFunction · 0.85
unexpectedClass · 0.85
unreachableFunction · 0.85
rewindMethod · 0.80
is_hash_prefixMethod · 0.80
change_stateMethod · 0.80
is_search_prefixMethod · 0.80
is_group_openMethod · 0.80
is_group_closeMethod · 0.80
is_protocol_suffixMethod · 0.80

Tested by

no test coverage detected