File: Parse_with_comments.mli

package info (click to toggle)
ocamlformat 0.27.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,068 kB
  • sloc: ml: 61,288; pascal: 4,739; lisp: 229; sh: 217; makefile: 121
file content (63 lines) | stat: -rw-r--r-- 1,899 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(**************************************************************************)
(*                                                                        *)
(*                              OCamlFormat                               *)
(*                                                                        *)
(*            Copyright (c) Facebook, Inc. and its affiliates.            *)
(*                                                                        *)
(*      This source code is licensed under the MIT license found in       *)
(*      the LICENSE file in the root directory of this source tree.       *)
(*                                                                        *)
(**************************************************************************)

type 'a with_comments =
  {ast: 'a; comments: Cmt.t list; prefix: string; source: Source.t}

module W : sig
  type t

  val in_lexer : int list

  val disable : int -> t

  val enable : int -> t

  val to_string : t list -> string
end

exception Warning50 of (Location.t * Warnings.t) list

val parse :
     ?disable_w50:bool
  -> ?disable_deprecated:bool
  -> (   'b
      -> ocaml_version:Ocaml_version.t
      -> input_name:string
      -> string
      -> 'a )
  -> 'b
  -> Conf.t
  -> input_name:string
  -> source:string
  -> 'a with_comments
(** @raise [Warning50] on misplaced documentation comments. *)

val parse_toplevel :
     ?disable_w50:bool
  -> ?disable_deprecated:bool
  -> Conf.t
  -> input_name:string
  -> source:string
  -> ( Extended_ast.use_file with_comments
     , Extended_ast.repl_file with_comments )
     Either.t
(** Variant of {!parse} that uses {!Extended_ast.Parse.toplevel}. This
    function handles [conf.parse_toplevel_phrases]. *)

val parse_ast :
     Conf.t
  -> 'a Extended_ast.t
  -> ocaml_version:Ocaml_version.t
  -> input_name:string
  -> string
  -> 'a
(** Argument to {!parse}. *)