@@ -10,7 +10,23 @@ __precompile__()
1010module HTML_Entities
1111using StrTables
1212
13- include (" html_table.jl" )
13+ VER = UInt32 (1 )
14+
15+ immutable HTML_Table{T} <: AbstractEntityTable
16+ ver:: UInt32
17+ tim:: String
18+ inf:: String
19+ base32:: UInt32
20+ base2c:: UInt32
21+ nam:: StrTable{T}
22+ ind:: Vector{UInt16}
23+ val16:: Vector{UInt16}
24+ ind16:: Vector{UInt16}
25+ val32:: Vector{UInt16}
26+ ind32:: Vector{UInt16}
27+ val2c:: Vector{UInt32}
28+ ind2c:: Vector{UInt16}
29+ end
1430
1531function __init__ ()
1632 const global _tab =
@@ -34,20 +50,16 @@ function _get_strings{T}(val::T, tab::Vector{T}, ind::Vector{UInt16})
3450 _tab. nam[ind[rng]]
3551end
3652
37- """ Given a HTML name, return the string it represents, or an empty string if not found"""
3853function lookupname (str:: AbstractString )
3954 rng = searchsorted (_tab. nam, str)
4055 isempty (rng) ? _empty_str : _get_str (_tab. ind[rng. start])
4156end
4257
43- """ Given a character, return all exact matches to the character as a vector"""
4458matchchar (ch:: Char ) =
4559 (ch <= ' \u ffff'
4660 ? _get_strings (ch% UInt16, _tab. val16, _tab. ind16)
4761 : (ch <= ' \U 1ffff' ? _get_strings (ch% UInt16, _tab. val32, _tab. ind32) : _empty_str_vec))
4862
49- """ Given a string, return all exact matches to the string as a vector"""
50- function matches end
5163matches (str:: AbstractString ) = matches (convert (Vector{Char}, str))
5264function matches (vec:: Vector{Char} )
5365 if length (vec) == 1
@@ -59,8 +71,6 @@ function matches(vec::Vector{Char})
5971 end
6072end
6173
62- """ Given a string, return all of the longest matches to the beginning of the string as a vector"""
63- function longestmatches end
6474longestmatches (str:: AbstractString ) = longestmatches (convert (Vector{Char}, str))
6575function longestmatches (vec:: Vector{Char} )
6676 isempty (vec) && return _empty_str_vec
@@ -72,9 +82,6 @@ function longestmatches(vec::Vector{Char})
7282 matchchar (vec[1 ])
7383end
7484
75-
76- """ Given a string, return all of the HTML entity names that start with that string, if any"""
77- function completions end
7885completions (str:: AbstractString ) = completions (convert (String, str))
7986completions (str:: String ) = StrTables. matchfirst (_tab. nam, str)
8087
0 commit comments