Skip to content

Commit

Permalink
Shorten code by list comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
RaimoNiskanen committed Aug 28, 2023
1 parent f3e5273 commit 776dfc5
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/stdlib/src/epp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,10 @@ parse_file(Epp) ->
%% added search for tokens to warn for
case epp_request(Epp, scan_erl_form) of
{ok,Toks} ->
Warnings = parse_file_warnings(Toks),
Warnings =
[{warning, {erl_anno:location(Anno),?MODULE,tqstring}}
%% Warn about using 3 or more double qoutes
|| {tqstring,Anno,_} <- Toks],
case erl_parse:parse_form(Toks) of
{ok, Form} ->
[Form|Warnings] ++ parse_file(Epp);
Expand All @@ -372,17 +375,6 @@ parse_file_problem(Epp, Problem, Warnings) ->
[{eof,Location}|Warnings]
end.

parse_file_warnings(Toks) ->
parse_file_warnings(Toks, []).
%%
parse_file_warnings([], Acc) -> Acc;
parse_file_warnings([{tqstring,Anno,_}|Toks], Acc) ->
%% Warn about using 3 or more double qoutes
Winfo = {erl_anno:location(Anno),?MODULE,tqstring},
parse_file_warnings(Toks, [{warning,Winfo}|Acc]);
parse_file_warnings([_|Toks], Acc) ->
parse_file_warnings(Toks, Acc).

-spec default_encoding() -> source_encoding().

default_encoding() ->
Expand Down

0 comments on commit 776dfc5

Please sign in to comment.