Skip to content

Commit 305a557

Browse files
Add missing epp_dodger compare details
1 parent cd4287f commit 305a557

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/ktn_dodger.erl

Lines changed: 12 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,19 @@ 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(Open ++ [{'{', Anno}, {atom, Anno, ?macro_call}, {',', Anno}, N, {',', AnnoN}], As),
802807
Opt).
803808

804809
macro_atom(atom, A) ->
@@ -895,8 +900,8 @@ fix_form([{atom, _, ?pp_form}, {'(', _}, {')', _}, {'->', _}, {atom, _, define},
895900
case lists:reverse(Ts) of
896901
[{dot, _}, {')', _} | _] ->
897902
{retry, Ts, fun fix_stringyfied_macros/1};
898-
[{dot, L} | Ts1] ->
899-
Ts2 = lists:reverse([{dot, L}, {')', L} | Ts1]),
903+
[{dot, Anno} | Ts1] ->
904+
Ts2 = lists:reverse([{dot, Anno}, {')', Anno} | Ts1]),
900905
{retry, Ts2, fun fix_stringyfied_macros/1};
901906
_ ->
902907
no_fix
@@ -958,7 +963,7 @@ fix_contiguous_strings([{string, L1, S1} = First, {string, L2, S2} = Second | Re
958963
{T1, T2} when is_list(T1), is_list(T2) ->
959964
Separator =
960965
case {erl_anno:location(L1), erl_anno:location(L2)} of
961-
{L, L} ->
966+
{Anno, Anno} ->
962967
$\s;
963968
{_, _} ->
964969
$\n % different lines

0 commit comments

Comments
 (0)