Commit 4ff8a6ac authored by MARCHE Claude's avatar MARCHE Claude

document + add sanitization on Ident.string_unique

parent 6fc9422e
...@@ -338,7 +338,7 @@ let translate ~loc dl = ...@@ -338,7 +338,7 @@ let translate ~loc dl =
Typing.add_decl loc main Typing.add_decl loc main
let read_channel env path file c = let read_channel env path file c =
let f = Py_lexer.parse file c in let f : Py_ast.file = Py_lexer.parse file c in
Debug.dprintf debug "%s parsed successfully.@." file; Debug.dprintf debug "%s parsed successfully.@." file;
let file = Filename.basename file in let file = Filename.basename file in
let file = Filename.chop_extension file in let file = Filename.chop_extension file in
......
...@@ -275,7 +275,7 @@ let id_unique printer ?(sanitizer = same) id = ...@@ -275,7 +275,7 @@ let id_unique printer ?(sanitizer = same) id =
Hid.replace printer.values id name; Hid.replace printer.values id name;
name name
let string_unique printer s = find_unique printer.indices s let string_unique printer s = find_unique printer.indices (printer.sanitizer s)
let forget_id printer id = let forget_id printer id =
try try
......
...@@ -28,7 +28,7 @@ module type Printer = sig ...@@ -28,7 +28,7 @@ module type Printer = sig
val tprinter : ident_printer (* type symbols *) val tprinter : ident_printer (* type symbols *)
val aprinter : ident_printer (* type variables *) val aprinter : ident_printer (* type variables *)
val sprinter : ident_printer (* variables and functions *) val sprinter : ident_printer (* variables and functions *)
val pprinter : ident_printer (* propoition names *) val pprinter : ident_printer (* proposition names *)
val forget_all : unit -> unit (* flush id_unique *) val forget_all : unit -> unit (* flush id_unique *)
val forget_tvs : unit -> unit (* flush id_unique for type vars *) val forget_tvs : unit -> unit (* flush id_unique for type vars *)
...@@ -93,3 +93,8 @@ include Printer ...@@ -93,3 +93,8 @@ include Printer
val create : Ident.ident_printer -> Ident.ident_printer -> val create : Ident.ident_printer -> Ident.ident_printer ->
Ident.ident_printer -> Ident.ident_printer -> Ident.ident_printer -> Ident.ident_printer ->
bool -> (module Printer) bool -> (module Printer)
(** `create spr apr tpr ppr forget` creates a new pretty-printing
module from the printer `spr` for variables and functions, `apr`
for type variables, `tpr` for type symbols and `ppr for proposition
names`. When the Boolean `forget` is true then all recorded names
are forgotten between printing of each tasks. *)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment