Implement // parsing

This commit is contained in:
Elliot Glaysher 2018-05-11 15:31:24 -07:00
parent ad5fc9d4ff
commit ee904e08b7
2 changed files with 36 additions and 5 deletions

View File

@ -17,7 +17,8 @@
test-date-from-schematic
test-unify-jugs
test-resource-wire-encoding
test-parse-scaffold-basic
test-parse-scaffold-direct
test-parse-scaffold-indirect
test-parse-scaffold-sur-lib
test-parse-scaffold-zuse-version
test-literal
@ -174,8 +175,8 @@
(need (path-to-scry-request:ford /gx/~nul/desk/~1234.5.6/bar/foo))
==
::
++ test-parse-scaffold-basic
~& %test-parse-scaffold-basic
++ test-parse-scaffold-direct
~& %test-parse-scaffold-direct
::
%- expect-eq !>
:- :- [1 19]
@ -191,6 +192,28 @@
[1 1]
"!. |=(a=@ud +(a))"
::
++ test-parse-scaffold-indirect
~& %test-parse-scaffold-indirect
::
=/ parsed
%+ (full (parse-scaffold:ford-gate [[~nul %desk %da ~1234.5.6] /foo/bar]))
[1 1]
"""
// /%/child/hoon
"""
?~ q.parsed
[%leaf "failed to parse at {<p.parsed>}"]~
%- expect-eq !>
:_ p.u.q.parsed
:* zuse-version=309
structures=~
libraries=~
cranes=~
^= sources
:~ :* %indirect
[[~nul %desk [%da ~1234.5.6]] /hoon/child/foo/bar]
== == ==
::
++ test-parse-scaffold-sur-lib
~& %test-parse-scaffold-sur-lib
::

View File

@ -1399,7 +1399,7 @@
%+ ifix [gay gay]
;~ plug
::
:: parses the zuse version, eg "/? 400"
:: parses the zuse version, eg "/? 309"
;~ pose
(ifix [;~(plug fas wut gap) gap] dem)
(easy zuse)
@ -1422,11 +1422,19 @@
::
(most gap brick)
==
:: +beam: parses a hood path and converts it to a beam
::
++ beam
%+ sear de-beam
;~ pfix
fas
(sear plex (stag %clsg poor)):hoon-parser
==
:: +brick: parses a +^brick, a direct or indirect piece of hoon code
::
++ brick
;~ pose
:: %indirect
(stag %indirect ;~(pfix fas fas gap beam))
(stag %direct tall:hoon-parser)
==
:: +cable: parses a +^cable, a reference to something on the filesystem