summaryrefslogtreecommitdiff
path: root/src/pretty_print_sail.ml
diff options
context:
space:
mode:
authorThomas Bauereiss2017-11-02 13:46:13 +0000
committerThomas Bauereiss2017-11-02 13:46:13 +0000
commitaa35f90fe4e7da4a6bbbe1396c23f9a5795b6909 (patch)
tree3c2253799750b91d66dd767e3c4303baf57e63f1 /src/pretty_print_sail.ml
parent9ea44b8b441eb394ffdd85d0b356167002ad7fdd (diff)
Fix a few AST and parsing-related bugs
Diffstat (limited to 'src/pretty_print_sail.ml')
-rw-r--r--src/pretty_print_sail.ml14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pretty_print_sail.ml b/src/pretty_print_sail.ml
index d346c801..a870f454 100644
--- a/src/pretty_print_sail.ml
+++ b/src/pretty_print_sail.ml
@@ -408,13 +408,13 @@ let doc_default (DT_aux(df,_)) = match df with
| DT_order(ord) -> separate space [string "default"; string "Order"; doc_ord ord]
let doc_spec (VS_aux(v,_)) = match v with
- | VS_val_spec(ts,id,None,false) ->
- separate space [string "val"; doc_typscm ts; doc_id id]
- | VS_val_spec (ts, id,None,true) ->
- separate space [string "val"; string "cast"; doc_typscm ts; doc_id id]
- | VS_val_spec(ts,id,Some ext,false) ->
- separate space [string "val"; string "extern"; doc_typscm ts;
- doc_op equals (doc_id id) (dquotes (string ext))]
+ | VS_val_spec(ts,id,ext_opt,is_cast) ->
+ let cast_pp = if is_cast then [string "cast"] else [] in
+ let extern_kwd_pp, id_pp = match ext_opt with
+ | Some ext -> [string "extern"], doc_op equals (doc_id id) (dquotes (string ext))
+ | None -> [], doc_id id
+ in
+ separate space ([string "val"] @ cast_pp @ extern_kwd_pp @ [doc_typscm ts] @ [id_pp])
| _ -> failwith "Invalid valspec"
let doc_namescm (Name_sect_aux(ns,_)) = match ns with