@@ -1519,9 +1519,12 @@ end
15191519 export printstyled
15201520end
15211521
1522- @static if VERSION < v " 0.7.0-DEV.3272"
1523- import Base: in, findfirst, findnext, findlast, findprev
1524-
1522+ @static if VERSION >= v " 0.7.0-DEV.3272"
1523+ findnext (xs... ) = Base. findnext (xs... )
1524+ findfirst (xs... ) = Base. findfirst (xs... )
1525+ findprev (xs... ) = Base. findprev (xs... )
1526+ findlast (xs... ) = Base. findlast (xs... )
1527+ else
15251528 struct OccursIn{T} <: Function
15261529 x:: T
15271530
@@ -1531,41 +1534,47 @@ end
15311534 const occursin = OccursIn
15321535 export occursin
15331536
1534- zero2nothing (x) = x == 0 ? nothing : x
1537+ zero2nothing (x:: Integer ) = x == 0 ? nothing : x
1538+ zero2nothing (x) = x
1539+
1540+ findnext (xs... ) = zero2nothing (Base. findnext (xs... ))
1541+ findfirst (xs... ) = zero2nothing (Base. findfirst (xs... ))
1542+ findprev (xs... ) = zero2nothing (Base. findprev (xs... ))
1543+ findlast (xs... ) = zero2nothing (Base. findlast (xs... ))
15351544
1536- findnext (r:: Regex , s:: AbstractString , idx:: Integer ) = search (s, r, idx)
1537- findfirst (r:: Regex , s:: AbstractString ) = search (s, r)
1538- findnext (c:: EqualTo{Char} , s:: AbstractString , i:: Integer ) = zero2nothing ( search (s, c. x, i) )
1539- findfirst (c:: EqualTo{Char} , s:: AbstractString ) = zero2nothing ( search (s, c. x) )
1540- findnext (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} , i:: Integer ) =
1541- zero2nothing ( search (a, b. x, i) )
1542- findfirst (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} ) =
1543- zero2nothing ( search (a, b. x) )
1545+ Base . findnext (r:: Regex , s:: AbstractString , idx:: Integer ) = search (s, r, idx)
1546+ Base . findfirst (r:: Regex , s:: AbstractString ) = search (s, r)
1547+ Base . findnext (c:: EqualTo{Char} , s:: AbstractString , i:: Integer ) = search (s, c. x, i)
1548+ Base . findfirst (c:: EqualTo{Char} , s:: AbstractString ) = search (s, c. x)
1549+ Base . findnext (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} , i:: Integer ) =
1550+ search (a, b. x, i)
1551+ Base . findfirst (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} ) =
1552+ search (a, b. x)
15441553
1545- findnext (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
1554+ Base . findnext (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
15461555 s:: AbstractString , i:: Integer ) =
1547- zero2nothing ( search (s, c. x, i) )
1548- findfirst (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
1556+ search (s, c. x, i)
1557+ Base . findfirst (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
15491558 s:: AbstractString ) =
1550- zero2nothing ( search (s, c. x) )
1551- findnext (t:: AbstractString , s:: AbstractString , i:: Integer ) = search (s, t, i)
1552- findfirst (t:: AbstractString , s:: AbstractString ) = search (s, t)
1553-
1554- findfirst (delim:: EqualTo{UInt8} , buf:: IOBuffer ) = zero2nothing ( search (buf, delim. x) )
1555-
1556- findprev (c:: EqualTo{Char} , s:: AbstractString , i:: Integer ) = zero2nothing ( rsearch (s, c. x, i) )
1557- findlast (c:: EqualTo{Char} , s:: AbstractString ) = zero2nothing ( rsearch (s, c. x) )
1558- findprev (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} , i:: Integer ) =
1559- zero2nothing ( rsearch (a, b. x, i) )
1560- findlast (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} ) =
1561- zero2nothing ( rsearch (a, b. x) )
1562-
1563- findprev (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
1564- s:: AbstractString , i:: Integer ) = zero2nothing ( rsearch (s, c. x, i) )
1565- findlast (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
1566- s:: AbstractString ) = zero2nothing ( rsearch (s, c. x) )
1567- findprev (t:: AbstractString , s:: AbstractString , i:: Integer ) = rsearch (s, t, i)
1568- findlast (t:: AbstractString , s:: AbstractString ) = rsearch (s, t)
1559+ search (s, c. x)
1560+ Base . findnext (t:: AbstractString , s:: AbstractString , i:: Integer ) = search (s, t, i)
1561+ Base . findfirst (t:: AbstractString , s:: AbstractString ) = search (s, t)
1562+
1563+ Base . findfirst (delim:: EqualTo{UInt8} , buf:: IOBuffer ) = search (buf, delim. x)
1564+
1565+ Base . findprev (c:: EqualTo{Char} , s:: AbstractString , i:: Integer ) = rsearch (s, c. x, i)
1566+ Base . findlast (c:: EqualTo{Char} , s:: AbstractString ) = rsearch (s, c. x)
1567+ Base . findprev (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} , i:: Integer ) =
1568+ rsearch (a, b. x, i)
1569+ Base . findlast (b:: EqualTo{<:Union{Int8,UInt8}} , a:: Vector{<:Union{Int8,UInt8}} ) =
1570+ rsearch (a, b. x)
1571+
1572+ Base . findprev (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
1573+ s:: AbstractString , i:: Integer ) = rsearch (s, c. x, i)
1574+ Base . findlast (c:: OccursIn {<: Union{Tuple{Vararg{Char}},AbstractVector{Char},Set{Char}} },
1575+ s:: AbstractString ) = rsearch (s, c. x)
1576+ Base . findprev (t:: AbstractString , s:: AbstractString , i:: Integer ) = rsearch (s, t, i)
1577+ Base . findlast (t:: AbstractString , s:: AbstractString ) = rsearch (s, t)
15691578
15701579 findall (b:: OccursIn , a) = findin (a, b. x)
15711580 # To fix ambiguity
0 commit comments