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

Function parseNumeric

lib/validator/component_name.cpp:167–180  ·  view source on GitHub ↗

Parses a non-negative integer without leading zeros. Returns the end position, or npos on failure.

Source from the content-addressed store, hash-verified

165// Parses a non-negative integer without leading zeros.
166// Returns the end position, or npos on failure.
167size_t parseNumeric(std::string_view V) {
168 if (V.empty())
169 return std::string_view::npos;
170 if (V[0] == '0') {
171 return 1;
172 }
173 if (V[0] >= '1' && V[0] <= '9') {
174 size_t Pos = 1;
175 while (Pos < V.size() && isdigit(V[Pos]))
176 Pos++;
177 return Pos;
178 }
179 return std::string_view::npos;
180}
181
182// canonversion ::= [1-9] [0-9]*
183// | '0.' [1-9] [0-9]*

Callers 2

isCanonVersionFunction · 0.85
isValidSemverFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected