Revision ec031ed0
Added by Arnaud Dieumegard almost 7 years ago
src/backends/VHDL/vhdl_ast_deriving.ml | ||
---|---|---|
77 | 77 |
| Bit_vector of int * int |
78 | 78 |
| Array of |
79 | 79 |
{ |
80 |
indexes: vhdl_name_t list ; |
|
80 |
indexes: vhdl_name_t list [@default []];
|
|
81 | 81 |
const: vhdl_constraint_t option [@default None]; |
82 | 82 |
definition: vhdl_subtype_indication_t } [@name "ARRAY_TYPE_DEFINITION"] |
83 | 83 |
| Record of vhdl_element_declaration_t list |
... | ... | |
844 | 844 |
:: fields |
845 | 845 |
in |
846 | 846 |
let fields = |
847 |
("indexes", |
|
848 |
((fun x -> |
|
849 |
`List (List.map (fun x -> vhdl_name_t_to_yojson x) x)) |
|
850 |
arg0.indexes)) |
|
851 |
:: fields in |
|
847 |
if arg0.indexes = [] |
|
848 |
then fields |
|
849 |
else |
|
850 |
("indexes", |
|
851 |
(((fun x -> |
|
852 |
`List |
|
853 |
(List.map (fun x -> vhdl_name_t_to_yojson x) x))) |
|
854 |
arg0.indexes)) |
|
855 |
:: fields |
|
856 |
in |
|
852 | 857 |
`Assoc fields)] |
853 | 858 |
| Record arg0 -> |
854 | 859 |
`List |
... | ... | |
946 | 951 |
}))))) |
947 | 952 |
| _::xs -> loop xs _state in |
948 | 953 |
loop xs |
949 |
((Result.Error "Vhdl_ast.vhdl_type_t.indexes"), |
|
950 |
(Result.Ok None), |
|
954 |
((Result.Ok []), (Result.Ok None), |
|
951 | 955 |
(Result.Error "Vhdl_ast.vhdl_type_t.definition")) |
952 | 956 |
| _ -> Result.Error "Vhdl_ast.vhdl_type_t")) arg0 |
953 | 957 |
| `List ((`String "RECORD_TYPE_DEFINITION")::arg0::[]) -> |
... | ... | |
4639 | 4643 |
| _ -> Result.Error "Vhdl_ast.vhdl_declaration_t") |
4640 | 4644 |
[@ocaml.warning "-A"]) |
4641 | 4645 |
|
4646 |
type vhdl_load_t = |
|
4647 |
| Library of vhdl_name_t list [@name "LIBRARY_CLAUSE"][@default []] |
|
4648 |
| Use of vhdl_name_t list [@name "USE_CLAUSE"][@default []] |
|
4649 |
|
|
4650 |
(* Adapted. TODO: check indentation *) |
|
4651 |
let rec pp_vhdl_load_t : |
|
4652 |
Format.formatter -> vhdl_load_t -> Ppx_deriving_runtime.unit = |
|
4653 |
let __1 () = pp_vhdl_name_t |
|
4654 |
|
|
4655 |
and __0 () = pp_vhdl_name_t |
|
4656 |
in |
|
4657 |
((let open! Ppx_deriving_runtime in |
|
4658 |
fun fmt -> |
|
4659 |
function |
|
4660 |
| Library a0 -> |
|
4661 |
(Format.fprintf fmt "library "; |
|
4662 |
((fun x -> |
|
4663 |
ignore |
|
4664 |
(List.fold_left |
|
4665 |
(fun sep -> |
|
4666 |
fun x -> |
|
4667 |
if sep then Format.fprintf fmt "."; |
|
4668 |
((__0 ()) fmt) x; |
|
4669 |
true) false x))) a0; |
|
4670 |
Format.fprintf fmt ":") |
|
4671 |
| Use a0 -> |
|
4672 |
(Format.fprintf fmt "use "; |
|
4673 |
((fun x -> |
|
4674 |
ignore |
|
4675 |
(List.fold_left |
|
4676 |
(fun sep -> |
|
4677 |
fun x -> |
|
4678 |
if sep then Format.fprintf fmt "."; |
|
4679 |
((__1 ()) fmt) x; |
|
4680 |
true) false x))) a0; |
|
4681 |
Format.fprintf fmt ";")) |
|
4682 |
[@ocaml.warning "-A"]) |
|
4683 |
|
|
4684 |
and show_vhdl_load_t : vhdl_load_t -> Ppx_deriving_runtime.string = |
|
4685 |
fun x -> Format.asprintf "%a" pp_vhdl_load_t x |
|
4686 |
|
|
4687 |
let rec (vhdl_load_t_to_yojson : vhdl_load_t -> Yojson.Safe.json) = |
|
4688 |
((let open! Ppx_deriving_yojson_runtime in |
|
4689 |
function |
|
4690 |
| Library arg0 -> |
|
4691 |
`List |
|
4692 |
[`String "LIBRARY_CLAUSE"; |
|
4693 |
((fun x -> |
|
4694 |
`List (List.map (fun x -> vhdl_name_t_to_yojson x) x))) arg0] |
|
4695 |
| Use arg0 -> |
|
4696 |
`List |
|
4697 |
[`String "USE_CLAUSE"; |
|
4698 |
((fun x -> |
|
4699 |
`List (List.map (fun x -> vhdl_name_t_to_yojson x) x))) arg0]) |
|
4700 |
[@ocaml.warning "-A"]) |
|
4701 |
|
|
4702 |
and (vhdl_load_t_of_yojson : |
|
4703 |
Yojson.Safe.json -> vhdl_load_t Ppx_deriving_yojson_runtime.error_or) |
|
4704 |
= |
|
4705 |
((let open! Ppx_deriving_yojson_runtime in |
|
4706 |
function |
|
4707 |
| `List ((`String "LIBRARY_CLAUSE")::arg0::[]) -> |
|
4708 |
((function |
|
4709 |
| `List xs -> map_bind (fun x -> vhdl_name_t_of_yojson x) [] xs |
|
4710 |
| _ -> Result.Error "Vhdl_ast.vhdl_load_t") arg0) >>= |
|
4711 |
((fun arg0 -> Result.Ok (Library arg0))) |
|
4712 |
| `List ((`String "USE_CLAUSE")::arg0::[]) -> |
|
4713 |
((function |
|
4714 |
| `List xs -> map_bind (fun x -> vhdl_name_t_of_yojson x) [] xs |
|
4715 |
| _ -> Result.Error "Vhdl_ast.vhdl_load_t") arg0) >>= |
|
4716 |
((fun arg0 -> Result.Ok (Use arg0))) |
|
4717 |
| _ -> Result.Error "Vhdl_ast.vhdl_load_t") |
|
4718 |
[@ocaml.warning "-A"]) |
|
4719 |
|
|
4720 |
type vhdl_declarative_item_t = |
|
4721 |
{ |
|
4722 |
use_clause: vhdl_load_t option [@default None]; |
|
4723 |
declaration: vhdl_declaration_t option [@default None]; |
|
4724 |
definition: vhdl_definition_t option [@default None]}[@@deriving |
|
4725 |
((show |
|
4726 |
{ |
|
4727 |
with_path = |
|
4728 |
false |
|
4729 |
}), |
|
4730 |
(yojson |
|
4731 |
{ |
|
4732 |
strict = |
|
4733 |
false |
|
4734 |
}))] |
|
4735 |
let rec pp_vhdl_declarative_item_t : |
|
4736 |
Format.formatter -> vhdl_declarative_item_t -> Ppx_deriving_runtime.unit = |
|
4737 |
let __2 () = pp_vhdl_definition_t |
|
4738 |
|
|
4739 |
and __1 () = pp_vhdl_declaration_t |
|
4740 |
|
|
4741 |
and __0 () = pp_vhdl_load_t |
|
4742 |
in |
|
4743 |
((let open! Ppx_deriving_runtime in |
|
4744 |
fun fmt -> |
|
4745 |
fun x -> |
|
4746 |
(match x.use_clause with |
|
4747 |
| None -> Format.fprintf fmt ""; |
|
4748 |
| Some e -> ((__0 ()) fmt) e); |
|
4749 |
(match x.declaration with |
|
4750 |
| None -> Format.fprintf fmt ""; |
|
4751 |
| Some e -> ((__1 ()) fmt) e); |
|
4752 |
(match x.definition with |
|
4753 |
| None -> Format.fprintf fmt ""; |
|
4754 |
| Some e -> ((__2 ()) fmt) e);) |
|
4755 |
[@ocaml.warning "-A"]) |
|
4756 |
|
|
4757 |
and show_vhdl_declarative_item_t : |
|
4758 |
vhdl_declarative_item_t -> Ppx_deriving_runtime.string = |
|
4759 |
fun x -> Format.asprintf "%a" pp_vhdl_declarative_item_t x |
|
4760 |
|
|
4761 |
let rec (vhdl_declarative_item_t_to_yojson : |
|
4762 |
vhdl_declarative_item_t -> Yojson.Safe.json) |
|
4763 |
= |
|
4764 |
((let open! Ppx_deriving_yojson_runtime in |
|
4765 |
fun x -> |
|
4766 |
let fields = [] in |
|
4767 |
let fields = |
|
4768 |
if x.definition = None |
|
4769 |
then fields |
|
4770 |
else |
|
4771 |
("definition", |
|
4772 |
(((function |
|
4773 |
| None -> `Null |
|
4774 |
| Some x -> ((fun x -> vhdl_definition_t_to_yojson x)) x)) |
|
4775 |
x.definition)) |
|
4776 |
:: fields |
|
4777 |
in |
|
4778 |
let fields = |
|
4779 |
if x.declaration = None |
|
4780 |
then fields |
|
4781 |
else |
|
4782 |
("declaration", |
|
4783 |
(((function |
|
4784 |
| None -> `Null |
|
4785 |
| Some x -> ((fun x -> vhdl_declaration_t_to_yojson x)) x)) |
|
4786 |
x.declaration)) |
|
4787 |
:: fields |
|
4788 |
in |
|
4789 |
let fields = |
|
4790 |
if x.use_clause = None |
|
4791 |
then fields |
|
4792 |
else |
|
4793 |
("use_clause", |
|
4794 |
(((function |
|
4795 |
| None -> `Null |
|
4796 |
| Some x -> ((fun x -> vhdl_load_t_to_yojson x)) x)) |
|
4797 |
x.use_clause)) |
|
4798 |
:: fields |
|
4799 |
in |
|
4800 |
`Assoc fields) |
|
4801 |
[@ocaml.warning "-A"]) |
|
4802 |
|
|
4803 |
and (vhdl_declarative_item_t_of_yojson : |
|
4804 |
Yojson.Safe.json -> |
|
4805 |
vhdl_declarative_item_t Ppx_deriving_yojson_runtime.error_or) |
|
4806 |
= |
|
4807 |
((let open! Ppx_deriving_yojson_runtime in |
|
4808 |
function |
|
4809 |
| `Assoc xs -> |
|
4810 |
let rec loop xs ((arg0,arg1,arg2) as _state) = |
|
4811 |
match xs with |
|
4812 |
| ("use_clause",x)::xs -> |
|
4813 |
loop xs |
|
4814 |
(((function |
|
4815 |
| `Null -> Result.Ok None |
|
4816 |
| x -> |
|
4817 |
((fun x -> vhdl_load_t_of_yojson x) x) >>= |
|
4818 |
((fun x -> Result.Ok (Some x)))) x), arg1, arg2) |
|
4819 |
| ("declaration",x)::xs -> |
|
4820 |
loop xs |
|
4821 |
(arg0, |
|
4822 |
((function |
|
4823 |
| `Null -> Result.Ok None |
|
4824 |
| x -> |
|
4825 |
((fun x -> vhdl_declaration_t_of_yojson x) x) >>= |
|
4826 |
((fun x -> Result.Ok (Some x)))) x), arg2) |
|
4827 |
| ("definition",x)::xs -> |
|
4828 |
loop xs |
|
4829 |
(arg0, arg1, |
|
4830 |
((function |
|
4831 |
| `Null -> Result.Ok None |
|
4832 |
| x -> |
|
4833 |
((fun x -> vhdl_definition_t_of_yojson x) x) >>= |
|
4834 |
((fun x -> Result.Ok (Some x)))) x)) |
|
4835 |
| [] -> |
|
4836 |
arg2 >>= |
|
4837 |
((fun arg2 -> |
|
4838 |
arg1 >>= |
|
4839 |
(fun arg1 -> |
|
4840 |
arg0 >>= |
|
4841 |
(fun arg0 -> |
|
4842 |
Result.Ok |
|
4843 |
{ |
|
4844 |
use_clause = arg0; |
|
4845 |
declaration = arg1; |
|
4846 |
definition = arg2 |
|
4847 |
})))) |
|
4848 |
| _::xs -> loop xs _state in |
|
4849 |
loop xs ((Result.Ok None), (Result.Ok None), (Result.Ok None)) |
|
4850 |
| _ -> Result.Error "Vhdl_ast.vhdl_declarative_item_t") |
|
4851 |
[@ocaml.warning "-A"]) |
|
4852 |
|
|
4642 | 4853 |
type vhdl_signal_condition_t = |
4643 | 4854 |
{ |
4644 | 4855 |
expr: vhdl_expr_t list ; |
... | ... | |
4999 | 5210 |
type vhdl_process_t = |
5000 | 5211 |
{ |
5001 | 5212 |
id: vhdl_name_t [@default NoName]; |
5002 |
declarations: vhdl_declaration_t list option
|
|
5213 |
declarations: vhdl_declarative_item_t list
|
|
5003 | 5214 |
[@key "PROCESS_DECLARATIVE_PART"][@default Some []]; |
5004 | 5215 |
active_sigs: vhdl_name_t list [@default []]; |
5005 | 5216 |
body: vhdl_sequential_stmt_t list |
... | ... | |
5011 | 5222 |
|
5012 | 5223 |
and __2 () = pp_vhdl_name_t |
5013 | 5224 |
|
5014 |
and __1 () = pp_vhdl_declaration_t
|
|
5225 |
and __1 () = pp_vhdl_declarative_item_t
|
|
5015 | 5226 |
|
5016 | 5227 |
and __0 () = pp_vhdl_name_t |
5017 | 5228 |
in |
... | ... | |
5037 | 5248 |
((__2 ()) fmt) x; |
5038 | 5249 |
true) false x))) x.active_sigs; |
5039 | 5250 |
Format.fprintf fmt ")"); |
5040 |
((function |
|
5041 |
| None -> Format.pp_print_string fmt "" |
|
5042 |
| Some x -> |
|
5043 |
Format.fprintf fmt "@;"; |
|
5044 |
((fun x -> |
|
5045 |
ignore |
|
5046 |
(List.fold_left |
|
5047 |
(fun sep -> |
|
5048 |
fun x -> |
|
5049 |
if sep then Format.fprintf fmt "@;"; |
|
5050 |
((__1 ()) fmt) x; |
|
5051 |
true) false x);)) x;)) x.declarations; |
|
5251 |
Format.fprintf fmt "@;"; |
|
5252 |
((fun x -> |
|
5253 |
ignore |
|
5254 |
(List.fold_left |
|
5255 |
(fun sep -> |
|
5256 |
fun x -> |
|
5257 |
if sep then Format.fprintf fmt "@;"; |
|
5258 |
((__1 ()) fmt) x; |
|
5259 |
true) false x))) x.declarations; |
|
5052 | 5260 |
Format.fprintf fmt "@]@;@[<v 2>begin@;"; |
5053 | 5261 |
((fun x -> |
5054 | 5262 |
ignore |
... | ... | |
5091 | 5299 |
:: fields |
5092 | 5300 |
in |
5093 | 5301 |
let fields = |
5094 |
if x.declarations = (Some [])
|
|
5302 |
if x.declarations = []
|
|
5095 | 5303 |
then fields |
5096 | 5304 |
else |
5097 | 5305 |
("PROCESS_DECLARATIVE_PART", |
5098 |
(((function |
|
5099 |
| None -> `Null |
|
5100 |
| Some x -> |
|
5101 |
((fun x -> |
|
5102 |
`List |
|
5103 |
(List.map |
|
5104 |
(fun x -> vhdl_declaration_t_to_yojson x) x))) |
|
5105 |
x)) x.declarations)) |
|
5306 |
(((fun x -> |
|
5307 |
`List |
|
5308 |
(List.map |
|
5309 |
(fun x -> vhdl_declarative_item_t_to_yojson x) x))) |
|
5310 |
x.declarations)) |
|
5106 | 5311 |
:: fields |
5107 | 5312 |
in |
5108 | 5313 |
let fields = |
... | ... | |
5128 | 5333 |
loop xs |
5129 | 5334 |
(arg0, |
5130 | 5335 |
((function |
5131 |
| `Null -> Result.Ok None |
|
5132 |
| x -> |
|
5133 |
((function |
|
5134 |
| `List xs -> |
|
5135 |
map_bind |
|
5136 |
(fun x -> vhdl_declaration_t_of_yojson x) |
|
5137 |
[] xs |
|
5138 |
| _ -> |
|
5139 |
Result.Error |
|
5140 |
"Vhdl_ast.vhdl_process_t.declarations") x) |
|
5141 |
>>= ((fun x -> Result.Ok (Some x)))) x), arg2, |
|
5142 |
arg3) |
|
5336 |
| `List xs -> |
|
5337 |
map_bind |
|
5338 |
(fun x -> vhdl_declarative_item_t_of_yojson x) |
|
5339 |
[] xs |
|
5340 |
| _ -> |
|
5341 |
Result.Error "Vhdl_ast.vhdl_process_t.declarations") |
|
5342 |
x), arg2, arg3) |
|
5143 | 5343 |
| ("active_sigs",x)::xs -> |
5144 | 5344 |
loop xs |
5145 | 5345 |
(arg0, arg1, |
... | ... | |
5176 | 5376 |
}))))) |
5177 | 5377 |
| _::xs -> loop xs _state in |
5178 | 5378 |
loop xs |
5179 |
((Result.Ok NoName), (Result.Ok (Some [])), (Result.Ok []),
|
|
5379 |
((Result.Ok NoName), (Result.Ok []), (Result.Ok []),
|
|
5180 | 5380 |
(Result.Ok [])) |
5181 | 5381 |
| _ -> Result.Error "Vhdl_ast.vhdl_process_t") |
5182 | 5382 |
[@ocaml.warning "-A"]) |
... | ... | |
5989 | 6189 |
| _ -> Result.Error "Vhdl_ast.vhdl_package_t") |
5990 | 6190 |
[@ocaml.warning "-A"]) |
5991 | 6191 |
|
5992 |
type vhdl_load_t = |
|
5993 |
| Library of vhdl_name_t list [@name "LIBRARY_CLAUSE"][@default []] |
|
5994 |
| Use of vhdl_name_t list [@name "USE_CLAUSE"][@default []] |
|
5995 |
|
|
5996 |
(* Adapted. TODO: check indentation *) |
|
5997 |
let rec pp_vhdl_load_t : |
|
5998 |
Format.formatter -> vhdl_load_t -> Ppx_deriving_runtime.unit = |
|
5999 |
let __1 () = pp_vhdl_name_t |
|
6000 |
|
|
6001 |
and __0 () = pp_vhdl_name_t |
|
6002 |
in |
|
6003 |
((let open! Ppx_deriving_runtime in |
|
6004 |
fun fmt -> |
|
6005 |
function |
|
6006 |
| Library a0 -> |
|
6007 |
(Format.fprintf fmt "library "; |
|
6008 |
((fun x -> |
|
6009 |
ignore |
|
6010 |
(List.fold_left |
|
6011 |
(fun sep -> |
|
6012 |
fun x -> |
|
6013 |
if sep then Format.fprintf fmt "."; |
|
6014 |
((__0 ()) fmt) x; |
|
6015 |
true) false x))) a0; |
|
6016 |
Format.fprintf fmt ":") |
|
6017 |
| Use a0 -> |
|
6018 |
(Format.fprintf fmt "use "; |
|
6019 |
((fun x -> |
|
6020 |
ignore |
|
6021 |
(List.fold_left |
|
6022 |
(fun sep -> |
|
6023 |
fun x -> |
|
6024 |
if sep then Format.fprintf fmt "."; |
|
6025 |
((__1 ()) fmt) x; |
|
6026 |
true) false x))) a0; |
|
6027 |
Format.fprintf fmt ";")) |
|
6028 |
[@ocaml.warning "-A"]) |
|
6029 |
|
|
6030 |
and show_vhdl_load_t : vhdl_load_t -> Ppx_deriving_runtime.string = |
|
6031 |
fun x -> Format.asprintf "%a" pp_vhdl_load_t x |
|
6032 |
|
|
6033 |
let rec (vhdl_load_t_to_yojson : vhdl_load_t -> Yojson.Safe.json) = |
|
6034 |
((let open! Ppx_deriving_yojson_runtime in |
|
6035 |
function |
|
6036 |
| Library arg0 -> |
|
6037 |
`List |
|
6038 |
[`String "LIBRARY_CLAUSE"; |
|
6039 |
((fun x -> |
|
6040 |
`List (List.map (fun x -> vhdl_name_t_to_yojson x) x))) arg0] |
|
6041 |
| Use arg0 -> |
|
6042 |
`List |
|
6043 |
[`String "USE_CLAUSE"; |
|
6044 |
((fun x -> |
|
6045 |
`List (List.map (fun x -> vhdl_name_t_to_yojson x) x))) arg0]) |
|
6046 |
[@ocaml.warning "-A"]) |
|
6047 |
|
|
6048 |
and (vhdl_load_t_of_yojson : |
|
6049 |
Yojson.Safe.json -> vhdl_load_t Ppx_deriving_yojson_runtime.error_or) |
|
6050 |
= |
|
6051 |
((let open! Ppx_deriving_yojson_runtime in |
|
6052 |
function |
|
6053 |
| `List ((`String "LIBRARY_CLAUSE")::arg0::[]) -> |
|
6054 |
((function |
|
6055 |
| `List xs -> map_bind (fun x -> vhdl_name_t_of_yojson x) [] xs |
|
6056 |
| _ -> Result.Error "Vhdl_ast.vhdl_load_t") arg0) >>= |
|
6057 |
((fun arg0 -> Result.Ok (Library arg0))) |
|
6058 |
| `List ((`String "USE_CLAUSE")::arg0::[]) -> |
|
6059 |
((function |
|
6060 |
| `List xs -> map_bind (fun x -> vhdl_name_t_of_yojson x) [] xs |
|
6061 |
| _ -> Result.Error "Vhdl_ast.vhdl_load_t") arg0) >>= |
|
6062 |
((fun arg0 -> Result.Ok (Use arg0))) |
|
6063 |
| _ -> Result.Error "Vhdl_ast.vhdl_load_t") |
|
6064 |
[@ocaml.warning "-A"]) |
|
6065 |
|
|
6066 | 6192 |
type vhdl_architecture_t = |
6067 | 6193 |
{ |
6068 | 6194 |
name: vhdl_name_t [@default NoName]; |
6069 | 6195 |
entity: vhdl_name_t [@default NoName]; |
6070 |
use_clauses: vhdl_load_t list [@default []]; |
|
6071 |
declarations: vhdl_declaration_t list |
|
6196 |
declarations: vhdl_declarative_item_t list |
|
6072 | 6197 |
[@key "ARCHITECTURE_DECLARATIVE_PART"][@default []]; |
6073 | 6198 |
body: vhdl_concurrent_stmt_t list |
6074 | 6199 |
[@key "ARCHITECTURE_STATEMENT_PART"][@default []]} |
6075 | 6200 |
|
6076 | 6201 |
let rec pp_vhdl_architecture_t : |
6077 | 6202 |
Format.formatter -> vhdl_architecture_t -> Ppx_deriving_runtime.unit = |
6078 |
let __4 () = pp_vhdl_concurrent_stmt_t
|
|
6203 |
let __3 () = pp_vhdl_concurrent_stmt_t
|
|
6079 | 6204 |
|
6080 |
and __3 () = pp_vhdl_declaration_t |
|
6081 |
|
|
6082 |
and __2 () = pp_vhdl_load_t |
|
6205 |
and __2 () = pp_vhdl_declarative_item_t |
|
6083 | 6206 |
|
6084 | 6207 |
and __1 () = pp_vhdl_name_t |
6085 | 6208 |
|
... | ... | |
6092 | 6215 |
Format.fprintf fmt " of "; |
6093 | 6216 |
((__1 ()) fmt) x.entity; |
6094 | 6217 |
Format.fprintf fmt " is@;"; |
6095 |
((fun x -> |
|
6096 |
ignore |
|
6097 |
(List.fold_left |
|
6098 |
(fun sep -> |
|
6099 |
fun x -> |
|
6100 |
if sep then Format.fprintf fmt ""; |
|
6101 |
((__2 ()) fmt) x; |
|
6102 |
Format.fprintf fmt "@;"; |
|
6103 |
true) false x))) x.use_clauses; |
|
6104 | 6218 |
((fun x -> |
6105 | 6219 |
ignore |
6106 | 6220 |
(List.fold_left |
6107 | 6221 |
(fun sep -> |
6108 | 6222 |
fun x -> |
6109 | 6223 |
if sep then Format.fprintf fmt "@;"; |
6110 |
((__3 ()) fmt) x;
|
|
6224 |
((__2 ()) fmt) x;
|
|
6111 | 6225 |
Format.fprintf fmt ";"; |
6112 | 6226 |
true) false x))) x.declarations; |
6113 | 6227 |
Format.fprintf fmt "@;"; |
... | ... | |
6120 | 6234 |
(fun sep -> |
6121 | 6235 |
fun x -> |
6122 | 6236 |
if sep then Format.fprintf fmt "@;"; |
6123 |
((__4 ()) fmt) x;
|
|
6237 |
((__3 ()) fmt) x;
|
|
6124 | 6238 |
true) false x))) x.body; |
6125 | 6239 |
Format.fprintf fmt "@]@;end;")) |
6126 | 6240 |
[@ocaml.warning "-A"]) |
... | ... | |
6153 | 6267 |
("ARCHITECTURE_DECLARATIVE_PART", |
6154 | 6268 |
(((fun x -> |
6155 | 6269 |
`List |
6156 |
(List.map (fun x -> vhdl_declaration_t_to_yojson x) x))) |
|
6270 |
(List.map |
|
6271 |
(fun x -> vhdl_declarative_item_t_to_yojson x) x))) |
|
6157 | 6272 |
x.declarations)) |
6158 | 6273 |
:: fields |
6159 | 6274 |
in |
6160 |
let fields = |
|
6161 |
if x.use_clauses = [] |
|
6162 |
then fields |
|
6163 |
else |
|
6164 |
("use_clauses", |
|
6165 |
(((fun x -> |
|
6166 |
`List (List.map (fun x -> vhdl_load_t_to_yojson x) x))) |
|
6167 |
x.use_clauses)) |
|
6168 |
:: fields |
|
6169 |
in |
|
6170 | 6275 |
let fields = |
6171 | 6276 |
if x.entity = NoName |
6172 | 6277 |
then fields |
... | ... | |
6189 | 6294 |
((let open! Ppx_deriving_yojson_runtime in |
6190 | 6295 |
function |
6191 | 6296 |
| `Assoc xs -> |
6192 |
let rec loop xs ((arg0,arg1,arg2,arg3,arg4) as _state) =
|
|
6297 |
let rec loop xs ((arg0,arg1,arg2,arg3) as _state) = |
|
6193 | 6298 |
match xs with |
6194 | 6299 |
| ("name",x)::xs -> |
6195 | 6300 |
loop xs |
6196 |
(((fun x -> vhdl_name_t_of_yojson x) x), arg1, arg2, arg3, |
|
6197 |
arg4) |
|
6301 |
(((fun x -> vhdl_name_t_of_yojson x) x), arg1, arg2, arg3) |
|
6198 | 6302 |
| ("entity",x)::xs -> |
6199 | 6303 |
loop xs |
6200 |
(arg0, ((fun x -> vhdl_name_t_of_yojson x) x), arg2, arg3, |
|
6201 |
arg4) |
|
6202 |
| ("use_clauses",x)::xs -> |
|
6203 |
loop xs |
|
6204 |
(arg0, arg1, |
|
6205 |
((function |
|
6206 |
| `List xs -> |
|
6207 |
map_bind (fun x -> vhdl_load_t_of_yojson x) [] xs |
|
6208 |
| _ -> |
|
6209 |
Result.Error |
|
6210 |
"Vhdl_ast.vhdl_architecture_t.use_clauses") x), |
|
6211 |
arg3, arg4) |
|
6304 |
(arg0, ((fun x -> vhdl_name_t_of_yojson x) x), arg2, arg3) |
|
6212 | 6305 |
| ("ARCHITECTURE_DECLARATIVE_PART",x)::xs -> |
6213 | 6306 |
loop xs |
6214 |
(arg0, arg1, arg2,
|
|
6307 |
(arg0, arg1, |
|
6215 | 6308 |
((function |
6216 | 6309 |
| `List xs -> |
6217 |
map_bind (fun x -> vhdl_declaration_t_of_yojson x) |
|
6310 |
map_bind |
|
6311 |
(fun x -> vhdl_declarative_item_t_of_yojson x) |
|
6218 | 6312 |
[] xs |
6219 | 6313 |
| _ -> |
6220 | 6314 |
Result.Error |
6221 | 6315 |
"Vhdl_ast.vhdl_architecture_t.declarations") x), |
6222 |
arg4)
|
|
6316 |
arg3)
|
|
6223 | 6317 |
| ("ARCHITECTURE_STATEMENT_PART",x)::xs -> |
6224 | 6318 |
loop xs |
6225 |
(arg0, arg1, arg2, arg3,
|
|
6319 |
(arg0, arg1, arg2, |
|
6226 | 6320 |
((function |
6227 | 6321 |
| `List xs -> |
6228 | 6322 |
map_bind |
... | ... | |
6231 | 6325 |
| _ -> Result.Error "Vhdl_ast.vhdl_architecture_t.body") |
6232 | 6326 |
x)) |
6233 | 6327 |
| [] -> |
6234 |
arg4 >>= |
|
6235 |
((fun arg4 -> |
|
6236 |
arg3 >>= |
|
6237 |
(fun arg3 -> |
|
6238 |
arg2 >>= |
|
6239 |
(fun arg2 -> |
|
6240 |
arg1 >>= |
|
6241 |
(fun arg1 -> |
|
6242 |
arg0 >>= |
|
6243 |
(fun arg0 -> |
|
6244 |
Result.Ok |
|
6245 |
{ |
|
6246 |
name = arg0; |
|
6247 |
entity = arg1; |
|
6248 |
use_clauses = arg2; |
|
6249 |
declarations = arg3; |
|
6250 |
body = arg4 |
|
6251 |
})))))) |
|
6328 |
arg3 >>= |
|
6329 |
((fun arg3 -> |
|
6330 |
arg2 >>= |
|
6331 |
(fun arg2 -> |
|
6332 |
arg1 >>= |
|
6333 |
(fun arg1 -> |
|
6334 |
arg0 >>= |
|
6335 |
(fun arg0 -> |
|
6336 |
Result.Ok |
|
6337 |
{ |
|
6338 |
name = arg0; |
|
6339 |
entity = arg1; |
|
6340 |
declarations = arg2; |
|
6341 |
body = arg3 |
|
6342 |
}))))) |
|
6252 | 6343 |
| _::xs -> loop xs _state in |
6253 | 6344 |
loop xs |
6254 | 6345 |
((Result.Ok NoName), (Result.Ok NoName), (Result.Ok []), |
6255 |
(Result.Ok []), (Result.Ok []))
|
|
6346 |
(Result.Ok [])) |
|
6256 | 6347 |
| _ -> Result.Error "Vhdl_ast.vhdl_architecture_t") |
6257 | 6348 |
[@ocaml.warning "-A"]) |
6258 | 6349 |
|
Also available in: Unified diff
Added support for declarative items