hoon: batch comment doccords inside of cores

changes $whit to have a (unit link) instead of (unit term). this holds
the identifier for where a comment is supposed to go. changes to parsers
in docs:vast to accomodate this.

this only allows for batch comments written for arms within a given
core. someday, the feature should allow you to write comments
virtually anywhere. the (unit link) in $whit should become a (unit (list
link)) to accommodate this
This commit is contained in:
drbeefsupreme 2022-06-28 12:05:29 -04:00
parent 8cd919b936
commit efe01b815a

View File

@ -6309,6 +6309,7 @@
[%cone p=aura q=atom] :: %constant [%cone p=aura q=atom] :: %constant
[%frag p=term] :: .leg [%frag p=term] :: .leg
[%funk p=term] :: +arm [%funk p=term] :: +arm
[%grog p=term] :: $mold
== :: == ::
+$ crib [summary=cord details=(list sect)] :: +$ crib [summary=cord details=(list sect)] ::
+$ help [links=(list link) =crib] :: documentation +$ help [links=(list link) =crib] :: documentation
@ -6601,7 +6602,7 @@
+$ vein (list (unit axis)) :: search trace +$ vein (list (unit axis)) :: search trace
+$ sect (list pica) :: paragraph +$ sect (list pica) :: paragraph
+$ whit :: +$ whit ::
$: lab=(unit term) :: label $: lab=(unit link) :: label
boy=(unit (pair cord (list sect))) :: body boy=(unit (pair cord (list sect))) :: body
def=(map term (pair cord (list sect))) :: definitions def=(map term (pair cord (list sect))) :: definitions
use=(set term) :: defs used use=(set term) :: defs used
@ -11584,22 +11585,44 @@
++ docs ++ docs
|% |%
:: ::
:: above core :: +apex: above hoon
::
++ apex ++ apex
%+ cook
|= $: a=(unit (pair cord (list sect)))
b=(map term (pair cord (list sect)))
c=(set term)
==
[*(unit link) a b c]
;~ plug ;~ plug
=/ ron (punt (indo noel))
(punt (ifix [ron ron] (into head))) :: label
::
=/ ron (punt (indo null)) =/ ron (punt (indo null))
(ifix [ron ron] (punt body)) :: body (ifix [ron ron] (punt body)) :: body
:: ::
(cook malt (star fill)) :: definitions (cook malt (star fill)) :: definitions
::
(easy ~) :: defs used (none) (easy ~) :: defs used (none)
== ==
:: ::
:: backward line :: +vext: parser for batch comments inside of cores
++ vext
%- star
;~ less
:: find a better fail condition than this
;~(plug gap lus lus)
;~(plug gap lus buc)
;~(plug gap lus tar)
;~ plug
(ingo (punt dibs)) :: link
::
=/ ron (punt (indo null))
(ifix [ron ron] (punt shot)) :: body
::
(cook malt (star fill)) :: definitions
::
(easy ~) :: defs used (none)
==
==
:: ::
:: +apse: backward line
++ apse ++ apse
;~ pose ;~ pose
%+ cook |=([a=term b=cord] %*(. *whit def (my [a b ~] ~))) %+ cook |=([a=term b=cord] %*(. *whit def (my [a b ~] ~)))
@ -11611,17 +11634,6 @@
(easy *whit) (easy *whit)
== ==
:: ::
::
++ beer
|= $: lab=(unit term)
boy=(unit (pair cord (list sect)))
def=(list (pair (pair term cord) (list sect)))
==
^- whit
=; def [lab boy (malt def) ~]
(turn def |=([[a=term b=cord] c=(list sect)] [a [b c]]))
::
::
++ body ++ body
;~ pose ;~ pose
;~ plug :: can duplicate :: ;~ plug :: can duplicate ::
@ -11634,37 +11646,59 @@
== ==
== ==
:: ::
:: +dibs: parses a $link at the start of a formal comment
++ dibs
%+ cook |=([a=term b=term] ;;(link [a b]))
%- stew
^. stet ^. limo
:~ :- '|'
;~(pfix bar (stag %chat sym))
:- '.'
;~(pfix dot (stag %frag sym))
:- '+'
;~(pfix lus (stag %funk sym))
:- '$'
;~(pfix buc (stag %grog sym))
==
++ shot
;~(plug ;~(sfix line (just `@`10) (punt gap)) (rant ;~(less tine text)))
::
++ text (pick line code) :: text line ++ text (pick line code) :: text line
++ line ;~(less ace (cook crip (star prn))) :: prose line ++ line ;~(less ace (cook crip (star prn))) :: prose line
++ code ;~(pfix step step (cook crip (star prn))) :: code line ++ code ;~(pfix step step (cook crip (star prn))) :: code line
++ noel ;~(plug (punt ;~(pfix step hax)) null) :: header padding ++ noel ;~(plug (punt ;~(pfix step hax)) null) :: header padding
++ head ;~(pfix hax step cen sym) :: header line
++ null (cold ~ (star ace)) :: blank line ++ null (cold ~ (star ace)) :: blank line
++ fine :: definition line ++ fine :: definition line
;~ (glue ;~(plug col ace)) ;~ (glue ;~(plug col ace))
sym sym
(cook crip (star prn)) (cook crip (star prn))
== ==
++ tine
;~ (glue ;~(plug col ace))
dibs
(cook crip (star prn))
==
:: ::
:: :: +step: indent
:: step: indent :: +into: :: and indent to end of line, consuming following space.
:: into: :: and indent to end of line, consuming following space. :: +indo: :: to end of line, consuming following space.
:: indo: :: to end of line, consuming following space. :: +exit: :: to end of line, not consuming following space.
:: exit: :: to end of line, not consuming following space. :: +ingo: :: then consume, followed by col ace
:: ::
++ step ;~(plug ace ace) ++ step ;~(plug ace ace)
++ into |*(bod=rule (indo ;~(pfix step bod))) ++ into |*(bod=rule (indo ;~(pfix step bod)))
::
++ indo ++ indo
|* bod=rule |* bod=rule
;~(pfix col gar ;~(sfix bod (just `@`10) (punt gap))) (ifix [;~(plug col gar) ;~(plug (just `@`10) (punt gap))] bod)
++ ingo
|* bod=rule
(ifix [;~(plug col gar step) ;~(plug col ace)] bod)
:: ::
++ exit ++ exit
|* bod=rule |* bod=rule
;~(pfix (star ace) col gal step bod) ;~(pfix (star ace) col gal step bod)
:: ::
:: fill: full definition :: +fill: full definition
::
++ fill ++ fill
%+ cook |=([[a=term b=cord] c=(list sect) (unit ~)] [a b c]) %+ cook |=([[a=term b=cord] c=(list sect) (unit ~)] [a b c])
;~ plug ;~ plug
@ -11673,13 +11707,12 @@
(punt (indo null)) (punt (indo null))
== ==
:: ::
:: rant: series of sections. :: +rant: series of sections.
::
++ rant ++ rant
|* sec=rule |* sec=rule
%- star %- star
;~ pfix ;~ pfix
(indo null) (punt (indo null)) :: why did i need to add a punt here?
(plus (into sec)) (plus (into sec))
== ==
-- --
@ -13278,14 +13311,25 @@
++ boog !: :: core arms ++ boog !: :: core arms
%+ knee [p=*term q=*hoon] |. ~+ %+ knee [p=*term q=*hoon] |. ~+
%+ cook %+ cook
|= [a=whit b=term c=whit d=hoon] |= [a=(list whit) b=term d=hoon]
=/ e=whit (glom a c) |-
?~ boy.e :: no arm docs ?~ a [b d]
[b d] ?~ lab.i.a $(a t.a)
[b [%note help+[[%funk b]~ u.boy.e] d]] ?~ boy.i.a $(a t.a)
%= $
a t.a
d [%note help+[[u.lab.i.a]~ u.boy.i.a] d]
==
;~ pose ;~ pose
%+ cook
|= [a=(list whit) b=term c=whit d=hoon]
?: =([~ ~ ~ ~] c)
[a b d]
?~ boy.c
[a b d]
[a b [%note help+[[funk+b]~ u.boy.c] d]]
;~ plug ;~ plug
apex:docs vext:docs
;~ pfix (jest '++') ;~ pfix (jest '++')
;~ plug ;~ plug
;~(pfix gap ;~(pose (cold %$ buc) sym)) ;~(pfix gap ;~(pose (cold %$ buc) sym))
@ -13296,10 +13340,14 @@
== ==
:: ::
%+ cook %+ cook
|= [a=whit b=term c=whit d=spec] |= [a=(list whit) b=term c=whit d=spec]
[a b c [%ktcl [%name b d]]] ?: =([~ ~ ~ ~] c)
[a b [%ktcl [%name b d]]]
?~ boy.c
[a b [%ktcl [%name b d]]]
[a b [%note help+[[grog+b]~ u.boy.c] [%ktcl [%name b d]]]]
;~ plug ;~ plug
apex:docs vext:docs
;~ pfix (jest '+$') ;~ pfix (jest '+$')
;~ plug ;~ plug
;~(pfix gap sym) ;~(pfix gap sym)
@ -13310,10 +13358,9 @@
== ==
:: ::
%+ cook %+ cook
|= [a=whit b=term d=hoon] |= [b=term d=hoon]
[a b *whit d] [*(list whit) b d]
;~ plug ;~ plug
apex:docs :: this doesn't work, not sure why yet
%+ cook %+ cook
|= [b=term c=(list term) e=spec] |= [b=term c=(list term) e=spec]
^- [term hoon] ^- [term hoon]
@ -13356,9 +13403,12 @@
:: lestify :: lestify
|= a=(list term) |= a=(list term)
?~(a !! a) ?~(a !! a)
::
++ whap !: :: chapter ++ whap !: :: chapter
%+ cook %+ cook
|= a=(list (pair term hoon)) |= a=(list (pair term hoon))
:: check hoons for notes and move them to the correct arm
%- glow
|- ^- (map term hoon) |- ^- (map term hoon)
?~ a ~ ?~ a ~
=+ $(a t.a) =+ $(a t.a)
@ -13369,6 +13419,44 @@
q.i.a q.i.a
(most muck boog) (most muck boog)
:: ::
:: +glow: moves batch comments to the correct arm
++ glow
|= dab=(map term hoon)
^- (map term hoon)
:: strips each hoon of wrapped help notes and puts them in a list
=/ [duds=(list help) nude=(map term hoon)]
%+ ~(rib by dab) *(list help)
|= [[a=term gen=hoon] duds=(list help)]
^- [(list help) [term hoon]]
|-
?. ?=([%note *] gen)
[duds [a gen]]
?. ?=([%help *] p.gen)
[duds [a gen]]
%= $
gen q.gen
duds (snoc duds p.p.gen)
==
|-
?~ duds nude
:: if there is no link, its not part of a batch comment
?~ links.i.duds
$(duds t.duds)
=/ nom=term
?- i.links.i.duds
[%cone *]
q.i.links.i.duds
::
?([%chat *] [%frag *] [%funk *] [%grog *])
p.i.links.i.duds
==
%= $
duds t.duds
nude ?. (~(has by nude) nom)
~&(nom+'unmatched link' nude)
(~(jab by nude) nom |=(a=hoon [%note help+i.duds a]))
==
::
++ whip :: chapter declare ++ whip :: chapter declare
;~ plug ;~ plug
(ifix [cen gap] sym) (ifix [cen gap] sym)
@ -13402,7 +13490,7 @@
:_ (~(uni by q.mor) q.wap.i.a) :_ (~(uni by q.mor) q.wap.i.a)
%+ ~(put by p.mor) %+ ~(put by p.mor)
p.wap.i.a p.wap.i.a
:- boy.wit.i.a :: body of the whit set as the what :- boy.wit.i.a :: body of the whit set as the what
?. (~(has by p.mor) p.wap.i.a) ?. (~(has by p.mor) p.wap.i.a)
q.wap.i.a q.wap.i.a
[[%$ [%eror (weld "duplicate chapter: |" (trip p.wap.i.a))]] ~ ~] [[%$ [%eror (weld "duplicate chapter: |" (trip p.wap.i.a))]] ~ ~]