
TODO: markdown & gemini coming git-svn-id: https://svn.yakumo.dev/yakumo.izuru/text_parse/trunk@1 cb476dc4-a1c2-9446-a177-162899b6b847
20 lines
505 B
OCaml
20 lines
505 B
OCaml
module type Fn = sig
|
|
type t
|
|
val paragraph_s: t -> t
|
|
val paragraph_e: t -> t
|
|
end
|
|
|
|
open Text_parse.Parser
|
|
open Text_parse.Syntax
|
|
open Text_parse.Cursor
|
|
|
|
module Make (F : Fn)(S : Text_parse.Parser.Sub_parsers with type t = F.t) = struct
|
|
type t = F.t
|
|
let s _cur ch = printable ch
|
|
let e cur = function
|
|
| '\n' -> char_at cur (-1) = '\n'
|
|
| _ when cur.pos + 1 = cur.right_boundary -> true
|
|
| _ -> false
|
|
let parse cur acc = F.paragraph_s acc |> parse S.subparsers cur |> F.paragraph_e
|
|
end
|