Skip to content

Commit

Permalink
Shorten code by list comprehension
Browse files Browse the repository at this point in the history
Summary: Ported from: erlang/otp@776dfc5

Reviewed By: alanz

Differential Revision: D57856381

fbshipit-source-id: 4af73e846248578c8f2deadd4cd3be86ecb83c21
  • Loading branch information
robertoaloi authored and facebook-github-bot committed Jun 26, 2024
1 parent aa86a80 commit 2e4fe37
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions erlang_service/src/elp_epp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,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 elp_parse:parse_form(Toks) of
{ok, Form} ->
[Form|Warnings] ++ parse_file(Epp);
Expand All @@ -387,17 +390,6 @@ parse_file_problem(Epp, Problem, Warnings) ->
[{eof,{Offset, Offset}}|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 2e4fe37

Please sign in to comment.