Make the +hood parser use +parse-scaffold. Also, error checking.

This commit is contained in:
Elliot Glaysher 2018-05-15 10:42:45 -07:00
parent fdcfebb73d
commit 8a521f4e80
2 changed files with 31 additions and 11 deletions

View File

@ -2213,7 +2213,7 @@
%- my :~
:- [%cx [[~nul %desk %da ~1234.5.6] /hoon/bar/foo]]
:* %noun scry-type
'|=(a=@ud +(a))'
'!. |=(a=@ud +(a))'
==
==
::
@ -2229,8 +2229,16 @@
::
^= moves
:~ :* duct=~[/hood] %give %made ~1234.5.6 %complete %success %hood
[309 ~ ~ ~ [%direct (ream '|=(a=@ud +(a))')]~]
==
:* zuse-version=309
structures=~
libraries=~
cranes=~
^= sources
:~ :* %direct
%dbug
[/~nul/desk/0/foo/bar/hoon [1 1] [1 19]]
(ream '|=(a=@ud +(a))')
== == == ==
:* duct=~ %pass /~nul/clay-sub/~nul/desk
%c %warp [~nul ~nul] %desk
`[%mult [%da ~1234.5.6] (sy [%x /foo/bar/hoon] ~)]

View File

@ -2890,17 +2890,29 @@
::
?: ?=([%error *] u.scry-result)
[build [%build-result u.scry-result] accessed-builds]
=+ result=(result-to-cage u.scry-result)
=+ as-cage=(result-to-cage u.scry-result)
:: hoon files must be atoms to parse
::
:: TODO: parse as ford-hoon, now plain hoon
?. ?=(@ q.q.as-cage)
:* build
[%build-result %error [%leaf "ford: %hood: file not an atom"]~]
accessed-builds
==
::
:: ford has its own parser, +fair, which parses cranes in addition to
:: normal hoon. eventually, we want to use that but for now, we'll
:: just get normal hoon working.
=* src-beam [[ship.disc desk.disc [%ud 0]] spur]:source-path
=/ parsed
((full (parse-scaffold src-beam)) [1 1] (trip q.q.as-cage))
::
=/ =scaffold
[309 ~ ~ ~ [%direct (ream ((hard @) q.q.result))]~]
[build [%build-result %success %hood scaffold] accessed-builds]
?~ q.parsed
:* build
:* %build-result
%error
[%leaf "syntax error: {<p.p.parsed>} {<q.p.parsed>}"]~
==
accessed-builds
==
::
[build [%build-result %success %hood p.u.q.parsed] accessed-builds]
::
++ path-impl
|= [=disc prefix=@tas raw-path=@tas]