| 767 | } |
| 768 | |
| 769 | static bool cv2_fields(cv2_context_t *ctx, cv2_span_t line, cv2_span_t fields[4]) { |
| 770 | size_t start = 0; |
| 771 | int field = 0; |
| 772 | for (size_t i = 0; i < line.length; i++) { |
| 773 | if (!cv2_step(ctx)) |
| 774 | return false; |
| 775 | if (line.data[i] != '\t') |
| 776 | continue; |
| 777 | if (field == 3) |
| 778 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 779 | fields[field++] = (cv2_span_t){line.data + start, i - start}; |
| 780 | start = i + 1; |
| 781 | } |
| 782 | if (field != 3) |
| 783 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 784 | fields[3] = (cv2_span_t){line.data + start, line.length - start}; |
| 785 | return true; |
| 786 | } |
| 787 | |
| 788 | static bool cv2_row(cv2_context_t *ctx, cv2_span_t input, size_t *position, bool test_row, |
| 789 | cv2_span_t fields[4]) { |