(L *LState, str string, repl string, matches []*pm.MatchData)
| 219 | } |
| 220 | |
| 221 | func strGsubStr(L *LState, str string, repl string, matches []*pm.MatchData) string { |
| 222 | infoList := make([]replaceInfo, 0, len(matches)) |
| 223 | for _, match := range matches { |
| 224 | start, end := match.Capture(0), match.Capture(1) |
| 225 | sc := newFlagScanner('%', "", "", repl) |
| 226 | for c, eos := sc.Next(); !eos; c, eos = sc.Next() { |
| 227 | if !sc.ChangeFlag { |
| 228 | if sc.HasFlag { |
| 229 | if c >= '0' && c <= '9' { |
| 230 | sc.AppendString(capturedString(L, match, str, 2*(int(c)-48))) |
| 231 | } else { |
| 232 | sc.AppendChar('%') |
| 233 | sc.AppendChar(c) |
| 234 | } |
| 235 | sc.HasFlag = false |
| 236 | } else { |
| 237 | sc.AppendChar(c) |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | infoList = append(infoList, replaceInfo{[]int{start, end}, sc.String()}) |
| 242 | } |
| 243 | |
| 244 | return strGsubDoReplace(str, infoList) |
| 245 | } |
| 246 | |
| 247 | func strGsubTable(L *LState, str string, repl *LTable, matches []*pm.MatchData) string { |
| 248 | infoList := make([]replaceInfo, 0, len(matches)) |
no test coverage detected
searching dependent graphs…