@@ -260,8 +260,8 @@ and stmt_alt_type =
260
260
and stmt_alt_port =
261
261
{
262
262
(* else lval is a timeout value. *)
263
- alt_port_arms : ( lval * lval ) array ;
264
- alt_port_else : (lval * block ) option ;
263
+ alt_port_arms : port_arm array ;
264
+ alt_port_else : (atom * block ) option ;
265
265
}
266
266
267
267
and block' = stmt array
@@ -325,6 +325,13 @@ and tag_arm = tag_arm' identified
325
325
and type_arm' = ident * slot * block
326
326
and type_arm = type_arm' identified
327
327
328
+ and port_arm' = port_case * block
329
+ and port_arm = port_arm' identified
330
+
331
+ and port_case =
332
+ PORT_CASE_send of (lval * lval)
333
+ | PORT_CASE_recv of (lval * lval)
334
+
328
335
and atom =
329
336
ATOM_literal of (lit identified)
330
337
| ATOM_lval of lval
@@ -495,7 +502,6 @@ let sane_name (n:name) : bool =
495
502
496
503
(* **********************************************************************)
497
504
498
- (* FIXME (issue #19): finish all parts with ?foo? as their output. *)
499
505
500
506
let fmt_ident (ff :Format.formatter ) (i :ident ) : unit =
501
507
fmt ff " %s" i
@@ -1246,7 +1252,25 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
1246
1252
fmt_cbb ff;
1247
1253
end ;
1248
1254
fmt_cbb ff;
1249
- | STMT_alt_port _ -> fmt ff " ?stmt_alt_port?"
1255
+ | STMT_alt_port at ->
1256
+ fmt_obox ff;
1257
+ fmt ff " alt " ;
1258
+ fmt_obr ff;
1259
+ Array. iter (fmt_port_arm ff) at.alt_port_arms;
1260
+ begin
1261
+ match at.alt_port_else with
1262
+ None -> ()
1263
+ | Some (timeout , block ) ->
1264
+ fmt ff " @\n " ;
1265
+ fmt_obox ff;
1266
+ fmt ff " case (_) " ;
1267
+ fmt_atom ff timeout;
1268
+ fmt ff " " ;
1269
+ fmt_obr ff;
1270
+ fmt_stmts ff block.node;
1271
+ fmt_cbb ff;
1272
+ end ;
1273
+ fmt_cbb ff;
1250
1274
| STMT_note at ->
1251
1275
begin
1252
1276
fmt ff " note " ;
@@ -1284,6 +1308,16 @@ and fmt_type_arm (ff:Format.formatter) (type_arm:type_arm) : unit =
1284
1308
let (_, slot, block) = type_arm.node in
1285
1309
fmt_arm ff (fun ff -> fmt_slot ff slot) block;
1286
1310
1311
+ and fmt_port_arm (ff :Format.formatter ) (port_arm :port_arm ) : unit =
1312
+ let (port_case, block) = port_arm.node in
1313
+ fmt_arm ff (fun ff -> fmt_port_case ff port_case) block;
1314
+
1315
+ and fmt_port_case (ff :Format.formatter ) (port_case :port_case ) : unit =
1316
+ let stmt' = match port_case with
1317
+ PORT_CASE_send params -> STMT_send params
1318
+ | PORT_CASE_recv params -> STMT_recv params in
1319
+ fmt_stmt ff {node = stmt'; id = Node 0 };
1320
+
1287
1321
1288
1322
and fmt_pat (ff :Format.formatter ) (pat :pat ) : unit =
1289
1323
match pat with
0 commit comments