summaryrefslogtreecommitdiff
path: root/lualibs-util-jsn.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-02-04 13:50:34 +0100
committerGitHub <noreply@github.com>2017-02-04 13:50:34 +0100
commit42f669beab39df38d2f4955b651541272126a04e (patch)
treef68d918629725f9306698bf0641910d1f714714b /lualibs-util-jsn.lua
parent144f6d16fd79bd0496b3ae379b69227e0d9bbfa9 (diff)
parent1b2f8c0355210dbfd34b10ed4ff7f0c90fda062d (diff)
downloadlualibs-master.tar.gz
Merge pull request #31 from phi-gamma/masterHEADmaster
v2.5
Diffstat (limited to 'lualibs-util-jsn.lua')
-rw-r--r--lualibs-util-jsn.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/lualibs-util-jsn.lua b/lualibs-util-jsn.lua
index bbe25d8..e835c07 100644
--- a/lualibs-util-jsn.lua
+++ b/lualibs-util-jsn.lua
@@ -64,18 +64,19 @@ local jnumber = (1-whitespace-rparent-rbrace-comma)^1 / tonumber
local key = jstring
local jsonconverter = { "value",
- object = lbrace * Cf(Ct("") * V("pair") * (comma * V("pair"))^0,rawset) * rbrace,
- pair = Cg(optionalws * key * optionalws * colon * V("value")),
- array = Ct(lparent * V("value") * (comma * V("value"))^0 * rparent),
- value = optionalws * (jstring + V("object") + V("array") + jtrue + jfalse + jnull + jnumber + #rparent) * optionalws,
+ hash = lbrace * Cf(Ct("") * (V("pair") * (comma * V("pair"))^0 + optionalws),rawset) * rbrace,
+ pair = Cg(optionalws * key * optionalws * colon * V("value")),
+ array = Ct(lparent * (V("value") * (comma * V("value"))^0 + optionalws) * rparent),
+-- value = optionalws * (jstring + V("hash") + V("array") + jtrue + jfalse + jnull + jnumber + #rparent) * optionalws,
+ value = optionalws * (jstring + V("hash") + V("array") + jtrue + jfalse + jnull + jnumber) * optionalws,
}
-- local jsonconverter = { "value",
--- object = lbrace * Cf(Ct("") * V("pair") * (comma * V("pair"))^0,rawset) * rbrace,
--- pair = Cg(optionalws * V("string") * optionalws * colon * V("value")),
--- array = Ct(lparent * V("value") * (comma * V("value"))^0 * rparent),
--- string = jstring,
--- value = optionalws * (V("string") + V("object") + V("array") + jtrue + jfalse + jnull + jnumber) * optionalws,
+-- hash = lbrace * Cf(Ct("") * (V("pair") * (comma * V("pair"))^0 + optionalws),rawset) * rbrace,
+-- pair = Cg(optionalws * V("string") * optionalws * colon * V("value")),
+-- array = Ct(lparent * (V("value") * (comma * V("value"))^0 + optionalws) * rparent),
+-- string = jstring,
+-- value = optionalws * (V("string") + V("hash") + V("array") + jtrue + jfalse + jnull + jnumber) * optionalws,
-- }
-- lpeg.print(jsonconverter) -- size 181
@@ -156,3 +157,5 @@ end
-- inspect(tmp)
-- inspect(json.tostring(true))
+
+return json