diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2022-10-31 18:08:37 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-11-14 14:46:50 +0100 |
commit | 0a2304a04925e43a50a345fb6a0b0c8ba180a973 (patch) | |
tree | 740cad554924d0efe83e69e9d69298d65211bda6 /gcc | |
parent | 442886a99dae94012575bcc1cd3407284da42081 (diff) | |
download | gcc-0a2304a04925e43a50a345fb6a0b0c8ba180a973.zip gcc-0a2304a04925e43a50a345fb6a0b0c8ba180a973.tar.gz gcc-0a2304a04925e43a50a345fb6a0b0c8ba180a973.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/libgnat/s-regpat.adb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/ada/libgnat/s-regpat.adb b/gcc/ada/libgnat/s-regpat.adb index 3290f90..3e9f880 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 |