Skip to content

Commit 6a70150

Browse files
Add missing epp_dodger compare details
1 parent cd4287f commit 6a70150

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/ktn_dodger.erl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ quickscan_macros([{'?', _}, {Type, _, _} = N | [{'(', _} | _] = Ts], [{':', _} |
549549
Ts2;
550550
{_, [{'when', _} | _] = Ts2} ->
551551
Ts2;
552+
{_, [{':', _} | _] = Ts2} ->
553+
Ts2;
552554
_ ->
553555
Ts %% assume macro without arguments
554556
end,
@@ -789,16 +791,21 @@ macro_call([{'(', _}, {')', _}], Anno, {_, AnnoN, _} = N, Rest, As, Opt) ->
789791
Rest,
790792
lists:reverse(
791793
Open ++
792-
[{atom, Anno, ?macro_call}, {'(', Anno}, N, {')', AnnoN}] ++
794+
[{'{', Anno}, {atom, Anno, ?macro_call}, {',', Anno}, N, {'}', AnnoN}] ++
793795
Close,
794796
As),
795797
Opt);
796-
macro_call([{'(', _} | Args], L, {_, Ln, _} = N, Rest, As, Opt) ->
798+
macro_call([{'(', _} | Args], Anno, {_, AnnoN, _} = N, Rest, As, Opt) ->
797799
{Open, Close} = parentheses(As),
800+
%% drop closing parenthesis
801+
{')', _} = lists:last(Args), %% assert
802+
Args1 = lists:droplast(Args),
798803
%% note that we must scan the argument list; it may not be skipped
799-
do_scan_macros(Args ++ Close,
804+
do_scan_macros(Args1 ++ [{'}', AnnoN} | Close],
800805
Rest,
801-
lists:reverse(Open ++ [{atom, L, ?macro_call}, {'(', L}, N, {',', Ln}], As),
806+
lists:reverse(
807+
Open ++
808+
[{'{', Anno}, {atom, Anno, ?macro_call}, {',', Anno}, N, {',', AnnoN}], As),
802809
Opt).
803810

804811
macro_atom(atom, A) ->
@@ -895,8 +902,8 @@ fix_form([{atom, _, ?pp_form}, {'(', _}, {')', _}, {'->', _}, {atom, _, define},
895902
case lists:reverse(Ts) of
896903
[{dot, _}, {')', _} | _] ->
897904
{retry, Ts, fun fix_stringyfied_macros/1};
898-
[{dot, L} | Ts1] ->
899-
Ts2 = lists:reverse([{dot, L}, {')', L} | Ts1]),
905+
[{dot, Anno} | Ts1] ->
906+
Ts2 = lists:reverse([{dot, Anno}, {')', Anno} | Ts1]),
900907
{retry, Ts2, fun fix_stringyfied_macros/1};
901908
_ ->
902909
no_fix
@@ -958,7 +965,7 @@ fix_contiguous_strings([{string, L1, S1} = First, {string, L2, S2} = Second | Re
958965
{T1, T2} when is_list(T1), is_list(T2) ->
959966
Separator =
960967
case {erl_anno:location(L1), erl_anno:location(L2)} of
961-
{L, L} ->
968+
{Anno, Anno} ->
962969
$\s;
963970
{_, _} ->
964971
$\n % different lines

0 commit comments

Comments
 (0)