Skip to content

Commit 5a8fd6e

Browse files
committed
Deprecate skipchars for skipuntil
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.
1 parent 2897fe8 commit 5a8fd6e

File tree

4 files changed

+6
-34
lines changed

4 files changed

+6
-34
lines changed

base/deprecated.jl

+6
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,9 @@ macro get!(h, key0, default)
208208
end
209209

210210
# END 1.5 deprecations
211+
212+
# BEGIN 1.5 deprecations
213+
214+
@deprecate skipchars(pred, io::IO; linecomment=nothing) skipuntil(!pred, io::IO; linecomment=linecomment)
215+
216+
# END 1.5 deprecations

base/exports.jl

-1
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,6 @@ export
820820
seekend,
821821
seekstart,
822822
skip,
823-
skipchars,
824823
skipuntil,
825824
take!,
826825
truncate,

base/io.jl

-32
Original file line numberDiff line numberDiff line change
@@ -1069,38 +1069,6 @@ Commit all currently buffered writes to the given stream.
10691069
"""
10701070
flush(io::IO) = nothing
10711071

1072-
"""
1073-
skipchars(predicate, io::IO; linecomment=nothing)
1074-
1075-
Advance the stream `io` such that the next-read character will be the first remaining for
1076-
which `predicate` returns `false`. If the keyword argument `linecomment` is specified, all
1077-
characters from that character until the start of the next line are ignored.
1078-
1079-
# Examples
1080-
```jldoctest
1081-
julia> buf = IOBuffer(" text")
1082-
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=8, maxsize=Inf, ptr=1, mark=-1)
1083-
1084-
julia> skipchars(isspace, buf)
1085-
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=8, maxsize=Inf, ptr=5, mark=-1)
1086-
1087-
julia> String(readavailable(buf))
1088-
"text"
1089-
```
1090-
"""
1091-
function skipchars(predicate, io::IO; linecomment=nothing)
1092-
while !eof(io)
1093-
c = read(io, Char)
1094-
if c === linecomment
1095-
readline(io)
1096-
elseif !predicate(c)
1097-
skip(io, -ncodeunits(c))
1098-
break
1099-
end
1100-
end
1101-
return io
1102-
end
1103-
11041072
"""
11051073
skipuntil(predicate, io::IO; linecomment=nothing)
11061074

doc/src/base/io-network.md

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Base.redirect_stdin
4343
Base.redirect_stdin(::Function, ::Any)
4444
Base.readchomp
4545
Base.truncate
46-
Base.skipchars
4746
Base.skipuntil
4847
Base.countlines
4948
Base.PipeBuffer

0 commit comments

Comments
 (0)