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

Function isCanonVersion

lib/validator/component_name.cpp:185–200  ·  view source on GitHub ↗

canonversion ::= [1-9] [0-9] | '0.' [1-9] [0-9] | '0.0.' [1-9] [0-9]

Source from the content-addressed store, hash-verified

183// | '0.' [1-9] [0-9]*
184// | '0.0.' [1-9] [0-9]*
185bool isCanonVersion(std::string_view V) {
186 if (V.empty())
187 return false;
188
189 // canonversion ::= [1-9] [0-9]* | '0.' [1-9] [0-9]* | '0.0.' [1-9] [0-9]*
190 for (int I = 0; I < 3; I++) {
191 if (V[0] >= '1' && V[0] <= '9') {
192 size_t End = parseNumeric(V);
193 return End == V.size();
194 }
195 if (!tryRead("0."sv, V) || V.empty())
196 return false;
197 }
198
199 return false;
200}
201
202// Validates a dot-separated pre-release or build identifier segment.
203// Each identifier is [0-9A-Za-z-]+.

Callers 1

isVersionFunction · 0.85

Calls 4

parseNumericFunction · 0.85
tryReadFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected