Module Cobol_unit.Types

Representation of COBOL compilation units

type 'a named_n_ordered = {
  1. named : 'a Cobol_unit__.Unit_resolver_map.TYPES.resolver_map;
  2. list : 'a list;
}

A type to manage sets of items in both named and ordered form. Note that in many cases anonymous elements of list do not appear in named.

type display_sign = {
  1. sign_position : sign_position;
    (*

    relevant for non-binary representations

    *)
  2. sign_separate : bool;
    (*

    true = separate character (extra byte)

    *)
}
and sign_position =
  1. | Leading
  2. | Trailing
type unit_config = {
  1. unit_currency_signs : Cobol_common.Basics.CharSet.t;
  2. unit_decimal_point : char;
  3. unit_display_sign_config : Cobol_data.Types.display_sign_config;
}

Corresponds to the contents of the CONFIGURATION SECTION.

type unit_env = {
  1. env_config : unit_config;
}
type data_definitions = {
  1. data_items : Cobol_data.Types.data_definition named_n_ordered;
  2. data_records : Cobol_data.Types.record list;
}

data_definitions exposes two views on the items (fields and tables) in DATA DIVISION:

  • data_items contains all the items with direct access by name.
  • data_records is a list of record trees where each element represents a record definition (typically a level 01 or 77 data item)
type paragraph = {
  1. paragraph_name : Cobol_ptree.procedure_name Cobol_common.Srcloc.TYPES.with_loc option;
    (*

    None for the unnamed paragraph at the begining of a section. Some qn where qn is fully qualified otherwise. Note that paragraph_name is different than paragraph_name in Cobol_ptree.paragraph. For an unnamed paragraph at the begining of a section Cobol_ptree.paragraph contains the (optionnal) section name whereas this paragraph_name contains None to indicate that the paragraph is anonymous.

    *)
  2. paragraph_sentences : Cobol_procedure.Types.statements Cobol_common.Srcloc.TYPES.with_loc list;
}
type section = {
  1. section_name : Cobol_ptree.name Cobol_common.Srcloc.TYPES.with_loc option;
    (*

    None for the unnamed section at the begining of PROCEDURE DIVISION For convenience when collecting references to all procedure names, section_name is visited as a procedure_name with_loc option.

    *)
  2. section_segment : Cobol_data.Types.integer_value option;
    (*

    Optional segment priority number (obsolete in COBOL-85)

    *)
  3. section_paragraphs : paragraph Cobol_common.Srcloc.TYPES.with_loc named_n_ordered;
    (*

    Includes an anonymous empty paragraph if the section is empty. However, this list does not start with an unnamed paragraph, when the section immediately starts with a paragraph name.

    *)
}
type procedure = {
  1. procedure_using : procedure_using Cobol_common.Srcloc.TYPES.with_loc option;
    (*

    PROCEDURE DIVISION USING ...

    *)
  2. procedure_sections : section Cobol_common.Srcloc.TYPES.with_loc list;
  3. procedure_blocks : procedure_block Cobol_unit__.Unit_resolver_map.TYPES.resolver_map;
}
type cobol_unit = {
  1. unit_name : string Cobol_common.Srcloc.TYPES.with_loc;
  2. unit_parent_name : string Cobol_common.Srcloc.TYPES.with_loc option;
  3. unit_env : unit_env;
  4. unit_data : data_definitions;
  5. unit_procedure : procedure;
}

Type of a main COBOL compilation unit

type group = Stdlib.Set.Make(Cobol_unit__.Unit_collections.M).t
type +'a group_map = 'a Stdlib.Map.Make(Cobol_unit__.Unit_collections.M).t