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 ex‐
12       panding 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() = erl_scan:error_info():
20
21
22         option() = atom() | {atom(), term()}:
23
24

EXPORTS

26       parse(Dev::file:io_device()) -> {ok, erl_syntax:forms()}
27
28              Equivalent to parse(IODevice, 1).
29
30       parse(Dev::file:io_device(), L::erl_anno:location()) ->  {ok,  erl_syn‐
31       tax:forms()}
32
33              Equivalent to parse(IODevice, StartLocation, []).
34
35              See also: parse/1.
36
37       parse(Dev::file:io_device(),   L0::erl_anno:location(),   Options::[op‐
38       tion()]) -> {ok, erl_syntax:forms()}
39
40              Reads and parses program text from an I/O stream. Characters are
41              read  from  IODevice until end-of-file; apart from this, the be‐
42              haviour is the same as for parse_file/2.  StartLocation  is  the
43              initial location.
44
45              See also: parse/2, parse_file/2, parse_form/2, quick_parse/3.
46
47       parse_file(File::file:filename()) -> {ok, erl_syntax:forms()} | {error,
48       errorinfo()}
49
50              Equivalent to parse_file(File, []).
51
52       parse_file(File::file:filename(), Options::[option()]) -> {ok, erl_syn‐
53       tax:forms()} | {error, errorinfo()}
54
55              Reads and parses a file. If successful, {ok, Forms} is returned,
56              where Forms is a list of abstract syntax trees representing  the
57              "program  forms"  of the file (cf. erl_syntax:is_form/1). Other‐
58              wise, {error, errorinfo()} is returned, typically  if  the  file
59              could  not  be  opened.  Note that parse errors show up as error
60              markers in the returned list of forms; they do  not  cause  this
61              function to fail or return {error, errorinfo()}.
62
63              Options:
64
65                {no_fail, boolean()}:
66                  If  true,  this  makes  epp_dodger replace any program forms
67                  that could not be  parsed  with  nodes  of  type  text  (see
68                  erl_syntax:text/1),  representing  the raw token sequence of
69                  the form, instead of reporting a parse  error.  The  default
70                  value is false.
71
72                {clever, boolean()}:
73                  If  set  to  true,  this  makes epp_dodger try to repair the
74                  source code as it seems fit, in certain cases where  parsing
75                  would otherwise fail. Currently, it inserts ++-operators be‐
76                  tween string literals and macros where it  looks  like  con‐
77                  catenation was intended. The default value is false.
78
79              See also: parse/2, quick_parse_file/1, erl_syntax:is_form/1.
80
81       parse_form(Dev::file:io_device(),   L0::erl_anno:location())   ->  {ok,
82       erl_syntax:forms(), erl_anno:location()} | {eof, erl_anno:location()} |
83       {error, errorinfo(), erl_anno:location()}
84
85              Equivalent to parse_form(IODevice, StartLocation, []).
86
87              See also: quick_parse_form/2.
88
89       parse_form(Dev::file:io_device(),      L0::erl_anno:location(),     Op‐
90       tions::[option()]) -> {ok, erl_syntax:forms(),  erl_anno:location()}  |
91       {eof, erl_anno:location()} | {error, errorinfo(), erl_anno:location()}
92
93              Reads and parses a single program form from an I/O stream. Char‐
94              acters are read from IODevice until  an  end-of-form  marker  is
95              found (a period character followed by whitespace), or until end-
96              of-file; apart from this, the behaviour is similar  to  that  of
97              parse/3,  except  that  the return values also contain the final
98              location given that StartLocation is the initial  location,  and
99              that {eof, Location} may be returned.
100
101              See also: parse/3, parse_form/2, quick_parse_form/3.
102
103       quick_parse(Dev::file:io_device()) -> {ok, erl_syntax:forms()}
104
105              Equivalent to quick_parse(IODevice, 1).
106
107       quick_parse(Dev::file:io_device(),   L::erl_anno:location())   ->  {ok,
108       erl_syntax:forms()}
109
110              Equivalent to quick_parse(IODevice, StartLocation, []).
111
112              See also: quick_parse/1.
113
114       quick_parse(Dev::file:io_device(),     L0::erl_anno:location(),     Op‐
115       tions::[option()]) -> {ok, erl_syntax:forms()}
116
117              Similar  to  parse/3, but does a more quick-and-dirty processing
118              of the code. See quick_parse_file/2 for details.
119
120              See   also:    parse/3,    quick_parse/2,    quick_parse_file/2,
121              quick_parse_form/2.
122
123       quick_parse_file(File::file:filename())  ->  {ok, erl_syntax:forms()} |
124       {error, errorinfo()}
125
126              Equivalent to quick_parse_file(File, []).
127
128       quick_parse_file(File::file:filename(),  Options::[option()])  ->  {ok,
129       erl_syntax:forms()} | {error, errorinfo()}
130
131              Similar  to  parse_file/2,  but does a more quick-and-dirty pro‐
132              cessing of the code. Macro definitions  and  other  preprocessor
133              directives  are discarded, and all macro calls are replaced with
134              atoms. This is useful when only the main structure of  the  code
135              is  of  interest,  and  not the details. Furthermore, the quick-
136              parse method can usually handle more strange cases than the nor‐
137              mal, more exact parsing.
138
139              Options:    see    parse_file/2.    Note    however   that   for
140              quick_parse_file/2, the option no_fail is true by default.
141
142              See also: parse_file/2, quick_parse/2.
143
144       quick_parse_form(Dev::file:io_device(),   L0::erl_anno:location())   ->
145       {ok,  erl_syntax:forms(),  erl_anno:location()}  | {eof, erl_anno:loca‐
146       tion()} | {error, errorinfo(), erl_anno:location()}
147
148              Equivalent to quick_parse_form(IODevice, StartLocation, []).
149
150              See also: parse_form/2.
151
152       quick_parse_form(Dev::file:io_device(),  L0::erl_anno:location(),   Op‐
153       tions::[option()])  ->  {ok, erl_syntax:forms(), erl_anno:location()} |
154       {eof, erl_anno:location()} | {error, errorinfo(), erl_anno:location()}
155
156              Similar to parse_form/3, but does a  more  quick-and-dirty  pro‐
157              cessing of the code. See quick_parse_file/2 for details.
158
159              See also: parse/3, parse_form/3, quick_parse_form/2.
160
161       tokens_to_string(Ts::[term()]) -> string()
162
163              Generates  a  string  corresponding to the given token sequence.
164              The string can be re-tokenized to  yield  the  same  token  list
165              again.
166

AUTHORS

168       Richard Carlsson <carlsson.richard@gmail.com>
169
170
171
172                               syntax_tools 3.0                  epp_dodger(3)
Impressum