Skip to content

Commit 95ee49b

Browse files
authored
Merge pull request #15 from JuliaString/spj/fixjoin
Fix join bug, better reporting of errors in calcstats
2 parents 68983eb + a0bba37 commit 95ee49b

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = ["ScottPJones <[email protected]>"]
44
keywords = ["Strings"]
55
license = "MIT"
66
uuid = "e79e7a6a-7bb1-5a4d-9d64-da657b06f53a"
7-
version = "1.0.5"
7+
version = "1.0.6"
88

99
[deps]
1010
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
[gitter-img]: https://badges.gitter.im/Join%20Chat.svg
1515
[gitter-url]: https://gitter.im/JuliaString/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
1616

17-
[travis-url]: https://travis-ci.org/JuliaString/StrBase.jl
18-
[travis-s-img]: https://travis-ci.org/JuliaString/StrBase.jl.svg
19-
[travis-m-img]: https://travis-ci.org/JuliaString/StrBase.jl.svg?branch=master
17+
[checks]: https://img.shields.io/github/checks-status/JuliaString/StrBase.jl/master
2018

2119
[codecov-url]: https://codecov.io/gh/JuliaString/StrBase.jl
2220
[codecov-img]: https://codecov.io/gh/JuliaString/StrBase.jl/branch/master/graph/badge.svg
@@ -27,8 +25,8 @@
2725

2826
| **Julia Version** | **Unit Tests** | **Coverage** |
2927
|:------------------:|:------------------:|:---------------------:|
30-
| [![][julia-release]][julia-url] | [![][travis-s-img]][travis-url] | [![][codecov-img]][codecov-url]
31-
| Julia Latest | [![][travis-m-img]][travis-url] | [![][codecov-img]][codecov-url]
28+
| [![][julia-release]][julia-url] | | [![][codecov-img]][codecov-url]
29+
| Julia Latest | [![][checks]][pkg-url] | [![][codecov-img]][codecov-url]
3230

3331
See the documentation in the [Strs](https://github.com/JuliaString/Strs.jl) package,
3432
this package contains the basic functionality, which can be used by other string related packages.

src/io.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ join(strings::AbstractArray{<:MaybeSub{T}}) where {C<:Quad_CSEs,T<:Str{C}} =
379379
_join(C, strings)
380380

381381
join(strings::AbstractArray{<:MaybeSub{<:Str}}, delim) =
382-
_joincvt(_calc_type(strings), strings, delim)
382+
_joincvt(calc_type(strings), strings, delim)
383383
join(strings::AbstractArray{<:MaybeSub{T}},
384384
delim) where {C<:Union{Text1CSE, BinaryCSE, ASCIICSE, Latin_CSEs},T<:Str{C}} =
385385
_join(C, strings, delim)

src/stats.jl

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#=
22
Statistics for Unicode character/string types
33
4-
Copyright 2017 Gandalf Software, Inc., Scott P. Jones
4+
Copyright 2017-2021 Gandalf Software, Inc., Scott P. Jones
55
Licensed under MIT License, see LICENSE.md
66
=#
77
struct LineCounts
@@ -48,13 +48,24 @@ function calcstats(lines)
4848
minlen = typemax(Int)
4949
maxlen = 0
5050
maxtyp = 0
51+
linnum = 0
5152
for l in lines
53+
linnum += 1
5254
len = length(l)
5355
minlen = min(minlen, len)
5456
maxlen = max(maxlen, len)
5557
flags = 0
58+
chrnum = 0
5659
for chr in l
57-
ch = chr%UInt32
60+
chrnum += 1
61+
ch = UInt32(0)
62+
try
63+
ch = chr%UInt32
64+
catch ex
65+
typeof(ex) == InterruptException ||
66+
println("Bad character: $chr at line $linnum, pos $chrnum")
67+
rethrow()
68+
end
5869
t = ch <= 0x7f ? 1 :
5970
ch <= 0xff ? 2 :
6071
ch <= 0x7ff ? 3 :

0 commit comments

Comments
 (0)