@@ -2,16 +2,14 @@ __precompile__(true)
2
2
"""
3
3
StrAPI package
4
4
5
- Copyright 2017-2018 Gandalf Software, Inc., Scott P. Jones
5
+ Copyright 2017-2020 Gandalf Software, Inc., Scott P. Jones
6
6
Licensed under MIT License, see LICENSE.md
7
7
"""
8
8
module StrAPI
9
9
10
10
using ModuleInterfaceTools
11
11
using ModuleInterfaceTools: m_eval, _stdout, _stderr
12
12
13
- const NEW_ITERATE = VERSION >= v " 0.7.0-DEV.5127"
14
-
15
13
const MaybeSub{T} = Union{T, SubString{T}} where {T<: AbstractString }
16
14
17
15
const CodeUnitTypes = Union{UInt8, UInt16, UInt32}
@@ -23,8 +21,7 @@ quotesym(s...) = Expr(:quote, symstr(s...))
23
21
24
22
@api public StringError
25
23
26
- @api develop NEW_ITERATE, CodeUnitTypes, CodePoints, MaybeSub, symstr, quotesym,
27
- _stdout, " @preserve"
24
+ @api develop CodeUnitTypes, CodePoints, MaybeSub, symstr, quotesym, _stdout, " @preserve"
28
25
29
26
@api base convert, getindex, length, map, collect, hash, sizeof, size, strides,
30
27
pointer, unsafe_load, string, read, write, reverse,
@@ -37,48 +34,43 @@ quotesym(s...) = Expr(:quote, symstr(s...))
37
34
# Conditionally import or export names that are only in v0.6 or in master
38
35
@api base! codeunit, codeunits, ncodeunits, codepoint, thisind, firstindex, lastindex
39
36
40
- @static NEW_ITERATE ? (@api base iterate) : (@api base start, next, done)
41
-
42
- @static if V6_COMPAT
43
- include (" compat.jl" )
44
- else # !V6_COMPAT
45
- import Base. GC: @preserve
37
+ @api base iterate
46
38
47
- function find end
48
- function ind2chr end
49
- function chr2ind end
39
+ import Base. GC: @preserve
50
40
51
- # Handle changes in array allocation
52
- create_vector (T, len) = Vector {T} (undef, len)
41
+ function find end
42
+ function ind2chr end
43
+ function chr2ind end
53
44
54
- # Add new short name for deprecated hex function
55
- outhex (v, p = 1 ) = string (v, base = 16 , pad = p )
45
+ # Handle changes in array allocation
46
+ create_vector (T, len) = Vector {T} (undef, len )
56
47
57
- get_iobuffer (siz) = IOBuffer (sizehint= siz)
48
+ # Add new short name for deprecated hex function
49
+ outhex (v, p= 1 ) = string (v, base= 16 , pad= p)
58
50
59
- const utf8crc = Base. _crc32c
60
- const is_lowercase = islowercase
61
- const is_uppercase = isuppercase
62
- const lowercase_first = lowercasefirst
63
- const uppercase_first = uppercasefirst
51
+ get_iobuffer (siz) = IOBuffer (sizehint= siz)
64
52
65
- using Base: unsafe_crc32c, Fix2
53
+ const utf8crc = Base. _crc32c
54
+ const is_lowercase = islowercase
55
+ const is_uppercase = isuppercase
56
+ const lowercase_first = lowercasefirst
57
+ const uppercase_first = uppercasefirst
66
58
67
- # Location of some methods moved from Base.UTF8proc to Base.Unicode
68
- const UC = Base. Unicode
69
- const Unicode = UC
59
+ using Base: unsafe_crc32c, Fix2
70
60
71
- import Base. CodeUnits
61
+ # Location of some methods moved from Base.UTF8proc to Base.Unicode
62
+ const UC = Base. Unicode
63
+ const Unicode = UC
72
64
73
- @api base IteratorSize
65
+ import Base . CodeUnits
74
66
75
- const is_letter = isletter
67
+ @api base IteratorSize
76
68
77
- pwc (c, io, str) = printstyled (io, str; color = c)
69
+ const is_letter = isletter
78
70
79
- const graphemes = UC . graphemes
71
+ pwc (c, io, str) = printstyled (io, str; color = c)
80
72
81
- end # !V6_COMPAT
73
+ const graphemes = UC . graphemes
82
74
83
75
@api base isequal, == , in
84
76
@@ -89,10 +81,9 @@ pr_ul(io, l) = pwc(:underline, io, l)
89
81
90
82
@api develop! pwc, pr_ul
91
83
92
- const str_next = @static NEW_ITERATE ? iterate : next
93
84
str_done (str:: AbstractString , i:: Integer ) = i > ncodeunits (str)
94
85
95
- @api develop! str_next, str_done
86
+ @api develop! str_done
96
87
@api develop unsafe_crc32c, Fix2, CodeUnits
97
88
@api public! is_lowercase, is_uppercase, lowercase_first, uppercase_first
98
89
@@ -119,8 +110,6 @@ function _uppercase end
119
110
function _titlecase end
120
111
@api develop! _write, _print, _isvalid, _lowercase, _uppercase, _titlecase
121
112
122
- const curmod = @static V6_COMPAT ? current_module () : @__MODULE__
123
-
124
113
include (" errors.jl" )
125
114
include (" traits.jl" )
126
115
include (" codepoints.jl" )
@@ -159,7 +148,7 @@ for (pref, lst) in
159
148
? (symstr (" is" , nam[1 ]), symstr (" is_" , nam[2 ]))
160
149
: (symstr (" is" , nam), symstr (" is_" , nam)))
161
150
162
- m_eval (curmod ,
151
+ m_eval (@__MODULE__ ,
163
152
(isdefined (Base, oldname)
164
153
? Expr (:const , Expr (:(= ), newname, oldname))
165
154
: Expr (:function , newname)))
0 commit comments