Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/LineReader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ function Base.getindex(l::Line, index::Int64)
error("Index out of range")
end

function Base.length(l::Line)
len = 0
for (i,) in enumerate(l)
len += 1
end
return len
end

Base.lastindex(l::Line) = length(l)
Base.getindex(l::Line, I) = [l[i] for i in I]

function find_delimiter(line::Bview, delimiter::UInt8, state::Int)
# State refers to the last location we scanned
Expand Down Expand Up @@ -55,4 +65,4 @@ end
@inline function splitV(line::Sview, delimiter::Char)
length(line) > 0 || error("Empty line given")
return Line(line.data, UInt8(delimiter))
end
end