From 264719047ad3192615c22048469192dbdf861c07 Mon Sep 17 00:00:00 2001 From: XeroOl Date: Fri, 27 Jun 2025 23:04:29 -0500 Subject: [PATCH] bump bundled dkjson to latest 2.8 --- deps/dkjson.lua | 17 ++++++++++------- tools/get-deps.fnl | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/deps/dkjson.lua b/deps/dkjson.lua index 7a86724..3bfbec2 100644 --- a/deps/dkjson.lua +++ b/deps/dkjson.lua @@ -7,11 +7,11 @@ local global_module_name = 'json' David Kolf's JSON module for Lua 5.1 - 5.4 -Version 2.7 +Version 2.8 For the documentation see the corresponding readme.txt or visit -. +. You can contact the author by sending an e-mail to 'david' at the domain 'dkolf.de'. @@ -42,8 +42,8 @@ SOFTWARE. --]==] -- global dependencies: -local pairs, type, tostring, tonumber, getmetatable, setmetatable, rawset = - pairs, type, tostring, tonumber, getmetatable, setmetatable, rawset +local pairs, type, tostring, tonumber, getmetatable, setmetatable = + pairs, type, tostring, tonumber, getmetatable, setmetatable local error, require, pcall, select = error, require, pcall, select local floor, huge = math.floor, math.huge local strrep, gsub, strsub, strbyte, strchar, strfind, strlen, strformat = @@ -52,7 +52,7 @@ local strrep, gsub, strsub, strbyte, strchar, strfind, strlen, strformat = local strmatch = string.match local concat = table.concat -local json = { version = "dkjson 2.7" } +local json = { version = "dkjson 2.8" } local jsonlpeg = {} @@ -225,6 +225,10 @@ local function addpair (key, value, prev, indent, level, buffer, buflen, tables, if indent then buflen = addnewline2 (level, buffer, buflen) end + -- When Lua is compiled with LUA_NOCVTN2S this will fail when + -- numbers are mixed into the keys of the table. JSON keys are always + -- strings, so this would be an implicit conversion too and the failure + -- is intentional. buffer[buflen+1] = quotestring (key) buffer[buflen+2] = ":" return encode2 (value, indent, level, buffer, buflen + 2, tables, globalorder, state) @@ -392,7 +396,7 @@ local function loc (str, where) break end end - return "line " .. line .. ", column " .. (where - linepos) + return strformat ("line %d, column %d", line, where - linepos) end local function unterminated (str, what, where) @@ -511,7 +515,6 @@ end local scanvalue -- forward declaration local function scantable (what, closechar, str, startpos, nullval, objectmeta, arraymeta) - local len = strlen (str) local tbl, n = {}, 0 local pos = startpos + 1 if what == 'object' then diff --git a/tools/get-deps.fnl b/tools/get-deps.fnl index 27da844..b5675fc 100644 --- a/tools/get-deps.fnl +++ b/tools/get-deps.fnl @@ -9,10 +9,10 @@ (local fennel-version "1.5.3") (local faith-version "0.2.0") (local penlight-version "1.14.0") -(local dkjson-version "2.7") +(local dkjson-version "2.8") ;; dkjson is hosted over http (unencrypted), so I check to make sure the file's not been tampered -(local dkjson-md5sum "94320e64e95f9bb5b06d9955e5391a78 build/dkjson.lua") -(local dkjson-sha1sum "6926b65aa74ae8278b6c5923c0c5568af4f1fef1 build/dkjson.lua") +(local dkjson-md5sum "6bdfb30f5e192315ad0bb249f1d48e72 build/dkjson.lua") +(local dkjson-sha1sum "19b27918b411b52b1c2b0061dd479672cb746687 build/dkjson.lua") ;; get fennel