]> matita.cs.unibo.it Git - helm.git/commitdiff
- ported to latest CicAst.Ident format (Some [] <> None)
authorStefano Zacchiroli <zack@upsilon.cc>
Tue, 2 Mar 2004 17:14:15 +0000 (17:14 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Tue, 2 Mar 2004 17:14:15 +0000 (17:14 +0000)
- unspecified local contexes are now inferred

helm/ocaml/cic_disambiguation/cicTextualParser2.ml
helm/ocaml/cic_disambiguation/disambiguate.ml

index 7c8261faebc372e2c92772bd1e50f3da3fc1af7f..f530a31beb30906e3dbc8f450299c6b87c53bcb4 100644 (file)
@@ -112,9 +112,7 @@ EXTEND
         PAREN "]" ->
           substs
       ] ->
-        (match subst with
-        | Some l -> CicAst.Ident (s, l)
-        | None -> CicAst.Ident (s, []))
+        CicAst.Ident (s, subst)
     ]
   ];
   name: [ (* as substituted_name with no explicit substitution *)
index bc78f55eddc0888d80dba682c7b3a6edeeef27bf..6a6ab9b274333529b8df915bb40f09fee54baa5f 100644 (file)
@@ -182,10 +182,9 @@ let interpretate ~context ~env ast =
         in
         List.fold_right (build_term inductiveFuns) inductiveFuns cic_body
     | CicAst.Ident (name, subst) ->
-        (* TODO hanlde explicit substitutions *)
         (try
           let index = find_in_environment name context in
-          if subst <> [] then
+          if subst <> None then
             CicTextualParser2.fail loc
               "Explicit substitutions not allowed here";
           Cic.Rel index
@@ -195,12 +194,16 @@ let interpretate ~context ~env ast =
             let ids_to_uris =
               List.map (fun uri -> UriManager.name_of_uri uri, uri) uris
             in
-            List.map
-              (fun (s, term) ->
-                (try
-                  List.assoc s ids_to_uris, aux loc context term
-                 with Not_found -> raise DisambiguateChoices.Invalid_choice))
-              subst
+            (match subst with
+            | Some subst ->
+                List.map
+                  (fun (s, term) ->
+                    (try
+                      List.assoc s ids_to_uris, aux loc context term
+                     with Not_found ->
+                       raise DisambiguateChoices.Invalid_choice))
+                  subst
+            | None -> List.map (fun uri -> uri, Cic.Implicit None) uris)
          in
           (match cic with
           | Cic.Const (uri, []) ->
@@ -324,19 +327,22 @@ let domain_of_term ~context ast =
         in
         where_dom @ defs_dom
     | CicAst.Ident (name, subst) ->
-        (* TODO hanlde explicit substitutions *)
         (try
           let index = find_in_environment name context in
-          if subst <> [] then
+          if subst <> None then
             CicTextualParser2.fail loc
-              "Explicit substitutions not allowed here";
-          []
+              "Explicit substitutions not allowed here"
+          else
+            []
         with Not_found ->
-          List.fold_left
-            (fun dom (_, term) ->
-              let dom' = aux loc context term in
-              dom' @ dom)
-            [ Id name ] subst)
+          (match subst with
+          | None -> [Id name]
+          | Some subst ->
+              List.fold_left
+                (fun dom (_, term) ->
+                  let dom' = aux loc context term in
+                  dom' @ dom)
+                [Id name] subst))
     | CicAst.Implicit -> []
     | CicAst.Num (num, i) -> [ Num i ]
     | CicAst.Meta (index, local_context) ->