Skip to content

Commit 5446711

Browse files
josevalimggVGc
authored andcommitted
Remove incorrect about incorrect usage of \x in strings
Their usage in Elixir v1.0 was always semantically wrong, which became deprecation warnings in v1.1 to avoid crashes. Any software relying on this feature both emits warnings and invalid strings. Closes elixir-lang#14660.
1 parent 6cf2c1e commit 5446711

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

lib/elixir/src/elixir_interpolation.erl

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -208,36 +208,6 @@ unescape_hex(<<A, B, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
208208
Bytes = list_to_integer([A, B], 16),
209209
unescape_chars(Rest, Map, <<Acc/binary, Bytes>>);
210210

211-
%% TODO: Remove deprecated sequences on v2.0
212-
213-
unescape_hex(<<A, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
214-
io:format(standard_error, "warning: \\xH inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
215-
append_codepoint(Rest, Map, [A], Acc, 16);
216-
217-
unescape_hex(<<${, A, $}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
218-
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
219-
append_codepoint(Rest, Map, [A], Acc, 16);
220-
221-
unescape_hex(<<${, A, B, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
222-
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
223-
append_codepoint(Rest, Map, [A, B], Acc, 16);
224-
225-
unescape_hex(<<${, A, B, C, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
226-
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
227-
append_codepoint(Rest, Map, [A, B, C], Acc, 16);
228-
229-
unescape_hex(<<${, A, B, C, D, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
230-
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
231-
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);
232-
233-
unescape_hex(<<${, A, B, C, D, E, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
234-
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
235-
append_codepoint(Rest, Map, [A, B, C, D, E], Acc, 16);
236-
237-
unescape_hex(<<${, A, B, C, D, E, F, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
238-
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (code point) instead~n", []),
239-
append_codepoint(Rest, Map, [A, B, C, D, E, F], Acc, 16);
240-
241211
unescape_hex(<<_/binary>>, _Map, _Acc) ->
242212
throw({error, "invalid hex escape character, expected \\xHH where H is a hexadecimal digit", "\\x"}).
243213

0 commit comments

Comments
 (0)