Skip to content

Commit

Permalink
remove cobol_unit/cobol_unit.ml
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Feb 1, 2024
1 parent 99d341f commit eb1016f
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/lsp/cobol_typeck/outputs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type artifacts =
type outputs =
{
ptree: Cobol_ptree.Types.compilation_group;
group: Cobol_unit.Types.group;
group: Cobol_unit.Group.TYPES.group;
artifacts: artifacts;
}
type t = outputs
Expand Down
26 changes: 0 additions & 26 deletions src/lsp/cobol_unit/cobol_unit.ml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

open EzCompat

open Unit_types
open Types
open Cobol_common.Srcloc.TYPES
open Cobol_common.Srcloc.INFIX

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
(**************************************************************************)

module TYPES = struct
type group = Unit_collections.SET.t
type +'a group_map = 'a Unit_collections.MAP.t
type group = Collections.SET.t
type +'a group_map = 'a Collections.MAP.t
end

(* (\** Alias for {!Collections.SET.empty} *\) *)
Expand All @@ -25,4 +25,4 @@ end
(* (\** Alias for {!Collections.SET.iter} *\) *)
(* let iter = Unit_collections.SET.iter *)

include Unit_collections.SET
include Collections.SET
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(* *)
(**************************************************************************)

open Unit_types
open Types

open Cobol_common.Srcloc.INFIX

Expand All @@ -22,13 +22,13 @@ let pp_cobol_unit ?(show_items = false) =
(Fmt.(list ~sep:nop) Cobol_data.Printer.pp_record));
C'(show_items,
Pretty.vfield "items" (fun x -> x.unit_data.data_items.named)
(Unit_qualmap.pp_qualmap Cobol_data.Printer.pp_data_definition));
(Qualmap.pp_qualmap Cobol_data.Printer.pp_data_definition));
]

let pp_cobol_unit' ppf u = pp_cobol_unit ppf ~&u

let pp_group ppf group =
Unit_collections.SET.iter begin fun u ->
Collections.SET.iter begin fun u ->
Fmt.(vbox @@ (styled `Yellow @@ any "unit") ++ any ": " ++
pp_cobol_unit' ++ any "@\n") ppf u
end group
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

(** Utilities to deal with sections/paragraphs of PROCEDURE DIVISIONs *)

open Unit_types
open Types

let rec find
?(in_section: procedure_section option)
Expand All @@ -22,10 +22,10 @@ let rec find
: procedure_block =
match in_section with
| None ->
Unit_qualmap.find procedure_name procedure.named
Qualmap.find procedure_name procedure.named
| Some { section_paragraphs; _ } ->
try
Paragraph (Unit_qualmap.find procedure_name section_paragraphs.named)
Paragraph (Qualmap.find procedure_name section_paragraphs.named)
with Not_found -> find procedure_name procedure

let rec full_qn
Expand All @@ -35,8 +35,8 @@ let rec full_qn
=
match in_section with
| None ->
(Unit_qualmap.find_binding procedure_name procedure.named).full_qn
(Qualmap.find_binding procedure_name procedure.named).full_qn
| Some { section_paragraphs; _ } ->
try
(Unit_qualmap.find_binding procedure_name section_paragraphs.named).full_qn
(Qualmap.find_binding procedure_name section_paragraphs.named).full_qn
with Not_found -> full_qn procedure_name procedure
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
(** Utilities to deal with sections/paragraphs of PROCEDURE DIVISIONs *)

val find
: ?in_section: Unit_types.procedure_section
: ?in_section: Types.procedure_section
-> Cobol_ptree.Types.qualname
-> Unit_types.procedure
-> Unit_types.procedure_block
-> Types.procedure
-> Types.procedure_block

val full_qn
: ?in_section: Unit_types.procedure_section
: ?in_section: Types.procedure_section
-> Cobol_ptree.Types.qualname
-> Unit_types.procedure
-> Types.procedure
-> Cobol_ptree.Types.qualname
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ open EzCompat (* String{Map,Set} *)
module StrMap = StringMap
module StrSet = StringSet

open Unit_qual
open Qual
module NEL = Cobol_common.Basics.NEL

(* --- *)
Expand Down Expand Up @@ -113,7 +113,7 @@ let rec find_binding qn { map; _ } =
| Exact { binding = None; refined; _ }, None ->
find_unique_binding qn refined
| Cut { binding; qn_suffix }, Some qn'
when Unit_qual.matches qn' ~full:qn_suffix ->
when Qual.matches qn' ~full:qn_suffix ->
binding
| Cut _, Some _ ->
raise Not_found
Expand Down Expand Up @@ -157,7 +157,7 @@ and find_all_bindings qn qmap : _ binding list =
(* Skip keys at toplevel of map: *)
StrMap.fold begin fun _key node acc -> match node with
| Cut { binding; qn_suffix }
when Unit_qual.matches qn ~full:qn_suffix ->
when Qual.matches qn ~full:qn_suffix ->
binding :: acc
| Cut _ ->
acc
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open Cobol_common.Srcloc.TYPES
many cases anonymous elements of [list] many not belong to [named]. *)
type 'a named_n_ordered =
{
named: 'a Unit_qualmap.t;
named: 'a Qualmap.t;
list: 'a list;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(* *)
(**************************************************************************)

open Unit_types
open Types

open Cobol_common.Visitor
open Cobol_common.Visitor.INFIX (* for `>>` (== `|>`) *)
Expand All @@ -22,7 +22,7 @@ open Cobol_common.Srcloc.TYPES
class ['a] folder = object
inherit ['a] Cobol_data.Visitor.folder
inherit!['a] Cobol_ptree.Proc_division_visitor.folder
method fold_unit_group: (Unit_group.t, 'a) fold = default
method fold_unit_group: (Group.t, 'a) fold = default
method fold_cobol_unit: (cobol_unit, 'a) fold = default
method fold_cobol_unit': (cobol_unit with_loc, 'a) fold = default
method fold_unit_config: (unit_config, 'a) fold = default
Expand Down Expand Up @@ -93,4 +93,4 @@ let fold_cobol_unit' (v: _ #folder) =

let fold_unit_group (v: _ #folder) =
handle v#fold_unit_group
~continue:(Unit_group.fold (fold_cobol_unit' v))
~continue:(Group.fold (fold_cobol_unit' v))

0 comments on commit eb1016f

Please sign in to comment.