Skip to content

Commit

Permalink
buffer in parse using IOBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
WestleyArgentum committed Jun 3, 2013
1 parent 17d8005 commit e11ba30
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/JSON.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ function parse(io::IO)
open_bracket, close_bracket = determine_bracket_type(io)
num_brackets_needed = 1

obj = [open_bracket]
obj = IOBuffer()
write(obj, open_bracket)

while num_brackets_needed > 0
c = read(io, Char)
push!(obj, c)
write(obj, c)

if c == open_bracket
num_brackets_needed += 1
Expand All @@ -106,7 +108,7 @@ function parse(io::IO)
end
end

JSON.parse(join(obj))
JSON.parse(takebuf_string(obj))
end

function parse(io::AsyncStream)
Expand Down

0 comments on commit e11ba30

Please sign in to comment.