File: epp_dodger.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (311 lines) | stat: -rw-r--r-- 7,738 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
.TH epp_dodger 3 "syntax_tools  1.5.5" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
epp_dodger \- epp_dodger - bypasses the Erlang preprocessor\&.
.SH DESCRIPTION
.LP
\fIepp_dodger\fR - bypasses the Erlang preprocessor\&.
.LP
This module tokenises and parses most Erlang source code without expanding preprocessor directives and macro applications, as long as these are syntactically "well-behaved"\&. Because the normal parse trees of the \fIerl_parse\fR module cannot represent these things (normally, they are expanded by the Erlang preprocessor epp(3) before the parser sees them), an extended syntax tree is created, using the erl_syntax module\&.

.SH DATA TYPES
.RS 2
.TP 4
.B
\fIerrorinfo() = {ErrorLine::integer(), Module::atom(), Descriptor::term()}\fR:

.RS 4
.LP
This is a so-called Erlang I/O ErrorInfo structure; see the io(3) module for details\&.
.LP

.RE
.RE
.SH EXPORTS
.LP
.B
parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.LP
Equivalent to parse(IODevice, 1)\&.
.RE
.LP
.B
parse(Dev::IODevice, L::StartLine) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Equivalent to parse(IODevice, StartLine, [])\&.
.LP
\fISee also:\fR parse/1\&.
.RE
.LP
.B
parse(Dev::IODevice, L0::StartLine, Options) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Options = [term()]
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Reads and parses program text from an I/O stream\&. Characters are read from \fIIODevice\fR until end-of-file; apart from this, the behaviour is the same as for parse_file/2\&. \fIStartLine\fR is the initial line number, which should be a positive integer\&. 
.LP
\fISee also:\fR parse/2, parse_file/2, parse_form/2, quick_parse/3\&.
.RE
.LP
.B
parse_file(File) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
File = filename() (see module file)
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Equivalent to parse_file(File, [])\&.
.RE
.LP
.B
parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
File = filename() (see module file)
.br
Options = [term()]
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Reads and parses a file\&. If successful, \fI{ok, Forms}\fR is returned, where \fIForms\fR is a list of abstract syntax trees representing the "program forms" of the file (cf\&. \fIerl_syntax:is_form/1\fR)\&. Otherwise, \fI{error, errorinfo()}\fR is returned, typically if the file could not be opened\&. Note that parse errors show up as error markers in the returned list of forms; they do not cause this function to fail or return \fI{error, errorinfo()}\fR\&.
.LP
Options: 
.RS 2
.TP 4
.B
\fI{no_fail, bool()}\fR:
If \fItrue\fR, this makes \fIepp_dodger\fR replace any program forms that could not be parsed with nodes of type \fItext\fR (see erl_syntax:text/1), representing the raw token sequence of the form, instead of reporting a parse error\&. The default value is \fIfalse\fR\&.
.TP 4
.B
\fI{clever, bool()}\fR:
If set to \fItrue\fR, this makes \fIepp_dodger\fR try to repair the source code as it seems fit, in certain cases where parsing would otherwise fail\&. Currently, it inserts \fI++\fR-operators between string literals and macros where it looks like concatenation was intended\&. The default value is \fIfalse\fR\&.
.RE
.LP

.LP
\fISee also:\fR parse/2, quick_parse_file/1, erl_syntax:is_form/1\&.
.RE
.LP
.B
parse_form(Dev::IODevice, L0::StartLine) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Form = syntaxTree() (see module erl_syntax)
.br
LineNo = integer()
.br
.RE
.RS
.LP
Equivalent to parse_form(IODevice, StartLine, [])\&.
.LP
\fISee also:\fR quick_parse_form/2\&.
.RE
.LP
.B
parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Options = [term()]
.br
Form = syntaxTree() (see module erl_syntax)
.br
LineNo = integer()
.br
.RE
.RS
.LP
Reads and parses a single program form from an I/O stream\&. Characters are read from \fIIODevice\fR until an end-of-form marker is found (a period character followed by whitespace), or until end-of-file; apart from this, the behaviour is similar to that of \fIparse/3\fR, except that the return values also contain the final line number given that \fIStartLine\fR is the initial line number, and that \fI{eof, LineNo}\fR may be returned\&. 
.LP
\fISee also:\fR parse/3, parse_form/2, quick_parse_form/3\&.
.RE
.LP
.B
quick_parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.LP
Equivalent to quick_parse(IODevice, 1)\&.
.RE
.LP
.B
quick_parse(Dev::IODevice, L::StartLine) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Equivalent to quick_parse(IODevice, StartLine, [])\&.
.LP
\fISee also:\fR quick_parse/1\&.
.RE
.LP
.B
quick_parse(Dev::IODevice, L0::StartLine, Options) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Options = [term()]
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Similar to parse/3, but does a more quick-and-dirty processing of the code\&. See quick_parse_file/2 for details\&. 
.LP
\fISee also:\fR parse/3, quick_parse/2, quick_parse_file/2, quick_parse_form/2\&.
.RE
.LP
.B
quick_parse_file(File) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
File = filename() (see module file)
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Equivalent to quick_parse_file(File, [])\&.
.RE
.LP
.B
quick_parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()}
.br
.RS
.TP
Types
File = filename() (see module file)
.br
Options = [term()]
.br
Forms = [syntaxTree() (see module erl_syntax)]
.br
.RE
.RS
.LP
Similar to parse_file/2, but does a more quick-and-dirty processing of the code\&. Macro definitions and other preprocessor directives are discarded, and all macro calls are replaced with atoms\&. This is useful when only the main structure of the code is of interest, and not the details\&. Furthermore, the quick-parse method can usually handle more strange cases than the normal, more exact parsing\&.
.LP
Options: see parse_file/2\&. Note however that for \fIquick_parse_file/2\fR, the option \fIno_fail\fR is \fItrue\fR by default\&. 
.LP
\fISee also:\fR parse_file/2, quick_parse/2\&.
.RE
.LP
.B
quick_parse_form(Dev::IODevice, L0::StartLine) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Form = syntaxTree() (see module erl_syntax) | none
.br
LineNo = integer()
.br
.RE
.RS
.LP
Equivalent to quick_parse_form(IODevice, StartLine, [])\&.
.LP
\fISee also:\fR parse_form/2\&.
.RE
.LP
.B
quick_parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo}
.br
.RS
.TP
Types
IODevice = pid()
.br
StartLine = integer()
.br
Options = [term()]
.br
Form = syntaxTree() (see module erl_syntax)
.br
LineNo = integer()
.br
.RE
.RS
.LP
Similar to parse_form/3, but does a more quick-and-dirty processing of the code\&. See quick_parse_file/2 for details\&. 
.LP
\fISee also:\fR parse/3, parse_form/3, quick_parse_form/2\&.
.RE
.LP
.B
tokens_to_string(Tokens::[term()]) -> string()
.br
.RS
.LP
Generates a string corresponding to the given token sequence\&. The string can be re-tokenized to yield the same token list again\&.
.RE