package ocamlformat-mlx-lib

  1. Overview
  2. Docs
OCaml .mlx Code Formatter

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocamlformat-mlx-0.28.1.1.tbz
sha256=087d7256a52808715875814d8bccf9172f97e933b398fc8d29ec40dc89fa9e0e
sha512=809b690e6c21110f81918dfdb1b5efecd185a4f26eadb2bb3aa6eb8069db20989e8797650b22a2207b6b26abe97db357c2dc6056943a3a4f630c4e1a0ebb4f1b

doc/src/ocamlformat-mlx-lib.parser_extended/pprintast.ml.html

Source file pprintast.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
let tyvar_of_name s =
  if String.length s >= 2 && s.[1] = '\'' then
    (* without the space, this would be parsed as
       a character literal *)
    "' " ^ s
  else if Lexer.is_keyword s then
    "'\\#" ^ s
  else if String.equal s "_" then
    s
  else
    "'" ^ s

module Doc = struct
  let tyvar ppf s =
    Format_doc.fprintf ppf "%s" (tyvar_of_name s)
end

let tyvar ppf v = Format_doc.compat Doc.tyvar ppf v