mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-20 21:31:32 +03:00
hoon: add ,/typed/path syntax
Prefixing a path with a com will cause the path to be interpreted as a `$pith`, aka a typed path. Instead of interpreting every element as a string, we use hoon's atom syntaxes to read the values, and tag them with appropriate auras. For example, `,/hi/5/0x6` becomes `[[%tas %hi] [%ud 5] [%ux 0x6] ~]`. Dynamic elements via `()` and `[]` is also supported, and may optionally be tagged with `aura+(etc)` syntax. For example, `,/next/ud+[+(1)]`. Could _maybe_ be refactored to use `+nuck`, but we'd need to wrestle the output, and we're a little stricter here anyway. This shadows existing `,/some-wing` syntax, which... presumably does something, but is not in active use anywhere. We might consider removing that syntax. Eventually, we probably want this to be the primary urbit-native path type. Invalidating existing path syntax is very invasive though, so for now we piggy-back on "com changes the parsing mode" for a less disruptive addition.
This commit is contained in:
parent
ac90c2a602
commit
db899ce09f
@ -1996,12 +1996,23 @@
|
||||
+$ knot @ta :: ASCII text
|
||||
+$ noun * :: any noun
|
||||
+$ path (list knot) :: like unix path
|
||||
+$ pith (list iota) :: typed urbit path
|
||||
+$ stud :: standard name
|
||||
$@ mark=@tas :: auth=urbit
|
||||
$: auth=@tas :: standards authority
|
||||
type=path :: standard label
|
||||
== ::
|
||||
+$ tang (list tank) :: bottom-first error
|
||||
:: ::
|
||||
+$ iota :: typed path segment
|
||||
$~ [%n ~]
|
||||
$% [%ub @ub] [%uc @uc] [%ud @ud] [%ui @ui]
|
||||
[%ux @ux] [%uv @uv] [%uw @uw] [%da @da]
|
||||
[%dr @dr] [%f ?] [%if @if] [%is @is]
|
||||
[%n ~] [%t @t] [%ta @ta] [%tas @tas]
|
||||
[%p @p] [%q @q] [%rd @rd] [%rh @rh]
|
||||
[%rq @rq] [%rs @rs] [%s @s]
|
||||
==
|
||||
::
|
||||
:: $tank: formatted print tree
|
||||
::
|
||||
@ -5970,6 +5981,22 @@
|
||||
~
|
||||
;~(pfix fas (most fas urs:ab))
|
||||
::
|
||||
++ stip :: typed path parser
|
||||
=- ;~(pfix fas (more fas -))
|
||||
|^ %- stew
|
||||
^. stet ^. limo
|
||||
:~ :- 'a'^'z' (slot (stag %tas sym))
|
||||
:- '$' (cold [%tas %$] buc)
|
||||
:- '0'^'9' (slot bisk:so)
|
||||
:- '-' (slot tash:so)
|
||||
:- '.' zust:so
|
||||
:- '~' (slot ;~(pfix sig ;~(pose crub:so (easy [%n ~]))))
|
||||
:- '\'' (stag %t qut)
|
||||
==
|
||||
::
|
||||
++ slot |*(r=rule (sear (soft iota) r))
|
||||
--
|
||||
::
|
||||
:::: 4n: virtualization
|
||||
::
|
||||
:: +mack: untyped, scry-less, unitary virtualization
|
||||
@ -11719,6 +11746,44 @@
|
||||
(stag %clsg poor)
|
||||
==
|
||||
::
|
||||
++ reed
|
||||
;~ pfix fas
|
||||
(stag %clsg (more fas stem))
|
||||
==
|
||||
::
|
||||
++ stem !:
|
||||
%+ knee *hoon |. ~+
|
||||
%+ cook
|
||||
|= iota=$%([%hoon =hoon] iota)
|
||||
?: ?=(%hoon -.iota) hoon.iota
|
||||
[%clhp [%rock %tas -.iota] [%sand iota]]
|
||||
|^ %- stew
|
||||
^. stet ^. limo
|
||||
:~ :- 'a'^'z' ;~ pose
|
||||
(spit (stag %cncl (ifix [pal par] (most ace wide))))
|
||||
(spit (ifix [sel ser] wide))
|
||||
(slot (stag %tas sym))
|
||||
==
|
||||
:- '$' (cold [%tas %$] buc)
|
||||
:- '0'^'9' (slot bisk:so)
|
||||
:- '-' (slot tash:so)
|
||||
:- '.' zust:so
|
||||
:- '~' (slot ;~(pfix sig ;~(pose crub:so (easy [%n ~]))))
|
||||
:- '\'' (stag %t qut)
|
||||
:- '[' (slip (ifix [sel ser] wide))
|
||||
:- '(' (slip (stag %cncl (ifix [pal par] (most ace wide))))
|
||||
==
|
||||
::
|
||||
++ slip |*(r=rule (stag %hoon r))
|
||||
++ slot |*(r=rule (sear (soft iota) r))
|
||||
++ spit
|
||||
|* r=rule
|
||||
%+ stag %hoon
|
||||
%+ cook
|
||||
|*([a=term b=*] `hoon`[%clhp [%rock %tas a] b])
|
||||
;~((glue lus) sym r)
|
||||
--
|
||||
::
|
||||
++ rupl
|
||||
%+ cook
|
||||
|= [a=? b=(list hoon) c=?]
|
||||
@ -12794,6 +12859,7 @@
|
||||
:~
|
||||
:- ','
|
||||
;~ pose
|
||||
;~(pfix com reed) ::NOTE shadows /wing syntax, maybe re/move
|
||||
(stag %ktcl ;~(pfix com wyde))
|
||||
(stag %wing rope)
|
||||
==
|
||||
|
Loading…
Reference in New Issue
Block a user