Skip to content

Commit

Permalink
parameterize IO in TOML parser (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Feb 5, 2018
1 parent d96e19b commit a221919
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ext/TOML/src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ Base.getindex(tbl::Table, key::AbstractString) = tbl.values[key]
Base.haskey(tbl::Table, key::AbstractString) = haskey(tbl.values ,key)

"Parser error exception"
mutable struct ParserError <: Exception
struct ParserError <: Exception
lo::Int
hi::Int
msg::String
end

"TOML Parser"
mutable struct Parser
input::IO
struct Parser{IO_T <: IO}
input::IO_T
errors::Vector{ParserError}

Parser(input::IO) = new(input, ParserError[])
Parser(input::IO_T) where {IO_T <: IO} = new{IO_T}(input, ParserError[])
end
Parser(input::String) = Parser(IOBuffer(input))
Base.error(p::Parser, l, h, msg) = push!(p.errors, ParserError(l, h, msg))
Expand Down

0 comments on commit a221919

Please sign in to comment.