X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_disambiguation%2FcicTextualParser2.ml;h=2b6d6c0c9f5ae10adc44a3ab786afdda83f7d982;hb=31f877fe0b3f0c0a4d5f03ff40c5afe5eb3f326f;hp=2474191fe4f0c9f866b40e8949f40e504e0fd91f;hpb=ae25bae855f66b7ebc9926a80dc38e622f0cff38;p=helm.git diff --git a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml index 2474191fe..2b6d6c0c9 100644 --- a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml +++ b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml @@ -40,6 +40,13 @@ type tactical = (CicAst.term, string) TacticAst.tactic TacticAst.tactical type command = CicAst.term CommandAst.command type script = CicAst.term CommandAst.Script.script +let fresh_num_instance = + let n = ref 0 in + function () -> + incr n; + !n +;; + let choice_of_uri (uri: string) = let cic = HelmLibraryObjects.term_of_uri (UriManager.uri_of_string uri) in (uri, (fun _ _ _ -> cic)) @@ -112,9 +119,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 *) @@ -177,13 +182,14 @@ EXTEND ] | "add" LEFTA [ (* nothing here by default *) ] | "mult" LEFTA [ (* nothing here by default *) ] + | "power" LEFTA [ (* nothing here by default *) ] | "inv" NONA [ (* nothing here by default *) ] | "simple" NONA [ sort = sort -> CicAst.Sort sort | n = substituted_name -> return_term loc n | PAREN "("; head = term; args = LIST1 term; PAREN ")" -> return_term loc (CicAst.Appl (head :: args)) - | i = NUM -> return_term loc (CicAst.Num (i, 0)) + | i = NUM -> return_term loc (CicAst.Num (i, (fresh_num_instance ()))) | IMPLICIT -> return_term loc CicAst.Implicit | m = META; substs = [ @@ -209,6 +215,8 @@ EXTEND PAREN "]" -> return_term loc (CicAst.Case (t, indty_ident, outtyp, patterns)) + | PAREN "("; t1 = term; SYMBOL ":"; t2 = term; PAREN ")" -> + return_term loc (CicAst.Appl [CicAst.Symbol ("cast", 0); t1; t2]) | PAREN "("; t = term; PAREN ")" -> return_term loc t ] ];