public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4012] ada: Fix non-capturing parentheses handling
@ 2022-11-14 13:51 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2022-11-14 13:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0a2304a04925e43a50a345fb6a0b0c8ba180a973

commit r13-4012-g0a2304a04925e43a50a345fb6a0b0c8ba180a973
Author: Ronan Desplanques <desplanques@adacore.com>
Date:   Mon Oct 31 18:08:37 2022 +0100

    ada: Fix non-capturing parentheses handling
    
    Before this patch, non-capturingly parenthesized expressions with more
    than one branch were processed incorrectly when part of a branch
    followed by another branch. This patch fixes this by aligning the
    handling of non-capturing parentheses with the handling of regular
    parentheses.
    
    gcc/ada/
    
            * libgnat/s-regpat.adb
            (Parse): Fix handling of non-capturing parentheses.

Diff:
---
 gcc/ada/libgnat/s-regpat.adb | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/libgnat/s-regpat.adb b/gcc/ada/libgnat/s-regpat.adb
index 3290f900544..3e9f880cd4e 100644
--- a/gcc/ada/libgnat/s-regpat.adb
+++ b/gcc/ada/libgnat/s-regpat.adb
@@ -920,18 +920,16 @@ package body System.Regpat is
             if Capturing then
                Ender := Emit_Node (CLOSE);
                Emit (Character'Val (Par_No));
-               Link_Tail (IP, Ender);
-
             else
-               --  Need to keep looking after the closing parenthesis
-               Ender := Emit_Ptr;
+               Ender := Emit_Node (NOTHING);
             end if;
 
          else
             Ender := Emit_Node (EOP);
-            Link_Tail (IP, Ender);
          end if;
 
+         Link_Tail (IP, Ender);
+
          if Have_Branch and then Emit_Ptr <= PM.Size + 1 then
 
             --  Hook the tails of the branches to the closing node

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-14 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 13:51 [gcc r13-4012] ada: Fix non-capturing parentheses handling Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).