mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-11 08:55:23 +03:00
language-server: convert to fusion
This commit is contained in:
parent
fd26b2184e
commit
2c2e16df7a
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d86877601e9038c205c3ee2e2dfc646c5d3cfc6c7d144a5b5bc14e1241a9f116
|
||||
size 13136154
|
||||
oid sha256:51ea2b84964f7ae79c6c10a17610e6f812e7842659db852aaed4a9c94f20f21b
|
||||
size 13136190
|
||||
|
@ -101,7 +101,7 @@
|
||||
=^ cards state
|
||||
?+ sign-arvo (on-arvo:def wire sign-arvo)
|
||||
[%e %bound *] `state
|
||||
[%f *] (handle-build:lsp wire +.sign-arvo)
|
||||
[%c *] (handle-build:lsp wire +.sign-arvo)
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
@ -240,42 +240,25 @@
|
||||
`state
|
||||
::
|
||||
++ handle-build
|
||||
|= [=path =gift:able:ford]
|
||||
|= [=path =gift:able:clay]
|
||||
^- (quip card _state)
|
||||
?> ?=([%made *] gift)
|
||||
?. ?=([%complete *] result.gift)
|
||||
[~ state]
|
||||
?> ?=([%writ *] gift)
|
||||
=/ uri=@t
|
||||
(snag 1 path)
|
||||
=/ =build-result:ford
|
||||
build-result.result.gift
|
||||
?+ build-result [~ state]
|
||||
::
|
||||
[%success %plan *]
|
||||
=. preludes
|
||||
(~(put by preludes) uri -:vase.build-result)
|
||||
=; res=(quip card _state)
|
||||
[(snoc -.res (build-file | uri path)) +.res]
|
||||
?~ p.gift
|
||||
[~ state]
|
||||
::
|
||||
[%success %core *]
|
||||
=. builds
|
||||
(~(put by builds) uri vase.build-result)
|
||||
=. ford-diagnostics
|
||||
(~(del by ford-diagnostics) uri)
|
||||
:_ state
|
||||
(give-rpc-notification (get-diagnostics uri))
|
||||
::
|
||||
[%error *]
|
||||
=/ error-ranges=(list =range:lsp-sur)
|
||||
(get-errors-from-tang:build uri message.build-result)
|
||||
?~ error-ranges
|
||||
[~ state]
|
||||
=. ford-diagnostics
|
||||
%+ ~(put by ford-diagnostics)
|
||||
uri
|
||||
[i.error-ranges 1 'Build Error']~
|
||||
:_ state
|
||||
(give-rpc-notification (get-diagnostics uri))
|
||||
==
|
||||
=. builds
|
||||
(~(put by builds) uri q.r.u.p.gift)
|
||||
=. ford-diagnostics
|
||||
(~(del by ford-diagnostics) uri)
|
||||
=+ .^(=open:clay %cs /(scot %p our.bow)/home/(scot %da now.bow)/open)
|
||||
=/ =type -:(open (uri-to-path:build uri))
|
||||
=. preludes
|
||||
(~(put by preludes) uri type)
|
||||
:_ state
|
||||
(give-rpc-notification (get-diagnostics uri))
|
||||
::
|
||||
++ get-diagnostics
|
||||
|= uri=@t
|
||||
@ -286,20 +269,14 @@
|
||||
(~(gut by ford-diagnostics) uri ~)
|
||||
(get-parser-diagnostics uri)
|
||||
::
|
||||
++ get-build-deps
|
||||
|= [=path buf=wall]
|
||||
^- schematic:ford
|
||||
=/ parse=(like scaffold:ford)
|
||||
%+ (lsp-parser [byk.bow path]) [1 1]
|
||||
(zing (join "\0a" buf))
|
||||
=/ =scaffold:ford
|
||||
?~ q.parse *scaffold:ford
|
||||
p.u.q.parse
|
||||
:* %plan
|
||||
[[our.bow %home] (flop path)]
|
||||
*coin
|
||||
scaffold(sources `(list hoon)`~[[%cnts ~[[%& 1]] ~]])
|
||||
==
|
||||
++ build-file
|
||||
|= [eager=? uri=@t =path]
|
||||
^- card
|
||||
=/ =rave:clay
|
||||
?: eager
|
||||
[%sing %a da+now.bow path]
|
||||
[%next %a da+now.bow path]
|
||||
[%pass /ford/[uri] %arvo %c %warp our.bow %home `rave]
|
||||
::
|
||||
++ handle-did-open
|
||||
|= item=text-document-item:lsp-sur
|
||||
@ -310,18 +287,10 @@
|
||||
(~(put by bufs) uri.item buf)
|
||||
=/ =path
|
||||
(uri-to-path:build uri.item)
|
||||
=/ =schematic:ford
|
||||
[%core [our.bow %home] (flop path)]
|
||||
=/ dep-schematic=schematic:ford
|
||||
(get-build-deps path buf)
|
||||
:_ state
|
||||
%+ weld
|
||||
(give-rpc-notification (get-diagnostics uri.item))
|
||||
^- (list card)
|
||||
:~
|
||||
[%pass /ford/[uri.item] %arvo %f %build live=%.y schematic]
|
||||
[%pass /ford/[uri.item]/deps %arvo %f %build live=%.y dep-schematic]
|
||||
==
|
||||
[(build-file & uri.item path) ~]
|
||||
::
|
||||
++ get-parser-diagnostics
|
||||
|= uri=@t
|
||||
@ -329,7 +298,7 @@
|
||||
=/ t=tape
|
||||
(zing (join "\0a" `wall`(~(got by bufs) uri)))
|
||||
=/ parse
|
||||
(lily:auto t (lsp-parser *beam))
|
||||
(lily:auto t (lsp-parser (uri-to-path:build uri)))
|
||||
?. ?=(%| -.parse)
|
||||
~
|
||||
=/ loc=position:lsp-sur
|
||||
|
@ -338,11 +338,11 @@
|
||||
~? > debug %start-magick
|
||||
=/ magicked txt:(insert-magic pos code)
|
||||
~? > debug %start-parsing
|
||||
=/ res (lily magicked (language-server-parser *beam))
|
||||
=/ res (lily magicked (language-server-parser *path))
|
||||
?: ?=(%| -.res)
|
||||
~? > debug [%parsing-error p.res]
|
||||
[%| p.res]
|
||||
:- %&
|
||||
~? > debug %parsed-good
|
||||
((cury tab-list-hoon sut) tssg+sources.p.res)
|
||||
((cury tab-list-hoon sut) hoon.p.res)
|
||||
--
|
||||
|
@ -1,204 +1,85 @@
|
||||
:: lifted directly from ford, should probably be in zuse
|
||||
=< parse-scaffold
|
||||
=, ford
|
||||
=, clay
|
||||
=< pile-rule
|
||||
|%
|
||||
++ parse-scaffold
|
||||
|= src-beam=beam
|
||||
::
|
||||
=/ hoon-parser (vang & (en-beam:format src-beam))
|
||||
|^ ::
|
||||
%+ cook
|
||||
|= a=[@ud (list ^cable) (list ^cable) (list ^crane) (list hoon)]
|
||||
^- scaffold
|
||||
[[[p q] s]:src-beam a]
|
||||
::
|
||||
%+ ifix [gay gay]
|
||||
;~ plug
|
||||
:: parses the zuse version, eg "/? 309"
|
||||
::
|
||||
;~ pose
|
||||
(ifix [;~(plug net wut gap) gap] dem)
|
||||
(easy zuse)
|
||||
==
|
||||
:: pareses the structures, eg "/- types"
|
||||
::
|
||||
;~ pose
|
||||
(ifix [;~(plug net hep gap) gap] (most ;~(plug com gaw) cable))
|
||||
(easy ~)
|
||||
==
|
||||
:: parses the libraries, eg "/+ lib1, lib2"
|
||||
::
|
||||
;~ pose
|
||||
(ifix [;~(plug net lus gap) gap] (most ;~(plug com gaw) cable))
|
||||
(easy ~)
|
||||
==
|
||||
::
|
||||
(star ;~(sfix crane gap))
|
||||
::
|
||||
(most gap tall:hoon-parser)
|
||||
==
|
||||
:: +beam: parses a hood path and converts it to a beam
|
||||
::
|
||||
++ beam
|
||||
%+ sear de-beam:format
|
||||
;~ pfix
|
||||
net
|
||||
(sear plex (stag %clsg poor)):hoon-parser
|
||||
==
|
||||
:: +cable: parses a +^cable, a reference to something on the filesystem
|
||||
::
|
||||
:: This parses:
|
||||
::
|
||||
:: `library` -> wraps `library` around the library `library`
|
||||
:: `face=library` -> wraps `face` around the library `library`
|
||||
:: `*library` -> exposes `library` directly to the subject
|
||||
::
|
||||
++ cable
|
||||
%+ cook |=(a=^cable a)
|
||||
++ pile-rule
|
||||
|= pax=path
|
||||
%- full
|
||||
%+ ifix [gay gay]
|
||||
%+ cook |=(pile +<)
|
||||
;~ pfix
|
||||
:: parse optional /? and ignore
|
||||
::
|
||||
;~ pose
|
||||
(stag ~ ;~(pfix tar sym))
|
||||
(cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym))
|
||||
(cook |=(a=term [`a a]) sym)
|
||||
(cold ~ ;~(plug net wut gap dem gap))
|
||||
(easy ~)
|
||||
==
|
||||
:: +crane: all runes that start with / which aren't /?, /-, /+ or //.
|
||||
::
|
||||
++ crane
|
||||
=< apex
|
||||
:: whether we allow tall form
|
||||
=| allow-tall-form=?
|
||||
::
|
||||
|%
|
||||
++ apex
|
||||
%+ knee *^crane |. ~+
|
||||
;~ pfix net
|
||||
;~ pose
|
||||
:: `/~` hoon literal
|
||||
::
|
||||
(stag %fssg ;~(pfix sig hoon))
|
||||
:: `/$` process query string
|
||||
::
|
||||
(stag %fsbc ;~(pfix bus hoon))
|
||||
:: `/|` first of many options that succeeds
|
||||
::
|
||||
(stag %fsbr ;~(pfix bar parse-alts))
|
||||
:: `/=` wrap a face around a crane
|
||||
::
|
||||
(stag %fsts ;~(pfix tis parse-face))
|
||||
:: `/.` null terminated list
|
||||
::
|
||||
(stag %fsdt ;~(pfix dot parse-list))
|
||||
:: `/,` switch by path
|
||||
::
|
||||
(stag %fscm ;~(pfix com parse-switch))
|
||||
:: `/&` pass through a series of mark
|
||||
::
|
||||
(stag %fspm ;~(pfix pad parse-pipe))
|
||||
:: `/_` run a crane on each file in the current directory
|
||||
::
|
||||
(stag %fscb ;~(pfix cab subcrane))
|
||||
:: `/;` passes date through a gate
|
||||
::
|
||||
(stag %fssm ;~(pfix mic parse-gate))
|
||||
:: `/:` evaluate at path
|
||||
::
|
||||
(stag %fscl ;~(pfix col parse-at-path))
|
||||
:: `/^` cast
|
||||
::
|
||||
(stag %fskt ;~(pfix ket parse-cast))
|
||||
:: `/*` run a crane on each file with current path as prefix
|
||||
::
|
||||
(stag %fstr ;~(pfix tar subcrane))
|
||||
:: `/!mark/ evaluate as hoon, then pass through mark
|
||||
::
|
||||
(stag %fszp ;~(pfix zap ;~(sfix sym net)))
|
||||
:: `/mark/` passes current path through :mark
|
||||
::
|
||||
(stag %fszy ;~(sfix sym net))
|
||||
;~ plug
|
||||
;~ pose
|
||||
;~ sfix
|
||||
%+ cook |=((list (list taut)) (zing +<))
|
||||
%+ more gap
|
||||
;~ pfix ;~(plug net hep gap)
|
||||
(most ;~(plug com gaw) taut-rule)
|
||||
==
|
||||
gap
|
||||
==
|
||||
(easy ~)
|
||||
==
|
||||
:: +parse-alts: parse a set of alternatives
|
||||
::
|
||||
++ parse-alts
|
||||
%+ wide-or-tall
|
||||
(ifix [lit rit] (most ace subcrane))
|
||||
;~(sfix (star subcrane) gap duz)
|
||||
:: +parse-face: parse a face around a subcrane
|
||||
::
|
||||
++ parse-face
|
||||
%+ wide-or-tall
|
||||
;~(plug sym ;~(pfix tis subcrane))
|
||||
;~(pfix gap ;~(plug sym subcrane))
|
||||
:: +parse-list: parse a null terminated list of cranes
|
||||
::
|
||||
++ parse-list
|
||||
%+ wide-or-tall
|
||||
fail
|
||||
;~(sfix (star subcrane) gap duz)
|
||||
:: +parse-switch: parses a list of [path crane]
|
||||
::
|
||||
++ parse-switch
|
||||
%+ wide-or-tall
|
||||
fail
|
||||
=- ;~(sfix (star -) gap duz)
|
||||
;~(pfix gap net ;~(plug static-path subcrane))
|
||||
:: +parse-pipe: parses a pipe of mark conversions
|
||||
::
|
||||
++ parse-pipe
|
||||
%+ wide-or-tall
|
||||
;~(plug (plus ;~(sfix sym pad)) subcrane)
|
||||
=+ (cook |=(a=term [a ~]) sym)
|
||||
;~(pfix gap ;~(plug - subcrane))
|
||||
:: +parse-gate: parses a gate applied to a crane
|
||||
::
|
||||
++ parse-gate
|
||||
%+ wide-or-tall
|
||||
;~(plug ;~(sfix wide:hoon-parser mic) subcrane)
|
||||
;~(pfix gap ;~(plug tall:hoon-parser subcrane))
|
||||
:: +parse-at-path: parses a late bound bath
|
||||
::
|
||||
++ parse-at-path
|
||||
%+ wide-or-tall
|
||||
;~(plug ;~(sfix late-bound-path col) subcrane)
|
||||
;~(pfix gap ;~(plug late-bound-path subcrane))
|
||||
:: +parse-cast: parses a mold and then the subcrane to apply that mold to
|
||||
::
|
||||
++ parse-cast
|
||||
%+ wide-or-tall
|
||||
;~(plug ;~(sfix wyde:hoon-parser ket) subcrane)
|
||||
;~(pfix gap ;~(plug till:hoon-parser subcrane))
|
||||
:: +subcrane: parses a subcrane
|
||||
::
|
||||
++ subcrane
|
||||
%+ wide-or-tall
|
||||
apex(allow-tall-form |)
|
||||
;~(pfix gap apex)
|
||||
:: +wide-or-tall: parses tall form hoon if :allow-tall-form is %.y
|
||||
::
|
||||
++ wide-or-tall
|
||||
|* [wide=rule tall=rule]
|
||||
?. allow-tall-form wide
|
||||
;~(pose wide tall)
|
||||
:: +hoon: parses hoon as an argument to a crane
|
||||
::
|
||||
++ hoon
|
||||
%+ wide-or-tall
|
||||
(ifix [lac rac] (stag %cltr (most ace wide:hoon-parser)))
|
||||
;~(pfix gap tall:hoon-parser)
|
||||
--
|
||||
:: +static-path: parses a path
|
||||
::
|
||||
++ static-path
|
||||
(sear plex (stag %clsg (more net hasp))):hoon-parser
|
||||
:: +late-bound-path: a path whose time varies
|
||||
::
|
||||
++ late-bound-path
|
||||
;~ pfix net
|
||||
%+ cook |=(a=truss a)
|
||||
=> hoon-parser
|
||||
;~ plug
|
||||
(stag ~ gash)
|
||||
;~(pose (stag ~ ;~(pfix cen porc)) (easy ~))
|
||||
;~ pose
|
||||
;~ sfix
|
||||
%+ cook |=((list (list taut)) (zing +<))
|
||||
%+ more gap
|
||||
;~ pfix ;~(plug net lus gap)
|
||||
(most ;~(plug com gaw) taut-rule)
|
||||
==
|
||||
gap
|
||||
==
|
||||
(easy ~)
|
||||
==
|
||||
::
|
||||
;~ pose
|
||||
;~ sfix
|
||||
%+ cook |=((list [face=term =path]) +<)
|
||||
%+ more gap
|
||||
;~ pfix ;~(plug net tis gap)
|
||||
%+ cook |=([term path] +<)
|
||||
;~(plug sym ;~(pfix ;~(plug gap net) (more net urs:ab)))
|
||||
==
|
||||
gap
|
||||
==
|
||||
(easy ~)
|
||||
==
|
||||
::
|
||||
;~ pose
|
||||
;~ sfix
|
||||
%+ cook |=((list [face=term =mark =path]) +<)
|
||||
%+ more gap
|
||||
;~ pfix ;~(plug net tar gap)
|
||||
%+ cook |=([term mark path] +<)
|
||||
;~ plug
|
||||
sym
|
||||
;~(pfix ;~(plug gap cen) sym)
|
||||
;~(pfix ;~(plug gap net) (more net urs:ab))
|
||||
==
|
||||
==
|
||||
gap
|
||||
==
|
||||
(easy ~)
|
||||
==
|
||||
::
|
||||
%+ cook |=(huz=(list hoon) `hoon`tssg+huz)
|
||||
(most gap tall:(vang & pax))
|
||||
==
|
||||
--
|
||||
==
|
||||
::
|
||||
++ taut-rule
|
||||
%+ cook |=(taut +<)
|
||||
;~ pose
|
||||
(stag ~ ;~(pfix tar sym))
|
||||
;~(plug (stag ~ sym) ;~(pfix tis sym))
|
||||
(cook |=(a=term [`a a]) sym)
|
||||
==
|
||||
--
|
||||
|
@ -396,23 +396,6 @@
|
||||
++ fusion
|
||||
=>
|
||||
|%
|
||||
:: $pile: preprocessed hoon source file
|
||||
::
|
||||
:: /- sur-file :: surface imports from /sur
|
||||
:: /+ lib-file :: library imports from /lib
|
||||
:: /= face /path :: imports built hoon file at path
|
||||
:: /* face %mark /path :: unbuilt file imports, as mark
|
||||
::
|
||||
+$ pile
|
||||
$: sur=(list taut)
|
||||
lib=(list taut)
|
||||
raw=(list [face=term =path])
|
||||
bar=(list [face=term =mark =path])
|
||||
=hoon
|
||||
==
|
||||
:: $taut: file import from /lib or /sur
|
||||
::
|
||||
+$ taut [face=(unit term) pax=term]
|
||||
:: +an: $ankh interface door
|
||||
::
|
||||
++ an
|
||||
@ -725,6 +708,17 @@
|
||||
=^ syd=dais nub (get-mark p.diff)
|
||||
:_(nub [p.old (~(pact dys (vale:dys q.old)) (vale:syd q.diff))])
|
||||
::
|
||||
++ prelude
|
||||
|= =path
|
||||
^- vase
|
||||
=^ cag=cage nub (get-value path)
|
||||
?> =(%hoon p.cag)
|
||||
=/ tex=tape (trip !<(@t q.cag))
|
||||
=/ =pile (parse-pile path tex)
|
||||
=. hoon.pile !,(*hoon .)
|
||||
=^ res=vase nub (run-pile pile)
|
||||
res
|
||||
::
|
||||
++ build-file
|
||||
|= =path
|
||||
^- [vase state]
|
||||
@ -741,14 +735,19 @@
|
||||
?> =(%hoon p.cag)
|
||||
=/ tex=tape (trip !<(@t q.cag))
|
||||
=/ =pile (parse-pile path tex)
|
||||
=^ res=vase nub (run-pile pile)
|
||||
=^ top stack.nub pop-stack
|
||||
=. vases.cache.nub (~(put by vases.cache.nub) path [res top])
|
||||
[res nub]
|
||||
::
|
||||
++ run-pile
|
||||
|= =pile
|
||||
=^ sut=vase nub run-reef
|
||||
=^ sut=vase nub (run-tauts sut %sur sur.pile)
|
||||
=^ sut=vase nub (run-tauts sut %lib lib.pile)
|
||||
=^ sut=vase nub (run-raw sut raw.pile)
|
||||
=^ sut=vase nub (run-bar sut bar.pile)
|
||||
=/ res=vase (slap sut hoon.pile)
|
||||
=^ top stack.nub pop-stack
|
||||
=. vases.cache.nub (~(put by vases.cache.nub) path [res top])
|
||||
[res nub]
|
||||
::
|
||||
++ parse-pile
|
||||
@ -1782,7 +1781,7 @@
|
||||
::
|
||||
++ reload-all
|
||||
=/ vanes=(list term)
|
||||
~[%ames %behn %clay %dill %eyre %ford %gall %iris %jael]
|
||||
~[%ames %behn %clay %dill %eyre %gall %iris %jael]
|
||||
|- ^+ ..park
|
||||
?~ vanes
|
||||
..park
|
||||
@ -3274,7 +3273,7 @@
|
||||
++ read-s
|
||||
|= [yon=aeon pax=path]
|
||||
^- (unit (unit cage))
|
||||
?. ?=([?(%yaki %blob %hash %cage) * ~] pax)
|
||||
?. ?=([?(%yaki %blob %hash %cage %open) * ~] pax)
|
||||
`~
|
||||
?- i.pax
|
||||
%yaki
|
||||
@ -3306,6 +3305,9 @@
|
||||
%- wrap:fusion
|
||||
(page-to-cage:(ford:fusion ank.dom ~ ~ lat.ran fod.dom) page)
|
||||
``cage+[-:!>(*^cage) cage]
|
||||
::
|
||||
%open
|
||||
``open+!>(prelude:(ford:fusion ank.dom ~ ~ lat.ran fod.dom))
|
||||
==
|
||||
:: +read-t: produce the list of paths within a yaki with :pax as prefix
|
||||
::
|
||||
|
@ -639,6 +639,7 @@
|
||||
$% {%& p/suba} :: delta
|
||||
{%| p/@tas} :: label
|
||||
== ::
|
||||
++ open $-(path vase) :: get prelude
|
||||
++ page (cask *) :: untyped cage
|
||||
++ plop blob :: unvalidated blob
|
||||
++ rang :: repository
|
||||
@ -707,6 +708,23 @@
|
||||
%^ cat 7 (sham [%yaki (roll p add) q t])
|
||||
(sham [%tako (roll p add) q t])
|
||||
[p q has t]
|
||||
:: $pile: preprocessed hoon source file
|
||||
::
|
||||
:: /- sur-file :: surface imports from /sur
|
||||
:: /+ lib-file :: library imports from /lib
|
||||
:: /= face /path :: imports built hoon file at path
|
||||
:: /* face %mark /path :: unbuilt file imports, as mark
|
||||
::
|
||||
+$ pile
|
||||
$: sur=(list taut)
|
||||
lib=(list taut)
|
||||
raw=(list [face=term =path])
|
||||
bar=(list [face=term =mark =path])
|
||||
=hoon
|
||||
==
|
||||
:: $taut: file import from /lib or /sur
|
||||
::
|
||||
+$ taut [face=(unit term) pax=term]
|
||||
:: $mars: mark conversion request
|
||||
:: $tube: mark conversion gate
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user