Revision d50b0dc0
Added by Teme Kahsai about 9 years ago
src/printers.ml | ||
---|---|---|
24 | 24 |
pp_set_all_formatter_output_functions fmt out flush newline spaces; |
25 | 25 |
end |
26 | 26 |
|
27 |
let rec print_dec_struct_ty_field fmt (label, cty) = |
|
28 |
fprintf fmt "%a : %a" pp_print_string label print_dec_ty cty |
|
29 |
and print_dec_ty fmt cty = |
|
30 |
match (*get_repr_type*) cty with |
|
31 |
| Tydec_any -> fprintf fmt "Any" |
|
32 |
| Tydec_int -> fprintf fmt "int" |
|
33 |
| Tydec_real |
|
34 |
| Tydec_float -> fprintf fmt "real" |
|
35 |
| Tydec_bool -> fprintf fmt "bool" |
|
36 |
| Tydec_clock cty' -> fprintf fmt "%a clock" print_dec_ty cty' |
|
37 |
| Tydec_const c -> fprintf fmt "%s" c |
|
38 |
| Tydec_enum taglist -> fprintf fmt "enum {%a }" |
|
39 |
(Utils.fprintf_list ~sep:", " pp_print_string) taglist |
|
40 |
| Tydec_struct fieldlist -> fprintf fmt "struct {%a }" |
|
41 |
(Utils.fprintf_list ~sep:"; " print_dec_struct_ty_field) fieldlist |
|
42 |
| Tydec_array (d, cty') -> fprintf fmt "%a^%a" print_dec_ty cty' Dimension.pp_dimension d |
|
27 | 43 |
|
28 | 44 |
let pp_var_name fmt id = fprintf fmt "%s" id.var_id |
29 | 45 |
|
... | ... | |
31 | 47 |
|
32 | 48 |
let pp_var fmt id = fprintf fmt "%s%s: %a" (if id.var_dec_const then "const " else "") id.var_id Types.print_ty id.var_type |
33 | 49 |
|
34 |
let pp_node_var fmt id = fprintf fmt "%s%s: %a%a" (if id.var_dec_const then "const " else "") id.var_id Types.print_node_ty id.var_type Clocks.print_ck_suffix id.var_clock |
|
35 |
|
|
36 |
let pp_node_args = fprintf_list ~sep:"; " pp_node_var |
|
37 |
|
|
38 | 50 |
let pp_quantifiers fmt (q, vars) = |
39 | 51 |
match q with |
40 | 52 |
| Forall -> fprintf fmt "forall %a" (fprintf_list ~sep:"; " pp_var) vars |
... | ... | |
125 | 137 |
in |
126 | 138 |
fprintf_list ~sep:"@ " pp_annot fmt expr_ann.annots |
127 | 139 |
|
128 |
|
|
140 |
(* |
|
141 |
let pp_node_var fmt id = fprintf fmt "%s%s: %a(%a)%a" (if id.var_dec_const then "const " else "") id.var_id print_dec_ty id.var_dec_type.ty_dec_desc Types.print_ty id.var_type Clocks.print_ck_suffix id.var_clock |
|
142 |
*) |
|
143 |
let pp_node_var fmt id = |
|
144 |
begin |
|
145 |
fprintf fmt "%s%s: %a%a" (if id.var_dec_const then "const " else "") id.var_id Types.print_node_ty id.var_type Clocks.print_ck_suffix id.var_clock; |
|
146 |
match id.var_dec_value with |
|
147 |
| None -> () |
|
148 |
| Some v -> fprintf fmt " = %a" pp_expr v |
|
149 |
end |
|
150 |
|
|
151 |
let pp_node_args = fprintf_list ~sep:"; " pp_node_var |
|
152 |
|
|
129 | 153 |
let pp_node_eq fmt eq = |
130 | 154 |
fprintf fmt "%a = %a;" |
131 | 155 |
pp_eq_lhs eq.eq_lhs |
Also available in: Unified diff
sync