mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Improve pretty-printing of infixes
This commit is contained in:
parent
bc52979e39
commit
73016b2992
1 changed files with 5 additions and 2 deletions
|
|
@ -32,7 +32,6 @@ let rewrite_infix s =
|
|||
else
|
||||
let num c = Char.code c - Char.code '0' in
|
||||
let c = Char.chr (num s.[i] * 10 + num s.[i+1]) in
|
||||
(* Printf.printf "Got char '%c'\n" c; *)
|
||||
Buffer.add_char b c;
|
||||
loop (i+2)
|
||||
in
|
||||
|
|
@ -44,7 +43,11 @@ class my_pp_e pp_decl fself = object
|
|||
method! c_Call ppf e f args =
|
||||
match f,args with
|
||||
| (Var s, [l; r]) when looks_like_infix s ->
|
||||
super#c_Call ppf e (Var (rewrite_infix s)) args (* CHANGE 1 *)
|
||||
Format.fprintf ppf "@[<h>%a@ %s@ %a@]"
|
||||
fself l
|
||||
(rewrite_infix s)
|
||||
fself r (* CHANGE 1 *)
|
||||
|
||||
| _ -> super#c_Call ppf e f args
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue