package ocamlformat-lib

  1. Overview
  2. Docs
OCaml Code Formatter

Install

Dune Dependency

Authors

Maintainers

Sources

ocamlformat-0.27.0.tbz
sha256=ddbf484c076d08f99400ee84b790ec231f5c8fcbd5d3324a6400d5388e846d15
sha512=4d2a8965a7b7ad45f8f4e76c01cf38bfa68462b07dfa7bdb2db23bd3e3017b214e6780f036679fa8595dde4167a01d957e3af8837274320449014e306773f917

doc/src/ocamlformat-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
OCaml

Innovation. Community. Security.