summaryrefslogtreecommitdiff
path: root/src/pretty_print_sail2.ml
diff options
context:
space:
mode:
authorBrian Campbell2017-12-05 11:31:02 +0000
committerBrian Campbell2017-12-06 17:36:59 +0000
commitc497bef0d49ec32afae584c63a0cee0730cb90b1 (patch)
tree864a5c115090a4a810956303a843e5ce633d3493 /src/pretty_print_sail2.ml
parent17c518d94e5b2f531de47ee94ca0ceca09051f25 (diff)
Add top-level pattern match guards internally
Also fix bug in mono analysis with generated variables Breaks lots of typechecking tests because it generates unnecessary equality tests on units (and the tests don't have generic equality), which I'll fix next.
Diffstat (limited to 'src/pretty_print_sail2.ml')
-rw-r--r--src/pretty_print_sail2.ml12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pretty_print_sail2.ml b/src/pretty_print_sail2.ml
index 07259a6f..4d05e04d 100644
--- a/src/pretty_print_sail2.ml
+++ b/src/pretty_print_sail2.ml
@@ -394,12 +394,12 @@ and doc_atomic_lexp (LEXP_aux (l_aux, _) as lexp) =
| LEXP_vector_range (lexp, exp1, exp2) -> doc_atomic_lexp lexp ^^ brackets (separate space [doc_exp exp1; string ".."; doc_exp exp2])
| LEXP_memory (id, exps) -> doc_id id ^^ parens (separate_map (comma ^^ space) doc_exp exps)
| _ -> parens (doc_lexp lexp)
-and doc_pexps pexps = surround 2 0 lbrace (separate_map (comma ^^ hardline) doc_pexp pexps) rbrace
-and doc_pexp (Pat_aux (pat_aux, _)) =
+and doc_pexps pexps = surround 2 0 lbrace (separate_map (comma ^^ hardline) (doc_pexp "=>") pexps) rbrace
+and doc_pexp sym (Pat_aux (pat_aux, _)) =
match pat_aux with
- | Pat_exp (pat, exp) -> separate space [doc_pat pat; string "=>"; doc_exp exp]
+ | Pat_exp (pat, exp) -> separate space [doc_pat pat; string sym; doc_exp exp]
| Pat_when (pat, wh, exp) ->
- separate space [doc_pat pat; string "if"; doc_exp wh; string "=>"; doc_exp exp]
+ separate space [doc_pat pat; string "if"; doc_exp wh; string sym; doc_exp exp]
and doc_letbind (LB_aux (lb_aux, _)) =
match lb_aux with
| LB_val (pat, exp) ->
@@ -407,8 +407,8 @@ and doc_letbind (LB_aux (lb_aux, _)) =
let doc_funcl funcl = string "FUNCL"
-let doc_funcl (FCL_aux (FCL_Funcl (id, pat, exp), _)) =
- group (separate space [doc_id id; doc_pat pat; equals; doc_exp exp])
+let doc_funcl (FCL_aux (FCL_Funcl (id, pexp), _)) =
+ group (separate space [doc_id id; doc_pexp "=" pexp])
let doc_default (DT_aux(df,_)) = match df with
| DT_kind(bk,v) -> string "DT_kind" (* separate space [string "default"; doc_bkind bk; doc_var v] *)