Skip to content

Commit 3d90903

Browse files
committed
Wire up filtering
1 parent 72177e7 commit 3d90903

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

src/file.jl

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ end
601601

602602
@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}
603603
while pos <= len
604-
origpos = pos
604+
rowstart = pos
605605
rowcode = None
606606
for col = 1:ncols
607607
if transpose
@@ -659,23 +659,31 @@ end
659659
break # from for col = 1:ncols
660660
end
661661
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
667679
end
668680
end
669681
end
670682
end
671683
if filter === nothing
672684
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
679687
end
680688
end
681689
return pos

0 commit comments

Comments
 (0)