mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
story: rip out parsers
This commit is contained in:
parent
75d6882b51
commit
b87a754622
@ -142,42 +142,6 @@
|
||||
++ mime :: retrieve form %mime
|
||||
|= [p=mite q=octs]
|
||||
^- story
|
||||
=/ commit-parser
|
||||
;~ sfix :: throw away the trailing newline
|
||||
;~ pfix (jest 'commit: ') :: throw away leading literal 'commit'
|
||||
(cook @uv ;~(pfix (jest '0v') viz:ag)) :: parse a @uv
|
||||
==
|
||||
::
|
||||
(just '\0a') :: parse trailing newline
|
||||
==
|
||||
::
|
||||
:: XX TODO: implement parsing in conflicts
|
||||
=/ proses-parse ~
|
||||
=/ title-parser
|
||||
;~ sfix :: throw away trailing newlines
|
||||
(cook crip (star prn)) :: parse any number of ascii characters, turn into cord
|
||||
(jest '\0a\0a') :: parse two newlines
|
||||
==
|
||||
::
|
||||
=/ body-parser
|
||||
;~ sfix :: parse the following and discard terminator
|
||||
%- star :: parse 0 or more of the following
|
||||
%+ cook crip :: convert to cord
|
||||
;~ less (jest '---\0a') :: exclude the terminator from the following parse
|
||||
;~(sfix (star prn) (just '\0a')) :: parse 0 or more prn chars then discard literal newline
|
||||
==
|
||||
::
|
||||
(jest '---\0a') :: parse the terminator
|
||||
==
|
||||
::
|
||||
=/ story-parser
|
||||
%- star :: parse any number of the chapters
|
||||
;~ plug :: parse chapter: a commit, followed by a title, followed by a body
|
||||
commit-parser
|
||||
title-parser
|
||||
body-parser
|
||||
==
|
||||
::
|
||||
=/ story-text `@t`q.q
|
||||
=/ parsed-story `(list [@uv @t wain])`(rash story-text story-parser)
|
||||
%- ~(gas by *story)
|
||||
|
Loading…
Reference in New Issue
Block a user