Skip to content

Commit

Permalink
Merge pull request #2 from JuliaString/spj/v7update
Browse files Browse the repository at this point in the history
Updates for v0.7
  • Loading branch information
ScottPJones committed Dec 22, 2017
2 parents 0b1cea3 + 83a7e5b commit 575bbbe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/HTML_Entities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using StrTables

VER = UInt32(1)

immutable HTML_Table{T} <: AbstractEntityTable
struct HTML_Table{T} <: AbstractEntityTable
ver::UInt32
tim::String
inf::String
Expand Down Expand Up @@ -44,7 +44,7 @@ function _get_str(ind)
string(Char(val>>>16), Char(val&0xffff))
end

function _get_strings{T}(val::T, tab::Vector{T}, ind::Vector{UInt16})
function _get_strings(val::T, tab::Vector{T}, ind::Vector{UInt16}) where {T}
rng = searchsorted(tab, val)
isempty(rng) && return _empty_str_vec
_tab.nam[ind[rng]]
Expand All @@ -55,10 +55,11 @@ function lookupname(str::AbstractString)
isempty(rng) ? _empty_str : _get_str(_tab.ind[rng.start])
end

matchchar(ch::Char) =
(ch <= '\uffff'
matchchar(ch::UInt32) =
(ch <= 0x0ffff
? _get_strings(ch%UInt16, _tab.val16, _tab.ind16)
: (ch <= '\U1ffff' ? _get_strings(ch%UInt16, _tab.val32, _tab.ind32) : _empty_str_vec))
: (ch <= 0x1ffff ? _get_strings(ch%UInt16, _tab.val32, _tab.ind32) : _empty_str_vec))
matchchar(ch::Char) = matchchar(UInt32(ch))

matches(str::AbstractString) = matches(convert(Vector{Char}, str))
function matches(vec::Vector{Char})
Expand Down

0 comments on commit 575bbbe

Please sign in to comment.