From 52c3389bc09759f1d48e42468a63dc5fc574b19c Mon Sep 17 00:00:00 2001 From: cryi Date: Tue, 24 Oct 2023 18:33:00 +0200 Subject: [PATCH] less error prone scan_string --- hjson/decoder.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hjson/decoder.lua b/hjson/decoder.lua index 5337fac..d159ca0 100644 --- a/hjson/decoder.lua +++ b/hjson/decoder.lua @@ -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 @@ -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