Module Cobol_parser.Outputs

Output types for the engine

Gathers some types used to define outputs for the parser engine.

type tokens_with_locs = Cobol_parser__.Grammar_tokens.token Cobol_common.Srcloc.TYPES.with_loc list
type artifacts = {
  1. tokens : tokens_with_locs Stdlib.Lazy.t;
  2. pplog : Cobol_preproc.Trace.log;
  3. rev_comments : Cobol_preproc.Text.comments;
  4. rev_ignored : Cobol_common.Srcloc.TYPES.lexloc list;
}
type ('result, 'memo) output =
  1. | Only : 'result -> ('result, Cobol_common.Behaviors.amnesic) output
  2. | WithArtifacts : 'result * artifacts -> ('result, Cobol_common.Behaviors.eidetic) output

The output of parsing functions depends on its memorization abilities:

  • an amnesic parse (when 'memo = Cobol_common.Behaviors.amnesic) only returns a parsing result (of type 'result);
  • an eidetic parse (when 'memo = Cobol_common.Behaviors.eidetic) additionally returns some parsing artefacts.
type 'm parsed_compilation_group = (Cobol_ptree.compilation_group option, 'm) output
include sig ... end
module TYPES : sig ... end
type !'a with_diags = 'a TYPES.with_diags = {
  1. result : 'a;
  2. diags : Cobol_parser__.Parser_diagnostics.ALL.t;
}
val result : ?diags:Cobol_parser__.Parser_diagnostics.ALL.t -> 'a -> 'a with_diags
val simple_result : 'a -> 'a with_diags
val some_result : ?diags:Cobol_parser__.Parser_diagnostics.ALL.t -> 'a -> 'a option with_diags
val no_result : diags:Cobol_parser__.Parser_diagnostics.ALL.t -> 'a option with_diags
val with_diags : 'a -> Cobol_parser__.Parser_diagnostics.ALL.t -> 'a with_diags
val with_more_diags : diags:Cobol_parser__.Parser_diagnostics.ALL.t -> 'a with_diags -> 'a with_diags
val result_only : 'a with_diags -> 'a
val forget_result : 'a with_diags -> Cobol_parser__.Parser_diagnostics.ALL.t
val more_result : f:('a -> 'b with_diags) -> 'a with_diags -> 'b with_diags
val map_result : f:('a -> 'b) -> 'a with_diags -> 'b with_diags
val map2_results : f:('a -> 'b -> 'c with_diags) -> 'a with_diags -> 'b with_diags -> 'c with_diags
val map_some_result : f:('a -> 'b) -> 'a option with_diags -> 'b option with_diags
val merge_results : f:('a -> 'b -> 'c) -> 'a with_diags -> 'b with_diags -> 'c with_diags
val cons_option_result : 'a option with_diags -> 'a list with_diags -> 'a list with_diags
val translate_diags : 'a with_diags -> 'a Cobol_common.Diagnostics.with_diags
val show_n_forget : ?set_status:bool -> ?min_level:Cobol_common.Diagnostics.severity -> ?ppf:Stdlib.Format.formatter -> 'a with_diags -> 'a
val sink_result : ?set_status:bool -> ?ppf:Stdlib.Format.formatter -> 'a with_diags -> unit