aboutsummaryrefslogtreecommitdiffhomepage
path: root/printing/ppconstr.mli
blob: 482c994c252eed37636e6d0e7153e7366dbc4e5b (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(** This module implements pretty-printers for constr_expr syntactic
    objects and their subcomponents. *)

(** The default pretty-printers produce {!Pp.std_ppcmds} that are
    interpreted as raw strings. *)
open Loc
open Pp
open Libnames
open Constrexpr
open Names
open Misctypes

val extract_lam_binders :
  constr_expr -> local_binder_expr list * constr_expr
val extract_prod_binders :
  constr_expr -> local_binder_expr list * constr_expr
val split_fix :
  int -> constr_expr -> constr_expr ->
  local_binder_expr list *  constr_expr * constr_expr

val prec_less : int -> int * Ppextend.parenRelation -> bool

val pr_tight_coma : unit -> std_ppcmds

val pr_or_var : ('a -> std_ppcmds) -> 'a or_var -> std_ppcmds

val pr_lident : Id.t located -> std_ppcmds
val pr_lname : Name.t located -> std_ppcmds

val pr_with_comments : ?loc:Loc.t -> std_ppcmds -> std_ppcmds
val pr_com_at : int -> std_ppcmds
val pr_sep_com :
  (unit -> std_ppcmds) ->
  (constr_expr -> std_ppcmds) ->
  constr_expr -> std_ppcmds

val pr_id : Id.t -> std_ppcmds
val pr_name : Name.t -> std_ppcmds
val pr_qualid : qualid -> std_ppcmds
val pr_patvar : patvar -> std_ppcmds

val pr_glob_level : glob_level -> std_ppcmds
val pr_glob_sort : glob_sort -> std_ppcmds
val pr_guard_annot : (constr_expr -> std_ppcmds) ->
  local_binder_expr list ->
  ('a * Names.Id.t) option * recursion_order_expr ->
  std_ppcmds

val pr_record_body : (reference * constr_expr) list -> std_ppcmds
val pr_binders : local_binder_expr list -> std_ppcmds
val pr_constr_pattern_expr : constr_pattern_expr -> std_ppcmds
val pr_lconstr_pattern_expr : constr_pattern_expr -> std_ppcmds
val pr_constr_expr : constr_expr -> std_ppcmds
val pr_lconstr_expr : constr_expr -> std_ppcmds
val pr_cases_pattern_expr : cases_pattern_expr -> std_ppcmds

type term_pr = {
  pr_constr_expr   : constr_expr -> std_ppcmds;
  pr_lconstr_expr  : constr_expr -> std_ppcmds;
  pr_constr_pattern_expr  : constr_pattern_expr -> std_ppcmds;
  pr_lconstr_pattern_expr : constr_pattern_expr -> std_ppcmds
}

val set_term_pr : term_pr -> unit
val default_term_pr : term_pr

(* The modular constr printer.
  [modular_constr_pr pr s p t] prints the head of the term [t] and calls
  [pr] on its subterms.
  [s] is typically {!Pp.mt} and [p] is [lsimpleconstr] for "constr" printers
  and [ltop] for "lconstr" printers (spiwack: we might need more
  specification here).
  We can make a new modular constr printer by overriding certain branches,
  for instance if we want to build a printer which prints "Prop" as "Omega"
  instead we can proceed as follows:
  let my_modular_constr_pr pr s p = function
  | CSort (_,GProp Null) -> str "Omega"
  | t -> modular_constr_pr pr s p t
  Which has the same type. We can turn a modular printer into a printer by
  taking its fixpoint. *)

type precedence
val lsimpleconstr : precedence
val ltop : precedence
val modular_constr_pr :
  ((unit->std_ppcmds) -> precedence -> constr_expr -> std_ppcmds) ->
  (unit->std_ppcmds) -> precedence  -> constr_expr -> std_ppcmds