MCPcopy Create free account
hub / github.com/writefreely/writefreely / parsePrerelease

Function parsePrerelease

semver.go:158–184  ·  view source on GitHub ↗
(v string)

Source from the content-addressed store, hash-verified

156}
157
158func parsePrerelease(v string) (t, rest string, ok bool) {
159 // "A pre-release version MAY be denoted by appending a hyphen and
160 // a series of dot separated identifiers immediately following the patch version.
161 // Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-].
162 // Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes."
163 if v == "" || v[0] != '-' {
164 return
165 }
166 i := 1
167 start := 1
168 for i < len(v) && v[i] != '+' {
169 if !isIdentChar(v[i]) && v[i] != '.' {
170 return
171 }
172 if v[i] == '.' {
173 if start == i || isBadNum(v[start:i]) {
174 return
175 }
176 start = i + 1
177 }
178 i++
179 }
180 if start == i || isBadNum(v[start:i]) {
181 return
182 }
183 return v[:i], v[i:], true
184}
185
186func parseBuild(v string) (t, rest string, ok bool) {
187 if v == "" || v[0] != '+' {

Callers 1

semParseFunction · 0.85

Calls 2

isIdentCharFunction · 0.85
isBadNumFunction · 0.85

Tested by

no test coverage detected