aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2004-11-17 14:19:13 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2004-11-17 14:19:13 +0000
commitfb5036b81d8eac2bfb1c32d31409489941fd2551 (patch)
tree2a6008fefa4380e716338c2b29150d510b52a285
parenta31b23df4870764cd31d62ad9f876fbff746765d (diff)
Ajout 'Locate Module'
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@6320 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--CHANGES4
-rw-r--r--parsing/g_basevernac.ml43
-rw-r--r--parsing/g_vernacnew.ml43
-rw-r--r--toplevel/vernacentries.ml14
-rw-r--r--toplevel/vernacexpr.ml1
-rw-r--r--translate/ppvernacnew.ml1
6 files changed, 24 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 71a6f3118..2f72a3a5f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,10 @@ Tactics
- Added "dependent rewrite term" and "dependent rewrite term in hyp" (doc TODO)
+Modules
+
+- Added "Locate Module qualid" to get the full path of a module.
+
Notations
- "format" option aware of recursive notations
diff --git a/parsing/g_basevernac.ml4 b/parsing/g_basevernac.ml4
index 74d527e8d..cd4213aa7 100644
--- a/parsing/g_basevernac.ml4
+++ b/parsing/g_basevernac.ml4
@@ -205,7 +205,8 @@ GEXTEND Gram
locatable:
[ [ qid = global -> LocateTerm qid
| IDENT "File"; f = lstring -> LocateFile f
- | IDENT "Library"; qid = global -> LocateLibrary qid
+ | IDENT "Library"; qid = global -> LocateLibrary qid
+ | IDENT "Module"; qid = global -> LocateModule qid
| s = lstring -> LocateNotation s ] ]
;
option_value:
diff --git a/parsing/g_vernacnew.ml4 b/parsing/g_vernacnew.ml4
index 45237e101..dafd6b3ca 100644
--- a/parsing/g_vernacnew.ml4
+++ b/parsing/g_vernacnew.ml4
@@ -608,7 +608,8 @@ GEXTEND Gram
locatable:
[ [ qid = global -> LocateTerm qid
| IDENT "File"; f = ne_string -> LocateFile f
- | IDENT "Library"; qid = global -> LocateLibrary qid
+ | IDENT "Library"; qid = global -> LocateLibrary qid
+ | IDENT "Module"; qid = global -> LocateModule qid
| s = ne_string -> LocateNotation s ] ]
;
option_value:
diff --git a/toplevel/vernacentries.ml b/toplevel/vernacentries.ml
index 3185d1f0c..3c8dd414e 100644
--- a/toplevel/vernacentries.ml
+++ b/toplevel/vernacentries.ml
@@ -220,6 +220,19 @@ let print_located_library r =
try msg_found_library (Library.locate_qualified_library qid)
with e -> msg_notfound_library loc qid e
+let print_located_module r =
+ let (loc,qid) = qualid_of_reference r in
+ let msg =
+ try
+ let dir = Nametab.full_name_module qid in
+ str "Module " ++ pr_dirpath dir
+ with Not_found ->
+ (if fst (repr_qualid qid) = empty_dirpath then
+ str "No module of basename "
+ else
+ str "No module of suffix ") ++ pr_qualid qid
+ in msgnl msg
+
(**********)
(* Syntax *)
@@ -963,6 +976,7 @@ let vernac_search s r =
let vernac_locate = function
| LocateTerm qid -> msgnl (print_located_qualid qid)
| LocateLibrary qid -> print_located_library qid
+ | LocateModule qid -> print_located_module qid
| LocateFile f -> locate_file f
| LocateNotation ntn ->
ppnl (Symbols.locate_notation (Constrextern.without_symbols pr_rawterm)
diff --git a/toplevel/vernacexpr.ml b/toplevel/vernacexpr.ml
index 854d18152..031cc98a2 100644
--- a/toplevel/vernacexpr.ml
+++ b/toplevel/vernacexpr.ml
@@ -76,6 +76,7 @@ type searchable =
type locatable =
| LocateTerm of reference
| LocateLibrary of reference
+ | LocateModule of reference
| LocateFile of string
| LocateNotation of notation
diff --git a/translate/ppvernacnew.ml b/translate/ppvernacnew.ml
index ecf7b76a1..4441b0b52 100644
--- a/translate/ppvernacnew.ml
+++ b/translate/ppvernacnew.ml
@@ -1042,6 +1042,7 @@ let rec pr_vernac = function
| LocateTerm qid -> pr_reference qid
| LocateFile f -> str"File" ++ spc() ++ qsnew f
| LocateLibrary qid -> str"Library" ++ spc () ++ pr_module qid
+ | LocateModule qid -> str"Module" ++ spc () ++ pr_module qid
| LocateNotation s -> qsnew s
in str"Locate" ++ spc() ++ pr_locate loc
| VernacComments l ->