|
@@ -1249,6 +1249,9 @@ module Printer = struct
|
|
|
let s_record_field name value =
|
|
|
Printf.sprintf "%s = %s;" name value
|
|
|
|
|
|
+ let s_pos p =
|
|
|
+ Printf.sprintf "%s: %i-%i" p.pfile p.pmin p.pmax
|
|
|
+
|
|
|
let s_record_fields tabs fields =
|
|
|
let sl = List.map (fun (name,value) -> s_record_field name value) fields in
|
|
|
Printf.sprintf "{\n%s\t%s\n%s}" tabs (String.concat ("\n\t" ^ tabs) sl) tabs
|
|
@@ -1282,22 +1285,26 @@ module Printer = struct
|
|
|
let s_type_params tl =
|
|
|
s_list ", " s_type_param tl
|
|
|
|
|
|
- let s_tclass_field cf =
|
|
|
- s_record_fields "\t" [
|
|
|
+ let s_tclass_field tabs cf =
|
|
|
+ s_record_fields tabs [
|
|
|
"cf_name",cf.cf_name;
|
|
|
"cf_doc",s_doc cf.cf_doc;
|
|
|
"cf_type",s_type_kind (follow cf.cf_type);
|
|
|
"cf_public",string_of_bool cf.cf_public;
|
|
|
+ "cf_pos",s_pos cf.cf_pos;
|
|
|
+ "cf_name_pos",s_pos cf.cf_name_pos;
|
|
|
"cf_meta",s_metadata cf.cf_meta;
|
|
|
"cf_kind",s_kind cf.cf_kind;
|
|
|
"cf_params",s_type_params cf.cf_params;
|
|
|
"cf_expr",s_opt (s_expr_ast true "\t\t" s_type) cf.cf_expr;
|
|
|
]
|
|
|
|
|
|
- let s_tclass c =
|
|
|
- s_record_fields "" [
|
|
|
+ let s_tclass tabs c =
|
|
|
+ s_record_fields tabs [
|
|
|
"cl_path",s_type_path c.cl_path;
|
|
|
"cl_module",s_type_path c.cl_module.m_path;
|
|
|
+ "cl_pos",s_pos c.cl_pos;
|
|
|
+ "cl_name_pos",s_pos c.cl_name_pos;
|
|
|
"cl_private",string_of_bool c.cl_private;
|
|
|
"cl_doc",s_doc c.cl_doc;
|
|
|
"cl_meta",s_metadata c.cl_meta;
|
|
@@ -1311,15 +1318,17 @@ module Printer = struct
|
|
|
"cl_array_access",s_opt s_type c.cl_array_access;
|
|
|
"cl_overrides",s_list "," (fun cf -> cf.cf_name) c.cl_overrides;
|
|
|
"cl_init",s_opt (s_expr_ast true "" s_type) c.cl_init;
|
|
|
- "cl_constructor",s_opt s_tclass_field c.cl_constructor;
|
|
|
- "cl_ordered_fields",s_list "\n\t" s_tclass_field c.cl_ordered_fields;
|
|
|
- "cl_ordered_statics",s_list "\n\t" s_tclass_field c.cl_ordered_statics;
|
|
|
+ "cl_constructor",s_opt (s_tclass_field (tabs ^ "\t")) c.cl_constructor;
|
|
|
+ "cl_ordered_fields",s_list "\n\t" (s_tclass_field (tabs ^ "\t")) c.cl_ordered_fields;
|
|
|
+ "cl_ordered_statics",s_list "\n\t" (s_tclass_field (tabs ^ "\t")) c.cl_ordered_statics;
|
|
|
]
|
|
|
|
|
|
let s_tdef tabs t =
|
|
|
s_record_fields tabs [
|
|
|
"t_path",s_type_path t.t_path;
|
|
|
"t_module",s_type_path t.t_module.m_path;
|
|
|
+ "t_pos",s_pos t.t_pos;
|
|
|
+ "t_name_pos",s_pos t.t_name_pos;
|
|
|
"t_private",string_of_bool t.t_private;
|
|
|
"t_doc",s_doc t.t_doc;
|
|
|
"t_meta",s_metadata t.t_meta;
|
|
@@ -1327,34 +1336,40 @@ module Printer = struct
|
|
|
"t_type",s_type_kind t.t_type
|
|
|
]
|
|
|
|
|
|
- let s_tenum_field ef =
|
|
|
- s_record_fields "\t" [
|
|
|
+ let s_tenum_field tabs ef =
|
|
|
+ s_record_fields tabs [
|
|
|
"ef_name",ef.ef_name;
|
|
|
"ef_doc",s_doc ef.ef_doc;
|
|
|
+ "ef_pos",s_pos ef.ef_pos;
|
|
|
+ "ef_name_pos",s_pos ef.ef_name_pos;
|
|
|
"ef_type",s_type_kind ef.ef_type;
|
|
|
"ef_index",string_of_int ef.ef_index;
|
|
|
"ef_params",s_type_params ef.ef_params;
|
|
|
"ef_meta",s_metadata ef.ef_meta
|
|
|
]
|
|
|
|
|
|
- let s_tenum en =
|
|
|
- s_record_fields "" [
|
|
|
+ let s_tenum tabs en =
|
|
|
+ s_record_fields tabs [
|
|
|
"e_path",s_type_path en.e_path;
|
|
|
"e_module",s_type_path en.e_module.m_path;
|
|
|
+ "e_pos",s_pos en.e_pos;
|
|
|
+ "e_name_pos",s_pos en.e_name_pos;
|
|
|
"e_private",string_of_bool en.e_private;
|
|
|
"d_doc",s_doc en.e_doc;
|
|
|
"e_meta",s_metadata en.e_meta;
|
|
|
"e_params",s_type_params en.e_params;
|
|
|
"e_type",s_tdef "\t" en.e_type;
|
|
|
"e_extern",string_of_bool en.e_extern;
|
|
|
- "e_constrs",s_list "\n\t" s_tenum_field (PMap.fold (fun ef acc -> ef :: acc) en.e_constrs []);
|
|
|
+ "e_constrs",s_list "\n\t" (s_tenum_field (tabs ^ "\t")) (PMap.fold (fun ef acc -> ef :: acc) en.e_constrs []);
|
|
|
"e_names",String.concat ", " en.e_names
|
|
|
]
|
|
|
|
|
|
- let s_tabstract a =
|
|
|
- s_record_fields "" [
|
|
|
+ let s_tabstract tabs a =
|
|
|
+ s_record_fields tabs [
|
|
|
"a_path",s_type_path a.a_path;
|
|
|
"a_modules",s_type_path a.a_module.m_path;
|
|
|
+ "a_pos",s_pos a.a_pos;
|
|
|
+ "a_name_pos",s_pos a.a_name_pos;
|
|
|
"a_private",string_of_bool a.a_private;
|
|
|
"a_doc",s_doc a.a_doc;
|
|
|
"a_meta",s_metadata a.a_meta;
|