From 776dfc53ca76e3bc698ec60a950fe5a42a4c6adb Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Mon, 28 Aug 2023 14:57:26 +0200 Subject: [PATCH] Shorten code by list comprehension --- lib/stdlib/src/epp.erl | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl index d570e1d628b8..55f328ea1cf8 100644 --- a/lib/stdlib/src/epp.erl +++ b/lib/stdlib/src/epp.erl @@ -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); @@ -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() ->