X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matitaB%2Fcomponents%2Fcontent_pres%2FcicNotationParser.ml;h=7522d3c792546a9e042f64aeda9cda048887a21d;hb=0d481cc22ba8ada5781885da5398086a0b5662f3;hp=8043d73a3e9cd071a656c13c3587632129f74992;hpb=dee464f8cd331524663167659d1fad01e558d4e1;p=helm.git diff --git a/matitaB/components/content_pres/cicNotationParser.ml b/matitaB/components/content_pres/cicNotationParser.ml index 8043d73a3..7522d3c79 100644 --- a/matitaB/components/content_pres/cicNotationParser.ml +++ b/matitaB/components/content_pres/cicNotationParser.ml @@ -45,6 +45,7 @@ type ('a,'b,'c,'d,'e) grammars = { sym_attributes: (string option * string option) Grammar.Entry.e; sym_table: (string * Stdpp.location Grammar.Entry.e) list; let_defs: 'c Grammar.Entry.e; + let_codefs: 'c Grammar.Entry.e; protected_binder_vars: 'd Grammar.Entry.e; level2_meta: 'b Grammar.Entry.e; } @@ -672,10 +673,11 @@ END let term = grammars.term in let atag_attributes = grammars.sym_attributes in let let_defs = grammars.let_defs in + let let_codefs = grammars.let_codefs in let ident = grammars.ident in let protected_binder_vars = grammars.protected_binder_vars in EXTEND - GLOBAL: level2_ast term let_defs protected_binder_vars ident atag_attributes; + GLOBAL: level2_ast term let_defs let_codefs protected_binder_vars ident atag_attributes; level2_ast: [ [ p = term -> p ] ]; sort: [ [ "Prop" -> `Prop @@ -724,10 +726,24 @@ EXTEND let uri,_ = CicNotationLexer.LocalizeEnv.find loc !loctable in match uri with - | Some u -> id, `Uri u - | None -> id, `Ambiguous + | Some u -> + prerr_endline ("trovata interpretazione per " ^ id ^ ": " ^ u); + id, `Uri u + | None -> + prerr_endline ("identificatore ambiguo: " ^ id); + id, `Ambiguous with - | Not_found -> id, `Ambiguous ]]; + | Not_found -> + prerr_endline ("identificatore non trovato: " ^ id); + id, `Ambiguous ]]; + gnum: [ + [ n = NUMBER -> + try + match CicNotationLexer.LocalizeEnv.find loc !loctable with + | _uri, Some interpr -> n, Some (Some "cic:/fakeuri.def(1)",interpr) + | _ -> n,None + with + | Not_found -> n,None ]]; arg: [ [ LPAREN; names = LIST1 gident SEP SYMBOL ","; SYMBOL ":"; ty = term; RPAREN -> @@ -866,7 +882,7 @@ EXTEND | u = URI -> return_term loc (Ast.Ident (NUri.name_of_uri (NUri.uri_of_string u), `Uri u)) | r = NREF -> return_term loc (Ast.NRef (NReference.reference_of_string r)) - | n = NUMBER -> return_term loc (Ast.Num (n, None)) + | (n,interpr) = gnum -> return_term loc (Ast.Num (n, interpr)) | IMPLICIT -> return_term loc (Ast.Implicit `JustOne) | SYMBOL <:unicode> -> return_term loc (Ast.Implicit `Vector) | PLACEHOLDER -> return_term loc Ast.UserInput @@ -924,6 +940,7 @@ let initial_grammars loctable keywords = [] initial_symbols in let let_defs = Grammar.Entry.create level2_ast_grammar "let_defs" in + let let_codefs = Grammar.Entry.create level2_ast_grammar "let_codefs" in let protected_binder_vars = Grammar.Entry.create level2_ast_grammar "protected_binder_vars" in let level2_meta = Grammar.Entry.create level2_meta_grammar "level2_meta" in @@ -935,6 +952,7 @@ let initial_grammars loctable keywords = sym_table=sym_table; sym_attributes=sym_attributes; let_defs=let_defs; + let_codefs=let_codefs; protected_binder_vars=protected_binder_vars; level2_meta=level2_meta; level2_ast_grammar=level2_ast_grammar; @@ -1011,6 +1029,7 @@ let level2_ast_grammar status = status#notation_parser_db.grammars.level2_ast_grammar let term status = status#notation_parser_db.grammars.term let let_defs status = status#notation_parser_db.grammars.let_defs +let let_codefs status = status#notation_parser_db.grammars.let_codefs let protected_binder_vars status = status#notation_parser_db.grammars.protected_binder_vars