summaryrefslogtreecommitdiff
path: root/src/pretty_print.ml
diff options
context:
space:
mode:
authorKathy Gray2014-11-21 15:46:23 +0000
committerKathy Gray2014-11-21 15:46:23 +0000
commit405fa876b603703185ea834f65ddd14808544331 (patch)
treeac3de61e2703e4e6b93eaf6435105a807984eab5 /src/pretty_print.ml
parenta2ffb770435e398fd23efce9e9a1238a914bfbee (diff)
Print out default values for underspecified vectors instead of leaving them and letting them turn into undefineds
Diffstat (limited to 'src/pretty_print.ml')
-rw-r--r--src/pretty_print.ml9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pretty_print.ml b/src/pretty_print.ml
index 48855e64..2eec2383 100644
--- a/src/pretty_print.ml
+++ b/src/pretty_print.ml
@@ -919,10 +919,13 @@ let doc_exp, doc_let =
("0b" ^
(List.fold_right (fun (E_aux(E_lit(L_aux(l, _)),_)) rst -> match l with | L_one -> "1"^rst | L_zero -> "0"^rst) exps ""))
| _ -> default_print ()))
- | E_vector_indexed (iexps, default) ->
- (* XXX TODO print default when it is non-empty *)
+ | E_vector_indexed (iexps, (Def_val_aux (default,_))) ->
+ let default_string =
+ (match default with
+ | Def_val_empty -> string ""
+ | Def_val_dec e -> concat [semi; space; string "default"; equals; (exp e)]) in
let iexp (i,e) = doc_op equals (doc_int i) (exp e) in
- brackets (separate_map comma iexp iexps)
+ brackets (concat [(separate_map comma iexp iexps); default_string])
| E_vector_update(v,e1,e2) ->
brackets (doc_op (string "with") (exp v) (doc_op equals (atomic_exp e1) (exp e2)))
| E_vector_update_subrange(v,e1,e2,e3) ->