-
Notifications
You must be signed in to change notification settings - Fork 102
[RFC] Simpler AST #355
Description
Hi,
First of all, thanks for this great library !
I'm trying to use Odoc in OCamlformat to format documentation comments.
It's been great so far but I ran into a few problems with the representation of comments (Model.Comment):
- The parser requires passing a
containing_definitionargument that is hard to understand. - A lot of comments that were valid with Octavius now trigger warnings
- Some part of the AST are very hard to understand and pretty print
References (see Reference.deconstruct #354)
I proposed in #351 to expose Parser_.Ast.
This AST has some advantages:
- Parser is easier to call (no need to build dummy arguments)
- Less strict (no
non_link_inline_element, etc..) - Heading label is not auto generated yet
It could then be simplified by moving some code from the parser to the semantics pass that build Model.Comment:
- Represent references as strings
- List syntax (
-or+vsulorol)
This information could also be inModel.Comment. - Keep whitespaces
- Allow any language or none in blocks (eg.
Raw_markup of string option * string)
Alternatively, most of these could be fixed without exposing Parser_.Ast and only modifying Model.Comment.
But I think this AST will be much easier to change in the future to allow more use cases.
We will probably receive issues about documentation comments on OCamlformat and Odoc will be used by a lot of projects.
I'll be happy to hear your opinions on this.