this repo has no description
1(*
2 * Copyright (c) 2014 Leo White <lpw25@cl.cam.ac.uk>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 *)
16
17open Odoc_model
18module Paths = Odoc_model.Paths
19
20val empty : string option -> Odoc_model.Comment.docs
21
22val is_stop_comment : Parsetree.attribute -> bool
23
24val attached :
25 warnings_tag:string option ->
26 'tags Semantics.handle_internal_tags ->
27 Paths.Identifier.LabelParent.t ->
28 Parsetree.attributes ->
29 Odoc_model.Comment.docs * 'tags
30
31val attached_no_tag :
32 warnings_tag:string option ->
33 Paths.Identifier.LabelParent.t ->
34 Parsetree.attributes ->
35 Odoc_model.Comment.docs
36(** Shortcut for [attached Semantics.Expect_none]. *)
37
38val page :
39 Paths.Identifier.LabelParent.t ->
40 Location.t ->
41 string ->
42 Odoc_model.Comment.docs * Frontmatter.t
43(** The parent identifier is used to define labels in the given string (i.e. for
44 things like [{1:some_section Some title}]) and the location is used for
45 error messages.
46
47 This function is meant to be used to read arbitrary files containing text in
48 the ocamldoc syntax. *)
49
50val standalone :
51 Paths.Identifier.LabelParent.t ->
52 warnings_tag:string option ->
53 Parsetree.attribute ->
54 Odoc_model.Comment.docs_or_stop option
55
56val standalone_multiple :
57 Paths.Identifier.LabelParent.t ->
58 warnings_tag:string option ->
59 Parsetree.attributes ->
60 Odoc_model.Comment.docs_or_stop list
61
62val extract_top_comment :
63 'tags Semantics.handle_internal_tags ->
64 warnings_tag:string option ->
65 classify:('item -> [ `Attribute of Parsetree.attribute | `Open ] option) ->
66 Paths.Identifier.Signature.t ->
67 'item list ->
68 'item list * (Comment.docs * Comment.docs) * 'tags
69(** Extract the first comment of a signature. Returns the remaining items.
70 Splits the docs on the first heading *)
71
72val extract_top_comment_class :
73 Lang.ClassSignature.item list ->
74 Lang.ClassSignature.item list * (Comment.docs * Comment.docs)
75(** Extract the first comment of a class signature. Returns the remaining items.
76*)
77
78val read_location : Location.t -> Odoc_model.Location_.span
79
80val conv_canonical_module : Odoc_model.Reference.path -> Paths.Path.Module.t
81val conv_canonical_type : Odoc_model.Reference.path -> Paths.Path.Type.t option
82val conv_canonical_module_type :
83 Odoc_model.Reference.path -> Paths.Path.ModuleType.t option
84
85type payload = string * Location.t
86
87type parsed_attribute =
88 [ `Text of payload (* Standalone comment. *)
89 | `Doc of payload (* Attached comment. *)
90 | `Stop of Location.t (* [(**/**)]. *)
91 | `Alert of string * payload option * Location.t
92 (* [`Alert (name, payload, loc)] is for [\[@@alert name "payload"\]] attributes. *)
93 ]
94
95val parse_attribute : Parsetree.attribute -> parsed_attribute option