1erl_comment_scan(3) Erlang Module Definition erl_comment_scan(3)
2
3
4
6 erl_comment_scan - Functions for reading comment lines from Erlang
7 source code.
8
10 Functions for reading comment lines from Erlang source code.
11
13 comment() = {Line::integer(), Column::integer(), Indentation::inte‐
14 ger(), Text::[string()]}:
15
16
17 commentLine() = {Line::integer(), Column::integer(), Indent::inte‐
18 ger(), Text::string()}:
19
20
22 file(Name::file:filename()) -> [comment()]
23
24 Extracts comments from an Erlang source code file. Returns a
25 list of entries representing multi-line comments, listed in or‐
26 der of increasing line-numbers. For each entry, Text is a list
27 of strings representing the consecutive comment lines in top-
28 down order; the strings contain all characters following (but
29 not including) the first comment-introducing % character on the
30 line, up to (but not including) the line-terminating newline.
31
32 Furthermore, Line is the line number and Column the left column
33 of the comment (i.e., the column of the comment-introducing %
34 character). Indent is the indentation (or padding), measured in
35 character positions between the last non-whitespace character
36 before the comment (or the left margin), and the left column of
37 the comment. Line and Column are always positive integers, and
38 Indentation is a nonnegative integer.
39
40 Evaluation exits with reason {read, Reason} if a read error oc‐
41 curred, where Reason is an atom corresponding to a Posix error
42 code; see the module file(3) for details.
43
44 join_lines(Lines::[commentLine()]) -> [comment()]
45
46 Joins individual comment lines into multi-line comments. The in‐
47 put is a list of entries representing individual comment lines,
48 in order of decreasing line-numbers; see scan_lines/1 for de‐
49 tails. The result is a list of entries representing multi-line
50 comments, still listed in order of decreasing line-numbers, but
51 where for each entry, Text is a list of consecutive comment
52 lines in order of increasing line-numbers (i.e., top-down).
53
54 See also: scan_lines/1.
55
56 scan_lines(Text::string()) -> [commentLine()]
57
58 Extracts individual comment lines from a source code string. Re‐
59 turns a list of comment lines found in the text, listed in order
60 of decreasing line-numbers, i.e., the last comment line in the
61 input is first in the resulting list. Text is a single string,
62 containing all characters following (but not including) the
63 first comment-introducing % character on the line, up to (but
64 not including) the line-terminating newline. For details on
65 Line, Column and Indent, see file/1.
66
67 string(Text::string()) -> [comment()]
68
69 Extracts comments from a string containing Erlang source code.
70 Except for reading directly from a string, the behaviour is the
71 same as for file/1.
72
73 See also: file/1.
74
76 Richard Carlsson <carlsson.richard@gmail.com>
77
78
79
80 syntax_tools 3.0.1 erl_comment_scan(3)