@@ -266,11 +266,7 @@ tokenize([$" | T], Line, Column, Scope, Tokens) ->
266266
267267% % TODO: Remove me in Elixir v2.0
268268tokenize ([$' | T ], Line , Column , Scope , Tokens ) ->
269- Message = " single-quoted strings represent charlists. "
270- " Use ~c \"\" if you indeed want a charlist or use \"\" instead.\n "
271- " You may run \" mix format --migrate\" to fix this warning automatically." ,
272- NewScope = prepend_warning (Line , Column , Message , Scope ),
273- handle_strings (T , Line , Column + 1 , $' , NewScope , Tokens );
269+ handle_strings (T , Line , Column + 1 , $' , Scope , Tokens );
274270
275271% Operator atoms
276272
@@ -786,7 +782,11 @@ handle_strings(T, Line, Column, H, Scope, Tokens) ->
786782 " number do not require quotes" ,
787783 [hd (Parts )]
788784 ),
789- prepend_warning (Line , Column , WarnMsg , InterScope );
785+ prepend_warning (Line , Column - 1 , WarnMsg , InterScope );
786+
787+ false when H =:= $' ->
788+ WarnMsg = " single quotes around keywords are deprecated. Use double quotes instead" ,
789+ prepend_warning (Line , Column - 1 , WarnMsg , InterScope );
790790
791791 false ->
792792 InterScope
@@ -814,7 +814,19 @@ handle_strings(T, Line, Column, H, Scope, Tokens) ->
814814 error (Reason , Rest , NewScope , Tokens )
815815 end ;
816816
817- {NewLine , NewColumn , Parts , Rest , NewScope } ->
817+ {NewLine , NewColumn , Parts , Rest , InterScope } ->
818+ NewScope =
819+ case H of
820+ $' ->
821+ Message = " single-quoted strings represent charlists. "
822+ " Use ~c \"\" if you indeed want a charlist or use \"\" instead.\n "
823+ " You may run \" mix format --migrate\" to fix this warning automatically." ,
824+ prepend_warning (Line , Column - 1 , Message , InterScope );
825+
826+ _ ->
827+ InterScope
828+ end ,
829+
818830 case unescape_tokens (Parts , Line , Column , NewScope ) of
819831 {ok , Unescaped } ->
820832 Token = {string_type (H ), {Line , Column - 1 , nil }, Unescaped },
0 commit comments