.TH erl_comment_scan 3erl "syntax_tools 3.1" "" "Erlang Module Definition" .SH NAME 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 "DATA TYPES" .RS 2 .TP 2 .B comment() = {Line::integer(), Column::integer(), Indentation::integer(), Text::[string()]}: .TP 2 .B commentLine() = {Line::integer(), Column::integer(), Indent::integer(), Text::string()}: .RE .SH EXPORTS .LP .B file(Name::file:filename()) -> [comment()] .br .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(3erl) for details\&. .RE .LP .B join_lines(Lines::[commentLine()]) -> [comment()] .br .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 .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(Text::string()) -> [comment()] .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 .SH AUTHORS .LP Richard Carlsson .I