summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-10-29 15:52:20 +0000
committerAlasdair Armstrong2018-10-29 16:28:17 +0000
commit546bd3e14957199cc1efc0810fb4a2c58ba23fde (patch)
tree7c0f51b0dc349c4edcbd67f6d921018c886dec5f /src
parent29f69b03602552d3ca1a29713527d21f5790e28a (diff)
Pretty printer tweaks for ASL parser
No longer remove braces around singleton expressions, as this can produce unreadably long lines in ASL parser output when assignments are converted to lets. Add brackets around as-patterns for type-variables
Diffstat (limited to 'src')
-rw-r--r--src/pretty_print_sail.ml3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/pretty_print_sail.ml b/src/pretty_print_sail.ml
index 0b0a8305..37c48220 100644
--- a/src/pretty_print_sail.ml
+++ b/src/pretty_print_sail.ml
@@ -237,7 +237,7 @@ let rec doc_pat (P_aux (p_aux, _) as pat) =
(* P_var short form sugar *)
| P_var (P_aux (P_id id, _), TP_aux (TP_var kid, _)) when Id.compare (id_of_kid kid) id == 0 ->
doc_kid kid
- | P_var (pat, tpat) -> separate space [doc_pat pat; string "as"; doc_typ_pat tpat]
+ | P_var (pat, tpat) -> parens (separate space [doc_pat pat; string "as"; doc_typ_pat tpat])
| P_vector pats -> brackets (separate_map (comma ^^ space) doc_pat pats)
| P_vector_concat pats -> separate_map (space ^^ string "@" ^^ space) doc_pat pats
| P_wild -> string "_"
@@ -286,7 +286,6 @@ let fixities =
let rec doc_exp (E_aux (e_aux, _) as exp) =
match e_aux with
| E_block [] -> string "()"
- | E_block [exp] -> doc_exp exp
| E_block exps -> surround 2 0 lbrace (doc_block exps) rbrace
| E_nondet exps -> assert false
(* This is mostly for the -convert option *)