From 7f0d43e0921c0ccada6c51ea2af223e33f2f5eef Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Mon, 25 Jul 2016 20:09:49 +0100 Subject: [PATCH] deps --- src/TOML.jl | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/TOML.jl b/src/TOML.jl index 4b9e39c..3d3c008 100644 --- a/src/TOML.jl +++ b/src/TOML.jl @@ -16,32 +16,32 @@ include("datetime.jl") type ParserState - subject::UTF8String + subject::(@compat String) index::Integer line::Integer - result::Dict{UTF8String, Any} - cur_tbl::Dict{UTF8String, Any} - tbl_names::Set{UTF8String} + result::Dict{(@compat String), Any} + cur_tbl::Dict{(@compat String), Any} + tbl_names::Set{(@compat String)} function ParserState{T<: @compat Union{AbstractString, Array{UInt8, 1}}}(subject::T) - if isa(subject, @compat Union{ByteString, Array{UInt8, 1}}) && !isvalid(UTF8String, subject) + if isa(subject, @compat Union{ByteString, Array{UInt8, 1}}) && !isvalid((@compat String), subject) throw(TOMLError("$T with invalid UTF-8 byte sequence.")) end try - subject = convert(UTF8String, subject) + subject = convert((@compat String), subject) catch - throw(TOMLError("Couldn't convert $T to UTF8String " * - "(no method convert(Type{UTF8String}, $T)).")) + throw(TOMLError("Couldn't convert $T to (@compat String) " * + "(no method convert(Type{(@compat String)}, $T)).")) end BOM = length(subject) > 0 && subject[1] == '\ufeff' ? true : false - maintbl = Dict{UTF8String,Any}() + maintbl = Dict{(@compat String),Any}() new( subject, BOM ? 4 : 1, # index. Strip the BOM if present. 1, # line maintbl, # result maintbl, # cur_tbl - Set{UTF8String}() # tbl_names + Set{(@compat String)}() # tbl_names ) end end @@ -102,7 +102,7 @@ function table(state::ParserState) _error("Key \"$k\" already defined", state) end else - tbl[k] = Dict{UTF8String,Any}() + tbl[k] = Dict{(@compat String),Any}() tbl = tbl[k] end end @@ -129,7 +129,7 @@ function table_array(state::ParserState) end if haskey(tbl, k) if i < length(keys) - if !isa(tbl[k], @compat Union{Array{Dict{UTF8String, Any}, 1}, Dict{UTF8String, Any}}) + if !isa(tbl[k], @compat Union{Array{Dict{(@compat String), Any}, 1}, Dict{(@compat String), Any}}) _error("Attempt to overwrite key $(join(keys[1:i], '.'))", state) end if isa(tbl[k], Dict) @@ -138,19 +138,19 @@ function table_array(state::ParserState) tbl = last(tbl[k]) end else - if !isa(tbl[k], Array{Dict{UTF8String, Any}, 1}) + if !isa(tbl[k], Array{Dict{(@compat String), Any}, 1}) _error("Attempt to overwrite value with array", state) end - push!(tbl[k], Dict{UTF8String,Any}()) + push!(tbl[k], Dict{(@compat String),Any}()) tbl = last(tbl[k]) break end else if i < length(keys) - tbl[k] = Dict{UTF8String,Any}() + tbl[k] = Dict{(@compat String),Any}() tbl = tbl[k] else # we're done - tbl[k] = [Dict{UTF8String,Any}()] + tbl[k] = [Dict{(@compat String),Any}()] tbl = last(tbl[k]) break end