urbit/pkg/arvo/ted/graph/eval.hoon

37 lines
880 B
Plaintext
Raw Normal View History

2020-12-11 08:51:29 +03:00
/- spider, graph=graph-store
/+ strandio, resource, graph-view
::
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([~ =action:graph-view] arg)
?> ?=(%eval -.action)
;< =bowl:spider bind:m get-bowl:strandio
=/ ast=(unit hoon)
(rush cord.action vest)
?~ ast
(pure:m !>(`tang`[%leaf "Syntax Error"]~))
=/ fowl=[our=@p now=@da eny=@uvJ]
:+ our.bowl
now.bowl
(shaz (cat 3 (mix [now eny]:bowl) %eny))
::
=/ subject [fowl ..zuse]
=/ minted=(each [=type =nock] (list tank))
%- mule |.
(~(mint ut -:!>(subject)) %noun u.ast)
?: ?=(%| -.minted) (pure:m !>(p.minted))
=/ =toon
(mock [subject nock.p.minted] |=(^ ~))
%- pure:m
!> ^- tang
?- -.toon
%0 [(sell type.p.minted p.toon) ~]
%1 :- leaf+".^ unsupported in chat eval"
(turn ;;((list path) p.toon) smyt)
%2 [leaf+"crash!" p.toon]
==