diff --git a/src/lsp/cobol_typeck/outputs.ml b/src/lsp/cobol_typeck/outputs.ml index d8bcbaa6b..b14c47b7c 100644 --- a/src/lsp/cobol_typeck/outputs.ml +++ b/src/lsp/cobol_typeck/outputs.ml @@ -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 diff --git a/src/lsp/cobol_unit/cobol_unit.ml b/src/lsp/cobol_unit/cobol_unit.ml deleted file mode 100644 index 506ba18e0..000000000 --- a/src/lsp/cobol_unit/cobol_unit.ml +++ /dev/null @@ -1,26 +0,0 @@ -(**************************************************************************) -(* *) -(* SuperBOL OSS Studio *) -(* *) -(* Copyright (c) 2022-2023 OCamlPro SAS *) -(* *) -(* All rights reserved. *) -(* This source code is licensed under the GNU Affero General Public *) -(* License version 3 found in the LICENSE.md file in the root directory *) -(* of this source tree. *) -(* *) -(**************************************************************************) - -module Qual = Unit_qual -module Qualmap = Unit_qualmap - -module Types = struct - include Unit_types - include Unit_group.TYPES -end - -module Group = Unit_group -module Procedure = Unit_procedure -module Collections = Unit_collections -module Printer = Unit_printer -module Visitor = Unit_visitor diff --git a/src/lsp/cobol_unit/unit_collections.ml b/src/lsp/cobol_unit/collections.ml similarity index 99% rename from src/lsp/cobol_unit/unit_collections.ml rename to src/lsp/cobol_unit/collections.ml index df8fb2e9a..b42429149 100644 --- a/src/lsp/cobol_unit/unit_collections.ml +++ b/src/lsp/cobol_unit/collections.ml @@ -13,7 +13,7 @@ open EzCompat -open Unit_types +open Types open Cobol_common.Srcloc.TYPES open Cobol_common.Srcloc.INFIX diff --git a/src/lsp/cobol_unit/unit_group.ml b/src/lsp/cobol_unit/group.ml similarity index 91% rename from src/lsp/cobol_unit/unit_group.ml rename to src/lsp/cobol_unit/group.ml index cd5269d2d..2cacb589a 100644 --- a/src/lsp/cobol_unit/unit_group.ml +++ b/src/lsp/cobol_unit/group.ml @@ -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} *\) *) @@ -25,4 +25,4 @@ end (* (\** Alias for {!Collections.SET.iter} *\) *) (* let iter = Unit_collections.SET.iter *) -include Unit_collections.SET +include Collections.SET diff --git a/src/lsp/cobol_unit/unit_printer.ml b/src/lsp/cobol_unit/printer.ml similarity index 91% rename from src/lsp/cobol_unit/unit_printer.ml rename to src/lsp/cobol_unit/printer.ml index 7f862a6f2..d28ae0b5d 100644 --- a/src/lsp/cobol_unit/unit_printer.ml +++ b/src/lsp/cobol_unit/printer.ml @@ -11,7 +11,7 @@ (* *) (**************************************************************************) -open Unit_types +open Types open Cobol_common.Srcloc.INFIX @@ -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 diff --git a/src/lsp/cobol_unit/unit_procedure.ml b/src/lsp/cobol_unit/procedure.ml similarity index 83% rename from src/lsp/cobol_unit/unit_procedure.ml rename to src/lsp/cobol_unit/procedure.ml index c66d2ca5f..7897582eb 100644 --- a/src/lsp/cobol_unit/unit_procedure.ml +++ b/src/lsp/cobol_unit/procedure.ml @@ -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) @@ -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 @@ -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 diff --git a/src/lsp/cobol_unit/unit_procedure.mli b/src/lsp/cobol_unit/procedure.mli similarity index 86% rename from src/lsp/cobol_unit/unit_procedure.mli rename to src/lsp/cobol_unit/procedure.mli index 025484b4a..7d2fe347c 100644 --- a/src/lsp/cobol_unit/unit_procedure.mli +++ b/src/lsp/cobol_unit/procedure.mli @@ -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 diff --git a/src/lsp/cobol_unit/unit_qual.ml b/src/lsp/cobol_unit/qual.ml similarity index 100% rename from src/lsp/cobol_unit/unit_qual.ml rename to src/lsp/cobol_unit/qual.ml diff --git a/src/lsp/cobol_unit/unit_qualmap.ml b/src/lsp/cobol_unit/qualmap.ml similarity index 98% rename from src/lsp/cobol_unit/unit_qualmap.ml rename to src/lsp/cobol_unit/qualmap.ml index 30b15d4d7..a03fc0c3d 100644 --- a/src/lsp/cobol_unit/unit_qualmap.ml +++ b/src/lsp/cobol_unit/qualmap.ml @@ -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 (* --- *) @@ -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 @@ -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 diff --git a/src/lsp/cobol_unit/unit_qualmap.mli b/src/lsp/cobol_unit/qualmap.mli similarity index 100% rename from src/lsp/cobol_unit/unit_qualmap.mli rename to src/lsp/cobol_unit/qualmap.mli diff --git a/src/lsp/cobol_unit/unit_types.ml b/src/lsp/cobol_unit/types.ml similarity index 98% rename from src/lsp/cobol_unit/unit_types.ml rename to src/lsp/cobol_unit/types.ml index 68b583a7d..700ba574a 100644 --- a/src/lsp/cobol_unit/unit_types.ml +++ b/src/lsp/cobol_unit/types.ml @@ -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; } diff --git a/src/lsp/cobol_unit/unit_visitor.ml b/src/lsp/cobol_unit/visitor.ml similarity index 96% rename from src/lsp/cobol_unit/unit_visitor.ml rename to src/lsp/cobol_unit/visitor.ml index 18de8a490..10f1390d6 100644 --- a/src/lsp/cobol_unit/unit_visitor.ml +++ b/src/lsp/cobol_unit/visitor.ml @@ -11,7 +11,7 @@ (* *) (**************************************************************************) -open Unit_types +open Types open Cobol_common.Visitor open Cobol_common.Visitor.INFIX (* for `>>` (== `|>`) *) @@ -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 @@ -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))