Module Pparse

module Pparse: sig .. end

Driver for the parser and external preprocessors.

Warning: this module is unstable and part of compiler-libs.


type error = 
| CannotRun of string
| WrongMagic of string
exception Error(error);
let preprocess: string => string;
let remove_preprocessed: string => unit;
type 'a ast_kind = 
| Structure : Parsetree.structure ast_kind
| Signature : Parsetree.signature ast_kind
let read_ast: (ast_kind('a), string) => 'a;
let write_ast: (ast_kind('a), string, 'a) => unit;
let file:
  (~tool_name: string, string, Lexing.lexbuf => 'a, ast_kind('a)) => 'a;
let apply_rewriters:
  (~restore: bool=?, ~tool_name: string, ast_kind('a), 'a) => 'a;

If restore = true (the default), cookies set by external rewriters will be kept for later calls.

let apply_rewriters_str:
  (~restore: bool=?, ~tool_name: string, Parsetree.structure) =>
  Parsetree.structure;
let apply_rewriters_sig:
  (~restore: bool=?, ~tool_name: string, Parsetree.signature) =>
  Parsetree.signature;
let report_error: (Format.formatter, error) => unit;
let parse_implementation: (~tool_name: string, string) => Parsetree.structure;
let parse_interface: (~tool_name: string, string) => Parsetree.signature;
let call_external_preprocessor: (string, string) => string;
let open_and_check_magic: (string, string) => (in_channel, bool);