aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2010-04-10 19:13:17 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2010-04-10 19:13:17 +0000
commit5ae3e803d6d8169deadef604fbc44fa86c13f876 (patch)
tree85fad238704d781667ca5fe7a214c204d54b0c2b /interp
parent1c75bf3def2601243d0a9f49e8a7d72b2b48defe (diff)
Optimized need for delimiters when disjoint scopes for strings and
numerals are open (see e.g. part of bug report #2044). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12924 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'interp')
-rw-r--r--interp/constrextern.ml4
-rw-r--r--interp/notation.ml10
-rw-r--r--interp/notation.mli2
3 files changed, 9 insertions, 7 deletions
diff --git a/interp/constrextern.ml b/interp/constrextern.ml
index 65976a03f..24f5a78c5 100644
--- a/interp/constrextern.ml
+++ b/interp/constrextern.ml
@@ -387,7 +387,7 @@ let rec extern_cases_pattern_in_scope (scopes:local_scopes) vars pat =
try
if !Flags.raw_print or !print_no_symbol then raise No_match;
let (na,sc,p) = uninterp_prim_token_cases_pattern pat in
- match availability_of_prim_token sc scopes with
+ match availability_of_prim_token p sc scopes with
| None -> raise No_match
| Some key ->
let loc = cases_pattern_loc pat in
@@ -604,7 +604,7 @@ let rec rename_rawconstr_var id0 id1 = function
let extern_possible_prim_token scopes r =
try
let (sc,n) = uninterp_prim_token r in
- match availability_of_prim_token sc scopes with
+ match availability_of_prim_token n sc scopes with
| None -> None
| Some key -> Some (insert_delimiters (CPrim (loc_of_rawconstr r,n)) key)
with No_match ->
diff --git a/interp/notation.ml b/interp/notation.ml
index bee6c5c93..794169a37 100644
--- a/interp/notation.ml
+++ b/interp/notation.ml
@@ -190,14 +190,14 @@ let prim_token_key_table = Hashtbl.create 7
let make_gr = function
- | ConstRef con ->
+ | ConstRef con ->
ConstRef(constant_of_kn(canonical_con con))
| IndRef (kn,i) ->
IndRef(mind_of_kn(canonical_mind kn),i)
| ConstructRef ((kn,i),j )->
ConstructRef((mind_of_kn(canonical_mind kn),i),j)
| VarRef id -> VarRef id
-
+
let rawconstr_key = function
| RApp (_,RRef (_,ref),_) -> RefKey (make_gr ref)
| RRef (_,ref) -> RefKey (make_gr ref)
@@ -409,8 +409,10 @@ let uninterp_prim_token_cases_pattern c =
| Some n -> (na,sc,n)
with Not_found -> raise No_match
-let availability_of_prim_token printer_scope local_scopes =
- let f scope = Hashtbl.mem prim_token_interpreter_tab scope in
+let availability_of_prim_token n printer_scope local_scopes =
+ let f scope =
+ try ignore (Hashtbl.find prim_token_interpreter_tab scope dummy_loc n); true
+ with Not_found -> false in
let scopes = make_current_scopes local_scopes in
Option.map snd (find_without_delimiters f (Some printer_scope,None) scopes)
diff --git a/interp/notation.mli b/interp/notation.mli
index d549bb387..f52e17cc8 100644
--- a/interp/notation.mli
+++ b/interp/notation.mli
@@ -98,7 +98,7 @@ val uninterp_prim_token_cases_pattern :
cases_pattern -> name * scope_name * prim_token
val availability_of_prim_token :
- scope_name -> local_scopes -> delimiters option option
+ prim_token -> scope_name -> local_scopes -> delimiters option option
(*s Declare and interpret back and forth a notation *)