|
601 | 601 |
|
602 | 602 | @inline function parserow(row, TR::Val{transpose}, ncols, typemap, columns, startpos, buf, pos, len, positions, pool, refs, rowsguess, rowoffset, types, flags, filter, names, codes, debug, options, coloptions, ::Type{customtypes}) where {transpose, customtypes} |
603 | 603 | while pos <= len |
604 | | - origpos = pos |
| 604 | + rowstart = pos |
605 | 605 | rowcode = None |
606 | 606 | for col = 1:ncols |
607 | 607 | if transpose |
@@ -659,23 +659,31 @@ end |
659 | 659 | break # from for col = 1:ncols |
660 | 660 | end |
661 | 661 | else |
662 | | - if pos <= len && !Parsers.newline(code) |
663 | | - rowcode = TooManyColumns |
664 | | - options.silencewarnings || toomanycolumns(ncols, rowoffset + row) |
665 | | - # ignore the rest of the line |
666 | | - pos = skiptorow(buf, pos, len, options.oq, options.e, options.cq, 1, 2) |
| 662 | + if col < ncols |
| 663 | + if Parsers.newline(code) || pos > len |
| 664 | + rowcode = NotEnoughColumns |
| 665 | + options.silencewarnings || notenoughcolumns(col, ncols, rowoffset + row) |
| 666 | + for j = (col + 1):ncols |
| 667 | + @inbounds flags[j] |= ANYMISSING |
| 668 | + @inbounds types[j] = Union{Missing, types[j]} |
| 669 | + end |
| 670 | + break # from for col = 1:ncols |
| 671 | + end |
| 672 | + else |
| 673 | + if pos <= len && !Parsers.newline(code) |
| 674 | + rowcode = TooManyColumns |
| 675 | + options.silencewarnings || toomanycolumns(ncols, rowoffset + row) |
| 676 | + # ignore the rest of the line |
| 677 | + pos = skiptorow(buf, pos, len, options.oq, options.e, options.cq, 1, 2) |
| 678 | + end |
667 | 679 | end |
668 | 680 | end |
669 | 681 | end |
670 | 682 | end |
671 | 683 | if filter === nothing |
672 | 684 | break |
673 | | - else |
674 | | - res = filter(ParsingRow(names, types, flags, rowcode, codes, row, columns, buf, origpos, pos - origpos)) |
675 | | - @show res |
676 | | - if res |
677 | | - break |
678 | | - end |
| 685 | + elseif filter(ParsingRow(names, types, flags, rowcode, codes, row, columns, buf, rowstart, pos - rowstart)) |
| 686 | + break |
679 | 687 | end |
680 | 688 | end |
681 | 689 | return pos |
|
0 commit comments