Module Odoc_parser.AstSource
Abstract syntax tree representing ocamldoc comments
This is a syntactic representation of ocamldoc comments. See The manual for a detailed description of the syntax understood. Note that there is no attempt at semantic analysis, and hence these types are capable of representing values that will be rejected by further stages, for example, invalid references or headings that are out of range.
References in doc comments can be of two kinds: {!simple} or {{!ref}With text}.
type inline_element = [ | `Space of string| `Word of string| `Code_span of string| `Raw_markup of string option * string| `Styled of Odoc_parser.Ast.style * Odoc_parser.Ast.inline_element Odoc_parser.Ast.with_location list| `Reference of Odoc_parser.Ast.reference_kind * string Odoc_parser.Ast.with_location * Odoc_parser.Ast.inline_element Odoc_parser.Ast.with_location list| `Link of string * Odoc_parser.Ast.inline_element Odoc_parser.Ast.with_location list| `Math_span of string(**)
]Inline elements are equivalent to what would be found in a span in HTML. Mostly these are straightforward. The `Reference constructor takes a triple whose second element is the reference itself, and the third the replacement text. Similarly the `Link constructor has the link itself as first parameter and the second is the replacement text.
type 'a abstract_table =
'a Odoc_parser.Ast.grid * Odoc_parser.Ast.alignment option list optiontype code_block_tag = [ | `Tag of string Odoc_parser.Ast.with_location| `Binding of string Odoc_parser.Ast.with_location * string Odoc_parser.Ast.with_location
]type code_block = {meta : Odoc_parser.Ast.code_block_meta option;delimiter : string option;content : string Odoc_parser.Ast.with_location;(*This is the raw content, that is the exact string inside the delimiters. In order to get the "processed" content, see
*)Odoc_parser.codeblock_contentoutput : Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list option;
}and nestable_block_element = [ | `Paragraph of Odoc_parser.Ast.inline_element Odoc_parser.Ast.with_location list| `Code_block of Odoc_parser.Ast.code_block| `Verbatim of string(*This is the raw content, that is the exact string inside the delimiters. In order to get the "processed" content, see
*)Odoc_parser.verbatim_content| `Modules of string Odoc_parser.Ast.with_location list| `List of [ `Unordered | `Ordered ] * [ `Light | `Heavy ] * Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list list| `Table of Odoc_parser.Ast.table| `Math_block of string(**)| `Media of Odoc_parser.Ast.reference_kind * Odoc_parser.Ast.media_href Odoc_parser.Ast.with_location * string * Odoc_parser.Ast.media(**)
]Some block elements may be nested within lists or tags, but not all. The `List constructor has a parameter of type [`Light | `Heavy]. This corresponds to the syntactic constructor used (see the manual).
and table =
Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.abstract_table
* [ `Light | `Heavy ]type internal_tag = [ | `Canonical of string Odoc_parser.Ast.with_location| `Inline| `Open| `Closed| `Hidden| `Children_order of Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Toc_status of Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Order_category of Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Short_title of Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list
]Internal tags are used to exercise fine control over the output of odoc. They are never rendered in the output
type ocamldoc_tag = [ | `Author of string| `Deprecated of Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Param of string * Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Raise of string * Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Custom of string * Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Return of Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `See of [ `Url | `File | `Document ] * string * Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Since of string| `Before of string * Odoc_parser.Ast.nestable_block_element Odoc_parser.Ast.with_location list| `Version of string
]ocamldoc tags are those that are specified in the manual)
type heading =
int
* string option
* Odoc_parser.Ast.inline_element Odoc_parser.Ast.with_location listtype block_element = [ | Odoc_parser.Ast.nestable_block_element| `Heading of Odoc_parser.Ast.heading| `Tag of Odoc_parser.Ast.tag
]