File: ag_doc.ml

package info (click to toggle)
atdgen 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 592 kB
  • ctags: 784
  • sloc: ml: 7,629; makefile: 314; sh: 18
file content (15 lines) | stat: -rw-r--r-- 500 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

type inline =
    [ `Text of string
    | `Code of string ]
type block = [ `Paragraph of inline list | `Pre of string ]
type doc = [ `Text of block list ]

let parse_text loc s =
  try Some (Some (`Text (Ag_doc_lexer.parse_string s : block list)))
  with e ->
    failwith (Printf.sprintf "%s:\nInvalid format for doc.text %S:\n%s"
                (Atd_ast.string_of_loc loc) s (Printexc.to_string e))

let get_doc loc an : doc option =
  Atd_annot.get_field (parse_text loc) None ["doc"] "text" an