File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -101,17 +101,21 @@ module IfThenElse = struct
101101 if ! changed then Some newStructure else None
102102end
103103
104+ let parse ~filename =
105+ let {Res_driver. parsetree = structure; comments} =
106+ Res_driver. parsingEngine.parseImplementation ~for Printer:false ~filename
107+ in
108+ let print ~structure =
109+ Res_printer. printImplementation ~width: ! Res_cli.ResClflags. width ~comments
110+ structure
111+ in
112+ (structure, print)
113+
104114let command ~path ~pos =
105115 if Filename. check_suffix path " .res" then
106- let parser =
107- Res_driver. parsingEngine.parseImplementation ~for Printer:false
108- in
109- let {Res_driver. parsetree = structure; comments} = parser ~filename: path in
110- let printer =
111- Res_printer. printImplementation ~width: ! Res_cli.ResClflags. width ~comments
112- in
116+ let structure, print = parse ~filename: path in
113117 match IfThenElse. xform ~pos structure with
114118 | None -> ()
115119 | Some newStructure ->
116- let formatted = printer newStructure in
120+ let formatted = print newStructure in
117121 Printf. printf " Hit IfThenElse. Formatted:\n %s" formatted
You can’t perform that action at this time.
0 commit comments