story: rip out parsers
++ 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)
