(v string)
| 156 | } |
| 157 | |
| 158 | func 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 | |
| 186 | func parseBuild(v string) (t, rest string, ok bool) { |
| 187 | if v == "" || v[0] != '+' { |
no test coverage detected