findNextParamPosition search for the next possible parameter start position
(pattern string)
| 323 | |
| 324 | // findNextParamPosition search for the next possible parameter start position |
| 325 | func findNextParamPosition(pattern string) int { |
| 326 | // Find the first parameter position |
| 327 | next := -1 |
| 328 | for i := range pattern { |
| 329 | if parameterStartChars[pattern[i]] && (i == 0 || pattern[i-1] != escapeChar) { |
| 330 | next = i |
| 331 | break |
| 332 | } |
| 333 | } |
| 334 | if next > 0 && pattern[next] != wildcardParam { |
| 335 | // checking the found parameterStartChar is a cluster |
| 336 | for i := next + 1; i < len(pattern); i++ { |
| 337 | if !parameterStartChars[pattern[i]] { |
| 338 | return i - 1 |
| 339 | } |
| 340 | } |
| 341 | return len(pattern) - 1 |
| 342 | } |
| 343 | return next |
| 344 | } |
| 345 | |
| 346 | // analyseConstantPart find the end of the constant part and create the route segment |
| 347 | func (*routeParser) analyseConstantPart(pattern string, nextParamPosition int) (int, *routeSegment) { |