Commit 0b33adf1 by Arnaud Charlet

[multiple changes]

2010-06-21  Emmanuel Briot  <briot@adacore.com>

	* s-regpat.adb: Improve debug traces
	(Dump): Change output format to keep it smaller.

2010-06-21  Javier Miranda  <miranda@adacore.com>

	* exp_cg.adb (Generate_CG_Output): Disable redirection of standard
	output to the output file when this routine completes its work.

From-SVN: r161073
parent a4c97feb
2010-06-21 Emmanuel Briot <briot@adacore.com>
* s-regpat.adb: Improve debug traces
(Dump): Change output format to keep it smaller.
2010-06-21 Javier Miranda <miranda@adacore.com>
* exp_cg.adb (Generate_CG_Output): Disable redirection of standard
output to the output file when this routine completes its work.
2010-06-20 Eric Botcazou <ebotcazou@adacore.com> 2010-06-20 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Subprogram_Body_to_gnu): Use while instead of * gcc-interface/trans.c (Subprogram_Body_to_gnu): Use while instead of
......
...@@ -132,6 +132,8 @@ package body Exp_CG is ...@@ -132,6 +132,8 @@ package body Exp_CG is
Write_Type_Info (N); Write_Type_Info (N);
end if; end if;
end loop; end loop;
Set_Special_Output (null);
end Generate_CG_Output; end Generate_CG_Output;
---------------- ----------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1986 by University of Toronto. -- -- Copyright (C) 1986 by University of Toronto. --
-- Copyright (C) 1999-2009, AdaCore -- -- Copyright (C) 1999-2010, AdaCore --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -47,6 +47,9 @@ with Ada.Unchecked_Conversion; ...@@ -47,6 +47,9 @@ with Ada.Unchecked_Conversion;
package body System.Regpat is package body System.Regpat is
Debug : constant Boolean := False;
-- Set to True to activate debug traces
MAGIC : constant Character := Character'Val (10#0234#); MAGIC : constant Character := Character'Val (10#0234#);
-- The first byte of the regexp internal "program" is actually -- The first byte of the regexp internal "program" is actually
-- this magic number; the start node begins in the second byte. -- this magic number; the start node begins in the second byte.
...@@ -318,6 +321,23 @@ package body System.Regpat is ...@@ -318,6 +321,23 @@ package body System.Regpat is
Worst_Expression : constant Expression_Flags := (others => False); Worst_Expression : constant Expression_Flags := (others => False);
-- Worst case -- Worst case
procedure Dump_Until
(Program : Program_Data;
Index : in out Pointer;
Till : Pointer;
Indent : Natural;
Do_Print : Boolean := True);
-- Dump the program until the node Till (not included) is met.
-- Every line is indented with Index spaces at the beginning
-- Dumps till the end if Till is 0.
procedure Dump_Operation
(Program : Program_Data;
Index : Pointer;
Indent : Natural);
-- Same as above, but only dumps a single operation, and compute its
-- indentation from the program
--------- ---------
-- "=" -- -- "=" --
--------- ---------
...@@ -2036,88 +2056,89 @@ package body System.Regpat is ...@@ -2036,88 +2056,89 @@ package body System.Regpat is
Compile (Matcher, Expression, Size, Flags); Compile (Matcher, Expression, Size, Flags);
end Compile; end Compile;
---------- --------------------
-- Dump -- -- Dump_Operation --
---------- --------------------
procedure Dump (Self : Pattern_Matcher) is
Op : Opcode;
Program : Program_Data renames Self.Program;
procedure Dump_Until
(Start : Pointer;
Till : Pointer;
Indent : Natural := 0);
-- Dump the program until the node Till (not included) is met.
-- Every line is indented with Index spaces at the beginning
-- Dumps till the end if Till is 0.
----------------
-- Dump_Until --
----------------
procedure Dump_Until procedure Dump_Operation
(Start : Pointer; (Program : Program_Data;
Till : Pointer; Index : Pointer;
Indent : Natural := 0) Indent : Natural)
is is
Next : Pointer; Current : Pointer := Index;
Index : Pointer; begin
Local_Indent : Natural := Indent; Dump_Until (Program, Current, Current + 1, Indent);
Length : Pointer; end Dump_Operation;
----------------
-- Dump_Until --
----------------
procedure Dump_Until
(Program : Program_Data;
Index : in out Pointer;
Till : Pointer;
Indent : Natural;
Do_Print : Boolean := True)
is
function Image (S : String) return String;
-- Remove leading space
function Image (S : String) return String is
begin begin
Index := Start; if S (S'First) = ' ' then
while Index < Till loop return S (S'First + 1 .. S'Last);
Op := Opcode'Val (Character'Pos ((Self.Program (Index)))); else
return S;
end if;
end Image;
if Op = CLOSE then Op : Opcode;
Local_Indent := Local_Indent - 3; Next : Pointer;
end if; Length : Pointer;
Local_Indent : Natural := Indent;
declare begin
Point : constant String := Pointer'Image (Index); while Index < Till loop
Op := Opcode'Val (Character'Pos ((Program (Index))));
Next := Index + Get_Next_Offset (Program, Index);
if Do_Print then
declare
Point : constant String := Pointer'Image (Index);
begin begin
for J in 1 .. 6 - Point'Length loop Put ((1 .. 4 - Point'Length => ' ')
Put (' '); & Point & ":"
end loop; & (1 .. Local_Indent * 2 => ' ') & Opcode'Image (Op));
Put (Point
& " : "
& (1 .. Local_Indent => ' ')
& Opcode'Image (Op));
end; end;
-- Print the parenthesis number -- Print the parenthesis number
if Op = OPEN or else Op = CLOSE or else Op = REFF then if Op = OPEN or else Op = CLOSE or else Op = REFF then
Put (Natural'Image (Character'Pos (Program (Index + 3)))); Put
(Image (Natural'Image (Character'Pos (Program (Index + 3)))));
end if; end if;
Next := Index + Get_Next_Offset (Program, Index);
if Next = Index then if Next = Index then
Put (" (next at 0)"); Put (" (-)");
else else
Put (" (next at " & Pointer'Image (Next) & ")"); Put (" (" & Image (Pointer'Image (Next)) & ")");
end if; end if;
end if;
case Op is case Op is
when ANYOF =>
-- Character class operand declare
Bitmap : Character_Class;
when ANYOF => null; Last : Character := ASCII.NUL;
declare Current : Natural := 0;
Bitmap : Character_Class; Current_Char : Character;
Last : Character := ASCII.NUL;
Current : Natural := 0;
Current_Char : Character; begin
Bitmap_Operand (Program, Index, Bitmap);
begin if Do_Print then
Bitmap_Operand (Program, Index, Bitmap); Put ("[");
Put (" operand=");
while Current <= 255 loop while Current <= 255 loop
Current_Char := Character'Val (Current); Current_Char := Character'Val (Current);
...@@ -2135,17 +2156,16 @@ package body System.Regpat is ...@@ -2135,17 +2156,16 @@ package body System.Regpat is
Current_Char := Character'Val (Current); Current_Char := Character'Val (Current);
exit when exit when
not Get_From_Class (Bitmap, Current_Char); not Get_From_Class (Bitmap, Current_Char);
end loop; end loop;
if Last <= ' ' then if not Is_Graphic (Last) then
Put (Last'Img); Put (Last'Img);
else else
Put (Last); Put (Last);
end if; end if;
if Character'Succ (Last) /= Current_Char then if Character'Succ (Last) /= Current_Char then
Put ("-" & Character'Pred (Current_Char)); Put ("\-" & Character'Pred (Current_Char));
end if; end if;
else else
...@@ -2153,69 +2173,88 @@ package body System.Regpat is ...@@ -2153,69 +2173,88 @@ package body System.Regpat is
end if; end if;
end loop; end loop;
New_Line; Put_Line ("]");
Index := Index + 3 + Bitmap'Length; end if;
end;
-- string operand Index := Index + 3 + Bitmap'Length;
end;
when EXACT | EXACTF => when EXACT | EXACTF =>
Length := String_Length (Program, Index); Length := String_Length (Program, Index);
Put (" operand (length:" & Program_Size'Image (Length + 1) if Do_Print then
& ") =" Put (" (" & Image (Program_Size'Image (Length + 1))
& String (Program (String_Operand (Index) & " chars) <"
.. String_Operand (Index) & String (Program (String_Operand (Index)
+ Length))); .. String_Operand (Index)
Index := String_Operand (Index) + Length + 1; + Length)));
New_Line; Put_Line (">");
end if;
-- Node operand Index := String_Operand (Index) + Length + 1;
when BRANCH => -- Node operand
New_Line;
Dump_Until (Index + 3, Next, Local_Indent + 3);
Index := Next;
when STAR | PLUS => when BRANCH | STAR | PLUS =>
if Do_Print then
New_Line; New_Line;
end if;
-- Only one instruction Index := Index + 3;
Dump_Until (Program, Index, Pointer'Min (Next, Till),
Local_Indent + 1, Do_Print);
when CURLY | CURLYX =>
if Do_Print then
Put_Line
(" {"
& Image (Natural'Image (Read_Natural (Program, Index + 3)))
& ","
& Image (Natural'Image (Read_Natural (Program, Index + 5)))
& "}");
end if;
Dump_Until (Index + 3, Index + 4, Local_Indent + 3); Index := Index + 7;
Index := Next; Dump_Until (Program, Index, Pointer'Min (Next, Till),
Local_Indent + 1, Do_Print);
when CURLY | CURLYX => when OPEN =>
Put (" {" if Do_Print then
& Natural'Image (Read_Natural (Program, Index + 3))
& ","
& Natural'Image (Read_Natural (Program, Index + 5))
& "}");
New_Line; New_Line;
Dump_Until (Index + 7, Next, Local_Indent + 3); end if;
Index := Next;
when OPEN => Index := Index + 4;
New_Line; Local_Indent := Local_Indent + 1;
Index := Index + 4;
Local_Indent := Local_Indent + 3;
when CLOSE | REFF => when CLOSE | REFF =>
if Do_Print then
New_Line; New_Line;
Index := Index + 4; end if;
when EOP => Index := Index + 4;
Index := Index + 3;
New_Line;
exit;
-- No operand if Op = CLOSE then
Local_Indent := Local_Indent - 1;
end if;
when others => when others =>
Index := Index + 3; Index := Index + 3;
if Do_Print then
New_Line; New_Line;
end case; end if;
end loop;
end Dump_Until; exit when Op = EOP;
end case;
end loop;
end Dump_Until;
----------
-- Dump --
----------
procedure Dump (Self : Pattern_Matcher) is
Program : Program_Data renames Self.Program;
Index : Pointer := Program'First + 1;
-- Start of processing for Dump -- Start of processing for Dump
...@@ -2238,8 +2277,8 @@ package body System.Regpat is ...@@ -2238,8 +2277,8 @@ package body System.Regpat is
Put_Line (" Multiple_Lines mode"); Put_Line (" Multiple_Lines mode");
end if; end if;
Put_Line (" 1 : MAGIC"); Put_Line (" 1:MAGIC");
Dump_Until (Program_First + 1, Self.Program'Last + 1); Dump_Until (Program, Index, Self.Program'Last + 1, 0);
end Dump; end Dump;
-------------------- --------------------
...@@ -2401,9 +2440,8 @@ package body System.Regpat is ...@@ -2401,9 +2440,8 @@ package body System.Regpat is
-- using a loop instead of recursion. -- using a loop instead of recursion.
-- Why is the above comment part of the spec rather than body ??? -- Why is the above comment part of the spec rather than body ???
function Match_Whilem (IP : Pointer) return Boolean; function Match_Whilem return Boolean;
-- Return True if a WHILEM matches -- Return True if a WHILEM matches the Current_Curly
-- How come IP is unreferenced in the body ???
function Recurse_Match (IP : Pointer; From : Natural) return Boolean; function Recurse_Match (IP : Pointer; From : Natural) return Boolean;
pragma Inline (Recurse_Match); pragma Inline (Recurse_Match);
...@@ -2418,6 +2456,11 @@ package body System.Regpat is ...@@ -2418,6 +2456,11 @@ package body System.Regpat is
Greedy : Boolean) return Boolean; Greedy : Boolean) return Boolean;
-- Return True it the simple operator (possibly non-greedy) matches -- Return True it the simple operator (possibly non-greedy) matches
Dump_Indent : Integer := -1;
procedure Dump_Current (Scan : Pointer; Prefix : Boolean := True);
procedure Dump_Error (Msg : String);
-- Debug: print the current context
pragma Inline (Index); pragma Inline (Index);
pragma Inline (Repeat); pragma Inline (Repeat);
...@@ -2447,13 +2490,12 @@ package body System.Regpat is ...@@ -2447,13 +2490,12 @@ package body System.Regpat is
function Recurse_Match (IP : Pointer; From : Natural) return Boolean is function Recurse_Match (IP : Pointer; From : Natural) return Boolean is
L : constant Natural := Last_Paren; L : constant Natural := Last_Paren;
Tmp_F : constant Match_Array := Tmp_F : constant Match_Array :=
Matches_Full (From + 1 .. Matches_Full'Last); Matches_Full (From + 1 .. Matches_Full'Last);
Start : constant Natural_Array := Start : constant Natural_Array :=
Matches_Tmp (From + 1 .. Matches_Tmp'Last); Matches_Tmp (From + 1 .. Matches_Tmp'Last);
Input : constant Natural := Input_Pos; Input : constant Natural := Input_Pos;
Dump_Indent_Save : constant Integer := Dump_Indent;
begin begin
if Match (IP) then if Match (IP) then
...@@ -2464,9 +2506,42 @@ package body System.Regpat is ...@@ -2464,9 +2506,42 @@ package body System.Regpat is
Matches_Full (Tmp_F'Range) := Tmp_F; Matches_Full (Tmp_F'Range) := Tmp_F;
Matches_Tmp (Start'Range) := Start; Matches_Tmp (Start'Range) := Start;
Input_Pos := Input; Input_Pos := Input;
Dump_Indent := Dump_Indent_Save;
return False; return False;
end Recurse_Match; end Recurse_Match;
------------------
-- Dump_Current --
------------------
procedure Dump_Current (Scan : Pointer; Prefix : Boolean := True) is
Length : constant := 10;
Pos : constant String := Integer'Image (Input_Pos);
begin
if Prefix then
Put ((1 .. 5 - Pos'Length => ' '));
Put (Pos & " <"
& Data (Input_Pos
.. Integer'Min (Last_In_Data, Input_Pos + Length - 1)));
Put ((1 .. Length - 1 - Last_In_Data + Input_Pos => ' '));
Put ("> |");
else
Put (" ");
end if;
Dump_Operation (Program, Scan, Indent => Dump_Indent);
end Dump_Current;
----------------
-- Dump_Error --
----------------
procedure Dump_Error (Msg : String) is
begin
Put (" | ");
Put ((1 .. Dump_Indent * 2 => ' '));
Put_Line (Msg);
end Dump_Error;
----------- -----------
-- Match -- -- Match --
----------- -----------
...@@ -2475,8 +2550,11 @@ package body System.Regpat is ...@@ -2475,8 +2550,11 @@ package body System.Regpat is
Scan : Pointer := IP; Scan : Pointer := IP;
Next : Pointer; Next : Pointer;
Op : Opcode; Op : Opcode;
Result : Boolean;
begin begin
Dump_Indent := Dump_Indent + 1;
State_Machine : State_Machine :
loop loop
pragma Assert (Scan /= 0); pragma Assert (Scan /= 0);
...@@ -2490,8 +2568,13 @@ package body System.Regpat is ...@@ -2490,8 +2568,13 @@ package body System.Regpat is
Next := Get_Next (Program, Scan); Next := Get_Next (Program, Scan);
if Debug then
Dump_Current (Scan);
end if;
case Op is case Op is
when EOP => when EOP =>
Dump_Indent := Dump_Indent - 1;
return True; -- Success ! return True; -- Success !
when BRANCH => when BRANCH =>
...@@ -2501,6 +2584,7 @@ package body System.Regpat is ...@@ -2501,6 +2584,7 @@ package body System.Regpat is
else else
loop loop
if Recurse_Match (Operand (Scan), 0) then if Recurse_Match (Operand (Scan), 0) then
Dump_Indent := Dump_Indent - 1;
return True; return True;
end if; end if;
...@@ -2517,7 +2601,7 @@ package body System.Regpat is ...@@ -2517,7 +2601,7 @@ package body System.Regpat is
when BOL => when BOL =>
exit State_Machine when Input_Pos /= BOL_Pos exit State_Machine when Input_Pos /= BOL_Pos
and then ((Self.Flags and Multiple_Lines) = 0 and then ((Self.Flags and Multiple_Lines) = 0
or else Data (Input_Pos - 1) /= ASCII.LF); or else Data (Input_Pos - 1) /= ASCII.LF);
when MBOL => when MBOL =>
exit State_Machine when Input_Pos /= BOL_Pos exit State_Machine when Input_Pos /= BOL_Pos
...@@ -2686,6 +2770,10 @@ package body System.Regpat is ...@@ -2686,6 +2770,10 @@ package body System.Regpat is
-- If we haven't seen that parenthesis yet -- If we haven't seen that parenthesis yet
if Last_Paren < No then if Last_Paren < No then
Dump_Indent := Dump_Indent - 1;
if Debug then
Dump_Error ("REFF: No match, backtracking");
end if;
return False; return False;
end if; end if;
...@@ -2695,6 +2783,10 @@ package body System.Regpat is ...@@ -2695,6 +2783,10 @@ package body System.Regpat is
if Input_Pos > Last_In_Data if Input_Pos > Last_In_Data
or else Data (Input_Pos) /= Data (Data_Pos) or else Data (Input_Pos) /= Data (Data_Pos)
then then
Dump_Indent := Dump_Indent - 1;
if Debug then
Dump_Error ("REFF: No match, backtracking");
end if;
return False; return False;
end if; end if;
...@@ -2711,7 +2803,9 @@ package body System.Regpat is ...@@ -2711,7 +2803,9 @@ package body System.Regpat is
Greed : constant Boolean := Greedy; Greed : constant Boolean := Greedy;
begin begin
Greedy := True; Greedy := True;
return Match_Simple_Operator (Op, Scan, Next, Greed); Result := Match_Simple_Operator (Op, Scan, Next, Greed);
Dump_Indent := Dump_Indent - 1;
return Result;
end; end;
when CURLYX => when CURLYX =>
...@@ -2742,6 +2836,7 @@ package body System.Regpat is ...@@ -2742,6 +2836,7 @@ package body System.Regpat is
Next => Next, Next => Next,
Lastloc => 0, Lastloc => 0,
Old_Cc => Current_Curly); Old_Cc => Current_Curly);
Greedy := True;
Current_Curly := Cc'Unchecked_Access; Current_Curly := Cc'Unchecked_Access;
Has_Match := Match (Next - 3); Has_Match := Match (Next - 3);
...@@ -2749,16 +2844,32 @@ package body System.Regpat is ...@@ -2749,16 +2844,32 @@ package body System.Regpat is
-- Start on the WHILEM -- Start on the WHILEM
Current_Curly := Cc.Old_Cc; Current_Curly := Cc.Old_Cc;
Dump_Indent := Dump_Indent - 1;
if not Has_Match then
if Debug then
Dump_Error ("CURLYX failed...");
end if;
end if;
return Has_Match; return Has_Match;
end; end;
when WHILEM => when WHILEM =>
return Match_Whilem (IP); Result := Match_Whilem;
Dump_Indent := Dump_Indent - 1;
if Debug and then not Result then
Dump_Error ("WHILEM: no match, backtracking");
end if;
return Result;
end case; end case;
Scan := Next; Scan := Next;
end loop State_Machine; end loop State_Machine;
if Debug then
Dump_Error ("failed...");
Dump_Indent := Dump_Indent - 1;
end if;
-- If we get here, there is no match. -- If we get here, there is no match.
-- For successful matches when EOP is the terminating point. -- For successful matches when EOP is the terminating point.
...@@ -2811,16 +2922,24 @@ package body System.Regpat is ...@@ -2811,16 +2922,24 @@ package body System.Regpat is
Operand_Code := Scan + 7; Operand_Code := Scan + 7;
end case; end case;
if Debug then
Dump_Current (Operand_Code, Prefix => False);
end if;
-- Non greedy operators -- Non greedy operators
if not Greedy then if not Greedy then
-- Test the minimal repetitions -- Test we can repeat at least Min times
if Min /= 0 if Min /= 0 then
and then Repeat (Operand_Code, Min) < Min No := Repeat (Operand_Code, Min);
then if No < Min then
return False; if Debug then
Dump_Error ("failed... matched" & No'Img & " times");
end if;
return False;
end if;
end if; end if;
Old := Input_Pos; Old := Input_Pos;
...@@ -2842,6 +2961,10 @@ package body System.Regpat is ...@@ -2842,6 +2961,10 @@ package body System.Regpat is
-- Look for the first possible opportunity -- Look for the first possible opportunity
if Debug then
Dump_Error ("Next_Char must be " & Next_Char);
end if;
loop loop
-- Find the next possible position -- Find the next possible position
...@@ -2864,6 +2987,10 @@ package body System.Regpat is ...@@ -2864,6 +2987,10 @@ package body System.Regpat is
begin begin
Input_Pos := Old; Input_Pos := Old;
if Debug then
Dump_Error ("Would we still match at that position?");
end if;
if Repeat (Operand_Code, Num) < Num then if Repeat (Operand_Code, Num) < Num then
return False; return False;
end if; end if;
...@@ -2879,14 +3006,18 @@ package body System.Regpat is ...@@ -2879,14 +3006,18 @@ package body System.Regpat is
Input_Pos := Input_Pos + 1; Input_Pos := Input_Pos + 1;
end loop; end loop;
-- We know what the next character is -- We do not know what the next character is
else else
while Max >= Min loop while Max >= Min loop
if Debug then
Dump_Error ("Non-greedy repeat, N=" & Min'Img);
Dump_Error ("Do we still match Next if we stop here?");
end if;
-- If the next character matches -- If the next character matches
if Match (Next) then if Recurse_Match (Next, 1) then
return True; return True;
end if; end if;
...@@ -2897,6 +3028,9 @@ package body System.Regpat is ...@@ -2897,6 +3028,9 @@ package body System.Regpat is
if Repeat (Operand_Code, 1) /= 0 then if Repeat (Operand_Code, 1) /= 0 then
Min := Min + 1; Min := Min + 1;
else else
if Debug then
Dump_Error ("Non-greedy repeat failed...");
end if;
return False; return False;
end if; end if;
end loop; end loop;
...@@ -2909,6 +3043,10 @@ package body System.Regpat is ...@@ -2909,6 +3043,10 @@ package body System.Regpat is
else else
No := Repeat (Operand_Code, Max); No := Repeat (Operand_Code, Max);
if Debug and then No < Min then
Dump_Error ("failed... matched" & No'Img & " times");
end if;
-- ??? Perl has some special code here in case the -- ??? Perl has some special code here in case the
-- next instruction is of type EOL, since $ and \Z -- next instruction is of type EOL, since $ and \Z
-- can match before *and* after newline at the end. -- can match before *and* after newline at the end.
...@@ -2948,9 +3086,7 @@ package body System.Regpat is ...@@ -2948,9 +3086,7 @@ package body System.Regpat is
-- tree by recursing ever deeper. And if it fails, we have to reset -- tree by recursing ever deeper. And if it fails, we have to reset
-- our parent's current state that we can try again after backing off. -- our parent's current state that we can try again after backing off.
function Match_Whilem (IP : Pointer) return Boolean is function Match_Whilem return Boolean is
pragma Unreferenced (IP);
Cc : constant Current_Curly_Access := Current_Curly; Cc : constant Current_Curly_Access := Current_Curly;
N : constant Natural := Cc.Cur + 1; N : constant Natural := Cc.Cur + 1;
Ln : Natural := 0; Ln : Natural := 0;
...@@ -2991,12 +3127,22 @@ package body System.Regpat is ...@@ -2991,12 +3127,22 @@ package body System.Regpat is
Cc.Cur := N; Cc.Cur := N;
Cc.Lastloc := Input_Pos; Cc.Lastloc := Input_Pos;
if Debug then
Dump_Error
("Tests that we match at least" & Cc.Min'Img & " N=" & N'Img);
end if;
if Match (Cc.Scan) then if Match (Cc.Scan) then
return True; return True;
end if; end if;
Cc.Cur := N - 1; Cc.Cur := N - 1;
Cc.Lastloc := Lastloc; Cc.Lastloc := Lastloc;
if Debug then
Dump_Error ("failed...");
end if;
return False; return False;
end if; end if;
...@@ -3022,6 +3168,9 @@ package body System.Regpat is ...@@ -3022,6 +3168,9 @@ package body System.Regpat is
-- Maximum greed exceeded ? -- Maximum greed exceeded ?
if N >= Cc.Max then if N >= Cc.Max then
if Debug then
Dump_Error ("failed...");
end if;
return False; return False;
end if; end if;
...@@ -3029,6 +3178,10 @@ package body System.Regpat is ...@@ -3029,6 +3178,10 @@ package body System.Regpat is
Cc.Cur := N; Cc.Cur := N;
Cc.Lastloc := Input_Pos; Cc.Lastloc := Input_Pos;
if Debug then
Dump_Error ("Next failed, what about Current?");
end if;
if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then
return True; return True;
end if; end if;
...@@ -3044,6 +3197,10 @@ package body System.Regpat is ...@@ -3044,6 +3197,10 @@ package body System.Regpat is
Cc.Cur := N; Cc.Cur := N;
Cc.Lastloc := Input_Pos; Cc.Lastloc := Input_Pos;
if Debug then
Dump_Error ("Recurse at current position");
end if;
if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then if Recurse_Match (Cc.Scan, Cc.Paren_Floor) then
return True; return True;
end if; end if;
...@@ -3057,6 +3214,10 @@ package body System.Regpat is ...@@ -3057,6 +3214,10 @@ package body System.Regpat is
Ln := Current_Curly.Cur; Ln := Current_Curly.Cur;
end if; end if;
if Debug then
Dump_Error ("Failed matching for later positions");
end if;
if Match (Cc.Next) then if Match (Cc.Next) then
return True; return True;
end if; end if;
...@@ -3068,6 +3229,11 @@ package body System.Regpat is ...@@ -3068,6 +3229,11 @@ package body System.Regpat is
Current_Curly := Cc; Current_Curly := Cc;
Cc.Cur := N - 1; Cc.Cur := N - 1;
Cc.Lastloc := Lastloc; Cc.Lastloc := Lastloc;
if Debug then
Dump_Error ("failed...");
end if;
return False; return False;
end Match_Whilem; end Match_Whilem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment