1Pparse(3) OCaml library Pparse(3)
2
3
4
6 Pparse - Driver for the parser and external preprocessors.
7
9 Module Pparse
10
12 Module Pparse
13 : sig end
14
15
16 Driver for the parser and external preprocessors.
17
18 Warning: this module is unstable and part of Compiler_libs .
19
20
21
22
23
24 type error =
25 | CannotRun of string
26 | WrongMagic of string
27
28
29
30
31
32 exception Error of error
33
34
35
36
37
38 val preprocess : string -> string
39
40
41
42
43 val remove_preprocessed : string -> unit
44
45
46
47 type 'a ast_kind =
48 | Structure : Parsetree.structure ast_kind
49 | Signature : Parsetree.signature ast_kind
50
51
52
53
54
55 val read_ast : 'a ast_kind -> string -> 'a
56
57
58
59
60 val write_ast : 'a ast_kind -> string -> 'a -> unit
61
62
63
64
65 val file : tool_name:string -> string -> (Lexing.lexbuf -> 'a) -> 'a
66 ast_kind -> 'a
67
68
69
70
71 val apply_rewriters : ?restore:bool -> tool_name:string -> 'a ast_kind
72 -> 'a -> 'a
73
74 If restore = true (the default), cookies set by external rewriters will
75 be kept for later calls.
76
77
78
79 val apply_rewriters_str : ?restore:bool -> tool_name:string -> Parse‐
80 tree.structure -> Parsetree.structure
81
82
83
84
85 val apply_rewriters_sig : ?restore:bool -> tool_name:string -> Parse‐
86 tree.signature -> Parsetree.signature
87
88
89
90
91 val report_error : Format.formatter -> error -> unit
92
93
94
95
96 val parse_implementation : tool_name:string -> string -> Parse‐
97 tree.structure
98
99
100
101
102 val parse_interface : tool_name:string -> string -> Parsetree.signature
103
104
105
106
107 val call_external_preprocessor : string -> string -> string
108
109
110
111
112 val open_and_check_magic : string -> string -> in_channel * bool
113
114
115
116
117
118
119OCamldoc 2020-02-27 Pparse(3)