Skip to content

Commit 3f5f0ea

Browse files
authored
Merge pull request #29 from bclement-ocp/bclement/pprint
Add an AST pretty-printer
2 parents 4a23316 + 496adff commit 3f5f0ea

31 files changed

+3408
-392
lines changed

src/lsp/cobol_ast/abstract.ml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,54 @@
1313

1414
module type MISC_SECTIONS = sig
1515
(* IDENTIFICATION_DIVISION *)
16-
type informational_paragraphs [@@deriving show]
17-
type options_paragraph [@@deriving show]
18-
type environment_division [@@deriving show]
16+
type informational_paragraphs [@@deriving ord]
17+
val pp_informational_paragraphs : informational_paragraphs Fmt.t
18+
type options_paragraph [@@deriving ord]
19+
val pp_options_paragraph : options_paragraph Fmt.t
20+
type environment_division [@@deriving ord]
21+
val pp_environment_division : environment_division Fmt.t
1922
end
2023

2124
module type PICTURE = sig
22-
type picture [@@deriving show]
25+
type picture [@@deriving show, ord]
2326
end
2427

2528
module type DATA_SECTIONS = sig
26-
type working_storage_section [@@deriving show]
27-
type linkage_section [@@deriving show]
28-
type file_section [@@deriving show]
29-
type communication_section [@@deriving show]
30-
type local_storage_section [@@deriving show]
31-
type report_section [@@deriving show]
32-
type screen_section [@@deriving show]
29+
type working_storage_section [@@deriving ord]
30+
val pp_working_storage_section : working_storage_section Pretty.printer
31+
type linkage_section [@@deriving ord]
32+
val pp_linkage_section : linkage_section Pretty.printer
33+
type file_section [@@deriving ord]
34+
val pp_file_section : file_section Pretty.printer
35+
type communication_section [@@deriving ord]
36+
val pp_communication_section : communication_section Pretty.printer
37+
type local_storage_section [@@deriving ord]
38+
val pp_local_storage_section : local_storage_section Pretty.printer
39+
type report_section [@@deriving ord]
40+
val pp_report_section : report_section Pretty.printer
41+
type screen_section [@@deriving ord]
42+
val pp_screen_section : screen_section Pretty.printer
3343
end
3444

3545
module type DATA_DIVISION = sig
3646
(* NOTE: could become PROG_DIVISIONS if relevant *)
37-
type data_division [@@deriving show]
47+
type data_division [@@deriving ord]
48+
val pp_data_division : data_division Pretty.printer
3849
end
3950

4051
module type STATEMENTS = sig
41-
type statement [@@deriving show]
42-
type statements [@@deriving show]
52+
type statement [@@deriving ord]
53+
val pp_statement : statement Fmt.t
54+
type statements [@@deriving ord]
55+
val pp_statements : statements Fmt.t
56+
val pp_dump_statements : statements Fmt.t
4357
end
4458

4559
module type PROC_DIVISION = sig
46-
type procedure_division [@@deriving show]
60+
type procedure_division [@@deriving ord]
61+
val pp_procedure_division : procedure_division Fmt.t
4762
end
4863

4964
module type COMPILATION_GROUP = sig
50-
type compilation_group [@@deriving show]
65+
type compilation_group [@@deriving show, ord]
5166
end

0 commit comments

Comments
 (0)