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
18 file(FileName::file:filename()) -> [Comment]
19
20 Types:
21
22 Comment = {Line, Column, Indentation, Text}
23 Line = integer()
24 Column = integer()
25 Indentation = integer()
26 Text = [string()]
27
28 Extracts comments from an Erlang source code file. Returns a
29 list of entries representing multi-line comments, listed in
30 order of increasing line-numbers. For each entry, Text is a list
31 of strings representing the consecutive comment lines in top-
32 down order; the strings contain all characters following (but
33 not including) the first comment-introducing % character on the
34 line, up to (but not including) the line-terminating newline.
35
36 Furthermore, Line is the line number and Column the left column
37 of the comment (i.e., the column of the comment-introducing %
38 character). Indent is the indentation (or padding), measured in
39 character positions between the last non-whitespace character
40 before the comment (or the left margin), and the left column of
41 the comment. Line and Column are always positive integers, and
42 Indentation is a nonnegative integer.
43
44 Evaluation exits with reason {read, Reason} if a read error
45 occurred, where Reason is an atom corresponding to a Posix error
46 code; see the module file(3) for details.
47
48 join_lines(Lines::[CommentLine]) -> [Comment]
49
50 Types:
51
52 CommentLine = {Line, Column, Indent, string()}
53 Line = integer()
54 Column = integer()
55 Indent = integer()
56 Comment = {Line, Column, Indent, Text}
57 Text = [string()]
58
59 Joins individual comment lines into multi-line comments. The
60 input is a list of entries representing individual comment
61 lines, in order of decreasing line-numbers; see scan_lines/1 for
62 details. The result is a list of entries representing multi-line
63 comments, still listed in order of decreasing line-numbers, but
64 where for each entry, Text is a list of consecutive comment
65 lines in order of increasing line-numbers (i.e., top-down).
66
67 See also: scan_lines/1.
68
69 scan_lines(Text::string()) -> [CommentLine]
70
71 Types:
72
73 CommentLine = {Line, Column, Indent, Text}
74 Line = integer()
75 Column = integer()
76 Indent = integer()
77 Text = string()
78
79 Extracts individual comment lines from a source code string.
80 Returns a list of comment lines found in the text, listed in
81 order of decreasing line-numbers, i.e., the last comment line in
82 the input is first in the resulting list. Text is a single
83 string, containing all characters following (but not including)
84 the first comment-introducing % character on the line, up to
85 (but not including) the line-terminating newline. For details on
86 Line, Column and Indent, see file/1.
87
88 string(Text::string()) -> [Comment]
89
90 Types:
91
92 Comment = {Line, Column, Indentation, Text}
93 Line = integer()
94 Column = integer()
95 Indentation = integer()
96 Text = [string()]
97
98 Extracts comments from a string containing Erlang source code.
99 Except for reading directly from a string, the behaviour is the
100 same as for file/1.
101
102 See also: file/1.
103
105 Richard Carlsson <carlsson.richard@gmail.com>
106
107
108
109 syntax_tools 2.1.4.1 erl_comment_scan(3)