From b366554ee70509836d7550107163e14aed66c83f Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Sun, 14 Feb 2010 07:22:10 +0100 Subject: syntax_tools: Remove $Id$ annotations --- lib/syntax_tools/src/erl_comment_scan.erl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/syntax_tools/src/erl_comment_scan.erl') diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl index df1449da4e..22d6777570 100644 --- a/lib/syntax_tools/src/erl_comment_scan.erl +++ b/lib/syntax_tools/src/erl_comment_scan.erl @@ -14,8 +14,7 @@ %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 %% USA %% -%% $Id$ -%% +%% ===================================================================== %% @copyright 1997-2006 Richard Carlsson %% @author Richard Carlsson %% @end -- cgit v1.2.3 From 8b7dd064e2d44b600f05a9135aac08a539a19ffa Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Sun, 14 Feb 2010 07:32:29 +0100 Subject: syntax_tools: Add types and specs for most exported functions While at it, consistently replace "bool()" with "boolean()" in the Edoc specs. --- lib/syntax_tools/src/erl_comment_scan.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/syntax_tools/src/erl_comment_scan.erl') diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl index 22d6777570..09ce21a428 100644 --- a/lib/syntax_tools/src/erl_comment_scan.erl +++ b/lib/syntax_tools/src/erl_comment_scan.erl @@ -27,6 +27,11 @@ -export([file/1, join_lines/1, scan_lines/1, string/1]). +%% ===================================================================== + +-type comment() :: {integer(), integer(), integer(), [string()]}. +-type commentLine() :: {integer(), integer(), integer(), string()}. + %% ===================================================================== %% @spec file(FileName::file:filename()) -> [Comment] %% @@ -58,6 +63,8 @@ %% error occurred, where `Reason' is an atom corresponding to %% a Posix error code; see the module {@link //kernel/file} for details. +-spec file(file:filename()) -> [comment()]. + file(Name) -> Name1 = filename(Name), case catch {ok, file:read_file(Name1)} of @@ -79,7 +86,7 @@ file(Name) -> %% ===================================================================== -%% string(string()) -> [Comment] +%% @spec string(string()) -> [Comment] %% %% Comment = {Line, Column, Indentation, Text} %% Line = integer() @@ -93,6 +100,8 @@ file(Name) -> %% %% @see file/1 +-spec string(string()) -> [comment()]. + string(Text) -> lists:reverse(join_lines(scan_lines(Text))). @@ -115,6 +124,8 @@ string(Text) -> %% to (but not including) the line-terminating newline. For details on %% `Line', `Column' and `Indent', see {@link file/1}. +-spec scan_lines(string()) -> [commentLine()]. + scan_lines(Text) -> scan_lines(Text, 1, 0, 0, []). @@ -230,6 +241,8 @@ scan_char([], _L, _Col, Ack) -> %% %% @see scan_lines/1 +-spec join_lines([commentLine()]) -> [comment()]. + join_lines([{L, Col, Ind, Txt} | Lines]) -> join_lines(Lines, [Txt], L, Col, Ind); join_lines([]) -> -- cgit v1.2.3