summaryrefslogtreecommitdiff
path: root/src/pretty_print.ml
diff options
context:
space:
mode:
authorGabriel Kerneis2014-05-19 17:54:38 +0100
committerGabriel Kerneis2014-05-19 17:54:38 +0100
commitd12c12d61ad4d2e4ea301cfaf11c0e09f6bcfcef (patch)
tree31fc02cefd15ec22dd949bf8f446305f1c44c776 /src/pretty_print.ml
parenteb75337f152ed64fc77bfc700466a88f683d9a2c (diff)
Add tricky necessary whitespace to avoid lexer confusion
Diffstat (limited to 'src/pretty_print.ml')
-rw-r--r--src/pretty_print.ml9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pretty_print.ml b/src/pretty_print.ml
index 66ddae26..2f1621e7 100644
--- a/src/pretty_print.ml
+++ b/src/pretty_print.ml
@@ -830,7 +830,10 @@ open PPrint
let doc_id (Id_aux(i,_)) =
match i with
| Id i -> string i
- | DeIid x -> parens (separate space [string "deinfix"; string x])
+ | DeIid x ->
+ (* add an extra space through empty to avoid a closing-comment
+ * token in case of x ending with star. *)
+ parens (separate space [string "deinfix"; string x; empty])
let doc_var (Kid_aux(Var v,_)) = string v
@@ -891,7 +894,9 @@ let rec doc_typ ty =
| Typ_tup typs -> parens (separate_map (spaces star) app_typ typs)
| _ -> app_typ ty
and app_typ ((Typ_aux (t, _)) as ty) = match t with
- | Typ_app(id,args) -> (doc_id id) ^^ (angles (separate_map comma_sp doc_typ_arg args))
+ | Typ_app(id,args) ->
+ (* trailing space to avoid >> token in case of nested app types *)
+ (doc_id id) ^^ (angles (separate_map comma_sp doc_typ_arg args)) ^^ space
| _ -> atomic_typ ty (* for simplicity, skip vec_typ - which is only sugar *)
and atomic_typ ((Typ_aux (t, _)) as ty) = match t with
| Typ_id id -> doc_id id