erl_comment_scan(3erl)
πΈ NAME πΈ
okay bestie, welcome to erl_comment_scan(3erl) β this is the Erlang module definition for erl_comment_scan, aka functions for reading comment lines from Erlang source code. Lowkey iconic. π
β¨ DESCRIPTION β¨
Functions for reading comment lines from Erlang source code. Thatβs the whole vibe check β itβs giving βcomment scanner main character energy.β π
π¦ DATA TYPES π¦
hereβs the exact data-type tea, no cap:
comment() = {Line::integer(), Column::integer(),
Indentation::integer(), Text::[string()]}:
commentLine() = {Line::integer(), Column::integer(),
Indent::integer(), Text::string()}:
π EXPORTS π
file(Name::file:filename()) -> [comment()]
bestie, this one extracts comments from an Erlang source code file. You get a list of entries representing multi-line comments, listed in order of increasing line-numbers. For each entry, Text is a list of strings representing the consecutive comment lines in top-down order; the strings contain all characters following (but not including) the first comment-introducing % character on the line, up to (but not including) the line-terminating newline.
Furthermore, Line is the line number and Column the left column of the comment (i.e., the column of the comment-introducing % character). Indent 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. Line and Column are always positive integers, and Indentation is a nonnegative integer.
π¨ warning-ish tea: evaluation exits with reason{read, Reason}if a read error occurred, whereReasonis an atom corresponding to a Posix error code; see the modulefile(3erl)for details.
join_lines(Lines::[commentLine()]) -> [comment()]
joins individual comment lines into multi-line comments. The input is a list of entries representing individual comment lines, in order of decreasing line-numbers; see scan_lines/1 for details. The result is a list of entries representing multi-line comments, still listed in order of decreasing line-numbers, but where for each entry, Text is a list of consecutive comment lines in order of increasing line-numbers (i.e., top-down). Obsessed with the flip-flop. π₯
See also: scan_lines/1.
scan_lines(Text::string()) -> [commentLine()]
extracts individual comment lines from a source code string. Returns a list of comment lines found in the text, listed in order of decreasing line-numbers, i.e., the last comment line in the input is first in the resulting list. Text is a single string, containing all characters following (but not including) the first comment-introducing % character on the line, up to (but not including) the line-terminating newline. For details on Line, Column and Indent, see file/1. Slay. β¨
string(Text::string()) -> [comment()]
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. Fr fr, itβs the string twin. π«Ά
See also: file/1.
π AUTHORS π
Richard Carlsson <carlsson.richard@gmail.com>
okay thatβs the whole page, bestie β source/version stamp is syntax_tools 3.0.1, and the original footer didnβt give us a date, so thatβs the footer tea: no date, periodt. π
π
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms