Skip to content

Commit

Permalink
less error prone scan_string
Browse files Browse the repository at this point in the history
  • Loading branch information
cryi committed Oct 24, 2023
1 parent 015a137 commit 52c3389
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions hjson/decoder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@ function HjsonDecoder:new(strict, object_hook, object_pairs_hook)
chunks = chunks .. content

if terminator == exitCh then
return false -- break
return true -- break
elseif terminator == '"' or terminator == "'" then
chunks = chunks .. terminator
return true -- continue
return -- continue
elseif terminator ~= "\\" then
if strict then
decodeError(s, begin, "Invalid control character " .. terminator)
else
chunks = chunks .. terminator
return true -- continue
return -- continue
end
end

Expand Down Expand Up @@ -206,9 +206,8 @@ function HjsonDecoder:new(strict, object_hook, object_pairs_hook)
end
end
chunks = chunks .. chars
return true
end
while scan_string() do end
while not scan_string() do end
return chunks, _end
end

Expand Down

0 comments on commit 52c3389

Please sign in to comment.