aboutsummaryrefslogtreecommitdiff
path: root/interp/notation.ml
diff options
context:
space:
mode:
authorherbelin2008-10-11 18:35:31 +0000
committerherbelin2008-10-11 18:35:31 +0000
commit76dfe2df5a5fc4623384a04610ba9f73030fee60 (patch)
treefd2dca003e37beb1d4cfa6d21f655ccc0edbd8b5 /interp/notation.ml
parent2e6c3a7b0b12cfd3b560de60f4918063f149fd01 (diff)
Backporting 11445 from 8.2 to trunk (negative conditions in
SearchAbout + referring objects by their notation). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11446 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'interp/notation.ml')
-rw-r--r--interp/notation.ml12
1 files changed, 8 insertions, 4 deletions
diff --git a/interp/notation.ml b/interp/notation.ml
index 46089245c1..0915304c39 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -408,7 +408,7 @@ let exists_notation_in_scope scopt ntn r =
r' = r
with Not_found -> false
-let isAVar = function AVar _ -> true | _ -> false
+let isAVar_or_AHole = function AVar _ | AHole _ -> true | _ -> false
(**********************************************************************)
(* Mapping classes to scopes *)
@@ -620,7 +620,7 @@ let browse_notation strict ntn map =
let global_reference_of_notation test (ntn,(sc,c,_)) =
match c with
| ARef ref when test ref -> Some (ntn,sc,ref)
- | AApp (ARef ref, l) when List.for_all isAVar l & test ref ->
+ | AApp (ARef ref, l) when List.for_all isAVar_or_AHole l & test ref ->
Some (ntn,sc,ref)
| _ -> None
@@ -632,8 +632,12 @@ let error_notation_not_reference loc ntn =
str "Unable to interpret " ++ quote (str ntn) ++
str " as a reference.")
-let interp_notation_as_global_reference loc test ntn =
- let ntns = browse_notation true ntn !scope_map in
+let interp_notation_as_global_reference loc test ntn sc =
+ let scopes = match sc with
+ | Some sc ->
+ Gmap.add sc (find_scope (find_delimiters_scope dummy_loc sc)) Gmap.empty
+ | None -> !scope_map in
+ let ntns = browse_notation true ntn scopes in
let refs = List.map (global_reference_of_notation test) ntns in
match Option.List.flatten refs with
| [_,_,ref] -> ref