File 5013-Delay-generation-of-text-annotation.patch of Package erlang

From 35a68dcd66f45d0ffc60aa05b7b5682c1cd890fa Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Wed, 28 Jun 2023 16:35:49 +0200
Subject: [PATCH 3/8] Delay generation of text annotation

---
 lib/stdlib/src/erl_scan.erl | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/lib/stdlib/src/erl_scan.erl b/lib/stdlib/src/erl_scan.erl
index 91e4d09ea9..4ac59478a9 100644
--- a/lib/stdlib/src/erl_scan.erl
+++ b/lib/stdlib/src/erl_scan.erl
@@ -650,9 +650,19 @@ scan_name(Cs, Ncs) ->
     {lists:reverse(Ncs),Cs}.
 
 -define(STR(Cl, St, S),
-        case (St#erl_scan.has_fun)
-            andalso (St#erl_scan.text_fun)(Cl, S) of
-            true -> S;
+        case ((St)#erl_scan.has_fun)
+            andalso ((St)#erl_scan.text_fun)((Cl), begin S end) of
+            true  -> begin S end;
+            false -> []
+        end).
+-define(STR(Cl, St, Tmp, S),
+        case ((St)#erl_scan.has_fun) of
+            true ->
+                Tmp = begin S end,
+                case ((St)#erl_scan.text_fun)((Cl), Tmp) of
+                    true ->  Tmp;
+                    false -> []
+                end;
             false -> []
         end).
 
@@ -956,11 +966,15 @@ scan_tqstring_finish(Cs, St, Line, Col, Toks, Tqs, IndentR) ->
     of
         Content when is_list(Content) ->
             Qs = Tqs#tqs.qs,
-            Chars =
-                lists_duplicate(
-                  Qs, $",%"
-                  tqstring_chars_r(ContentR, lists:duplicate(Qs, $"))),%"
-            Anno = anno(Line0, Col0, St, ?STR(string, St, Chars)),
+            Anno =
+                anno(
+                  Line0, Col0, St,
+                  ?STR(
+                     string, St, Chars,
+                     lists_duplicate(
+                       Qs, $",%"
+                       tqstring_chars_r(
+                         ContentR, lists:duplicate(Qs, $"))))),%"
             scan1(Cs, St, Line, Col, [{string,Anno,Content}|Toks]);
         {Tag=indentation, ErrorLine, ErrorCol} ->
             scan_error(
-- 
2.35.3

openSUSE Build Service is sponsored by