Skip to content

Commit

Permalink
Tweak erl_scan:token_info/2: deprecated warnings for OTP >= 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
drobakowski committed Aug 24, 2015
1 parent ce89693 commit 6e6c66c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/aleppo.erl
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ stringify_tokens(TokenList) ->
stringify_tokens1([], Acc) ->
lists:concat(lists:reverse(Acc));
stringify_tokens1([Token|Rest], []) ->
{symbol, Symbol} = erl_scan:token_info(Token, symbol),
Symbol = get_symbol(Token),
stringify_tokens1(Rest, [Symbol]);
stringify_tokens1([Token|Rest], Acc) ->
{symbol, Symbol} = erl_scan:token_info(Token, symbol),
Symbol = get_symbol(Token),
stringify_tokens1(Rest, [Symbol, " "|Acc]).

insert_comma_tokens(Args, Loc) ->
Expand Down Expand Up @@ -417,6 +417,10 @@ location(Attrs) ->
-ifdef(pre18).
location_helper(Attrs) ->
legacy_location(Attrs).

get_symbol(Token) ->
{symbol, Symbol} = erl_scan:token_info(Token, symbol),
Symbol.
-else.
location_helper(Attrs) ->
case erl_anno:is_anno(Attrs) of
Expand All @@ -425,6 +429,9 @@ location_helper(Attrs) ->
false ->
legacy_location(Attrs)
end.

get_symbol(Token) ->
erl_scan:symbol(Token).
-endif.

legacy_location(Attrs) when is_list(Attrs) ->
Expand Down

0 comments on commit 6e6c66c

Please sign in to comment.