@@ -119,7 +119,7 @@ function result(dlmoffsets::DLMOffsets)
119119 dlmoffsets. oarr
120120end
121121
122- type DLMStore{T,S <: String } <: DLMHandler
122+ type DLMStore{T} <: DLMHandler
123123 hdr:: Array{AbstractString, 2}
124124 data:: Array{T, 2}
125125
@@ -128,29 +128,29 @@ type DLMStore{T,S<:String} <: DLMHandler
128128 lastrow:: Int
129129 lastcol:: Int
130130 hdr_offset:: Int
131- sbuff:: S
131+ sbuff:: String
132132 auto:: Bool
133133 eol:: Char
134134end
135135
136- function DLMStore {T,S<:String } (:: Type{T} , dims:: NTuple{2,Integer} , has_header:: Bool , sbuff:: S , auto:: Bool , eol:: Char )
136+ function DLMStore {T} (:: Type{T} , dims:: NTuple{2,Integer} , has_header:: Bool , sbuff:: String , auto:: Bool , eol:: Char )
137137 (nrows,ncols) = dims
138138 nrows <= 0 && throw (ArgumentError (" number of rows in dims must be > 0, got $nrows " ))
139139 ncols <= 0 && throw (ArgumentError (" number of columns in dims must be > 0, got $ncols " ))
140140 hdr_offset = has_header ? 1 : 0
141- DLMStore {T,S } (fill (SubString (sbuff,1 ,0 ), 1 , ncols), Array (T, nrows- hdr_offset, ncols), nrows, ncols, 0 , 0 , hdr_offset, sbuff, auto, eol)
141+ DLMStore {T} (fill (SubString (sbuff,1 ,0 ), 1 , ncols), Array (T, nrows- hdr_offset, ncols), nrows, ncols, 0 , 0 , hdr_offset, sbuff, auto, eol)
142142end
143143
144144_chrinstr (sbuff:: String , chr:: UInt8 , startpos:: Int , endpos:: Int ) = (endpos >= startpos) && (C_NULL != ccall (:memchr , Ptr{UInt8}, (Ptr{UInt8}, Int32, Csize_t), pointer (sbuff. data)+ startpos- 1 , chr, endpos- startpos+ 1 ))
145145
146- function store_cell {T,S<:String } (dlmstore:: DLMStore{T,S } , row:: Int , col:: Int , quoted:: Bool , startpos:: Int , endpos:: Int )
146+ function store_cell {T} (dlmstore:: DLMStore{T} , row:: Int , col:: Int , quoted:: Bool , startpos:: Int , endpos:: Int )
147147 drow = row - dlmstore. hdr_offset
148148
149149 ncols = dlmstore. ncols
150150 lastcol = dlmstore. lastcol
151151 lastrow = dlmstore. lastrow
152152 cells:: Array{T,2} = dlmstore. data
153- sbuff:: S = dlmstore. sbuff
153+ sbuff = dlmstore. sbuff
154154
155155 endpos = prevind (sbuff, nextind (sbuff,endpos))
156156 (endpos > 0 ) && (' \n ' == dlmstore. eol) && (' \r ' == Char (sbuff[endpos])) && (endpos = prevind (sbuff, endpos))
@@ -316,12 +316,12 @@ function dlm_fill(T::DataType, offarr::Vector{Vector{Int}}, dims::NTuple{2,Integ
316316 end
317317end
318318
319- function colval {S<:String} (sbuff:: S , startpos:: Int , endpos:: Int , cells:: Array{Bool,2} , row:: Int , col:: Int )
319+ function colval (sbuff:: String , startpos:: Int , endpos:: Int , cells:: Array{Bool,2} , row:: Int , col:: Int )
320320 n = tryparse_internal (Bool, sbuff, startpos, endpos, false )
321321 isnull (n) || (cells[row, col] = get (n))
322322 isnull (n)
323323end
324- function colval {T<:Integer, S<:String } (sbuff:: S , startpos:: Int , endpos:: Int , cells:: Array{T,2} , row:: Int , col:: Int )
324+ function colval {T<:Integer} (sbuff:: String , startpos:: Int , endpos:: Int , cells:: Array{T,2} , row:: Int , col:: Int )
325325 n = tryparse_internal (T, sbuff, startpos, endpos, 0 , false )
326326 isnull (n) || (cells[row, col] = get (n))
327327 isnull (n)
@@ -336,11 +336,11 @@ function colval(sbuff::String, startpos::Int, endpos::Int, cells::Array{Float32,
336336 isnull (n) || (cells[row, col] = get (n))
337337 isnull (n)
338338end
339- function colval {T<:AbstractString, S<:String } (sbuff:: S , startpos:: Int , endpos:: Int , cells:: Array{T,2} , row:: Int , col:: Int )
339+ function colval {T<:AbstractString} (sbuff:: String , startpos:: Int , endpos:: Int , cells:: Array{T,2} , row:: Int , col:: Int )
340340 cells[row, col] = SubString (sbuff, startpos, endpos)
341341 return false
342342end
343- function colval {S<:String} (sbuff:: S , startpos:: Int , endpos:: Int , cells:: Array{Any,2} , row:: Int , col:: Int )
343+ function colval (sbuff:: String , startpos:: Int , endpos:: Int , cells:: Array{Any,2} , row:: Int , col:: Int )
344344 # if array is of Any type, attempt parsing only the most common types: Int, Bool, Float64 and fallback to SubString
345345 len = endpos- startpos+ 1
346346 if len > 0
@@ -359,15 +359,15 @@ function colval{S<:String}(sbuff::S, startpos::Int, endpos::Int, cells::Array{An
359359 cells[row, col] = SubString (sbuff, startpos, endpos)
360360 false
361361end
362- function colval {T<:Char, S<:String } (sbuff:: S , startpos:: Int , endpos:: Int , cells:: Array{T,2} , row:: Int , col:: Int )
362+ function colval {T<:Char} (sbuff:: String , startpos:: Int , endpos:: Int , cells:: Array{T,2} , row:: Int , col:: Int )
363363 if startpos == endpos
364364 cells[row, col] = next (sbuff, startpos)[1 ]
365365 return false
366366 else
367367 return true
368368 end
369369end
370- colval {S<:String} (sbuff:: S , startpos:: Int , endpos:: Int , cells:: Array , row:: Int , col:: Int ) = true
370+ colval (sbuff:: String , startpos:: Int , endpos:: Int , cells:: Array , row:: Int , col:: Int ) = true
371371
372372function dlm_parse {T,D} (dbuff:: T , eol:: D , dlm:: D , qchar:: D , cchar:: D ,
373373 ign_adj_dlm:: Bool , allow_quote:: Bool , allow_comments:: Bool ,
@@ -376,7 +376,7 @@ function dlm_parse{T,D}(dbuff::T, eol::D, dlm::D, qchar::D, cchar::D,
376376 isascii (dlm) &&
377377 (! allow_quote || isascii (qchar)) &&
378378 (! allow_comments || isascii (cchar)))
379- if (T <: String ) && all_ascii
379+ if T === String && all_ascii
380380 return dlm_parse (dbuff. data, eol % UInt8, dlm % UInt8, qchar % UInt8, cchar % UInt8,
381381 ign_adj_dlm, allow_quote, allow_comments, skipstart, skipblanks, dh)
382382 end
0 commit comments