We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ebb7c73 commit 8011552Copy full SHA for 8011552
3 files changed
lib/elixir/src/elixir_interpolation.erl
@@ -80,17 +80,8 @@ extract([$\\ | Rest], Buffer, Output, Line, Column, Scope, Interpol, Last) ->
80
81
%% Catch all clause
82
83
-extract([Char | _Rest], _Buffer, _Output, Line, Column, _Scope, _Interpol, _Last)
84
- when ?break(Char) ->
85
- Token = io_lib:format("\\u~4.16.0B", [Char]),
86
- Pos = io_lib:format(". If you want to use such character, use it in its escaped ~ts form instead", [Token]),
87
- {error, {?LOC(Line, Column),
88
- {"invalid line break character in string: ",
89
- Pos},
90
- Token}};
91
-
92
extract([Char1, Char2 | Rest], Buffer, Output, Line, Column, Scope, Interpol, Last)
93
- when Char1 =< 255, Char2 =< 255 ->
+ when Char1 =< 255, Char2 =< 255, not (?break(Char1)) ->
94
extract([Char2 | Rest], [Char1 | Buffer], Output, Line, Column + 1, Scope, Interpol, Last);
95
96
extract(Rest, Buffer, Output, Line, Column, Scope, Interpol, Last) ->
lib/elixir/src/elixir_tokenizer.hrl
@@ -24,20 +24,20 @@
24
25
%% Bidirectional control
26
%% Retrieved from https://trojansource.codes/trojan-source.pdf
27
--define(bidi(C), C =:= 16#202A;
28
- C =:= 16#202B;
29
- C =:= 16#202D;
30
- C =:= 16#202E;
31
- C =:= 16#2066;
32
- C =:= 16#2067;
33
- C =:= 16#2068;
34
- C =:= 16#202C;
+-define(bidi(C), C =:= 16#202A orelse
+ C =:= 16#202B orelse
+ C =:= 16#202D orelse
+ C =:= 16#202E orelse
+ C =:= 16#2066 orelse
+ C =:= 16#2067 orelse
+ C =:= 16#2068 orelse
+ C =:= 16#202C orelse
35
C =:= 16#2069).
36
37
%% Unsupported newlines
38
%% https://www.unicode.org/reports/tr55/
39
--define(break(C), C =:= 16#000B;
40
- C =:= 16#000C;
41
- C =:= 16#0085;
42
- C =:= 16#2028;
+-define(break(C), C =:= 16#000B orelse
+ C =:= 16#000C orelse
+ C =:= 16#0085 orelse
+ C =:= 16#2028 orelse
43
C =:= 16#2029).
lib/elixir/test/elixir/kernel/parser_test.exs
@@ -1137,23 +1137,15 @@ defmodule Kernel.ParserTest do
1137
"nofile:1:12:",
1138
"invalid line break character in string: \\u000B. If you want to use such character, use it in its escaped \\u000B form instead"
1139
],
1140
- :erlang.list_to_binary([34] ++ ~c"this is a " ++ [11, 34])
+ [34] ++ ~c"this is a " ++ [11, 34]
1141
)
1142
1143
assert_syntax_error(
1144
[
1145
1146
"invalid line break character in string: \\u000C. If you want to use such character, use it in its escaped \\u000C form instead"
1147
1148
- :erlang.list_to_binary([34] ++ ~c"this is a " ++ [12, 34])
1149
- )
1150
1151
- assert_syntax_error(
1152
- [
1153
- "nofile:1:12:",
1154
- "invalid line break character in string: \\u0085. If you want to use such character, use it in its escaped \\u0085 form instead"
1155
- ],
1156
- <<34, "this is a ", 194, 133, 34>>
+ [34] ++ ~c"this is a " ++ [12, 34]
1157
1158
end
1159
0 commit comments