1epp_dodger(3)              Erlang Module Definition              epp_dodger(3)
2
3
4

NAME

6       epp_dodger - epp_dodger - bypasses the Erlang preprocessor.
7

DESCRIPTION

9       epp_dodger - bypasses the Erlang preprocessor.
10
11       This  module  tokenises  and  parses  most  Erlang  source code without
12       expanding preprocessor directives and macro applications,  as  long  as
13       these  are syntactically "well-behaved". Because the normal parse trees
14       of the erl_parse module cannot represent these things  (normally,  they
15       are  expanded  by the Erlang preprocessor epp(3) before the parser sees
16       them), an extended syntax tree is created, using the erl_syntax module.
17

DATA TYPES

19         errorinfo()   =   {ErrorLine::integer(),   Module::atom(),   Descrip‐
20         tor::term()}:
21
22
23           This  is  a so-called Erlang I/O ErrorInfo structure; see the io(3)
24           module for details.
25

EXPORTS

27       parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()}
28
29              Equivalent to parse(IODevice, 1).
30
31       parse(Dev::IODevice, L::StartLine) ->  {ok,  Forms}  |  {error,  error‐
32       info()}
33
34              Types:
35
36                 IODevice = pid()
37                 StartLine = integer()
38                 Forms = [erl_syntax:syntaxTree()]
39
40              Equivalent to parse(IODevice, StartLine, []).
41
42              See also: parse/1.
43
44       parse(Dev::IODevice,  L0::StartLine,  Options) -> {ok, Forms} | {error,
45       errorinfo()}
46
47              Types:
48
49                 IODevice = pid()
50                 StartLine = integer()
51                 Options = [term()]
52                 Forms = [erl_syntax:syntaxTree()]
53
54              Reads and parses program text from an I/O stream. Characters are
55              read  from  IODevice until end-of-file; apart from this, the be‐
56              haviour is the same as for parse_file/2. StartLine is  the  ini‐
57              tial line number, which should be a positive integer.
58
59              See also: parse/2, parse_file/2, parse_form/2, quick_parse/3.
60
61       parse_file(File) -> {ok, Forms} | {error, errorinfo()}
62
63              Types:
64
65                 File = file:filename()
66                 Forms = [erl_syntax:syntaxTree()]
67
68              Equivalent to parse_file(File, []).
69
70       parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()}
71
72              Types:
73
74                 File = file:filename()
75                 Options = [term()]
76                 Forms = [erl_syntax:syntaxTree()]
77
78              Reads and parses a file. If successful, {ok, Forms} is returned,
79              where Forms is a list of abstract syntax trees representing  the
80              "program  forms"  of the file (cf. erl_syntax:is_form/1). Other‐
81              wise, {error, errorinfo()} is returned, typically  if  the  file
82              could  not  be  opened.  Note that parse errors show up as error
83              markers in the returned list of forms; they do  not  cause  this
84              function to fail or return {error, errorinfo()}.
85
86              Options:
87
88                {no_fail, boolean()}:
89                  If  true,  this  makes  epp_dodger replace any program forms
90                  that could not be  parsed  with  nodes  of  type  text  (see
91                  erl_syntax:text/1),  representing  the raw token sequence of
92                  the form, instead of reporting a parse  error.  The  default
93                  value is false.
94
95                {clever, boolean()}:
96                  If  set  to  true,  this  makes epp_dodger try to repair the
97                  source code as it seems fit, in certain cases where  parsing
98                  would  otherwise  fail.  Currently,  it inserts ++-operators
99                  between string literals and macros where it looks like  con‐
100                  catenation was intended. The default value is false.
101
102              See also: parse/2, quick_parse_file/1, erl_syntax:is_form/1.
103
104       parse_form(Dev::IODevice,  L0::StartLine) -> {ok, Form, LineNo} | {eof,
105       LineNo} | {error, errorinfo(), LineNo}
106
107              Types:
108
109                 IODevice = pid()
110                 StartLine = integer()
111                 Form = erl_syntax:syntaxTree()
112                 LineNo = integer()
113
114              Equivalent to parse_form(IODevice, StartLine, []).
115
116              See also: quick_parse_form/2.
117
118       parse_form(Dev::IODevice, L0::StartLine, Options) -> {ok, Form, LineNo}
119       | {eof, LineNo} | {error, errorinfo(), LineNo}
120
121              Types:
122
123                 IODevice = pid()
124                 StartLine = integer()
125                 Options = [term()]
126                 Form = erl_syntax:syntaxTree()
127                 LineNo = integer()
128
129              Reads and parses a single program form from an I/O stream. Char‐
130              acters are read from IODevice until  an  end-of-form  marker  is
131              found (a period character followed by whitespace), or until end-
132              of-file; apart from this, the behaviour is similar  to  that  of
133              parse/3,  except  that  the return values also contain the final
134              line number given that StartLine is the initial line number, and
135              that {eof, LineNo} may be returned.
136
137              See also: parse/3, parse_form/2, quick_parse_form/3.
138
139       quick_parse(Dev::IODevice) -> {ok, Forms} | {error, errorinfo()}
140
141              Equivalent to quick_parse(IODevice, 1).
142
143       quick_parse(Dev::IODevice,  L::StartLine)  ->  {ok,  Forms}  |  {error,
144       errorinfo()}
145
146              Types:
147
148                 IODevice = pid()
149                 StartLine = integer()
150                 Forms = [erl_syntax:syntaxTree()]
151
152              Equivalent to quick_parse(IODevice, StartLine, []).
153
154              See also: quick_parse/1.
155
156       quick_parse(Dev::IODevice, L0::StartLine, Options)  ->  {ok,  Forms}  |
157       {error, errorinfo()}
158
159              Types:
160
161                 IODevice = pid()
162                 StartLine = integer()
163                 Options = [term()]
164                 Forms = [erl_syntax:syntaxTree()]
165
166              Similar  to  parse/3, but does a more quick-and-dirty processing
167              of the code. See quick_parse_file/2 for details.
168
169              See   also:    parse/3,    quick_parse/2,    quick_parse_file/2,
170              quick_parse_form/2.
171
172       quick_parse_file(File) -> {ok, Forms} | {error, errorinfo()}
173
174              Types:
175
176                 File = file:filename()
177                 Forms = [erl_syntax:syntaxTree()]
178
179              Equivalent to quick_parse_file(File, []).
180
181       quick_parse_file(File, Options) -> {ok, Forms} | {error, errorinfo()}
182
183              Types:
184
185                 File = file:filename()
186                 Options = [term()]
187                 Forms = [erl_syntax:syntaxTree()]
188
189              Similar  to  parse_file/2,  but does a more quick-and-dirty pro‐
190              cessing of the code. Macro definitions  and  other  preprocessor
191              directives  are discarded, and all macro calls are replaced with
192              atoms. This is useful when only the main structure of  the  code
193              is  of  interest,  and  not the details. Furthermore, the quick-
194              parse method can usually handle more strange cases than the nor‐
195              mal, more exact parsing.
196
197              Options:    see    parse_file/2.    Note    however   that   for
198              quick_parse_file/2, the option no_fail is true by default.
199
200              See also: parse_file/2, quick_parse/2.
201
202       quick_parse_form(Dev::IODevice, L0::StartLine) -> {ok, Form, LineNo}  |
203       {eof, LineNo} | {error, errorinfo(), LineNo}
204
205              Types:
206
207                 IODevice = pid()
208                 StartLine = integer()
209                 Form = erl_syntax:syntaxTree() | none
210                 LineNo = integer()
211
212              Equivalent to quick_parse_form(IODevice, StartLine, []).
213
214              See also: parse_form/2.
215
216       quick_parse_form(Dev::IODevice,  L0::StartLine,  Options) -> {ok, Form,
217       LineNo} | {eof, LineNo} | {error, errorinfo(), LineNo}
218
219              Types:
220
221                 IODevice = pid()
222                 StartLine = integer()
223                 Options = [term()]
224                 Form = erl_syntax:syntaxTree()
225                 LineNo = integer()
226
227              Similar to parse_form/3, but does a  more  quick-and-dirty  pro‐
228              cessing of the code. See quick_parse_file/2 for details.
229
230              See also: parse/3, parse_form/3, quick_parse_form/2.
231
232       tokens_to_string(Tokens::[term()]) -> string()
233
234              Generates  a  string  corresponding to the given token sequence.
235              The string can be re-tokenized to  yield  the  same  token  list
236              again.
237

AUTHORS

239       Richard Carlsson <carlsson.richard@gmail.com>
240
241
242
243                               syntax_tools 2.5                  epp_dodger(3)
Impressum