package odoc-parser
Parser for ocaml documentation comments
Install
Dune Dependency
Authors
Maintainers
Sources
odoc-parser-2.0.0.tbz
sha256=407919fbb0eb95761d6fc6ec6777628d94aa1907343bdca678b1880bafb33922
sha512=d2bffa3e9f30471045682e390dcee7a2c1caf3831bca4bd57c16939e782c2e23434e6f1c9887580a1804800b3629ef4c4311a9d418fca5a939f324650d54006e
Description
Odoc_parser is a library for parsing the contents of OCaml documentation comments, formatted using 'odoc' syntax, an extension of the language understood by ocamldoc.
Published: 07 Jul 2022
README
odoc-parser
Odoc-parser is a parser for odoc markup, which is an extension of the original markup language parsed by ocamldoc.
OCaml code can contain specially formatted comments that are used to document the interfaces of modules. These comments are delimited by (**
and *)
. This parser is intended to be used to parse the contents of these comments.
The parser is part of the odoc project.
Please see CONTRIBUTING.md for details of the development process.
Example usage:
# #require "odoc-parser";;
# let location = {Lexing.pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum = 0};;
val location : Lexing.position =
{Lexing.pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum = 0}
# let p = Odoc_parser.parse_comment ~location ~text:"{b Bold!}[unfinished";;
val p : Odoc_parser.t = <abstr>
# let w = Odoc_parser.warnings p;;
val w : Odoc_parser.Warning.t list =
[{Odoc_parser.Warning.location =
{Odoc_parser.Loc.file = "";
start = {Odoc_parser.Loc.line = 1; column = 20};
end_ = {Odoc_parser.Loc.line = 1; column = 20}};
message = "End of text is not allowed in '[...]' (code)."}]
# Odoc_parser.ast p;;
- : Odoc_parser.Ast.t =
[{Odoc_parser__.Loc.location =
{Odoc_parser__.Loc.file = "";
start = {Odoc_parser__.Loc.line = 1; column = 0};
end_ = {Odoc_parser__.Loc.line = 1; column = 20}};
value =
`Paragraph
[{Odoc_parser__.Loc.location =
{Odoc_parser__.Loc.file = "";
start = {Odoc_parser__.Loc.line = 1; column = 0};
end_ = {Odoc_parser__.Loc.line = 1; column = 9}};
value =
`Styled
(`Bold,
[{Odoc_parser__.Loc.location =
{Odoc_parser__.Loc.file = "";
start = {Odoc_parser__.Loc.line = 1; column = 3};
end_ = {Odoc_parser__.Loc.line = 1; column = 8}};
value = `Word "Bold!"}])};
{Odoc_parser__.Loc.location =
{Odoc_parser__.Loc.file = "";
start = {Odoc_parser__.Loc.line = 1; column = 9};
end_ = {Odoc_parser__.Loc.line = 1; column = 20}};
value = `Code_span "unfinished"}]}]
Dependencies (5)
- camlp-streams
- result
- astring
-
ocaml
>= "4.02.0"
-
dune
>= "2.8"
Dev Dependencies (3)
-
sexplib0
with-test
-
ocaml
< "4.04.1" & with-test
-
ppx_expect
with-test
Used by (4)
-
mdx
>= "1.11.0" & < "2.3.1"
-
ocaml-lsp-server
>= "1.16.1" & < "1.17.0"
-
ocamlformat
= "0.24.1"
-
odoc
>= "2.2.0" & < "2.3.0"
Conflicts
None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page