From b535f43fc5604809ac708d512bee2bad93a78b13 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 30 Jul 2015 15:32:46 -0700 Subject: [PATCH] further tree/*.json.hook uncoupling --- tree/kids/json.hook | 9 --------- tree/snip/json.hook | 27 +++++++++++++++++++++------ tree/util.hoon | 21 --------------------- 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/tree/kids/json.hook b/tree/kids/json.hook index 55c49e1b5c..4490a43e6e 100644 --- a/tree/kids/json.hook +++ b/tree/kids/json.hook @@ -2,23 +2,14 @@ :::: /hook/json/kids/tree :: /? 314 -/= gas /$ fuel /= dat /: /=== /^ (map ,@ta json) /% 2 /_ /react-json/ -:: -:::: - :: -// /%%%/util -:: -[util=. +>] -:: !: :::: :: ^- json -=+ ~(. util gas) %+ joba %kids =- [%a (turn (~(tap by dat)) -)] |= [a=span b=json] diff --git a/tree/snip/json.hook b/tree/snip/json.hook index 33d090ab33..edc65d6848 100644 --- a/tree/snip/json.hook +++ b/tree/snip/json.hook @@ -2,7 +2,6 @@ :::: /hook/json/snip/tree :: /? 314 -/= gas /$ fuel /= dat /: /=== /^ (map ,@ta json) /% 2 @@ -10,15 +9,31 @@ :: :::: :: -// /%%%/util -:: -[util=. +>] -:: +|% +++ baff |*([a=(unit) b=(trap)] ?^(a a *b)) +++ find-in-tree + |* [paz=fist:jo fun=$+(* (unit))] + |= a=json ^+ *fun + %+ biff (paz a) + |* [b=(list json) c=*] ^+ *fun + %+ baff (fun c) + |. + ?~ b ~ + (baff ^^$(a i.b) |.(^$(b t.b))) +++ json-front + |= a=json ^- json + =- (fall `(unit json)`- ~) + %+ biff ((ot body/some ~):jo a) + %+ find-in-tree (ot c/(ar some) gn/so ga/(om so) ~):jo + |= [nom=span atr=(map span cord)] ^- (unit json) + ?. (~(has by atr) 'urb:front') ~ + ?> ?=(%meta nom) + (biff (~(get by atr) %value) poja) +-- !: :::: :: ^- json -=+ ~(. util gas) %+ joba %snip =- [%a (turn (~(tap by dat)) -)] |= [a=span b=json] diff --git a/tree/util.hoon b/tree/util.hoon index fd4c8d367e..2691c70b5d 100644 --- a/tree/util.hoon +++ b/tree/util.hoon @@ -1,26 +1,5 @@ !: |_ gas=epic -++ baff |*([a=(unit) b=(trap)] ?^(a a *b)) -++ find-in-tree - |* [paz=fist:jo fun=$+(* (unit))] - |= a=json ^+ *fun - %+ biff (paz a) - |* [b=(list json) c=*] ^+ *fun - %+ baff (fun c) - |. - ?~ b ~ - (baff ^^$(a i.b) |.(^$(b t.b))) -:: -++ json-front - |= a=json ^- json - =- (fall `(unit json)`- ~) - %+ biff ((ot body/some ~):jo a) - %+ find-in-tree (ot c/(ar some) gn/so ga/(om so) ~):jo - |= [nom=span atr=(map span cord)] ^- (unit json) - ?. (~(has by atr) 'urb:front') ~ - ?> ?=(%meta nom) - (biff (~(get by atr) %value) poja) -:: ++ get-path ^- path (tope bem.gas(s but.gas))