Skip to content

Commit

Permalink
Merge pull request #15 from JuliaString/spj/fixjoin
Browse files Browse the repository at this point in the history
Fix join bug, better reporting of errors in calcstats
  • Loading branch information
ScottPJones authored May 18, 2021
2 parents 68983eb + a0bba37 commit 95ee49b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = ["ScottPJones <scottjones@alum.mit.edu>"]
keywords = ["Strings"]
license = "MIT"
uuid = "e79e7a6a-7bb1-5a4d-9d64-da657b06f53a"
version = "1.0.5"
version = "1.0.6"

[deps]
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
[gitter-img]: https://badges.gitter.im/Join%20Chat.svg
[gitter-url]: https://gitter.im/JuliaString/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge

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

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

| **Julia Version** | **Unit Tests** | **Coverage** |
|:------------------:|:------------------:|:---------------------:|
| [![][julia-release]][julia-url] | [![][travis-s-img]][travis-url] | [![][codecov-img]][codecov-url]
| Julia Latest | [![][travis-m-img]][travis-url] | [![][codecov-img]][codecov-url]
| [![][julia-release]][julia-url] | | [![][codecov-img]][codecov-url]
| Julia Latest | [![][checks]][pkg-url] | [![][codecov-img]][codecov-url]

See the documentation in the [Strs](https://github.com/JuliaString/Strs.jl) package,
this package contains the basic functionality, which can be used by other string related packages.
2 changes: 1 addition & 1 deletion src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ join(strings::AbstractArray{<:MaybeSub{T}}) where {C<:Quad_CSEs,T<:Str{C}} =
_join(C, strings)

join(strings::AbstractArray{<:MaybeSub{<:Str}}, delim) =
_joincvt(_calc_type(strings), strings, delim)
_joincvt(calc_type(strings), strings, delim)
join(strings::AbstractArray{<:MaybeSub{T}},
delim) where {C<:Union{Text1CSE, BinaryCSE, ASCIICSE, Latin_CSEs},T<:Str{C}} =
_join(C, strings, delim)
Expand Down
15 changes: 13 additions & 2 deletions src/stats.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#=
Statistics for Unicode character/string types
Copyright 2017 Gandalf Software, Inc., Scott P. Jones
Copyright 2017-2021 Gandalf Software, Inc., Scott P. Jones
Licensed under MIT License, see LICENSE.md
=#
struct LineCounts
Expand Down Expand Up @@ -48,13 +48,24 @@ function calcstats(lines)
minlen = typemax(Int)
maxlen = 0
maxtyp = 0
linnum = 0
for l in lines
linnum += 1
len = length(l)
minlen = min(minlen, len)
maxlen = max(maxlen, len)
flags = 0
chrnum = 0
for chr in l
ch = chr%UInt32
chrnum += 1
ch = UInt32(0)
try
ch = chr%UInt32
catch ex
typeof(ex) == InterruptException ||
println("Bad character: $chr at line $linnum, pos $chrnum")
rethrow()
end
t = ch <= 0x7f ? 1 :
ch <= 0xff ? 2 :
ch <= 0x7ff ? 3 :
Expand Down

0 comments on commit 95ee49b

Please sign in to comment.