~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to parsing/printer.ml

  • Committer: Package Import Robot
  • Author(s): Stéphane Glondu
  • Date: 2012-01-03 23:42:48 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20120103234248-p9r8h1579n67v55a
Tags: 8.3pl3-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
(************************************************************************)
2
2
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
3
 
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010     *)
 
3
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011     *)
4
4
(*   \VV/  **************************************************************)
5
5
(*    //   *      This file is distributed under the terms of the       *)
6
6
(*         *       GNU Lesser General Public License Version 2.1        *)
7
7
(************************************************************************)
8
8
 
9
 
(* $Id: printer.ml 13390 2010-09-02 08:03:01Z herbelin $ *)
 
9
(* $Id: printer.ml 14641 2011-11-06 11:59:10Z herbelin $ *)
10
10
 
11
11
open Pp
12
12
open Util
499
499
let prterm = pr_lconstr
500
500
 
501
501
 
502
 
(* spiwack: printer function for sets of Environ.assumption.
503
 
            It is used primarily by the Print Assumption command. *)
 
502
(* Printer function for sets of Assumptions.assumptions.
 
503
   It is used primarily by the Print Assumptions command. *)
 
504
 
 
505
open Assumptions
 
506
 
504
507
let pr_assumptionset env s =
505
 
  if (Environ.ContextObjectMap.is_empty s) then
506
 
    str "Closed under the global context"
 
508
  if ContextObjectMap.is_empty s then
 
509
    str "Closed under the global context" ++ fnl()
507
510
  else
 
511
    let safe_pr_constant env kn =
 
512
      try pr_constant env kn
 
513
      with Not_found ->
 
514
        let mp,_,lab = repr_con kn in
 
515
        str (string_of_mp mp ^ "." ^ string_of_label lab)
 
516
    in
 
517
    let safe_pr_ltype typ =
 
518
      try str " : " ++ pr_ltype typ with _ -> mt ()
 
519
    in
508
520
    let (vars,axioms,opaque) =
509
 
      Environ.ContextObjectMap.fold (fun t typ r ->
 
521
      ContextObjectMap.fold (fun t typ r ->
510
522
        let (v,a,o) = r in
511
523
        match t with
512
524
        | Variable id -> (  Some (
521
533
        | Axiom kn    -> ( v ,
522
534
                             Some (
523
535
                              Option.default (fnl ()) a
524
 
                           ++ (pr_constant env kn)
525
 
                           ++ str " : "
526
 
                           ++ pr_ltype typ
 
536
                           ++ safe_pr_constant env kn
 
537
                           ++ safe_pr_ltype typ
527
538
                           ++ fnl ()
528
539
                             )
529
540
                         , o
531
542
        | Opaque kn    -> ( v , a ,
532
543
                             Some (
533
544
                              Option.default (fnl ()) o
534
 
                           ++ (pr_constant env kn)
535
 
                           ++ str " : "
536
 
                           ++ pr_ltype typ
 
545
                           ++ safe_pr_constant env kn
 
546
                           ++ safe_pr_ltype typ
537
547
                           ++ fnl ()
538
548
                             )
539
549
                         )