(L *LState)
| 299 | } |
| 300 | |
| 301 | func strGmatchIter(L *LState) int { |
| 302 | md := L.CheckUserData(1).Value.(*strMatchData) |
| 303 | str := md.str |
| 304 | matches := md.matches |
| 305 | idx := md.pos |
| 306 | md.pos += 1 |
| 307 | if idx == len(matches) { |
| 308 | return 0 |
| 309 | } |
| 310 | L.Push(L.Get(1)) |
| 311 | match := matches[idx] |
| 312 | if match.CaptureLength() == 2 { |
| 313 | L.Push(LString(str[match.Capture(0):match.Capture(1)])) |
| 314 | return 1 |
| 315 | } |
| 316 | |
| 317 | for i := 2; i < match.CaptureLength(); i += 2 { |
| 318 | if match.IsPosCapture(i) { |
| 319 | L.Push(LNumber(match.Capture(i))) |
| 320 | } else { |
| 321 | L.Push(LString(str[match.Capture(i):match.Capture(i+1)])) |
| 322 | } |
| 323 | } |
| 324 | return match.CaptureLength()/2 - 1 |
| 325 | } |
| 326 | |
| 327 | func strGmatch(L *LState) int { |
| 328 | str := L.CheckString(1) |
nothing calls this directly
no test coverage detected
searching dependent graphs…