Skip to content

Commit ceb6861

Browse files
Merge pull request #92 from paulo-ferraz-oliveira/fix/post-otp28-support
fix: Add missing `epp_dodger` compare details
2 parents 6b56f8e + f7838ed commit ceb6861

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/ktn_dodger.erl

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ quickscan_macros([{'?', _}, {Type, _, _} = N | [{'(', _} | _] = Ts], [{':', _} |
539539
Ts2;
540540
{_, [{'when', _} | _] = Ts2} ->
541541
Ts2;
542+
{_, [{':', _} | _] = Ts2} ->
543+
Ts2;
542544
_ ->
543545
Ts %% assume macro without arguments
544546
end,
@@ -661,13 +663,8 @@ default_prefix(#opt{parse_macro_definitions = false, compact_strings = true}) ->
661663
end.
662664

663665
scan_form([{'-', _Anno}, {atom, AnnoA, define} | Ts], #opt{parse_macro_definitions = false}) ->
664-
[
665-
{atom, AnnoA, ?pp_form},
666-
{'(', AnnoA},
667-
{')', AnnoA},
668-
{'->', AnnoA},
669-
{atom, AnnoA, define}
670-
| Ts];
666+
[{atom, AnnoA, ?pp_form}, {'(', AnnoA}, {')', AnnoA}, {'->', AnnoA}, {atom, AnnoA, define}
667+
| Ts];
671668
scan_form([{'-', _Anno}, {atom, AnnoA, define} | Ts], Opt) ->
672669
[{atom, AnnoA, ?pp_form}, {'(', AnnoA}, {')', AnnoA}, {'->', AnnoA}, {atom, AnnoA, define}
673670
| scan_macros(Ts, Opt)];
@@ -780,23 +777,28 @@ macro_call([{'(', _}, {')', _}], Anno, {_, AnnoN, _} = N, Rest, As, Opt) ->
780777
{Open, Close} = parentheses(As),
781778
do_scan_macros([],
782779
Rest,
780+
%% {'?macro_call', N }
783781
lists:reverse(
784782
Open ++
785-
[{atom, Anno, ?macro_call}, {'(', Anno}, N, {')', AnnoN}] ++
783+
[{'{', Anno}, {atom, Anno, ?macro_call}, {',', Anno}, N, {'}', AnnoN}] ++
786784
Close,
787785
As),
788786
Opt);
789-
macro_call([{'(', _} | Args], L, {_, Ln, _} = N, Rest, As, Opt) ->
787+
macro_call([{'(', _} | Args], Anno, {_, AnnoN, _} = N, Rest, As, Opt) ->
790788
{Open, Close} = parentheses(As),
791789
%% drop closing parenthesis
792790

793791
%% assert
794792
{')', _} = lists:last(Args),
795793
Args1 = lists:droplast(Args),
796794
%% note that we must scan the argument list; it may not be skipped
797-
do_scan_macros(Args1 ++ [{'}', Ln} | Close],
795+
do_scan_macros(Args1 ++ [{'}', AnnoN} | Close],
798796
Rest,
799-
lists:reverse(Open ++ [{atom, L, ?macro_call}, {'(', L}, N, {',', Ln}], As),
797+
%% {'?macro_call', N, Arg1, ... }
798+
lists:reverse(
799+
Open ++
800+
[{'{', Anno}, {atom, Anno, ?macro_call}, {',', Anno}, N, {',', AnnoN}],
801+
As),
800802
Opt).
801803

802804
macro_atom(atom, A) ->
@@ -911,8 +913,8 @@ fix_form([{atom, _, ?pp_form}, {'(', _}, {')', _}, {'->', _}, {atom, _, define},
911913
case lists:reverse(Ts) of
912914
[{dot, _}, {')', _} | _] ->
913915
{retry, Ts, fun fix_stringyfied_macros/1};
914-
[{dot, L} | Ts1] ->
915-
Ts2 = lists:reverse([{dot, L}, {')', L} | Ts1]),
916+
[{dot, Anno} | Ts1] ->
917+
Ts2 = lists:reverse([{dot, Anno}, {')', Anno} | Ts1]),
916918
{retry, Ts2, fun fix_stringyfied_macros/1};
917919
_ ->
918920
no_fix
@@ -974,7 +976,7 @@ fix_contiguous_strings([{string, L1, S1} = First, {string, L2, S2} = Second | Re
974976
{T1, T2} when is_list(T1), is_list(T2) ->
975977
Separator =
976978
case {erl_anno:location(L1), erl_anno:location(L2)} of
977-
{L, L} ->
979+
{Anno, Anno} ->
978980
$\s;
979981
{_, _} ->
980982
$\n % different lines

0 commit comments

Comments
 (0)