(t *testing.T, raw string, start int)
| 310 | } |
| 311 | |
| 312 | func parseRustRegexStringAt(t *testing.T, raw string, start int) (string, int) { |
| 313 | t.Helper() |
| 314 | if strings.HasPrefix(raw[start:], "'''") { |
| 315 | end := strings.Index(raw[start+3:], "'''") |
| 316 | if end < 0 { |
| 317 | t.Fatalf("unterminated TOML literal string %q", raw[start:]) |
| 318 | } |
| 319 | return raw[start+3 : start+3+end], start + 3 + end + 3 |
| 320 | } |
| 321 | if raw[start] == '\'' { |
| 322 | end := strings.IndexByte(raw[start+1:], '\'') |
| 323 | if end < 0 { |
| 324 | t.Fatalf("unterminated TOML literal string %q", raw[start:]) |
| 325 | } |
| 326 | return raw[start+1 : start+1+end], start + 1 + end + 1 |
| 327 | } |
| 328 | if raw[start] == '"' { |
| 329 | for end := start + 1; end < len(raw); end++ { |
| 330 | if raw[end] == '\\' { |
| 331 | end++ |
| 332 | continue |
| 333 | } |
| 334 | if raw[end] == '"' { |
| 335 | s, err := strconv.Unquote(raw[start : end+1]) |
| 336 | if err != nil { |
| 337 | t.Fatalf("invalid TOML basic string %q: %v", raw[start:end+1], err) |
| 338 | } |
| 339 | return s, end + 1 |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | t.Fatalf("expected TOML string at %q", raw[start:]) |
| 344 | return "", 0 |
| 345 | } |
| 346 | |
| 347 | func parseRustRegexMatches(t *testing.T, raw string) []rustRegexMatch { |
| 348 | t.Helper() |
no outgoing calls
no test coverage detected