diff options
Diffstat (limited to 'lib/syntax_tools/src')
-rw-r--r-- | lib/syntax_tools/src/erl_comment_scan.erl | 5 | ||||
-rw-r--r-- | lib/syntax_tools/src/erl_prettypr.erl | 6 | ||||
-rw-r--r-- | lib/syntax_tools/src/erl_recomment.erl | 9 | ||||
-rw-r--r-- | lib/syntax_tools/src/erl_syntax.erl | 1 | ||||
-rw-r--r-- | lib/syntax_tools/src/erl_syntax_lib.erl | 7 | ||||
-rw-r--r-- | lib/syntax_tools/src/igor.erl | 22 | ||||
-rw-r--r-- | lib/syntax_tools/src/prettypr.erl | 2 |
7 files changed, 22 insertions, 30 deletions
diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl index 09ce21a428..108ab3bffd 100644 --- a/lib/syntax_tools/src/erl_comment_scan.erl +++ b/lib/syntax_tools/src/erl_comment_scan.erl @@ -26,6 +26,7 @@ -export([file/1, join_lines/1, scan_lines/1, string/1]). +-export_type([comment/0]). %% ===================================================================== @@ -273,12 +274,8 @@ join_lines([], Txt, L, Col, Ind) -> filename([C|T]) when is_integer(C), C > 0, C =< 255 -> [C | filename(T)]; -filename([H|T]) -> - filename(H) ++ filename(T); filename([]) -> []; -filename(N) when is_atom(N) -> - atom_to_list(N); filename(N) -> report_error("bad filename: `~P'.", [N, 25]), exit(error). diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl index 606441bcf1..c2c72d1ed2 100644 --- a/lib/syntax_tools/src/erl_prettypr.erl +++ b/lib/syntax_tools/src/erl_prettypr.erl @@ -384,7 +384,7 @@ lay_postcomments(Cs, D) -> beside(D, floating(break(stack_comments(Cs, true)), 1, 0)). %% Format (including padding, if `Pad' is `true', otherwise not) -%% and stack the listed comments above each other, +%% and stack the listed comments above each other. stack_comments([C | Cs], Pad) -> D = stack_comment_lines(erl_syntax:comment_text(C)), @@ -405,9 +405,7 @@ stack_comments([C | Cs], Pad) -> D1; % done _ -> above(D1, stack_comments(Cs, Pad)) - end; -stack_comments([], _) -> - empty(). + end. %% Stack lines of text above each other and prefix each string in %% the list with a single `%' character. diff --git a/lib/syntax_tools/src/erl_recomment.erl b/lib/syntax_tools/src/erl_recomment.erl index 145bbc6f37..94e760dad7 100644 --- a/lib/syntax_tools/src/erl_recomment.erl +++ b/lib/syntax_tools/src/erl_recomment.erl @@ -486,7 +486,7 @@ build_tree(Node) -> %% Include L, while preserving Min =< Max. tree_node(minpos(L, Min), - max(L, Max), + erlang:max(L, Max), erl_syntax:type(Node), erl_syntax:get_attrs(Node), Subtrees) @@ -507,7 +507,7 @@ build_list(Ts) -> build_list([T | Ts], Min, Max, Ack) -> Node = build_tree(T), Min1 = minpos(node_min(Node), Min), - Max1 = max(node_max(Node), Max), + Max1 = erlang:max(node_max(Node), Max), build_list(Ts, Min1, Max1, [Node | Ack]); build_list([], Min, Max, Ack) -> list_node(Min, Max, lists:reverse(Ack)). @@ -518,7 +518,7 @@ build_list_list(Ls) -> build_list_list([L | Ls], Min, Max, Ack) -> Node = build_list(L), Min1 = minpos(node_min(Node), Min), - Max1 = max(node_max(Node), Max), + Max1 = erlang:max(node_max(Node), Max), build_list_list(Ls, Min1, Max1, [Node | Ack]); build_list_list([], Min, Max, Ack) -> {lists:reverse(Ack), Min, Max}. @@ -723,9 +723,6 @@ tree_node_attrs(#tree{attrs = Attrs}) -> %% Just the generic "maximum" function -max(X, Y) when X > Y -> X; -max(_, Y) -> Y. - %% Return the least positive integer of X and Y, or zero if none of them %% are positive. (This is necessary for computing minimum source line %% numbers, since zero (or negative) numbers may occur, but they diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index 9a2967d550..a40bf83c5a 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -309,6 +309,7 @@ data/1, is_tree/1]). +-export_type([forms/0, syntaxTree/0, syntaxTreeAttributes/0]). %% ===================================================================== %% IMPLEMENTATION NOTES: diff --git a/lib/syntax_tools/src/erl_syntax_lib.erl b/lib/syntax_tools/src/erl_syntax_lib.erl index 5c4e074488..4808971a59 100644 --- a/lib/syntax_tools/src/erl_syntax_lib.erl +++ b/lib/syntax_tools/src/erl_syntax_lib.erl @@ -46,6 +46,8 @@ new_variable_names/2, new_variable_names/3, strip_comments/1, to_comment/1, to_comment/2, to_comment/3, variables/1]). +-export_type([info_pair/0]). + %% ===================================================================== -type ordset(X) :: [X]. % XXX: TAKE ME OUT @@ -400,10 +402,7 @@ new_variable_name(N, R, _T, F, S) -> %% implementation of `sets'. start_range(S) -> - max(sets:size(S) * ?START_RANGE_FACTOR, ?MINIMUM_RANGE). - -max(X, Y) when X > Y -> X; -max(_, Y) -> Y. + erlang:max(sets:size(S) * ?START_RANGE_FACTOR, ?MINIMUM_RANGE). %% The previous number might or might not be used to compute the %% next number to be tried. It is currently not used. diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl index e92e9593b6..702b399615 100644 --- a/lib/syntax_tools/src/igor.erl +++ b/lib/syntax_tools/src/igor.erl @@ -699,7 +699,7 @@ merge_files(Name, Trees, Files, Opts) -> options :: [option()] }). --spec merge_sources(atom(), erl_syntax:forms(), [option()]) -> +-spec merge_sources(atom(), [erl_syntax:forms()], [option()]) -> {erl_syntax:syntaxTree(), [stubDescriptor()]}. merge_sources(Name, Sources, Opts) -> @@ -782,12 +782,12 @@ merge_sources_1(Name, Modules, Trees, Opts) -> %% however not "safe" by default. If no modules are explicitly %% specified as static, it is assumed that *all* are static. Static0 = ordsets:from_list(proplists:append_values(static, Opts)), - case proplists:is_defined(static, Opts) of - false -> - Static = All; - true -> - Static = ordsets:add_element(Name, Static0) - end, + Static = case proplists:is_defined(static, Opts) of + false -> + All; + true -> + ordsets:add_element(Name, Static0) + end, check_module_names(Static, All, "declared 'static'"), verbose("static modules: ~p.", [Static], Opts), @@ -806,8 +806,8 @@ merge_sources_1(Name, Modules, Trees, Opts) -> verbose("safe modules: ~p.", [Safe], Opts), Preserved = (ordsets:is_element(Name, Sources) - and ordsets:is_element(Name, Export)) - or proplists:get_bool(no_banner, Opts), + andalso ordsets:is_element(Name, Export)) + orelse proplists:get_bool(no_banner, Opts), NoHeaders = proplists:get_bool(no_headers, Opts), Notes = proplists:get_value(notes, Opts, always), Rs = proplists:append_values(redirect, Opts), @@ -2924,9 +2924,7 @@ make_attribute({Name, Term}) -> [erl_syntax:abstract(Term)]). is_auto_import({F, A}) -> - erl_internal:bif(F, A); -is_auto_import(_) -> - false. + erl_internal:bif(F, A). timestamp() -> {{Yr, Mth, Dy}, {Hr, Mt, Sc}} = erlang:localtime(), diff --git a/lib/syntax_tools/src/prettypr.erl b/lib/syntax_tools/src/prettypr.erl index 1868f63e54..c13fa30998 100644 --- a/lib/syntax_tools/src/prettypr.erl +++ b/lib/syntax_tools/src/prettypr.erl @@ -48,6 +48,8 @@ nest/2, par/1, par/2, sep/1, text/1, null_text/1, text_par/1, text_par/2]). +-export_type([document/0]). + %% --------------------------------------------------------------------- -type deep_string() :: [char() | deep_string()]. |