diff options
Diffstat (limited to 'gcc/ada/s-regpat.adb')
-rw-r--r-- | gcc/ada/s-regpat.adb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ada/s-regpat.adb b/gcc/ada/s-regpat.adb index f672b9e..7675f70 100644 --- a/gcc/ada/s-regpat.adb +++ b/gcc/ada/s-regpat.adb @@ -2614,16 +2614,28 @@ package body System.Regpat is exit State_Machine when Input_Pos /= BOL_Pos; when EOL => - exit State_Machine when Input_Pos <= Last_In_Data - and then ((Self.Flags and Multiple_Lines) = 0 - or else Data (Input_Pos) /= ASCII.LF); + -- A combination of MEOL and SEOL + if (Self.Flags and Multiple_Lines) = 0 then + -- single line mode + exit State_Machine when Input_Pos <= Data'Last; + elsif Input_Pos <= Last_In_Data then + exit State_Machine when Data (Input_Pos) /= ASCII.LF; + else + exit State_Machine when Last_In_Data /= Data'Last; + end if; when MEOL => - exit State_Machine when Input_Pos <= Last_In_Data - and then Data (Input_Pos) /= ASCII.LF; + if Input_Pos <= Last_In_Data then + exit State_Machine when Data (Input_Pos) /= ASCII.LF; + else + exit State_Machine when Last_In_Data /= Data'Last; + end if; when SEOL => - exit State_Machine when Input_Pos <= Last_In_Data; + -- If we have a character before Data'Last (even if + -- Last_In_Data stops before then), we can't have + -- the end of the line. + exit State_Machine when Input_Pos <= Data'Last; when BOUND | NBOUND => |