From 173803fdbd223b937742af70f6050210a4302b28 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Sun, 19 Nov 2017 17:02:16 +0100 Subject: [PATCH] bump TOML --- ext/TOML/.travis.yml | 2 +- ext/TOML/README.md | 2 +- ext/TOML/REQUIRE | 2 +- ext/TOML/appveyor.yml | 10 +++++----- ext/TOML/src/TOML.jl | 10 +++------- ext/TOML/src/parser.jl | 18 +++++++++--------- ext/TOML/test/runtests.jl | 2 +- 7 files changed, 21 insertions(+), 25 deletions(-) diff --git a/ext/TOML/.travis.yml b/ext/TOML/.travis.yml index a99a4664126a9..6902f1f2db0c3 100644 --- a/ext/TOML/.travis.yml +++ b/ext/TOML/.travis.yml @@ -3,7 +3,7 @@ os: - linux - osx julia: - # - release + - 0.6 - nightly notifications: email: false diff --git a/ext/TOML/README.md b/ext/TOML/README.md index 1c79c202afb5e..21cf8bb4a8bb0 100644 --- a/ext/TOML/README.md +++ b/ext/TOML/README.md @@ -17,7 +17,7 @@ julia> using TOML julia> TOML.parse(""" name = "value" """) -Dict{AbstractString,Any} with 1 entry: +Dict{String,Any} with 1 entry: "name" => "value" julia> TOML.parsefile("etc/example.toml") diff --git a/ext/TOML/REQUIRE b/ext/TOML/REQUIRE index 70e314a25e0a8..137767a42af4a 100644 --- a/ext/TOML/REQUIRE +++ b/ext/TOML/REQUIRE @@ -1 +1 @@ -julia 0.5- +julia 0.6 diff --git a/ext/TOML/appveyor.yml b/ext/TOML/appveyor.yml index 73f4ba3f1e88f..88fd4e37fee68 100644 --- a/ext/TOML/appveyor.yml +++ b/ext/TOML/appveyor.yml @@ -1,9 +1,9 @@ environment: matrix: - # - JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe" - # - JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe" - - JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe" - - JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" + - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe" + - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" + - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" branches: only: @@ -18,7 +18,7 @@ notifications: install: # Download most recent Julia Windows binary - ps: (new-object net.webclient).DownloadFile( - $("http://s3.amazonaws.com/"+$env:JULIAVERSION), + $env:JULIA_URL, "C:\projects\julia-binary.exe") # Run installer silently, output to C:\projects\julia - C:\projects\julia-binary.exe /S /D=C:\projects\julia diff --git a/ext/TOML/src/TOML.jl b/ext/TOML/src/TOML.jl index d92afe0743e7f..5a44ae21955a9 100644 --- a/ext/TOML/src/TOML.jl +++ b/ext/TOML/src/TOML.jl @@ -1,20 +1,16 @@ module TOML - if VERSION < v"0.6-" - eachline(args...; chomp=false) = (@assert !chomp; Base.eachline(args...)) - end - include("parser.jl") include("print.jl") - "Convert `TOML.Table` to `Dict{AbstractString,Any}`" + "Convert `TOML.Table` to `Dict{String,Any}`" function table2dict(tbl::Nullable{Table}) - isnull(tbl) && return Dict{AbstractString,Any}() + isnull(tbl) && return Dict{String,Any}() return table2dict(get(tbl)) end function table2dict(tbl::Table) - ret = Dict{AbstractString,Any}() + ret = Dict{String,Any}() for (k,v) in tbl.values if isa(v, Table) ret[k] = table2dict(v) diff --git a/ext/TOML/src/parser.jl b/ext/TOML/src/parser.jl index 03833c240e3e2..56ecb26367024 100644 --- a/ext/TOML/src/parser.jl +++ b/ext/TOML/src/parser.jl @@ -1,14 +1,14 @@ NONE() = Nullable() -NONE{T}(::Type{T}) = Nullable{T}() -SOME{T}(v::T) = Nullable{T}(v) +NONE(::Type{T}) where {T} = Nullable{T}() +SOME(v::T) where {T} = Nullable{T}(v) "TOML Table" -type Table - values::Dict{AbstractString,Any} +mutable struct Table + values::Dict{String,Any} defined::Bool end -Table(defined::Bool) = Table(Dict{AbstractString,Any}(), defined) +Table(defined::Bool) = Table(Dict{String,Any}(), defined) function Base.show(io::IO, tbl::Table, level::Int=1) Base.print(io, "T($(tbl.defined)){\n") for (k,v) in tbl.values @@ -34,14 +34,14 @@ Base.getindex(tbl::Table, key::AbstractString) = tbl.values[key] Base.haskey(tbl::Table, key::AbstractString) = haskey(tbl.values ,key) "Parser error exception" -type ParserError <: Exception +mutable struct ParserError <: Exception lo::Int hi::Int msg::String end "TOML Parser" -type Parser +mutable struct Parser input::IO errors::Vector{ParserError} @@ -50,7 +50,7 @@ end Parser(input::String) = Parser(IOBuffer(input)) Base.error(p::Parser, l, h, msg) = push!(p.errors, ParserError(l, h, msg)) Base.eof(p::Parser) = eof(p.input) -Base.position(p::Parser) = position(p.input)+1 +Base.position(p::Parser) = Int(position(p.input))+1 Base.read(p::Parser) = read(p.input, Char) "Rewind parser input on `n` characters." @@ -58,7 +58,7 @@ function rewind(p::Parser, n=1) pos = position(p.input) pos == 0 && return 0 skip(p.input, -n) - return position(p.input) + return Int(position(p.input)) end "Converts an offset to a line and a column in the original source." diff --git a/ext/TOML/test/runtests.jl b/ext/TOML/test/runtests.jl index b6a707ccced9f..7fd08df9c01c3 100644 --- a/ext/TOML/test/runtests.jl +++ b/ext/TOML/test/runtests.jl @@ -506,7 +506,7 @@ trimmed in raw strings. a = [2] [[a]] b = 5 - ", "expected type `TOML.Table`, found type `Int64`") + ", "expected type `TOML.Table`, found type `$(Int)`") @fail(" a = 1 [a.b]