Skip to content

Commit

Permalink
Deprecate skipchars for skipuntil
Browse files Browse the repository at this point in the history
Closes JuliaLang#36132

The name skipchars does not clearly communicate the functionality
available.

Tests for skipchars were left in place to ensure the @deprecate macro
correctly converted those calls to using skipuntil.
  • Loading branch information
non-Jedi committed Jun 5, 2020
1 parent 2897fe8 commit 6c72f67
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 34 deletions.
6 changes: 6 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,9 @@ macro get!(h, key0, default)
end

# END 1.5 deprecations

# BEGIN 1.6 deprecations

@deprecate skipchars(pred, io::IO; linecomment=nothing) skipuntil(!pred, io::IO; linecomment=linecomment)

# END 1.6 deprecations
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,6 @@ export
seekend,
seekstart,
skip,
skipchars,
skipuntil,
take!,
truncate,
Expand Down
32 changes: 0 additions & 32 deletions base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1069,38 +1069,6 @@ Commit all currently buffered writes to the given stream.
"""
flush(io::IO) = nothing

"""
skipchars(predicate, io::IO; linecomment=nothing)
Advance the stream `io` such that the next-read character will be the first remaining for
which `predicate` returns `false`. If the keyword argument `linecomment` is specified, all
characters from that character until the start of the next line are ignored.
# Examples
```jldoctest
julia> buf = IOBuffer(" text")
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=8, maxsize=Inf, ptr=1, mark=-1)
julia> skipchars(isspace, buf)
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=8, maxsize=Inf, ptr=5, mark=-1)
julia> String(readavailable(buf))
"text"
```
"""
function skipchars(predicate, io::IO; linecomment=nothing)
while !eof(io)
c = read(io, Char)
if c === linecomment
readline(io)
elseif !predicate(c)
skip(io, -ncodeunits(c))
break
end
end
return io
end

"""
skipuntil(predicate, io::IO; linecomment=nothing)
Expand Down
1 change: 0 additions & 1 deletion doc/src/base/io-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Base.redirect_stdin
Base.redirect_stdin(::Function, ::Any)
Base.readchomp
Base.truncate
Base.skipchars
Base.skipuntil
Base.countlines
Base.PipeBuffer
Expand Down

0 comments on commit 6c72f67

Please sign in to comment.