package ocamlformat-mlx-lib

  1. Overview
  2. Docs
OCaml .mlx Code Formatter

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocamlformat-mlx-0.28.1.3.tbz
sha256=fb3af0d7a0b6ced6c9cbd84858e7aa86fe2a4b9f4b8f46080a04bc465b0e6eff
sha512=c0dc6c33aea286fbc007fdf02b09c37b72caf76d12ccf92576a04823cdcacf3044b6deba3372f40a87a0ae6f602da20d5840ebf0f116f4ca346b85c4d540b2f0

doc/src/ocamlformat-mlx-lib.parser_standard/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