From 0bd0b1d55aba3f0ca0f495377b9aca8ef4fc4163 Mon Sep 17 00:00:00 2001 From: herbelin Date: Thu, 29 Jul 2010 23:10:17 +0000 Subject: Rather quick hack to make basic unicode notations available by requiring a file Utf8_core. That needs to be improved... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13358 85f007b7-540e-0410-9357-904b9bb8a0f7 --- lib/flags.ml | 2 -- lib/flags.mli | 2 -- parsing/ppconstr.ml | 12 ++++-------- theories/Unicode/Utf8_core.v | 25 +++++++++++++++++++++++++ theories/Unicode/vo.itarget | 1 + toplevel/coqtop.ml | 2 +- 6 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 theories/Unicode/Utf8_core.v diff --git a/lib/flags.ml b/lib/flags.ml index b8e297267c..1b92aaf339 100644 --- a/lib/flags.ml +++ b/lib/flags.ml @@ -33,8 +33,6 @@ let dont_load_proofs = ref false let raw_print = ref false -let unicode_syntax = ref false - (* Compatibility mode *) type compat_version = V8_2 diff --git a/lib/flags.mli b/lib/flags.mli index 13cc68a300..1d18b4c516 100644 --- a/lib/flags.mli +++ b/lib/flags.mli @@ -25,8 +25,6 @@ val dont_load_proofs : bool ref val raw_print : bool ref -val unicode_syntax : bool ref - type compat_version = V8_2 val compat_version : compat_version option ref val version_strictly_greater : compat_version -> bool diff --git a/parsing/ppconstr.ml b/parsing/ppconstr.ml index 73f98ca95f..6276a23c39 100644 --- a/parsing/ppconstr.ml +++ b/parsing/ppconstr.ml @@ -409,15 +409,11 @@ let pr_app pr a l = pr (lapp,L) a ++ prlist (fun a -> spc () ++ pr_expl_args pr a) l) -let pr_forall () = - if !Flags.unicode_syntax then str"Π" ++ spc () - else str"forall" ++ spc () +let pr_forall () = str"forall" ++ spc () -let pr_fun () = - if !Flags.unicode_syntax then str"λ" ++ spc () - else str"fun" ++ spc () +let pr_fun () = str"fun" ++ spc () -let pr_fun_sep = lazy (if !Flags.unicode_syntax then str "," else str " =>") +let pr_fun_sep = str " =>" let pr_dangling_with_for sep pr inherited a = @@ -454,7 +450,7 @@ let pr pr sep inherited a = hov 0 ( hov 2 (pr_delimited_binders pr_fun spc (pr mt ltop) bl) ++ - Lazy.force pr_fun_sep ++ pr spc ltop a), + pr_fun_sep ++ pr spc ltop a), llambda | CLetIn (_,(_,Name x),(CFix(_,(_,x'),[_])|CCoFix(_,(_,x'),[_]) as fx), b) when x=x' -> diff --git a/theories/Unicode/Utf8_core.v b/theories/Unicode/Utf8_core.v new file mode 100644 index 0000000000..a42de3abd7 --- /dev/null +++ b/theories/Unicode/Utf8_core.v @@ -0,0 +1,25 @@ +(* -*- coding:utf-8 -*- *) +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* y) (at level 90, right associativity): type_scope. +Notation "x ↔ y" := (x <-> y) (at level 95, no associativity): type_scope. +Notation "¬ x" := (~x) (at level 75, right associativity) : type_scope. +Notation "x ≠ y" := (x <> y) (at level 70) : type_scope. + +(* Abstraction *) +Notation "'λ' x .. y , t" := (fun x => .. (fun y => t) ..) + (at level 200, x binder, y binder, right associativity). diff --git a/theories/Unicode/vo.itarget b/theories/Unicode/vo.itarget index 243a40b762..7be1b9961c 100644 --- a/theories/Unicode/vo.itarget +++ b/theories/Unicode/vo.itarget @@ -1 +1,2 @@ Utf8.vo +Utf8_core.vo diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml index 29cbde2099..b424006624 100644 --- a/toplevel/coqtop.ml +++ b/toplevel/coqtop.ml @@ -249,7 +249,7 @@ let parse_args arglist = | "-emacs-U" :: rem -> Flags.print_emacs := true; Flags.print_emacs_safechar := true; Pp.make_pp_emacs(); parse rem - | "-unicode" :: rem -> Flags.unicode_syntax := true; parse rem + | "-unicode" :: rem -> add_require "Utf8_core"; parse rem | "-coqlib" :: d :: rem -> Flags.coqlib_spec:=true; Flags.coqlib:=d; parse rem | "-coqlib" :: [] -> usage () -- cgit v1.2.3