MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / parsePkgPath

Function parsePkgPath

lib/validator/component_name.cpp:314–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312};
313
314Expect<PkgPath> parsePkgPath(std::string_view &Next,
315 std::string_view StopChars) {
316 std::string_view Namespace;
317 if (!readUntil(Next, ':', Namespace))
318 return reportError("expected ':' in namespace"sv);
319 if (!isLowercaseKebabString(Namespace))
320 return reportError("invalid namespace"sv);
321
322 size_t PkgEnd = Next.find_first_of(StopChars);
323 if (PkgEnd == Next.npos)
324 return reportError("unterminated package name"sv);
325 std::string_view Package = Next.substr(0, PkgEnd);
326 Next.remove_prefix(PkgEnd);
327 if (!isLowercaseKebabString(Package))
328 return reportError("invalid package name"sv);
329
330 return PkgPath{Namespace, Package};
331}
332
333} // anonymous namespace
334

Callers

nothing calls this directly

Calls 4

readUntilFunction · 0.85
reportErrorFunction · 0.85
isLowercaseKebabStringFunction · 0.85
substrMethod · 0.80

Tested by

no test coverage detected