package ciao_lwt

  1. Overview
  2. Docs

Module Ocamlformat_utilsSource

Sourcemodule Parsing : sig ... end

OCamlformat's version of OCaml's parsing modules

module Cmt = Ocamlformat_lib.Cmt
Sourcemodule Ast_utils : module type of Ast_utils

Utility functions for contructing AST nodes.

Sourcetype modify_ast = {
  1. structure : Parsing.Parsetree.structure -> Parsing.Parsetree.structure * Cmt.t list;
  2. signature : Parsing.Parsetree.signature -> Parsing.Parsetree.signature * Cmt.t list;
}
Sourceval format_in_place : file:string -> modify_ast:modify_ast -> (unit, [ `Msg of string ]) result

Format the content of and overwrite file. modify_ast can be used to apply any change to the program. Raises Failure and Sys_error.

Sourceval parse : file:string -> ([ `Structure of Parsing.Parsetree.structure | `Signature of Parsing.Parsetree.signature ], [ `Msg of string ]) result

Parse an ocaml file.

Formatting a fragment of AST. This is most useful for messages.

Sourceval format_expression : Parsing.Parsetree.expression -> string
Sourceval format_longident : Parsing.Longident.t -> string

Format longidents without comments.