diff --git a/pkg/arvo/neo/cod/std/src/con/vase-htmx.hoon b/pkg/arvo/neo/cod/std/src/con/vase-htmx.hoon index d246be3ee6..b36ae9cf8e 100644 --- a/pkg/arvo/neo/cod/std/src/con/vase-htmx.hoon +++ b/pkg/arvo/neo/cod/std/src/con/vase-htmx.hoon @@ -1,5 +1,165 @@ +=/ prelude !>(.) :- [%vase %$ %htmx] |= vax=vase |= =bowl:neo -;/ -(of-wall:format (~(win re (sell vax)) 0 80)) +=/ depth=@ud 2 +=/ ty p.vax +|- ^- manx +=* loop $ +|^ ^- manx +?: =(depth 0) + ;/ "Bottoming out" +=/ arms (slow:neo ty) +=/ items=(list item:dprint:neo) + (zing (turn arms |=(ls=(list term) `(list item:dprint:neo)`(drop (find-item-in-type:dprint:neo ls ty))))) +;div + ;* (turn items print-item) +== +++ print-item + |= val=item:dprint:neo + ^- manx + ?+ -.val ;/ "Unsupported {(trip -.val)}" + %core (print-core +.val) + %chapter (print-chapter +.val) + %arm (print-arm +.val) + %view + ;div + ;* (turn items.val print-overview-item) + == + == +++ print-overview-item + |= tim=overview-item:dprint:neo + ^- manx + ?- -.tim + %header (print-overview-header +.tim) + %item (print-overview-item-actual +.tim) + == +++ print-overview-header + |= [doc=what children=overview:dprint:neo] + ^- manx + ;div + ;* (print-what "" doc) + :+ (print-overview children) + == +++ print-overview-item-actual + |= [name=tape doc=what] + ;div + ;div: {name} + ;* (print-what "" doc) + == +++ print-core + |= $: name=tape :: arm that built it + docs=what :: + sut=type :: [%core *] + children=(unit item:dprint:neo) :: compiled against + == + ^- manx + ;div + ;h3 + ; Core + ; {name} + == + ;div + ;* (print-what "" docs) + ;div: Children + ;+ loop(ty sut) + == + == +++ print-chapter + |= $: name=tape :: name of chapter + docs=what :: + sut=type :: [%core *] + tom=tome :: tome of chapter + == + ^- manx + ;div + ;h3 + ; Chapter + ; {name} + == + ;div + ;* (print-what "Overview" docs) + ;* (print-what "Tome" p.tom) + ;* + %+ turn ~(tap by q.tom) + |= [=term =hoon] + ^- manx + ;span: Arm {(trip term)} + :: loop(vax (slap sut wing/~[term]), depth (dec depth)) + :: loop(ty (~(play ut sut) hoon), depth (dec depth)) + == + == +++ print-arm + |= $: + name=tape :: arm name + adoc=what :: arm doc + pdoc=what :: product doc + cdoc=what :: $ arm/prod doc + gen=hoon :: arm hoon AST + sut=type :: subject of arm + == + =/ t (~(play ut sut) gen) + + ^- manx + ;div + ;h3 + ; + + ; {name} + == + ;div + ;details + ;summary: Signature + ;code + ;pre + ;* + %+ turn (wash [0 80] ~(duck easy-print:neo t)) + |= tap=tape + ;div: {tap} + == + == + == + ;div: Docs + ;* (print-what "" adoc) + ;* (print-what "Product" pdoc) + ;* (print-what "$" cdoc) + == + ;div: Children + ;+ + loop(ty (~(play ut ty) gen), depth (dec depth)) + == +:: +++ print-what + |= [name=tape wat=what] + ^- (list manx) + ?~ wat + ~ + :_ ~ + ?: =(~ q.u.wat) + ;div + ; {(trip p.u.wat)} + == + ;details + ;summary + ; {(trip p.u.wat)} + == + ;div + ;* (turn q.u.wat print-sect) + == + == +++ print-sect + |= sec=sect + ^- manx + ;div.p2 + ;* (turn sec print-pica) + == +++ print-pica + |= pic=pica + ^- manx + ?: p.pic + ;div.prose + ; {(trip q.pic)} + == + ;code + ; {(trip q.pic)} + == +-- diff --git a/pkg/arvo/neo/cod/std/src/imp/hawk-eyre-handler.hoon b/pkg/arvo/neo/cod/std/src/imp/hawk-eyre-handler.hoon index 2412dfe40a..d92b7c1c7e 100644 --- a/pkg/arvo/neo/cod/std/src/imp/hawk-eyre-handler.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/hawk-eyre-handler.hoon @@ -329,7 +329,7 @@ :: ignored shrubs ?=([[%p @] %cod %grab *] heer) ?=([[%p @] %cod %grow *] heer) - ?=([[%p @] %cod %std %out *] heer) + :: ?=([[%p @] %cod %std %out *] heer) ?=([[%p @] %cod %std %pre *] heer) ?=([[%p @] %out *] heer) ?=([[%p @] %srv *] heer) diff --git a/pkg/arvo/neo/cod/std/src/imp/messenger.hoon b/pkg/arvo/neo/cod/std/src/imp/messenger.hoon index 15ab034683..60a2566350 100644 --- a/pkg/arvo/neo/cod/std/src/imp/messenger.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/messenger.hoon @@ -2,7 +2,6 @@ /@ dm-diff /@ groupchat-diff /@ messenger-diff -^- kook:neo => |% ++ send-invites @@ -18,8 +17,21 @@ :: |% ++ state pro/%messenger -++ poke (sy %dm-diff %groupchat-diff %messenger-diff ~) +:: +poke: The poke types +:: +:: We allow for the three different kinds of diffs that we support +:: +++ poke + :: %dm-diff is for creating DMs + (sy %dm-diff %groupchat-diff %messenger-diff ~) +:: +kids: Children for messenger ++ kids + :: Child constraints + :: + :: All children under this tree either are DMs, or groupchats + :: Dms are identified by @p + :: Groupchats are identified by [@p @t] + :: :+ ~ %y %- ~(gas by *lads:neo) :~ :- [&/%dms |/%p |] @@ -29,7 +41,7 @@ == ++ deps *deps:neo ++ form - ^- form:neo + :: ^- form:neo |_ [=bowl:neo =aeon:neo state=pail:neo] ++ init |= old=(unit pail:neo) diff --git a/pkg/arvo/neo/cod/std/src/lib/deco.hoon b/pkg/arvo/neo/cod/std/src/lib/deco.hoon new file mode 100644 index 0000000000..0773c879a0 --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/lib/deco.hoon @@ -0,0 +1,189 @@ +:: Hoon doccords sample +:: +:: this is a sample file designed to explain syntax and conventions +:: for doccords +:: +:: all lines must be under 80 characters. no blank lines. +:: any line longer than 60 characters is probably too long. +:: uppercase or non-ascii letters are strongly discouraged. +:: +:: whenever possible, use formal decorations. {::} decorates +:: the next expression when put on its own line, and the previous +:: expression if written on the same line +:: +:: there are two places to put decorations: in line with the +:: code, and on the right margin. +:: +:: the file below is a well-commented library, built around +:: a typical two-core structure. the cores are labeled {%arch} +:: (structures) and {%work} (productions). +:: +:: this code is written to display the variety of formatting +:: options the parser allows. a specific convention should pick +:: one of these styles and stick to it. +:: +:: there are three ways to mark the beginning of a formal comment: +:: 1- {:: $foo:} +:: 2- {:: +bar:} +:: 3- {:: } +:: +:: style 1 may optionally be followed by a series of paragraphs, where each +:: paragraph is preceded by a line containing only {::} and whitespace, and +:: each line of a given paragraph is preceded by four aces. +:: {::} +:: {:: more text} +:: {:: even more text} +:: {::} +:: {:: |=(code=hoon !!)} +:: +:: style 2 is much like style 1, but paragraphs are indented by two spaces +:: instead of four. +:: {::} +:: {:: more text} +:: {:: even more text} +:: {::} +:: {:: |=(code=hoon !!)} +:: +:: code is indented a total of six aces, for either style. +:: +:: style 3 is used to annotate the hoon or spec that immediately follows +:: the comment. paragraphs are written with style 2. +:: +:: the $foo and +bar above are examples of *lexical locations* for +:: style and batch-commenting purposes. this tells the parser to attempt +:: to attach the comment to the specified location. these locations +:: may be written as follows: +:: - `|foo` means a chapter +:: - `%foo` means a constant +:: - `.foo` means a face +:: - `+foo` means an arm +:: - `$foo` means a spec +:: - `^foo` means a core +:: - `_foo` means a door +:: - `=foo` means a gate +:: - `/foo` means a file path segment +:: +:: thus /lib/foo^widget|initial=open means the =open gate in the |initial +:: chapter of the ^widget core in the /foo library +:: +:: at present, doccords does not support lexical locations in full. +:: only single-element locations of the form `$foo` and `+foo` are supported, +:: and must be written above an arm in the core to which they are to be +:: attached, and after the chapter they are in (if the core has chapters). +:: you may still write doccords for other locations in anticipation of the +:: fully supported lexical location, but they will be thrown away before they +:: make it to the compiler. +:: +:: a postfix formal comment will either attach to hoon or spec on the +:: current line, or the arm name if there is no hoon or spec on the +:: line. the convention for +$ arms is that the comment attached to the +:: arm is about the mold itself, while the comment attached to the spec +:: is about the output type of the mold. +:: +:: to inspect doccords in this file from dojo, try the following: +:: +:: > =deco -build-file %/lib/deco/hoon +:: > # deco +:: > # deco/arch +:: > # deco/arch/molds +:: > # deco/arch/molds/goof +:: +:: > ?? *goof:deco +:: +=> :: + :: structures for our imaginary hello, world generator. + :: + :: nothing forces us to put structures in a separate core. + :: but compile-time evaluation doesnt work in the current + :: core; we often want to statically evaluate structures. + :: + :: there are three kinds of structures: moldss (normalizing + :: functions), mold builders (functions that build molds), and + :: constants (static data). + :: + :: most code will not need its own mold builders. but put them + :: in a separate chapter (separated by {+|}). + |% + :: molds are functions that normalize nouns. + :: + :: arms producing molds are introduced with {+$}. the + :: compiler will copy the arm decoration onto its product + +| %molds + :: $jam: some delicious jam + :: $jelly: different from jam? + +$ spot [p=@ q=@] :: a coordinate + +$ tops :: mold for coordinate + [p=@ q=@] :: another coordinate + +$ goof :: a simple tuple mold + $: foo=@ :: something mysterious + bar=@ :: go here for drink + moo=(binary-tree juice) :: cows do this + == + +$ juice :: fruity beverage mold + $% [%plum p=@] :: fresh prune + [%pear p=@ q=@] :: good for cider + [%acai p=@] :: aztec superfood + == + +$ jam @tas + +$ jelly @tas + :: mold builders are functions that build molds from other molds + :: + :: other languages might call these "type constructors" + :: or "higher-kinded types". + +| %mold-builders + ++ binary-tree :: tree mold builder + |* a=$-(* *) + $@(~ [n=a l=(binary-tree a) r=(binary-tree a)]) + :: + :: if you have constants, put them in their own chapter. + +| %constant + ++ answer :: answer to everything + 42 + -- +:: engines for our imaginary hello, world app. +:: +|% +:: +default-jam: bunts $jam +:: +default-juice: bunts $juice +++ say-hello :: say hi to someone + :: friendly welcome message + :: + |= + :: .txt: friend to say hi to + :: + txt=term + ^- tape + "hello, {(rip 3 txt)}" +:: +say-goodbye: say a really proper goodbye +:: +:: some paragraphs about the goodbye algorithm, possibly +:: including code indented by four extra spaces: +:: +:: ?: =(%hello %world) +:: %hello +:: %world +:: +++ say-goodbye + :: describe product of function + :: + |= + :: .txt: departing friend + :: .num: number of friends + $: txt=term + num=@ + == + ^- tape + :: .foo: four + :: .bar: forty-two + =/ foo (add 2 2) + =/ bar (add (mul num foo) 2) + =/ moo (mul num bar) :: for all the cows + "goodbye and {(scow %ud moo)}, {(rip 3 txt)}" +:: +++ say-minimum :: minimal decoration + |= txt=term + "nothing to say to {(rip 3 txt)}" +:: +++ default-jam *jam +++ default-juice *juice +-- diff --git a/pkg/arvo/neo/cod/std/src/lib/manx-utils.hoon b/pkg/arvo/neo/cod/std/src/lib/manx-utils.hoon index fd8c895f0b..2fbd398334 100644 --- a/pkg/arvo/neo/cod/std/src/lib/manx-utils.hoon +++ b/pkg/arvo/neo/cod/std/src/lib/manx-utils.hoon @@ -1,7 +1,5 @@ |_ a=manx -:: named -:: -:: first child with name=tape, or null +:: +named: first child with name=tape, or null :: ++ named |= name=tape @@ -12,9 +10,7 @@ =((~(gut by (malt a.g.manx)) %name "") name) ?: =(0 (lent n)) ~ `(snag 0 n) -:: get -:: -:: tape at attribute, or null +:: +get: tape at attribute, or null :: ++ get |= =mane diff --git a/pkg/arvo/sur/neo.hoon b/pkg/arvo/sur/neo.hoon index 53088de953..5ae2dfb535 100644 --- a/pkg/arvo/sur/neo.hoon +++ b/pkg/arvo/sur/neo.hoon @@ -1,3 +1,5 @@ +/+ dprint +/+ easy-print=language-server-easy-print :: $neo: New Shrub :: :: Urbit is a namespace, from a path -> data @@ -1705,8 +1707,10 @@ :: Ending with | indicates that the path match stops :: +$ pish + $+ pish $@(? [i=dita t=pish]) +$ rail + $+ rail $@(? [i=zeta t=rail]) +$ conf (map term pith) +$ crew (map term pith) @@ -2028,8 +2032,8 @@ +$ deps band :: $band: Dependencies :: -+$ band (map term fief) -+$ lads (map pish lash) ++$ band $+(band (map term fief)) ++$ lads $+(lads (map pish lash)) +$ dare ?(%y %z) +$ port (pair dare lads) +$ kids (unit port) @@ -2255,4 +2259,20 @@ ?(%t %ta %tas) (aor q.a q.b) == :: +++ dprint ^dprint +++ easy-print ^easy-print +++ slow :: get arms in core + |= typ=type + ^- (list (list term)) + ?+ typ ~ + [%hold *] $(typ ~(repo ut typ)) + [%hint *] $(typ ~(repo ut typ)) + [%core *] + %- zing + %+ turn ~(tap by q.r.q.typ) + |= [a=term b=tome] + %+ turn ~(tap by q.b) + |= [c=term *] + ~[a c] + == -- diff --git a/pkg/shrub/lib/dprint.hoon b/pkg/shrub/lib/dprint.hoon new file mode 120000 index 0000000000..70e75730fb --- /dev/null +++ b/pkg/shrub/lib/dprint.hoon @@ -0,0 +1 @@ +../../arvo/lib/dprint.hoon \ No newline at end of file diff --git a/pkg/shrub/mar/txt.hoon b/pkg/shrub/mar/txt.hoon index 4325415754..017cac25e9 120000 --- a/pkg/shrub/mar/txt.hoon +++ b/pkg/shrub/mar/txt.hoon @@ -1 +1 @@ -../../base-dev/mar/txt.hoon \ No newline at end of file +../../arvo/mar/txt.hoon \ No newline at end of file