.TH erl_comment_scan 3erl "syntax_tools 1.6.8" "" "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 \fIcomment() = {integer(), integer(), integer(), [string()]}\fR\&: .RE .SH EXPORTS .LP .B file(FileName::filename() (see module file)) -> [Comment] .br .RS .LP Types: .RS 3 Comment = {Line, Column, Indentation, Text} .br Line = integer() .br Column = integer() .br Indentation = integer() .br Text = [string()] .br .RE .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 \fBfile(3erl)\fR\& for details\&. .RE .LP .B join_lines(Lines::[CommentLine]) -> [Comment] .br .RS .LP Types: .RS 3 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 .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 \fBscan_lines/1\fR\& 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\& \fBscan_lines/1\fR\&\&. .RE .LP .B scan_lines(Text::string()) -> [CommentLine] .br .RS .LP Types: .RS 3 CommentLine = {Line, Column, Indent, Text} .br Line = integer() .br Column = integer() .br Indent = integer() .br Text = string() .br .RE .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 \fBfile/1\fR\&\&. .RE .LP .B string(Text::string()) -> [Comment] .br .RS .LP Types: .RS 3 Comment = {Line, Column, Indentation, Text} .br Line = integer() .br Column = integer() .br Indentation = integer() .br Text = [string()] .br .RE .RE .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 \fBfile/1\fR\&\&. .LP \fISee also:\fR\& \fBfile/1\fR\&\&. .RE .SH AUTHORS .LP Richard Carlsson .I