File: erl_comment_scan.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 (92 lines) | stat: -rw-r--r-- 3,385 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
.TH erl_comment_scan 3 "syntax_tools  1.5.5" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
erl_comment_scan \- Functions for reading comment lines from Erlang source code\&.
.SH DESCRIPTION
.LP
Functions for reading comment lines from Erlang source code\&.

.SH EXPORTS
.LP
.B
file(FileName::filename() (see module file)) -> [Comment]
.br
.RS
.TP
Types
Comment = {Line, Column, Indentation, Text}
.br
Line = integer()
.br
Column = integer()
.br
Indentation = integer()
.br
Text = [string()]
.br
.RE
.RS
.LP
Extracts comments from an Erlang source code file\&. Returns a list of entries representing \fImulti-line\fR comments, listed in order of increasing line-numbers\&. For each entry, \fIText\fR is a list of strings representing the consecutive comment lines in top-down order; the strings contain \fIall\fR characters following (but not including) the first comment-introducing \fI%\fR character on the line, up to (but not including) the line-terminating newline\&.
.LP
Furthermore, \fILine\fR is the line number and \fIColumn\fR the left column of the comment (i\&.e\&., the column of the comment-introducing \fI%\fR character)\&. \fIIndent\fR is the indentation (or padding), measured in character positions between the last non-whitespace character before the comment (or the left margin), and the left column of the comment\&. \fILine\fR and \fIColumn\fR are always positive integers, and \fIIndentation\fR is a nonnegative integer\&.
.LP
Evaluation exits with reason \fI{read, Reason}\fR if a read error occurred, where \fIReason\fR is an atom corresponding to a Posix error code; see the module file(3) for details\&.
.RE
.LP
.B
join_lines(Lines::[CommentLine]) -> [Comment]
.br
.RS
.TP
Types
CommentLine = {Line, Column, Indent, string()}
.br
Line = integer()
.br
Column = integer()
.br
Indent = integer()
.br
Comment = {Line, Column, Indent, Text}
.br
Text = [string()]
.br
.RE
.RS
.LP
Joins individual comment lines into multi-line comments\&. The input is a list of entries representing individual comment lines, \fIin order of decreasing line-numbers\fR; see scan_lines/1 for details\&. The result is a list of entries representing \fImulti-line\fR comments, \fIstill listed in order of decreasing line-numbers\fR, but where for each entry, \fIText\fR is a list of consecutive comment lines in order of \fIincreasing\fR line-numbers (i\&.e\&., top-down)\&. 
.LP
\fISee also:\fR scan_lines/1\&.
.RE
.LP
.B
scan_lines(Text::string()) -> [CommentLine]
.br
.RS
.TP
Types
CommentLine = {Line, Column, Indent, Text}
.br
Line = integer()
.br
Column = integer()
.br
Indent = integer()
.br
Text = string()
.br
.RE
.RS
.LP
Extracts individual comment lines from a source code string\&. Returns a list of comment lines found in the text, listed in order of \fIdecreasing\fR line-numbers, i\&.e\&., the last comment line in the input is first in the resulting list\&. \fIText\fR is a single string, containing all characters following (but not including) the first comment-introducing \fI%\fR character on the line, up to (but not including) the line-terminating newline\&. For details on \fILine\fR, \fIColumn\fR and \fIIndent\fR, see file/1\&.
.RE
.LP
.B
string() -> term()
.br
.RS
.LP
Extracts comments from a string containing Erlang source code\&. Except for reading directly from a string, the behaviour is the same as for file/1\&. 
.LP
\fISee also:\fR file/1\&.
.RE