@@ -70,6 +70,16 @@ column of the comment. `Line` and `Column` are always positive integers, and
7070Evaluation exits with reason ` {read, Reason} ` if a read error occurred, where
7171` Reason ` is an atom corresponding to a Posix error code; see the module
7272[ ` //kernel/file ` ] ( `m:file` ) for details.
73+
74+ ## Examples
75+
76+ ``` erlang
77+ 1 > File = " ./erl_comment_scan_doctest.erl" .
78+ 2 > file :write_file (File , " %% module note\n f() -> ok. % trailing\n " ).
79+ 3 > Comments = erl_comment_scan :file (File ).
80+ [{1 ,1 ,0 ,[" % module note" ]},{2 ,12 ,1 ,[" trailing" ]}]
81+ 4 > file :delete (File ).
82+ ```
7383""" .
7484-spec file (file :filename ()) -> [comment ()].
7585
@@ -121,6 +131,13 @@ Except for reading directly from a string, the behavior is the same
121131as for ` file/1 ` .
122132
123133_ See also: _ ` file/1 ` .
134+
135+ ## Examples
136+
137+ ``` erlang
138+ 1 > erl_comment_scan :string (" %% module note\n f() -> ok. % trailing\n " ).
139+ [{1 ,1 ,0 ,[" % module note" ]},{2 ,12 ,1 ,[" trailing" ]}]
140+ ```
124141""" .
125142-spec string (string ()) -> [comment ()].
126143
@@ -138,6 +155,13 @@ all characters following (but not including) the first
138155comment-introducing ` % ` character on the line, up to (but not
139156including) the line-terminating newline. For details on ` Line ` ,
140157` Column ` and ` Indent ` , see ` file/1 ` .
158+
159+ ## Examples
160+
161+ ``` erlang
162+ 1 > erl_comment_scan :scan_lines (" A = \" not % a comment\" . % real\n % next\n " ).
163+ [{2 ,1 ,0 ," next" },{1 ,24 ,1 ," real" }]
164+ ```
141165""" .
142166-spec scan_lines (string ()) -> [commentLine ()].
143167
@@ -248,6 +272,13 @@ where for each entry, `Text` is a list of consecutive comment lines in
248272order of _ increasing_ line-numbers (that is, top-down).
249273
250274_ See also: _ ` scan_lines/1 ` .
275+
276+ ## Examples
277+
278+ ``` erlang
279+ 1 > erl_comment_scan :join_lines ([{2 ,1 ,0 ," second" },{1 ,1 ,0 ," first" }]).
280+ [{1 ,1 ,0 ,[" first" ," second" ]}]
281+ ```
251282""" .
252283-spec join_lines ([commentLine ()]) -> [comment ()].
253284
0 commit comments