Module Cobol_preproc

Source format

module Src_format : sig ... end

Text

"Text" refers to the source after manipulations by preprocessor statements.

module Text : sig ... end
module Text_printer : sig ... end

Miscellaneous support modules

module Src_overlay : sig ... end

A source overlay associates complex source code elements with virtual limits of lexing tokens that can be fed to parsers so as to tag ASTs with complex source locations.

module Trace : sig ... end
module Directives : sig ... end
module Diagnostics : sig ... end
module Outputs : sig ... end
module Env : sig ... end

Main entry points for the processor itself

type input =
  1. | String of {
    1. contents : string;
    2. filename : string;
    }
  2. | Channel of {
    1. ic : Stdlib.in_channel;
    2. filename : string;
    }
module Input : sig ... end
module Options : sig ... end
type preprocessor
val preprocessor : ?options:Cobol_preproc__.Preproc_options.preproc_options -> Cobol_preproc__.Src_input.t -> preprocessor
val reset_preprocessor_for_string : string -> ?new_position:Stdlib.Lexing.position -> preprocessor -> preprocessor
val diags : preprocessor -> Cobol_preproc__.Preproc_diagnostics.diagnostics
val position : preprocessor -> Stdlib.Lexing.position
val position_at : line:int -> char:int -> preprocessor -> Stdlib.Lexing.position
val source_format : preprocessor -> Src_format.any
val rev_log : preprocessor -> Cobol_preproc__.Preproc_trace.TYPES.log
val rev_comments : preprocessor -> Text.comments
val next_chunk : preprocessor -> Text.text * preprocessor

High-level commands

val lex_input : dialect:Cobol_config.dialect -> source_format:Cobol_config.source_format_spec -> ?ppf:Stdlib.Format.formatter -> Cobol_preproc__.Src_input.t -> unit Cobol_preproc__.Preproc_outputs.TYPES.with_diags
val lex_file : dialect:Cobol_config.dialect -> source_format:Cobol_config.source_format_spec -> ?ppf:Stdlib.Format.formatter -> string -> unit Cobol_preproc__.Preproc_outputs.TYPES.with_diags
val lex_lib : dialect:Cobol_config.dialect -> source_format:Cobol_config.source_format_spec -> lookup_config:Cobol_common.Copybook.lookup_config -> ?ppf:Stdlib.Format.formatter -> Cobol_common.Copybook.fileloc -> unit Cobol_preproc__.Preproc_outputs.TYPES.with_diags
val fold_source_lines : dialect:Cobol_config.dialect -> source_format:Cobol_config.source_format_spec -> ?on_initial_source_format:(Src_format.any -> 'a -> 'a) -> ?skip_compiler_directives_text:bool -> ?on_compiler_directive: (int -> Cobol_preproc__.Preproc_directives.compiler_directive Cobol_common.Srcloc.TYPES.with_loc -> 'a -> 'a) -> f:(int -> Text.text -> 'a -> 'a) -> Cobol_preproc__.Src_input.t -> 'a -> 'a

fold_source_lines ~dialect ~source_format ~skip_compiler_directives_text ~on_compiler_directive ~on_initial_source_format ~f input acc applies f line_number line acc for each successive source line line of input. line_number gives the line number for line (starting at 1). line is given empty to f if it corresponds to an empty line in the input, or was a line continuation in the case of fixed-width reference format.

When given, on_compiler_directive is called after f has been fed with the text of a compiler directive, with the same line number.

When given, on_initial_source_format is called before either f or on_compiler_directive has been called.

When set, skip_compiler_directives_text (false by default) prevents the text of compiler directives from being fed to f. If given, on_compiler_directive is called as if the text had been fed to f.

Diagnostics resulting from lexing and parsing the input are attached to the returned accumulated value.

val scan_prefix_for_copybook : dialect:Cobol_config.dialect -> source_format:Cobol_config.source_format_spec -> Cobol_preproc__.Src_input.t -> [ `Program | `Copybook ]
val preprocess_input : ?options:Cobol_preproc__.Preproc_options.preproc_options -> ?ppf:Stdlib.Format.formatter -> Cobol_preproc__.Src_input.t -> unit Cobol_preproc__.Preproc_outputs.TYPES.with_diags
val preprocess_file : ?options:Cobol_preproc__.Preproc_options.preproc_options -> ?ppf:Stdlib.Format.formatter -> string -> unit Cobol_preproc__.Preproc_outputs.TYPES.with_diags
val text_of_file : ?options:Cobol_preproc__.Preproc_options.preproc_options -> string -> Text.t Cobol_preproc__.Preproc_outputs.TYPES.with_diags
val text_of_input : ?options:Cobol_preproc__.Preproc_options.preproc_options -> Cobol_preproc__.Src_input.t -> Text.t Cobol_preproc__.Preproc_outputs.TYPES.with_diags