From 133cbbb6aeac7327d5c69393aae354065dff7c92 Mon Sep 17 00:00:00 2001 From: pkova Date: Tue, 26 Nov 2019 15:19:00 +0200 Subject: [PATCH] zuse: implement json number to @rd parsing --- bin/solid.pill | 4 ++-- pkg/arvo/sys/zuse.hoon | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/bin/solid.pill b/bin/solid.pill index cf7291a58..86d3001d5 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0d7e3807c3159b1483220caf14fc2b96af65c05f2f761c4351c8614dc7db3cf -size 9634290 +oid sha256:17e7708b65df64f3d8a69f360b5eccdb96dec87dd1e1c60658be834b40f066ce +size 9627978 diff --git a/pkg/arvo/sys/zuse.hoon b/pkg/arvo/sys/zuse.hoon index 7c03fb2d6..fc337aa0d 100644 --- a/pkg/arvo/sys/zuse.hoon +++ b/pkg/arvo/sys/zuse.hoon @@ -5453,6 +5453,39 @@ |= cis/coin ?. ?=({$$ case} cis) ~ `(unit beam)`[~ [who dex `case`p.cis] (flop t.t.t.pax)] + :: + ++ json-rn :: json to rn parser + %+ knee *rn |. + ;~ plug + (easy %d) + ;~(pose (cold | hep) (easy &)) + ;~ plug dim:ag + ;~ pose + ;~ pfix dot + %+ sear + |= a=tape + =/ b (rust a dum:ag) + ?~ b ~ + (some [(lent a) u.b]) + (plus (shim '0' '9')) + == + (easy [0 0]) + == + ;~ pose + ;~ pfix + (just 'e') + ;~ plug + ;~(pose (cold | hep) (easy &)) + ;~ pose + ;~(pfix (plus (just '0')) dim:ag) + dim:ag + == + == + == + (easy [& 0]) + == + == + == :: :: ++enjs:format ++ enjs ^? :: json encoders |% @@ -5571,9 +5604,9 @@ :: :: ++ne:dejs:format ++ ne :: number as real |= jon/json - ^- (unit @rd) - :: please implement me, it's not that hard! - !! + ^- @rd + ?> ?=([%n *] jon) + (rash p.jon (cook ryld (cook royl-cell:^so json-rn))) :: :: ++ni:dejs:format ++ ni :: number as integer |= jon/json @@ -5784,7 +5817,8 @@ ++ ne :: number as real |= jon/json ^- (unit @rd) - !! + ?. ?=([%n *] jon) ~ + (rush p.jon (cook ryld (cook royl-cell:^so json-rn))) :: ++ ni :: number as integer |= jon/json