File 5021-Allow-unicode-in-triple-quoted-strings.patch of Package erlang
From 75c213008100cb9e6bda6bedeba17eff76918699 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Mon, 11 Sep 2023 17:03:48 +0200
Subject: [PATCH] Allow unicode in triple-quoted strings
---
lib/stdlib/src/erl_scan.erl | 2 +-
lib/stdlib/test/erl_scan_SUITE.erl | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/stdlib/src/erl_scan.erl b/lib/stdlib/src/erl_scan.erl
index ff7107d948..bd022666a1 100644
--- a/lib/stdlib/src/erl_scan.erl
+++ b/lib/stdlib/src/erl_scan.erl
@@ -930,7 +930,7 @@ scan_tqstring_line(Cs, St, Line, Col, Toks, Qs, Tqs, Acc) ->
Ncs, St, Line, Ncol, Toks,
0, Tqs, Nacc)
end;
- ?UNI255(C) ->
+ ?UNICODE(C) ->
scan_tqstring_line(
Ncs, St, Line, Ncol, Toks,
0, Tqs, Nacc); % Stop searching for end quote chars
diff --git a/lib/stdlib/test/erl_scan_SUITE.erl b/lib/stdlib/test/erl_scan_SUITE.erl
index 5da9c4e159..3a9c90195d 100644
--- a/lib/stdlib/test/erl_scan_SUITE.erl
+++ b/lib/stdlib/test/erl_scan_SUITE.erl
@@ -1505,6 +1505,18 @@ triple_quoted_string(Config) when is_list(Config) ->
"\"\"\"\"", % A string starts at the last char but never ends
{1,1}, []),
+ {ok,[{string,1,[16#D000]}],3} =
+ erl_scan:string(
+ [$",$",$",$\n,
+ 16#D000,$\n, % Unicode character
+ $",$",$"]),
+
+ {error,{2,erl_scan,{illegal,character}},2} =
+ erl_scan:string(
+ [$",$",$",$\n,
+ 16#FFFF,$\n, % Out of Unicode range
+ $",$",$"]),
+
%% Test the real deal in this source code
""""
```erlang
--
2.35.3